apps 0.0.1-beta.3 → 0.0.1-beta.30

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 (139) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-G7ZIRKMK.js → chunk-2D2PKLGQ.js} +118 -197
  4. package/js/chunk-3SPRHIEE.js +42 -0
  5. package/js/{chunk-FDNTX5QJ.js → chunk-4N26L465.js} +2 -2
  6. package/js/chunk-5ZHHO4OM.js +92 -0
  7. package/js/{chunk-EVJUVWN2.js → chunk-65SZ23BK.js} +2 -2
  8. package/js/{chunk-M6ZRRIBI.js → chunk-6JBTHTI5.js} +1 -1
  9. package/js/{chunk-J7O55ZV7.js → chunk-6NK26ONC.js} +332 -187
  10. package/js/chunk-6VWYEQ4X.js +254 -0
  11. package/js/{chunk-RN2MXB4R.js → chunk-AE4FWJQU.js} +128 -24
  12. package/js/{chunk-HDJH3RPR.js → chunk-BBTELEAN.js} +2 -2
  13. package/js/{chunk-LGIYBDWA.js → chunk-BRGF7VFN.js} +65 -1
  14. package/js/{chunk-MYYEW3RA.js → chunk-BSRU52RU.js} +984 -61
  15. package/js/{chunk-FZJOYIZO.js → chunk-BTJMXW4I.js} +1 -1
  16. package/js/{chunk-HDTGZWP2.js → chunk-IMCEF6KE.js} +139 -32
  17. package/js/chunk-KQCMHI3K.js +118 -0
  18. package/js/{chunk-BMOIAIVR.js → chunk-M2KEEOIQ.js} +49 -1
  19. package/js/{chunk-YEJOQEII.js → chunk-MYCVMDWI.js} +45 -7
  20. package/js/{chunk-FW5HBOIK.js → chunk-NXTXZ635.js} +1841 -1701
  21. package/js/chunk-OD3KFKZD.js +1617 -0
  22. package/js/{chunk-JN55AYQH.js → chunk-OI5CKSBU.js} +61 -32
  23. package/js/{chunk-NQ3OMCA5.js → chunk-P46HIAX6.js} +2 -2
  24. package/js/chunk-PUC24GZP.js +801 -0
  25. package/js/{chunk-SATWJKN6.js → chunk-PWF2DRJ3.js} +1 -1
  26. package/js/{chunk-D47C7KG5.js → chunk-VUVBMNKC.js} +2 -2
  27. package/js/{chunk-ZCAMUXSG.js → chunk-WGBI5MVX.js} +3 -4
  28. package/js/{chunk-T2LAZCAD.js → chunk-WQ5MVBTP.js} +1 -1
  29. package/js/{chunk-PLCMJREA.js → chunk-XBQTJP76.js} +60 -20
  30. package/js/{chunk-QKHR7BMF.js → chunk-XGN5IFOZ.js} +3 -3
  31. package/js/{chunk-WFSQXYUT.js → chunk-YML53Z7H.js} +42 -5
  32. package/js/{chunk-5MQZEB6Y.js → chunk-ZZOCEUTB.js} +37 -12
  33. package/js/client.js +120 -84
  34. package/js/contracts.js +110 -16
  35. package/js/effect.js +20 -20
  36. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  37. package/js/graphql.js +58 -54
  38. package/js/host.js +20 -20
  39. package/js/index.js +247 -204
  40. package/js/mcp/effect.js +24 -22
  41. package/js/mcp/stdio.js +35 -30
  42. package/js/mcp.js +105 -68
  43. package/js/openapi.js +4087 -1503
  44. package/js/react.js +3 -3
  45. package/js/skills/effect.js +5 -3
  46. package/js/skills.js +15 -15
  47. package/js/storage/facet.js +4 -4
  48. package/js/ui/auth/contracts.js +2 -2
  49. package/js/ui/auth.js +5 -5
  50. package/js/ui/contracts.js +5 -4
  51. package/js/ui/serving.js +8516 -214
  52. package/package.json +1 -1
  53. package/runtime.json +1 -1
  54. package/types/app-data/src/contracts/database.d.ts +33 -6
  55. package/types/app-data/src/implementation/schema.d.ts +2 -17
  56. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  57. package/types/apps/src/contracts/app.d.ts +7 -6
  58. package/types/apps/src/contracts/failure.d.ts +54 -0
  59. package/types/apps/src/contracts/graphql.d.ts +2 -1
  60. package/types/apps/src/contracts/host.d.ts +34 -11
  61. package/types/apps/src/contracts/mcp.d.ts +91 -10
  62. package/types/apps/src/contracts/network.d.ts +84 -0
  63. package/types/apps/src/contracts/openapi-compile.d.ts +31 -3
  64. package/types/apps/src/contracts/openapi.d.ts +45 -9
  65. package/types/apps/src/contracts/operations.d.ts +5 -6
  66. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  67. package/types/apps/src/contracts/protocols/1.d.ts +251 -69
  68. package/types/apps/src/contracts/protocols/2.d.ts +710 -0
  69. package/types/apps/src/contracts/protocols/3.d.ts +716 -0
  70. package/types/apps/src/contracts/protocols/4.d.ts +1298 -0
  71. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  72. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  73. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  74. package/types/apps/src/contracts/protocols/8.d.ts +1119 -0
  75. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  76. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  77. package/types/apps/src/contracts/provider.d.ts +115 -10
  78. package/types/apps/src/contracts/router.d.ts +59 -0
  79. package/types/apps/src/contracts/skills.d.ts +18 -5
  80. package/types/apps/src/contracts/storage.d.ts +3 -3
  81. package/types/apps/src/contracts/ui.d.ts +18 -0
  82. package/types/apps/src/contracts/workflows.d.ts +34 -3
  83. package/types/apps/src/graphql.d.ts +1 -3
  84. package/types/apps/src/implementation/account-router.d.ts +12 -0
  85. package/types/apps/src/implementation/app.d.ts +5 -4
  86. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  87. package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
  88. package/types/apps/src/implementation/elicitation.d.ts +9 -9
  89. package/types/apps/src/implementation/failure-detail.d.ts +46 -0
  90. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  91. package/types/apps/src/implementation/graphql.d.ts +4 -3
  92. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  93. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  94. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  95. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  96. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  97. package/types/apps/src/implementation/mcp.d.ts +52 -25
  98. package/types/apps/src/implementation/network.d.ts +16 -0
  99. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  100. package/types/apps/src/implementation/openapi-document.d.ts +35 -8
  101. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  102. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  103. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  104. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  105. package/types/apps/src/implementation/operations.d.ts +36 -3
  106. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  107. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  108. package/types/apps/src/implementation/provider.d.ts +19 -5
  109. package/types/apps/src/implementation/router-catalog.d.ts +224 -0
  110. package/types/apps/src/implementation/router.d.ts +68 -0
  111. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  112. package/types/apps/src/implementation/schema.d.ts +52 -1
  113. package/types/apps/src/implementation/skills.d.ts +2 -2
  114. package/types/apps/src/implementation/storage.d.ts +5 -3
  115. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  116. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  117. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  118. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  119. package/types/apps/src/implementation/ui-serving.d.ts +10 -4
  120. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  121. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  122. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  123. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  124. package/types/apps/src/index.d.ts +29 -11
  125. package/types/apps/src/mcp-stdio.d.ts +2 -5
  126. package/types/apps/src/mcp.d.ts +25 -5
  127. package/types/apps/src/openapi.d.ts +6 -6
  128. package/types/apps/src/skills.d.ts +4 -4
  129. package/types/telemetry/src/browser-operations.d.ts +5 -2
  130. package/types/telemetry/src/config.d.ts +2 -2
  131. package/types/utils/src/api-error.d.ts +48 -0
  132. package/js/chunk-PYUYJRSK.js +0 -93
  133. package/js/chunk-SWPD52J7.js +0 -35
  134. package/js/chunk-W7D7WVSY.js +0 -18
  135. package/js/chunk-Z5NMEGJN.js +0 -29
  136. package/js/chunk-ZJWDMTE3.js +0 -63
  137. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  138. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  139. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -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,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,29 +0,0 @@
1
- import {
2
- operationDeclaration
3
- } from "./chunk-PYUYJRSK.js";
4
-
5
- // src/implementation/protocol-operations.ts
6
- var protocolOperations = (operations, kinds = {}) => {
7
- const queries = {};
8
- const mutations = {};
9
- for (const [name, operation] of Object.entries(operations)) {
10
- const kind = Object.hasOwn(kinds, name) ? kinds[name] : operation.readOnly === true ? "query" : "mutation";
11
- const native = {
12
- description: operation.description,
13
- ...operation.title === void 0 ? {} : { title: operation.title },
14
- ...operation.annotations === void 0 ? {} : { annotations: operation.annotations },
15
- ...operation._meta === void 0 ? {} : { _meta: operation._meta },
16
- input: operation.input,
17
- run: operation.run
18
- };
19
- const output = Object.getOwnPropertyDescriptor(operation, "outputSchema");
20
- const withOutput = (target) => output === void 0 || output.get === void 0 && output.value === void 0 ? target : Object.defineProperty(target, "outputSchema", { ...output, enumerable: true });
21
- if (kind === "query") queries[name] = operationDeclaration(withOutput({ ...native, kind }));
22
- else mutations[name] = operationDeclaration(withOutput({ ...native, kind: "mutation" }));
23
- }
24
- return { queries, mutations };
25
- };
26
-
27
- export {
28
- protocolOperations
29
- };
@@ -1,63 +0,0 @@
1
- import {
2
- ProviderError
3
- } from "./chunk-W7D7WVSY.js";
4
- import {
5
- AccountId
6
- } from "./chunk-SATWJKN6.js";
7
- import {
8
- Option_exports,
9
- Schema_exports
10
- } from "./chunk-FW5HBOIK.js";
11
-
12
- // src/implementation/provider-error.ts
13
- function parseProviderError(error) {
14
- return Schema_exports.decodeUnknownOption(ProviderError)(error).pipe(
15
- Option_exports.map(({ reason, status, accountId }) => new ProviderError({ reason, status, accountId }))
16
- );
17
- }
18
- function httpProviderError(status, headers = {}) {
19
- if (status >= 500 && status <= 599) return new ProviderError({ reason: "unavailable", status });
20
- if (status === 401) return new ProviderError({ reason: "unauthorized", status });
21
- if (status === 429) return new ProviderError({ reason: "rate_limited", status });
22
- if (status !== 403) return void 0;
23
- const retry = headers["retry-after"];
24
- if (headers["x-ratelimit-remaining"] === "0" || retry !== void 0 && (/^\d+$/.test(retry) || Number.isFinite(Date.parse(retry))))
25
- return new ProviderError({ reason: "rate_limited", status });
26
- if (/\bBearer\b.*\berror="insufficient_scope"/i.test(headers["www-authenticate"] ?? ""))
27
- return new ProviderError({ reason: "forbidden", status });
28
- return new ProviderError({ reason: "rejected", status });
29
- }
30
- function accountProviderError(error, accountId) {
31
- const parsed = parseProviderError(error);
32
- const account = Schema_exports.decodeUnknownOption(AccountId)(accountId);
33
- if (Option_exports.isNone(parsed) || Option_exports.isNone(account)) return error;
34
- return new ProviderError({
35
- reason: parsed.value.reason,
36
- status: parsed.value.status,
37
- accountId: account.value
38
- });
39
- }
40
- function graphqlProviderError(errors, status) {
41
- const codes = errors.flatMap((error) => {
42
- const parsed = Schema_exports.decodeUnknownOption(
43
- Schema_exports.Struct({
44
- type: Schema_exports.optional(Schema_exports.String),
45
- extensions: Schema_exports.optional(Schema_exports.Struct({ code: Schema_exports.optional(Schema_exports.String) }))
46
- })
47
- )(error);
48
- return Option_exports.isSome(parsed) ? [parsed.value.type, parsed.value.extensions?.code] : [];
49
- });
50
- if (codes.includes("RATE_LIMITED") || codes.includes("TOO_MANY_REQUESTS"))
51
- return new ProviderError({ reason: "rate_limited", status });
52
- if (codes.includes("UNAUTHENTICATED"))
53
- return new ProviderError({ reason: "unauthorized", status });
54
- if (codes.includes("FORBIDDEN")) return new ProviderError({ reason: "forbidden", status });
55
- return void 0;
56
- }
57
-
58
- export {
59
- parseProviderError,
60
- httpProviderError,
61
- accountProviderError,
62
- graphqlProviderError
63
- };
@@ -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;