apps 0.0.1-beta.11 → 0.0.1-beta.110

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 (197) hide show
  1. package/README.md +60 -42
  2. package/framework-reference.json +1 -1
  3. package/js/chunk-2RGJMA7N.js +5186 -0
  4. package/js/chunk-3BI34I5S.js +449 -0
  5. package/js/chunk-3BOEMXAJ.js +713 -0
  6. package/js/{chunk-JU7VHODU.js → chunk-4PIQKACY.js} +65 -10
  7. package/js/{chunk-VFZKSM3T.js → chunk-4X2UI4R2.js} +3 -3
  8. package/js/{chunk-KUMBKVJD.js → chunk-62NVUKED.js} +2 -2
  9. package/js/chunk-74H25C4X.js +95 -0
  10. package/js/chunk-7HG422GB.js +90 -0
  11. package/js/{chunk-UK573G7W.js → chunk-ACQXVKVQ.js} +87 -51
  12. package/js/chunk-BKIQCV72.js +994 -0
  13. package/js/{chunk-IJX4CYZO.js → chunk-DILSCQPJ.js} +228 -264
  14. package/js/chunk-HLMJBE4T.js +49 -0
  15. package/js/{chunk-RELFXUOO.js → chunk-JCX2K2SI.js} +931 -289
  16. package/js/{chunk-M3B3DE4K.js → chunk-KLSEU35Y.js} +463 -218
  17. package/js/chunk-OD3KFKZD.js +1617 -0
  18. package/js/chunk-OIH73VFM.js +175 -0
  19. package/js/chunk-OWN3DP2W.js +88 -0
  20. package/js/{chunk-IPI4MFSN.js → chunk-PBGPES67.js} +2 -2
  21. package/js/{chunk-WVVV4TX2.js → chunk-RIV62DRM.js} +4 -3
  22. package/js/{chunk-RFVIONFX.js → chunk-SXQVVXJE.js} +123 -44
  23. package/js/chunk-UPTAFF6L.js +335 -0
  24. package/js/{chunk-ODEIDRGW.js → chunk-URKOTNDA.js} +795 -176
  25. package/js/{chunk-5T57N25Q.js → chunk-VAI3EVCS.js} +643 -69
  26. package/js/{chunk-57RKNWL2.js → chunk-YDW7DX3A.js} +4 -4
  27. package/js/{chunk-CDL5PM2Q.js → chunk-ZKDXML77.js} +19239 -18404
  28. package/js/{chunk-GPFVWWDZ.js → chunk-ZXG7RMCB.js} +113 -58
  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 +231 -188
  34. package/js/host.js +116 -78
  35. package/js/index.js +213 -98
  36. package/js/mcp/effect.js +21 -21
  37. package/js/mcp.js +91 -57
  38. package/js/openapi.js +4349 -1415
  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 +40 -2
  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 +6869 -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 +85 -6
  87. package/types/apps/src/contracts/router.d.ts +2 -1
  88. package/types/apps/src/contracts/schedules.d.ts +7 -1
  89. package/types/apps/src/contracts/schema.d.ts +21 -0
  90. package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
  91. package/types/apps/src/contracts/skills.d.ts +50 -13
  92. package/types/apps/src/contracts/sql.d.ts +63 -0
  93. package/types/apps/src/contracts/ui.d.ts +70 -30
  94. package/types/apps/src/contracts/webhooks.d.ts +24 -7
  95. package/types/apps/src/contracts/workflows.d.ts +56 -34
  96. package/types/apps/src/facet.d.ts +4 -5
  97. package/types/apps/src/host.d.ts +5 -0
  98. package/types/apps/src/implementation/account-router.d.ts +4 -3
  99. package/types/apps/src/implementation/app.d.ts +41 -14
  100. package/types/apps/src/implementation/authoring.d.ts +25 -5
  101. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  102. package/types/apps/src/implementation/cache.d.ts +29 -2
  103. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  104. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  105. package/types/apps/src/implementation/events.d.ts +64 -0
  106. package/types/apps/src/implementation/failure-detail.d.ts +28 -5
  107. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  108. package/types/apps/src/implementation/graphql.d.ts +4 -3
  109. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  110. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  111. package/types/apps/src/implementation/live.d.ts +2 -2
  112. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  113. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  114. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  115. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  116. package/types/apps/src/implementation/mcp.d.ts +20 -9
  117. package/types/apps/src/implementation/network.d.ts +16 -0
  118. package/types/apps/src/implementation/openapi-compile.d.ts +38 -7
  119. package/types/apps/src/implementation/openapi-document.d.ts +50 -20
  120. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  121. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  122. package/types/apps/src/implementation/openapi-source.d.ts +23 -1
  123. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  124. package/types/apps/src/implementation/operations.d.ts +58 -7
  125. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  126. package/types/apps/src/implementation/placement.d.ts +60 -0
  127. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  128. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  129. package/types/apps/src/implementation/provider.d.ts +19 -4
  130. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  131. package/types/apps/src/implementation/router-catalog.d.ts +24 -18
  132. package/types/apps/src/implementation/router.d.ts +26 -6
  133. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  134. package/types/apps/src/implementation/schedules.d.ts +39 -8
  135. package/types/apps/src/implementation/schema.d.ts +108 -11
  136. package/types/apps/src/implementation/skills.d.ts +18 -24
  137. package/types/apps/src/implementation/sql.d.ts +71 -0
  138. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  139. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  140. package/types/apps/src/implementation/ui-client.d.ts +3 -3
  141. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  142. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  143. package/types/apps/src/implementation/ui-serving.d.ts +28 -11
  144. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  145. package/types/apps/src/implementation/upstream-error.d.ts +17 -0
  146. package/types/apps/src/implementation/webhooks.d.ts +15 -6
  147. package/types/apps/src/implementation/workflow-context.d.ts +6 -2
  148. package/types/apps/src/implementation/workflows.d.ts +11 -4
  149. package/types/apps/src/index.d.ts +51 -16
  150. package/types/apps/src/mcp.d.ts +20 -1
  151. package/types/apps/src/openapi.d.ts +22 -1
  152. package/types/apps/src/react.d.ts +1 -1
  153. package/types/apps/src/skills.d.ts +10 -8
  154. package/types/apps/src/ui-serving.d.ts +1 -1
  155. package/types/telemetry/src/app-records.d.ts +42 -0
  156. package/types/telemetry/src/browser-operations.d.ts +2 -2
  157. package/types/telemetry/src/browser.d.ts +8 -3
  158. package/types/telemetry/src/config.d.ts +2 -2
  159. package/types/telemetry/src/index.d.ts +2 -1
  160. package/types/telemetry/src/layer.d.ts +10 -4
  161. package/types/telemetry/src/measurements.d.ts +1 -1
  162. package/types/telemetry/src/ownership.d.ts +60 -0
  163. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  164. package/types/telemetry/src/relay.d.ts +16 -6
  165. package/types/telemetry/src/span-attributes.d.ts +17 -1
  166. package/types/telemetry/src/transport.d.ts +8 -1
  167. package/types/utils/src/api-error.d.ts +55 -0
  168. package/types/utils/src/connection-failure.d.ts +33 -0
  169. package/types/utils/src/legacy-keys.d.ts +20 -0
  170. package/types/utils/src/recorded-message.d.ts +18 -0
  171. package/types/utils/src/schema-definitions.d.ts +13 -0
  172. package/types/utils/src/user-facing-error.d.ts +83 -0
  173. package/js/chunk-27F7W2LG.js +0 -34
  174. package/js/chunk-EFAPIRVB.js +0 -299
  175. package/js/chunk-KRSCJDTW.js +0 -2668
  176. package/js/chunk-MKWZPDR6.js +0 -63
  177. package/js/chunk-N7YDVXYJ.js +0 -186
  178. package/js/chunk-NKLWZJLE.js +0 -172
  179. package/js/chunk-PJJ24GU7.js +0 -877
  180. package/js/chunk-PZB6T6KU.js +0 -19
  181. package/js/chunk-R3EV5FTO.js +0 -97
  182. package/js/chunk-TYVDBQSI.js +0 -242
  183. package/js/chunk-YBRC463S.js +0 -224
  184. package/js/chunk-Z2QY3YTF.js +0 -507
  185. package/js/chunk-ZQINWV4W.js +0 -630
  186. package/js/mcp/stdio.js +0 -128
  187. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  188. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  189. package/types/app-data/src/implementation/promise.d.ts +0 -68
  190. package/types/app-data/src/implementation/range.d.ts +0 -8
  191. package/types/app-data/src/implementation/schema.d.ts +0 -18
  192. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  193. package/types/app-data/src/index.d.ts +0 -4
  194. package/types/apps/src/contracts/storage.d.ts +0 -68
  195. package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
  196. package/types/apps/src/implementation/storage.d.ts +0 -15
  197. 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-TYVDBQSI.js";
9
- import "./chunk-ZQINWV4W.js";
14
+ } from "./chunk-3BI34I5S.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-GPFVWWDZ.js";
25
+ toolAnnotations,
26
+ withApproval,
27
+ withApprovals
28
+ } from "./chunk-ZXG7RMCB.js";
22
29
  import {
23
- accountProviderError
24
- } from "./chunk-MKWZPDR6.js";
30
+ accountProviderError,
31
+ fromPromise
32
+ } from "./chunk-OIH73VFM.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-KRSCJDTW.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-2RGJMA7N.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 });
@@ -183,28 +252,21 @@ var mergeSummary = (name, variants) => {
183
252
  description: first.description,
184
253
  ...first.title === void 0 ? {} : { title: first.title },
185
254
  readOnly: variants.every(([, tool]) => tool.readOnly === true),
255
+ ...variants.every(([, tool]) => tool.kindConfirmed === true) ? { kindConfirmed: true } : {},
186
256
  ...sameAcross("annotations", variants)
187
257
  });
188
258
  };
189
259
  var merge = (name, variants) => Schema_exports.decodeUnknownSync(HostedTool)({
190
260
  ...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
- },
261
+ inputSchema: accountBranches(
262
+ variants.map(([accountId, tool]) => [accountId, tool.inputSchema])
263
+ ),
202
264
  ...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}`)]
265
+ outputSchema: outputBranches(
266
+ variants.flatMap(
267
+ ([, tool]) => tool.outputSchema === void 0 ? [] : [tool.outputSchema]
206
268
  )
207
- }
269
+ )
208
270
  } : {},
209
271
  ...sameAcross("_meta", variants)
210
272
  });
@@ -218,7 +280,7 @@ var combineDynamic = (sources) => {
218
280
  );
219
281
  for (const tool of tools) {
220
282
  const variants = groups.get(tool.name) ?? [];
221
- if (variants.some(([id2]) => id2 === accountId))
283
+ if (variants.some(([id]) => id === accountId))
222
284
  return yield* Effect_exports.die(new Error("Duplicate source operation"));
223
285
  variants.push([accountId, tool]);
224
286
  groups.set(tool.name, variants);
@@ -307,7 +369,7 @@ var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
307
369
  const routers = /* @__PURE__ */ new Map();
308
370
  for (const account of accounts) {
309
371
  const declaration2 = yield* Effect_exports.tryPromise({
310
- try: () => discover(account),
372
+ try: async () => discover(account),
311
373
  catch: (error) => accountProviderError(error, account.id)
312
374
  });
313
375
  if (routers.has(account.id))
@@ -327,7 +389,7 @@ var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
327
389
 
328
390
  // src/implementation/dynamic-skills.ts
329
391
  var dynamicSkills = (source) => ({
330
- list: fromPromise(async () => source.list())
392
+ list: fromPromise(async () => source.list(), "skills")
331
393
  });
332
394
 
333
395
  // src/contracts/app.ts
@@ -337,58 +399,102 @@ var NotImplemented = class extends Schema_exports.TaggedError()("NotImplemented"
337
399
  };
338
400
 
339
401
  // src/implementation/schedules.ts
340
- var declaration = (timing, operation, input) => {
402
+ var declaration = (scope, timing, operation, input) => {
341
403
  const native = nativeOperation(operation);
342
404
  if (native === void 0 || native.kind !== "mutation")
343
405
  throw new Error("A schedule must reference a mutation");
406
+ if (scope === "app" && native.approval !== void 0)
407
+ throw new Error("An app schedule must reference a mutation without an approval");
344
408
  Schema_exports.decodeUnknownSync(native.input)(input);
345
- return { operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
409
+ return { scope, operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
346
410
  };
347
- var interval = (duration, operation, input) => {
411
+ var intervalTiming = (duration) => {
348
412
  const value = Schema_exports.decodeUnknownSync(Interval)(duration);
349
413
  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
- );
414
+ return Schema_exports.decodeUnknownSync(ScheduleTiming)({ kind: "interval", milliseconds });
355
415
  };
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
- );
416
+ var cronTiming = (calendar) => ({
417
+ kind: "cron",
418
+ calendar: Schema_exports.decodeUnknownSync(CalendarSchedule)({
419
+ ...calendar,
420
+ timezone: calendar.timezone ?? "UTC"
421
+ })
422
+ });
423
+ var userInterval = (duration, operation, input) => declaration("user", intervalTiming(duration), operation, input);
424
+ var userCron = (calendar, operation, input) => declaration("user", cronTiming(calendar), operation, input);
425
+ var appInterval = (duration, operation, input) => declaration("app", intervalTiming(duration), operation, input);
426
+ var appCron = (calendar, operation, input) => declaration("app", cronTiming(calendar), operation, input);
367
427
 
368
428
  // src/index.ts
429
+ var isFields = (value) => typeof value === "object" && value !== null && Object.values(value).every(isSchema);
430
+ var accountDecoder = (schema) => (
431
+ // SAFETY: the brand exists only in types; secret values are strings at runtime.
432
+ decoderOf(schema)
433
+ );
434
+ var exposureOf = (schema) => {
435
+ const marked = "fields" in schema && isFields(schema.fields) ? fieldExposure(schema.fields) : {};
436
+ return Object.keys(marked).length === 0 ? {} : { exposure: marked };
437
+ };
438
+ var fieldNames = (schema) => "fields" in schema && isFields(schema.fields) ? Object.keys(schema.fields) : schema === OAuth2AccessToken2 ? ["access_token"] : [];
439
+ var placementsOf = (method, schema, request) => request === void 0 ? {} : {
440
+ request: declarePlacements(
441
+ method,
442
+ fieldNames(schema),
443
+ exposureOf(schema).exposure,
444
+ request
445
+ )
446
+ };
369
447
  var OAuth2AccessToken2 = wrap(OAuth2AccessToken, false);
370
- var secrets2 = (options) => secrets({ label: options.label, fields: decoderOf(options.fields) });
448
+ var secrets2 = (options) => secrets({
449
+ label: options.label,
450
+ fields: accountDecoder(options.fields),
451
+ ...exposureOf(options.fields),
452
+ // SAFETY: the callback receives references named by the schema's own keys.
453
+ ...placementsOf(
454
+ `"${options.label}"`,
455
+ options.fields,
456
+ options.request
457
+ )
458
+ });
371
459
  function oauth22(options) {
372
- const { response = OAuth2AccessToken2, ...config } = options;
373
- return Effect_exports.runSync(oauth2(config, decoderOf(response)));
460
+ const { response = OAuth2AccessToken2, request, ...config } = options;
461
+ return Effect_exports.runSync(
462
+ oauth2(
463
+ config,
464
+ accountDecoder(response),
465
+ exposureOf(response).exposure,
466
+ // SAFETY: the callback receives references named by the response projection's own keys.
467
+ placementsOf("OAuth", response, request).request
468
+ )
469
+ );
374
470
  }
375
471
  var decodeJson2 = (response, schema) => {
376
472
  const native = {
377
473
  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)
474
+ json: () => (
475
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- a Response the app passes from its own code
476
+ Effect_exports.tryPromise({
477
+ try: () => response.json(),
478
+ catch: (error) => error
479
+ }).pipe(
480
+ Effect_exports.catch(
481
+ (error) => error instanceof SyntaxError ? Effect_exports.fail(new ResponseDecodeError()) : Effect_exports.die(error)
482
+ )
384
483
  )
385
484
  )
386
485
  };
387
486
  return Effect_exports.runPromise(decodeJson(native, decoderOf(schema)));
388
487
  };
488
+ function query3(first, second) {
489
+ if (typeof first === "string") return query(first, second);
490
+ return query2(...[first, second]);
491
+ }
389
492
  export {
390
493
  CacheError,
494
+ DeclarationInvalid,
391
495
  ElicitationFailed,
496
+ FetchOptionUnsupported,
497
+ NetworkRefused,
392
498
  NonRetryableError,
393
499
  NotImplemented,
394
500
  OAuth2AccessToken2 as OAuth2AccessToken,
@@ -398,17 +504,20 @@ export {
398
504
  ValidationError,
399
505
  WorkflowFailure,
400
506
  accountRouter,
507
+ appCron,
508
+ appInterval,
401
509
  array,
510
+ base64,
511
+ basic,
512
+ bearer,
402
513
  boolean,
403
- cron,
404
514
  decodeJson2 as decodeJson,
405
515
  defineApp,
406
- defineDatabase,
407
516
  defineProvider,
408
517
  dynamicRouter,
409
518
  dynamicSkills,
410
- id,
411
- interval,
519
+ event,
520
+ header,
412
521
  json,
413
522
  jsonSchema,
414
523
  literal,
@@ -416,13 +525,19 @@ export {
416
525
  number,
417
526
  oauth22 as oauth2,
418
527
  object,
419
- query,
528
+ plain,
529
+ query3 as query,
530
+ raw,
420
531
  record,
532
+ renameTools,
421
533
  router,
422
534
  secrets2 as secrets,
423
535
  string,
424
- table,
425
- userId,
536
+ t,
537
+ toolAnnotations,
538
+ userCron,
539
+ userInterval,
426
540
  withApproval,
541
+ withApprovals,
427
542
  workflow
428
543
  };
package/js/mcp/effect.js CHANGED
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  mcpClientEffect,
3
+ mcpHealthEffect,
3
4
  mcpToolsEffect
4
- } from "../chunk-YBRC463S.js";
5
- import "../chunk-EFAPIRVB.js";
5
+ } from "../chunk-3BOEMXAJ.js";
6
6
  import "../chunk-BCSNKUAC.js";
7
- import "../chunk-RELFXUOO.js";
8
- import "../chunk-NKLWZJLE.js";
9
- import "../chunk-Z2QY3YTF.js";
10
- import "../chunk-IPI4MFSN.js";
11
- import "../chunk-TYVDBQSI.js";
12
- import "../chunk-ZQINWV4W.js";
13
- import "../chunk-GPFVWWDZ.js";
14
- import "../chunk-MKWZPDR6.js";
15
- import "../chunk-KRSCJDTW.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-JCX2K2SI.js";
8
+ import "../chunk-UPTAFF6L.js";
9
+ import "../chunk-BKIQCV72.js";
10
+ import "../chunk-HLMJBE4T.js";
11
+ import "../chunk-PBGPES67.js";
12
+ import "../chunk-3BI34I5S.js";
13
+ import "../chunk-ZXG7RMCB.js";
14
+ import "../chunk-OIH73VFM.js";
15
+ import "../chunk-2RGJMA7N.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
  };