apps 0.0.1-beta.10 → 0.0.1-beta.100

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 (195) hide show
  1. package/README.md +60 -42
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-Z5M2LQOZ.js → chunk-2CURR5Y7.js} +113 -58
  4. package/js/{chunk-72JNVHPK.js → chunk-2LSGC7XY.js} +4 -3
  5. package/js/{chunk-JU7VHODU.js → chunk-4PIQKACY.js} +65 -10
  6. package/js/chunk-4UPC36ZL.js +5185 -0
  7. package/js/{chunk-VFZKSM3T.js → chunk-4X2UI4R2.js} +3 -3
  8. package/js/chunk-5C6RAGAS.js +335 -0
  9. package/js/{chunk-KUMBKVJD.js → chunk-62NVUKED.js} +2 -2
  10. package/js/chunk-74H25C4X.js +95 -0
  11. package/js/chunk-7HG422GB.js +90 -0
  12. package/js/chunk-7STIP5CS.js +171 -0
  13. package/js/{chunk-UK573G7W.js → chunk-ACQXVKVQ.js} +87 -51
  14. package/js/{chunk-IJX4CYZO.js → chunk-DILSCQPJ.js} +228 -264
  15. package/js/chunk-ILYCJ3HV.js +449 -0
  16. package/js/chunk-K6TSCYAO.js +712 -0
  17. package/js/{chunk-M3B3DE4K.js → chunk-KLSEU35Y.js} +463 -218
  18. package/js/chunk-OD3KFKZD.js +1617 -0
  19. package/js/chunk-OWN3DP2W.js +88 -0
  20. package/js/{chunk-IPI4MFSN.js → chunk-PBGPES67.js} +2 -2
  21. package/js/{chunk-FL2QR3XW.js → chunk-QI66R4FP.js} +355 -76
  22. package/js/{chunk-V5KNQVCT.js → chunk-RN4YB4JT.js} +931 -289
  23. package/js/{chunk-ODEIDRGW.js → chunk-URKOTNDA.js} +795 -176
  24. package/js/{chunk-5T57N25Q.js → chunk-VAI3EVCS.js} +643 -69
  25. package/js/chunk-VCYWAA4N.js +49 -0
  26. package/js/{chunk-57RKNWL2.js → chunk-YDW7DX3A.js} +4 -4
  27. package/js/{chunk-RFVIONFX.js → chunk-YWVISRZD.js} +123 -44
  28. package/js/{chunk-CDL5PM2Q.js → chunk-ZKDXML77.js} +19239 -18404
  29. package/js/client.js +148 -84
  30. package/js/contracts.js +150 -21
  31. package/js/effect.js +18 -19
  32. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  33. package/js/graphql.js +49 -40
  34. package/js/host.js +85 -62
  35. package/js/index.js +212 -98
  36. package/js/mcp/effect.js +21 -21
  37. package/js/mcp.js +84 -57
  38. package/js/openapi.js +4189 -1411
  39. package/js/react.js +2 -3
  40. package/js/skills/effect.js +6 -3
  41. package/js/skills.js +208 -81
  42. package/js/storage/facet.js +1 -540
  43. package/js/ui/auth/contracts.js +2 -2
  44. package/js/ui/auth.js +5 -5
  45. package/js/ui/contracts.js +9 -8
  46. package/js/ui/serving.js +8609 -228
  47. package/package.json +3 -8
  48. package/runtime.json +1 -1
  49. package/types/app-cache/src/contracts/cache.d.ts +18 -0
  50. package/types/app-cache/src/index.d.ts +34 -2
  51. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  52. package/types/apps/src/contracts/app.d.ts +56 -11
  53. package/types/apps/src/contracts/cache.d.ts +20 -0
  54. package/types/apps/src/contracts/context.d.ts +60 -17
  55. package/types/apps/src/contracts/elicitation.d.ts +23 -7
  56. package/types/apps/src/contracts/events.d.ts +94 -0
  57. package/types/apps/src/contracts/failure.d.ts +30 -1
  58. package/types/apps/src/contracts/graphql.d.ts +2 -1
  59. package/types/apps/src/contracts/host.d.ts +1456 -20
  60. package/types/apps/src/contracts/icons.d.ts +28 -0
  61. package/types/apps/src/contracts/live.d.ts +2 -0
  62. package/types/apps/src/contracts/mcp.d.ts +81 -20
  63. package/types/apps/src/contracts/network.d.ts +120 -0
  64. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  65. package/types/apps/src/contracts/openapi-document.d.ts +1 -1
  66. package/types/apps/src/contracts/openapi.d.ts +41 -9
  67. package/types/apps/src/contracts/operations.d.ts +14 -7
  68. package/types/apps/src/contracts/placement.d.ts +102 -0
  69. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  70. package/types/apps/src/contracts/protocols/1.d.ts +733 -81
  71. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  72. package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
  73. package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
  74. package/types/apps/src/contracts/protocols/2.d.ts +69 -26
  75. package/types/apps/src/contracts/protocols/3.d.ts +133 -33
  76. package/types/apps/src/contracts/protocols/4.d.ts +122 -45
  77. package/types/apps/src/contracts/protocols/5.d.ts +157 -47
  78. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  79. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  80. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  81. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  82. package/types/apps/src/contracts/protocols/current.d.ts +6857 -0
  83. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  84. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  85. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  86. package/types/apps/src/contracts/provider.d.ts +90 -6
  87. package/types/apps/src/contracts/schedules.d.ts +7 -1
  88. package/types/apps/src/contracts/schema.d.ts +21 -0
  89. package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
  90. package/types/apps/src/contracts/skills.d.ts +50 -13
  91. package/types/apps/src/contracts/sql.d.ts +63 -0
  92. package/types/apps/src/contracts/ui.d.ts +70 -30
  93. package/types/apps/src/contracts/webhooks.d.ts +24 -7
  94. package/types/apps/src/contracts/workflows.d.ts +56 -34
  95. package/types/apps/src/facet.d.ts +4 -5
  96. package/types/apps/src/host.d.ts +5 -0
  97. package/types/apps/src/implementation/account-router.d.ts +4 -3
  98. package/types/apps/src/implementation/app.d.ts +41 -14
  99. package/types/apps/src/implementation/authoring.d.ts +25 -5
  100. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  101. package/types/apps/src/implementation/cache.d.ts +29 -2
  102. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  103. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  104. package/types/apps/src/implementation/events.d.ts +64 -0
  105. package/types/apps/src/implementation/failure-detail.d.ts +28 -5
  106. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  107. package/types/apps/src/implementation/graphql.d.ts +4 -3
  108. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  109. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  110. package/types/apps/src/implementation/live.d.ts +2 -2
  111. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  112. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  113. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  114. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  115. package/types/apps/src/implementation/mcp.d.ts +20 -9
  116. package/types/apps/src/implementation/network.d.ts +16 -0
  117. package/types/apps/src/implementation/openapi-compile.d.ts +28 -7
  118. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  119. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  120. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  121. package/types/apps/src/implementation/openapi-source.d.ts +23 -1
  122. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  123. package/types/apps/src/implementation/operations.d.ts +58 -7
  124. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  125. package/types/apps/src/implementation/placement.d.ts +60 -0
  126. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  127. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  128. package/types/apps/src/implementation/provider.d.ts +19 -4
  129. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  130. package/types/apps/src/implementation/router-catalog.d.ts +20 -18
  131. package/types/apps/src/implementation/router.d.ts +24 -5
  132. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  133. package/types/apps/src/implementation/schedules.d.ts +39 -8
  134. package/types/apps/src/implementation/schema.d.ts +108 -11
  135. package/types/apps/src/implementation/skills.d.ts +18 -24
  136. package/types/apps/src/implementation/sql.d.ts +71 -0
  137. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  138. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  139. package/types/apps/src/implementation/ui-client.d.ts +3 -3
  140. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  141. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  142. package/types/apps/src/implementation/ui-serving.d.ts +28 -11
  143. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  144. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  145. package/types/apps/src/implementation/webhooks.d.ts +15 -6
  146. package/types/apps/src/implementation/workflow-context.d.ts +6 -2
  147. package/types/apps/src/implementation/workflows.d.ts +11 -4
  148. package/types/apps/src/index.d.ts +68 -19
  149. package/types/apps/src/mcp.d.ts +20 -1
  150. package/types/apps/src/openapi.d.ts +6 -1
  151. package/types/apps/src/react.d.ts +1 -1
  152. package/types/apps/src/skills.d.ts +10 -8
  153. package/types/apps/src/ui-serving.d.ts +1 -1
  154. package/types/telemetry/src/app-records.d.ts +42 -0
  155. package/types/telemetry/src/browser-operations.d.ts +2 -2
  156. package/types/telemetry/src/browser.d.ts +8 -3
  157. package/types/telemetry/src/config.d.ts +2 -2
  158. package/types/telemetry/src/index.d.ts +2 -1
  159. package/types/telemetry/src/layer.d.ts +10 -4
  160. package/types/telemetry/src/measurements.d.ts +1 -1
  161. package/types/telemetry/src/ownership.d.ts +60 -0
  162. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  163. package/types/telemetry/src/relay.d.ts +16 -6
  164. package/types/telemetry/src/span-attributes.d.ts +17 -1
  165. package/types/telemetry/src/transport.d.ts +8 -1
  166. package/types/utils/src/api-error.d.ts +55 -0
  167. package/types/utils/src/connection-failure.d.ts +33 -0
  168. package/types/utils/src/legacy-keys.d.ts +20 -0
  169. package/types/utils/src/recorded-message.d.ts +18 -0
  170. package/types/utils/src/schema-definitions.d.ts +13 -0
  171. package/types/utils/src/user-facing-error.d.ts +83 -0
  172. package/js/chunk-27F7W2LG.js +0 -34
  173. package/js/chunk-CRDWFA74.js +0 -299
  174. package/js/chunk-EPT3ZP52.js +0 -224
  175. package/js/chunk-MKWZPDR6.js +0 -63
  176. package/js/chunk-N7YDVXYJ.js +0 -186
  177. package/js/chunk-NKLWZJLE.js +0 -172
  178. package/js/chunk-PJJ24GU7.js +0 -877
  179. package/js/chunk-PZB6T6KU.js +0 -19
  180. package/js/chunk-R3EV5FTO.js +0 -97
  181. package/js/chunk-WLE7WX2U.js +0 -2645
  182. package/js/chunk-YXQHV65J.js +0 -242
  183. package/js/chunk-ZQINWV4W.js +0 -630
  184. package/js/mcp/stdio.js +0 -128
  185. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  186. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  187. package/types/app-data/src/implementation/promise.d.ts +0 -68
  188. package/types/app-data/src/implementation/range.d.ts +0 -8
  189. package/types/app-data/src/implementation/schema.d.ts +0 -18
  190. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  191. package/types/app-data/src/index.d.ts +0 -4
  192. package/types/apps/src/contracts/storage.d.ts +0 -68
  193. package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
  194. package/types/apps/src/implementation/storage.d.ts +0 -15
  195. package/types/apps/src/mcp-stdio.d.ts +0 -5
package/js/index.js CHANGED
@@ -1,78 +1,93 @@
1
1
  import {
2
2
  ResponseDecodeError,
3
3
  ResponseStatusError,
4
+ base64,
5
+ basic,
6
+ bearer,
7
+ declarePlacements,
4
8
  defineApp,
5
- defineDatabase,
6
- table,
9
+ event,
10
+ header,
11
+ query,
12
+ t,
7
13
  workflow
8
- } from "./chunk-YXQHV65J.js";
9
- import "./chunk-ZQINWV4W.js";
14
+ } from "./chunk-ILYCJ3HV.js";
10
15
  import {
11
16
  dynamicRouter,
12
- fromPromise,
13
17
  mutation,
14
18
  nativeOperation,
15
19
  nativeRouter,
16
20
  operationDeclaration,
17
- query,
21
+ query as query2,
22
+ renameTools,
18
23
  router,
19
24
  routerDeclaration,
20
- withApproval
21
- } from "./chunk-Z5M2LQOZ.js";
25
+ toolAnnotations,
26
+ withApproval,
27
+ withApprovals
28
+ } from "./chunk-2CURR5Y7.js";
22
29
  import {
23
- accountProviderError
24
- } from "./chunk-MKWZPDR6.js";
30
+ accountProviderError,
31
+ fromPromise
32
+ } from "./chunk-7STIP5CS.js";
25
33
  import {
34
+ CacheError,
26
35
  CalendarSchedule,
27
36
  ElicitationFailed,
37
+ FetchOptionUnsupported,
28
38
  HostedTool,
29
39
  HostedToolSummary,
30
40
  Interval,
41
+ NetworkRefused,
31
42
  NonRetryableError,
32
43
  OAuth2AccessToken,
33
44
  OAuth2Config,
34
45
  OAuth2Method,
35
46
  Provider,
47
+ ProviderError,
36
48
  ScheduleTiming,
37
49
  SecretsMethod,
38
50
  WorkflowFailure
39
- } from "./chunk-WLE7WX2U.js";
40
- import "./chunk-N7YDVXYJ.js";
41
- import {
42
- CacheError,
43
- ProviderError
44
- } from "./chunk-R3EV5FTO.js";
45
- import "./chunk-JU7VHODU.js";
51
+ } from "./chunk-4UPC36ZL.js";
52
+ import "./chunk-4PIQKACY.js";
46
53
  import {
47
54
  array,
48
55
  boolean,
56
+ combineJsonSchemas,
49
57
  decoderOf,
50
- id,
58
+ fieldExposure,
51
59
  importedJsonSchema,
60
+ isSchema,
52
61
  json,
53
62
  jsonSchema,
54
63
  literal,
55
- nestJsonSchema,
56
64
  number,
57
65
  object,
58
66
  once,
59
67
  parse,
68
+ parseDeclaration,
69
+ plain,
70
+ raw,
60
71
  record,
61
72
  string,
62
- userId,
63
73
  withLazyJsonSchemaDocument,
64
74
  wrap
65
- } from "./chunk-5T57N25Q.js";
66
- import "./chunk-PZB6T6KU.js";
75
+ } from "./chunk-VAI3EVCS.js";
76
+ import "./chunk-URKOTNDA.js";
77
+ import "./chunk-YDW7DX3A.js";
78
+ import "./chunk-OWN3DP2W.js";
67
79
  import {
80
+ DeclarationInvalid,
68
81
  JsonObject,
69
82
  JsonValue,
70
83
  ValidationError
71
- } from "./chunk-27F7W2LG.js";
84
+ } from "./chunk-7HG422GB.js";
85
+ import "./chunk-DILSCQPJ.js";
86
+ import "./chunk-ACQXVKVQ.js";
72
87
  import {
73
88
  Effect_exports,
74
89
  Schema_exports
75
- } from "./chunk-CDL5PM2Q.js";
90
+ } from "./chunk-ZKDXML77.js";
76
91
  import "./chunk-CZ7CSFO4.js";
77
92
 
78
93
  // src/implementation/http.ts
@@ -86,27 +101,86 @@ var decodeJson = (response, schema) => Effect_exports.gen(function* () {
86
101
 
87
102
  // src/implementation/provider.ts
88
103
  var secrets = (options) => new SecretsMethod(options);
89
- var oauth2 = (config, response) => parse(OAuth2Config, config).pipe(Effect_exports.map((config2) => new OAuth2Method({ config: config2, response })));
104
+ var clientCredentials = Schema_exports.is(Schema_exports.Struct({ grant: Schema_exports.Literal("client_credentials") }));
105
+ var oauth2Form = (config) => {
106
+ const [discovered, declared, discoveredMachine, declaredMachine] = OAuth2Config.members;
107
+ const discovers = typeof config === "object" && config !== null && Object.hasOwn(config, "discover");
108
+ if (clientCredentials(config)) return discovers ? discoveredMachine : declaredMachine;
109
+ return discovers ? discovered : declared;
110
+ };
111
+ var oauth2 = (config, response, exposure, request) => parseDeclaration(OAuth2Config, config, "oauth2()", oauth2Form).pipe(
112
+ Effect_exports.map(
113
+ (config2) => new OAuth2Method({
114
+ config: config2,
115
+ response,
116
+ ...exposure === void 0 ? {} : { exposure },
117
+ ...request === void 0 ? {} : { request }
118
+ })
119
+ )
120
+ );
90
121
  var defineProvider = ({
91
122
  health,
92
123
  ...options
93
124
  }) => {
125
+ const placed = Object.entries(options.auth).filter(([, method]) => method.request !== void 0);
126
+ if (options.hosts === void 0 && placed.length > 0)
127
+ throw new TypeError(
128
+ `Provider "${options.name}" declares a request for ${placed.map(([name]) => name).join(", ")} but no hosts. Declare the hosts its credentials may be sent to.`
129
+ );
94
130
  if (health === void 0) return new Provider(options);
95
- const run = fromPromise(health);
131
+ const run = fromPromise(health, "check");
96
132
  return new Provider({ ...options, health: { run } });
97
133
  };
98
134
 
99
135
  // src/implementation/account-router.ts
100
- var inputDocument = (operation) => {
101
- const imported = importedJsonSchema(operation.input);
136
+ var decoderDocument = (decoder) => {
137
+ const imported = importedJsonSchema(decoder);
102
138
  if (imported !== void 0) return Schema_exports.decodeUnknownSync(JsonObject)(imported);
103
- const document = Schema_exports.toJsonSchemaDocument(operation.input);
139
+ const document = Schema_exports.toJsonSchemaDocument(decoder);
104
140
  return Schema_exports.decodeUnknownSync(JsonObject)({ ...document.schema, $defs: document.definitions });
105
141
  };
142
+ var accountBranches = (variants) => {
143
+ const groups = /* @__PURE__ */ new Map();
144
+ for (const [accountId, schema] of variants) {
145
+ const key = JSON.stringify(schema);
146
+ const group = groups.get(key);
147
+ if (group === void 0) groups.set(key, { schema, first: accountId, rest: [] });
148
+ else group.rest.push(accountId);
149
+ }
150
+ const branches = [...groups.values()];
151
+ const { $defs, schemas } = combineJsonSchemas(
152
+ branches.map(({ schema }) => schema),
153
+ (index) => `#/anyOf/${index}/properties/input`
154
+ );
155
+ return {
156
+ type: "object",
157
+ ...$defs === void 0 ? {} : { $defs },
158
+ anyOf: schemas.map((input, index) => {
159
+ const { first, rest } = branches[index];
160
+ return {
161
+ type: "object",
162
+ properties: {
163
+ accountId: rest.length === 0 ? { type: "string", const: first } : { type: "string", enum: [first, ...rest] },
164
+ input
165
+ },
166
+ required: ["accountId", "input"]
167
+ };
168
+ })
169
+ };
170
+ };
171
+ var outputBranches = (outputs) => {
172
+ const { $defs, schemas } = combineJsonSchemas(
173
+ [...new Map(outputs.map((output) => [JSON.stringify(output), output])).values()],
174
+ (index) => `#/anyOf/${index}`
175
+ );
176
+ return { ...$defs === void 0 ? {} : { $defs }, anyOf: schemas };
177
+ };
106
178
  var declaresOutput = (operation) => {
179
+ if (operation.output !== void 0) return true;
107
180
  const property = Object.getOwnPropertyDescriptor(operation, "outputSchema");
108
181
  return property !== void 0 && (property.get !== void 0 || property.value !== void 0);
109
182
  };
183
+ var outputDocument = (operation) => operation.output === void 0 ? operation.outputSchema : decoderDocument(operation.output);
110
184
  var combineOperation = (accounts) => {
111
185
  const variants = [...accounts.values()];
112
186
  const first = variants[0];
@@ -123,17 +197,9 @@ var combineOperation = (accounts) => {
123
197
  ([accountId, operation]) => Schema_exports.Struct({ accountId: Schema_exports.Literal(accountId), input: operation.input })
124
198
  )
125
199
  );
126
- const inputSchema = () => ({
127
- type: "object",
128
- anyOf: [...accounts].map(([accountId, operation], index) => ({
129
- type: "object",
130
- properties: {
131
- accountId: { type: "string", const: accountId },
132
- input: nestJsonSchema(inputDocument(operation), `#/anyOf/${index}/properties/input`)
133
- },
134
- required: ["accountId", "input"]
135
- }))
136
- });
200
+ const inputSchema = () => accountBranches(
201
+ [...accounts].map(([accountId, operation]) => [accountId, decoderDocument(operation.input)])
202
+ );
137
203
  const declaration2 = operationDeclaration({
138
204
  kind,
139
205
  ...first.description === void 0 ? {} : { description: first.description },
@@ -158,11 +224,14 @@ var combineOperation = (accounts) => {
158
224
  }
159
225
  });
160
226
  if (variants.every(declaresOutput)) {
161
- const outputSchema = once(() => ({
162
- anyOf: variants.flatMap(
163
- (operation) => operation.outputSchema === void 0 ? [] : [operation.outputSchema]
164
- ).map((output, index) => nestJsonSchema(output, `#/anyOf/${index}`))
165
- }));
227
+ const outputSchema = once(
228
+ () => outputBranches(
229
+ variants.flatMap((operation) => {
230
+ const output = outputDocument(operation);
231
+ return output === void 0 ? [] : [output];
232
+ })
233
+ )
234
+ );
166
235
  const native2 = nativeOperation(declaration2);
167
236
  if (native2 !== void 0)
168
237
  Object.defineProperty(native2, "outputSchema", { enumerable: true, get: outputSchema });
@@ -188,23 +257,15 @@ var mergeSummary = (name, variants) => {
188
257
  };
189
258
  var merge = (name, variants) => Schema_exports.decodeUnknownSync(HostedTool)({
190
259
  ...mergeSummary(name, variants),
191
- inputSchema: {
192
- type: "object",
193
- anyOf: variants.map(([accountId, tool], index) => ({
194
- type: "object",
195
- properties: {
196
- accountId: { type: "string", const: accountId },
197
- input: nestJsonSchema(tool.inputSchema, `#/anyOf/${index}/properties/input`)
198
- },
199
- required: ["accountId", "input"]
200
- }))
201
- },
260
+ inputSchema: accountBranches(
261
+ variants.map(([accountId, tool]) => [accountId, tool.inputSchema])
262
+ ),
202
263
  ...variants.every(([, tool]) => tool.outputSchema !== void 0) ? {
203
- outputSchema: {
204
- anyOf: variants.flatMap(
205
- ([, tool], index) => tool.outputSchema === void 0 ? [] : [nestJsonSchema(tool.outputSchema, `#/anyOf/${index}`)]
264
+ outputSchema: outputBranches(
265
+ variants.flatMap(
266
+ ([, tool]) => tool.outputSchema === void 0 ? [] : [tool.outputSchema]
206
267
  )
207
- }
268
+ )
208
269
  } : {},
209
270
  ...sameAcross("_meta", variants)
210
271
  });
@@ -218,7 +279,7 @@ var combineDynamic = (sources) => {
218
279
  );
219
280
  for (const tool of tools) {
220
281
  const variants = groups.get(tool.name) ?? [];
221
- if (variants.some(([id2]) => id2 === accountId))
282
+ if (variants.some(([id]) => id === accountId))
222
283
  return yield* Effect_exports.die(new Error("Duplicate source operation"));
223
284
  variants.push([accountId, tool]);
224
285
  groups.set(tool.name, variants);
@@ -307,7 +368,7 @@ var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
307
368
  const routers = /* @__PURE__ */ new Map();
308
369
  for (const account of accounts) {
309
370
  const declaration2 = yield* Effect_exports.tryPromise({
310
- try: () => discover(account),
371
+ try: async () => discover(account),
311
372
  catch: (error) => accountProviderError(error, account.id)
312
373
  });
313
374
  if (routers.has(account.id))
@@ -327,7 +388,7 @@ var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
327
388
 
328
389
  // src/implementation/dynamic-skills.ts
329
390
  var dynamicSkills = (source) => ({
330
- list: fromPromise(async () => source.list())
391
+ list: fromPromise(async () => source.list(), "skills")
331
392
  });
332
393
 
333
394
  // src/contracts/app.ts
@@ -337,58 +398,102 @@ var NotImplemented = class extends Schema_exports.TaggedError()("NotImplemented"
337
398
  };
338
399
 
339
400
  // src/implementation/schedules.ts
340
- var declaration = (timing, operation, input) => {
401
+ var declaration = (scope, timing, operation, input) => {
341
402
  const native = nativeOperation(operation);
342
403
  if (native === void 0 || native.kind !== "mutation")
343
404
  throw new Error("A schedule must reference a mutation");
405
+ if (scope === "app" && native.approval !== void 0)
406
+ throw new Error("An app schedule must reference a mutation without an approval");
344
407
  Schema_exports.decodeUnknownSync(native.input)(input);
345
- return { operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
408
+ return { scope, operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
346
409
  };
347
- var interval = (duration, operation, input) => {
410
+ var intervalTiming = (duration) => {
348
411
  const value = Schema_exports.decodeUnknownSync(Interval)(duration);
349
412
  const milliseconds = value.seconds !== void 0 ? value.seconds * 1e3 : value.minutes !== void 0 ? value.minutes * 6e4 : value.hours * 36e5;
350
- return declaration(
351
- Schema_exports.decodeUnknownSync(ScheduleTiming)({ kind: "interval", milliseconds }),
352
- operation,
353
- input
354
- );
413
+ return Schema_exports.decodeUnknownSync(ScheduleTiming)({ kind: "interval", milliseconds });
355
414
  };
356
- var cron = (calendar, operation, input) => declaration(
357
- {
358
- kind: "cron",
359
- calendar: Schema_exports.decodeUnknownSync(CalendarSchedule)({
360
- ...calendar,
361
- timezone: calendar.timezone ?? "UTC"
362
- })
363
- },
364
- operation,
365
- input
366
- );
415
+ var cronTiming = (calendar) => ({
416
+ kind: "cron",
417
+ calendar: Schema_exports.decodeUnknownSync(CalendarSchedule)({
418
+ ...calendar,
419
+ timezone: calendar.timezone ?? "UTC"
420
+ })
421
+ });
422
+ var userInterval = (duration, operation, input) => declaration("user", intervalTiming(duration), operation, input);
423
+ var userCron = (calendar, operation, input) => declaration("user", cronTiming(calendar), operation, input);
424
+ var appInterval = (duration, operation, input) => declaration("app", intervalTiming(duration), operation, input);
425
+ var appCron = (calendar, operation, input) => declaration("app", cronTiming(calendar), operation, input);
367
426
 
368
427
  // src/index.ts
428
+ var isFields = (value) => typeof value === "object" && value !== null && Object.values(value).every(isSchema);
429
+ var accountDecoder = (schema) => (
430
+ // SAFETY: the brand exists only in types; secret values are strings at runtime.
431
+ decoderOf(schema)
432
+ );
433
+ var exposureOf = (schema) => {
434
+ const marked = "fields" in schema && isFields(schema.fields) ? fieldExposure(schema.fields) : {};
435
+ return Object.keys(marked).length === 0 ? {} : { exposure: marked };
436
+ };
437
+ var fieldNames = (schema) => "fields" in schema && isFields(schema.fields) ? Object.keys(schema.fields) : schema === OAuth2AccessToken2 ? ["access_token"] : [];
438
+ var placementsOf = (method, schema, request) => request === void 0 ? {} : {
439
+ request: declarePlacements(
440
+ method,
441
+ fieldNames(schema),
442
+ exposureOf(schema).exposure,
443
+ request
444
+ )
445
+ };
369
446
  var OAuth2AccessToken2 = wrap(OAuth2AccessToken, false);
370
- var secrets2 = (options) => secrets({ label: options.label, fields: decoderOf(options.fields) });
447
+ var secrets2 = (options) => secrets({
448
+ label: options.label,
449
+ fields: accountDecoder(options.fields),
450
+ ...exposureOf(options.fields),
451
+ // SAFETY: the callback receives references named by the schema's own keys.
452
+ ...placementsOf(
453
+ `"${options.label}"`,
454
+ options.fields,
455
+ options.request
456
+ )
457
+ });
371
458
  function oauth22(options) {
372
- const { response = OAuth2AccessToken2, ...config } = options;
373
- return Effect_exports.runSync(oauth2(config, decoderOf(response)));
459
+ const { response = OAuth2AccessToken2, request, ...config } = options;
460
+ return Effect_exports.runSync(
461
+ oauth2(
462
+ config,
463
+ accountDecoder(response),
464
+ exposureOf(response).exposure,
465
+ // SAFETY: the callback receives references named by the response projection's own keys.
466
+ placementsOf("OAuth", response, request).request
467
+ )
468
+ );
374
469
  }
375
470
  var decodeJson2 = (response, schema) => {
376
471
  const native = {
377
472
  status: response.status,
378
- json: () => Effect_exports.tryPromise({
379
- try: () => response.json(),
380
- catch: (error) => error
381
- }).pipe(
382
- Effect_exports.catch(
383
- (error) => error instanceof SyntaxError ? Effect_exports.fail(new ResponseDecodeError()) : Effect_exports.die(error)
473
+ json: () => (
474
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- a Response the app passes from its own code
475
+ Effect_exports.tryPromise({
476
+ try: () => response.json(),
477
+ catch: (error) => error
478
+ }).pipe(
479
+ Effect_exports.catch(
480
+ (error) => error instanceof SyntaxError ? Effect_exports.fail(new ResponseDecodeError()) : Effect_exports.die(error)
481
+ )
384
482
  )
385
483
  )
386
484
  };
387
485
  return Effect_exports.runPromise(decodeJson(native, decoderOf(schema)));
388
486
  };
487
+ function query3(first, second) {
488
+ if (typeof first === "string") return query(first, second);
489
+ return query2(...[first, second]);
490
+ }
389
491
  export {
390
492
  CacheError,
493
+ DeclarationInvalid,
391
494
  ElicitationFailed,
495
+ FetchOptionUnsupported,
496
+ NetworkRefused,
392
497
  NonRetryableError,
393
498
  NotImplemented,
394
499
  OAuth2AccessToken2 as OAuth2AccessToken,
@@ -398,17 +503,20 @@ export {
398
503
  ValidationError,
399
504
  WorkflowFailure,
400
505
  accountRouter,
506
+ appCron,
507
+ appInterval,
401
508
  array,
509
+ base64,
510
+ basic,
511
+ bearer,
402
512
  boolean,
403
- cron,
404
513
  decodeJson2 as decodeJson,
405
514
  defineApp,
406
- defineDatabase,
407
515
  defineProvider,
408
516
  dynamicRouter,
409
517
  dynamicSkills,
410
- id,
411
- interval,
518
+ event,
519
+ header,
412
520
  json,
413
521
  jsonSchema,
414
522
  literal,
@@ -416,13 +524,19 @@ export {
416
524
  number,
417
525
  oauth22 as oauth2,
418
526
  object,
419
- query,
527
+ plain,
528
+ query3 as query,
529
+ raw,
420
530
  record,
531
+ renameTools,
421
532
  router,
422
533
  secrets2 as secrets,
423
534
  string,
424
- table,
425
- userId,
535
+ t,
536
+ toolAnnotations,
537
+ userCron,
538
+ userInterval,
426
539
  withApproval,
540
+ withApprovals,
427
541
  workflow
428
542
  };
package/js/mcp/effect.js CHANGED
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  mcpClientEffect,
3
+ mcpHealthEffect,
3
4
  mcpToolsEffect
4
- } from "../chunk-EPT3ZP52.js";
5
- import "../chunk-CRDWFA74.js";
5
+ } from "../chunk-K6TSCYAO.js";
6
6
  import "../chunk-BCSNKUAC.js";
7
- import "../chunk-V5KNQVCT.js";
8
- import "../chunk-NKLWZJLE.js";
9
- import "../chunk-FL2QR3XW.js";
10
- import "../chunk-IPI4MFSN.js";
11
- import "../chunk-YXQHV65J.js";
12
- import "../chunk-ZQINWV4W.js";
13
- import "../chunk-Z5M2LQOZ.js";
14
- import "../chunk-MKWZPDR6.js";
15
- import "../chunk-WLE7WX2U.js";
16
- import "../chunk-N7YDVXYJ.js";
17
- import "../chunk-R3EV5FTO.js";
18
- import "../chunk-JU7VHODU.js";
19
- import "../chunk-ODEIDRGW.js";
20
- import "../chunk-57RKNWL2.js";
21
- import "../chunk-UK573G7W.js";
22
- import "../chunk-5T57N25Q.js";
23
- import "../chunk-PZB6T6KU.js";
24
- import "../chunk-27F7W2LG.js";
25
- import "../chunk-CDL5PM2Q.js";
7
+ import "../chunk-RN4YB4JT.js";
8
+ import "../chunk-5C6RAGAS.js";
9
+ import "../chunk-QI66R4FP.js";
10
+ import "../chunk-VCYWAA4N.js";
11
+ import "../chunk-PBGPES67.js";
12
+ import "../chunk-ILYCJ3HV.js";
13
+ import "../chunk-2CURR5Y7.js";
14
+ import "../chunk-7STIP5CS.js";
15
+ import "../chunk-4UPC36ZL.js";
16
+ import "../chunk-4PIQKACY.js";
17
+ import "../chunk-VAI3EVCS.js";
18
+ import "../chunk-URKOTNDA.js";
19
+ import "../chunk-YDW7DX3A.js";
20
+ import "../chunk-OWN3DP2W.js";
21
+ import "../chunk-7HG422GB.js";
22
+ import "../chunk-DILSCQPJ.js";
23
+ import "../chunk-ACQXVKVQ.js";
24
+ import "../chunk-ZKDXML77.js";
26
25
  import "../chunk-CZ7CSFO4.js";
27
26
  export {
28
27
  mcpClientEffect,
28
+ mcpHealthEffect,
29
29
  mcpToolsEffect
30
30
  };