apps 0.0.1-beta.15 → 0.0.1-beta.16

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.
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  joinPath,
6
6
  mergeMeta
7
- } from "./chunk-SWXGYMUW.js";
7
+ } from "./chunk-TEFD5OBS.js";
8
8
  import {
9
9
  parseProviderError
10
10
  } from "./chunk-MKWZPDR6.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  fixedRouter
3
- } from "./chunk-H34RQANV.js";
3
+ } from "./chunk-CIUZ3HSV.js";
4
4
  import {
5
5
  nativeOperation,
6
6
  operationDeclaration,
7
7
  routerDeclaration
8
- } from "./chunk-SWXGYMUW.js";
8
+ } from "./chunk-TEFD5OBS.js";
9
9
 
10
10
  // src/implementation/protocol-operations.ts
11
11
  var protocolOperations = (operations, kinds = {}) => {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-JAKBOQ5T.js";
3
+ } from "./chunk-ZBGV4RN4.js";
4
4
  import {
5
5
  fromPromise
6
- } from "./chunk-SWXGYMUW.js";
6
+ } from "./chunk-TEFD5OBS.js";
7
7
  import {
8
8
  ElicitationFailed,
9
9
  McpError,
@@ -2,7 +2,7 @@ import {
2
2
  adaptMcpTools,
3
3
  mcpClient,
4
4
  mcpJsonSchemaValidator
5
- } from "./chunk-YHLXXXKH.js";
5
+ } from "./chunk-QAXLPXKL.js";
6
6
  import {
7
7
  accountProviderError,
8
8
  httpProviderError
@@ -68,13 +68,18 @@ var operationOptions = (options) => {
68
68
  }
69
69
  };
70
70
  };
71
+ var approvedOperation = (operation, approval) => {
72
+ const copy = Object.defineProperties({}, Object.getOwnPropertyDescriptors(operation));
73
+ return Object.defineProperty(copy, "approval", {
74
+ enumerable: true,
75
+ value: (context) => Effect_exports.tryPromise({ try: async () => approval(context), catch: (error) => error })
76
+ });
77
+ };
71
78
  var withApproval = (operation, approval) => ({
72
79
  ...operation,
73
- [NativeOperation]: {
74
- ...operation[NativeOperation],
75
- approval: (context) => Effect_exports.tryPromise({ try: async () => approval(context), catch: (error) => error })
76
- }
80
+ [NativeOperation]: approvedOperation(operation[NativeOperation], approval)
77
81
  });
82
+ var toolAnnotations = (operation) => nativeOperation(operation)?.annotations;
78
83
  var make = (kind, options, run) => operationDeclaration({
79
84
  ...operationOptions(options),
80
85
  kind,
@@ -189,6 +194,44 @@ var declaredOperations = (root, path = "") => Object.entries(root?.children ?? {
189
194
  return [];
190
195
  }
191
196
  });
197
+ var withApprovals = (source, policy) => {
198
+ const native = nativeRouter(source);
199
+ if (native === void 0) throw new Error("withApprovals expects a router");
200
+ const operation = (node, name) => {
201
+ const approval = policy(operationDeclaration(node), name);
202
+ return approval === void 0 ? node : approvedOperation(node, approval);
203
+ };
204
+ const child = (node, name) => {
205
+ switch (node.kind) {
206
+ case "query":
207
+ case "mutation":
208
+ return operation(node, name);
209
+ case "router":
210
+ case "dynamic":
211
+ return walk(node, name);
212
+ }
213
+ };
214
+ const walk = (node, path) => node.kind === "dynamic" ? {
215
+ ...node,
216
+ resolve: (name) => node.resolve(name).pipe(
217
+ Effect_exports.flatMap(
218
+ (resolved) => resolved === void 0 ? Effect_exports.succeed(void 0) : Effect_exports.try({
219
+ try: () => operation(resolved, joinPath(path, name)),
220
+ catch: (error) => error
221
+ })
222
+ )
223
+ )
224
+ } : {
225
+ ...node,
226
+ children: Object.fromEntries(
227
+ Object.entries(node.children).map(([key, value]) => [
228
+ key,
229
+ child(value, joinPath(path, key))
230
+ ])
231
+ )
232
+ };
233
+ return routerDeclaration(walk(native, ""));
234
+ };
192
235
 
193
236
  export {
194
237
  fromPromise,
@@ -196,6 +239,7 @@ export {
196
239
  operationDeclaration,
197
240
  nativeOperation,
198
241
  withApproval,
242
+ toolAnnotations,
199
243
  query,
200
244
  mutation,
201
245
  routerDeclaration,
@@ -205,5 +249,6 @@ export {
205
249
  dynamicRouter,
206
250
  joinPath,
207
251
  locate,
208
- declaredOperations
252
+ declaredOperations,
253
+ withApprovals
209
254
  };
@@ -6,7 +6,7 @@ import {
6
6
  fromPromise,
7
7
  nativeOperation,
8
8
  nativeRouter
9
- } from "./chunk-SWXGYMUW.js";
9
+ } from "./chunk-TEFD5OBS.js";
10
10
  import {
11
11
  ScheduleTiming
12
12
  } from "./chunk-CL3O2NIN.js";
@@ -8,7 +8,7 @@ import {
8
8
  failureDetail,
9
9
  readCatalog,
10
10
  routerSkills
11
- } from "./chunk-H34RQANV.js";
11
+ } from "./chunk-CIUZ3HSV.js";
12
12
  import {
13
13
  folderSkillsEffect
14
14
  } from "./chunk-IPI4MFSN.js";
@@ -18,7 +18,7 @@ import {
18
18
  isApp,
19
19
  toEffectApp,
20
20
  unavailableStorage
21
- } from "./chunk-O5G3NDEO.js";
21
+ } from "./chunk-TXFDBLWA.js";
22
22
  import {
23
23
  parseDatabaseSchema
24
24
  } from "./chunk-ZQINWV4W.js";
@@ -28,7 +28,7 @@ import {
28
28
  locate,
29
29
  nativeOperation,
30
30
  toPromise
31
- } from "./chunk-SWXGYMUW.js";
31
+ } from "./chunk-TEFD5OBS.js";
32
32
  import {
33
33
  accountProviderError,
34
34
  httpProviderError,
package/js/effect.js CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  ApprovalDecision,
4
4
  createAppHandler,
5
5
  prepareElicitation
6
- } from "./chunk-JAKBOQ5T.js";
6
+ } from "./chunk-ZBGV4RN4.js";
7
7
  import "./chunk-NKLWZJLE.js";
8
- import "./chunk-H34RQANV.js";
8
+ import "./chunk-CIUZ3HSV.js";
9
9
  import "./chunk-IPI4MFSN.js";
10
- import "./chunk-O5G3NDEO.js";
10
+ import "./chunk-TXFDBLWA.js";
11
11
  import "./chunk-ZQINWV4W.js";
12
- import "./chunk-SWXGYMUW.js";
12
+ import "./chunk-TEFD5OBS.js";
13
13
  import "./chunk-MKWZPDR6.js";
14
14
  import {
15
15
  ToolAnnotations
package/js/graphql.js CHANGED
@@ -3,20 +3,20 @@ import {
3
3
  } from "./chunk-RFVIONFX.js";
4
4
  import {
5
5
  protocolOperations
6
- } from "./chunk-4J3IQXFD.js";
6
+ } from "./chunk-L2QHGLWF.js";
7
7
  import "./chunk-BCSNKUAC.js";
8
- import "./chunk-JAKBOQ5T.js";
8
+ import "./chunk-ZBGV4RN4.js";
9
9
  import {
10
10
  cacheKey
11
11
  } from "./chunk-NKLWZJLE.js";
12
- import "./chunk-H34RQANV.js";
12
+ import "./chunk-CIUZ3HSV.js";
13
13
  import "./chunk-IPI4MFSN.js";
14
- import "./chunk-O5G3NDEO.js";
14
+ import "./chunk-TXFDBLWA.js";
15
15
  import "./chunk-ZQINWV4W.js";
16
16
  import {
17
17
  nativeOperation,
18
18
  routerDeclaration
19
- } from "./chunk-SWXGYMUW.js";
19
+ } from "./chunk-TEFD5OBS.js";
20
20
  import {
21
21
  accountProviderError,
22
22
  graphqlProviderError,
package/js/host.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-JAKBOQ5T.js";
3
+ } from "./chunk-ZBGV4RN4.js";
4
4
  import "./chunk-NKLWZJLE.js";
5
- import "./chunk-H34RQANV.js";
5
+ import "./chunk-CIUZ3HSV.js";
6
6
  import "./chunk-IPI4MFSN.js";
7
- import "./chunk-O5G3NDEO.js";
7
+ import "./chunk-TXFDBLWA.js";
8
8
  import "./chunk-ZQINWV4W.js";
9
- import "./chunk-SWXGYMUW.js";
9
+ import "./chunk-TEFD5OBS.js";
10
10
  import "./chunk-MKWZPDR6.js";
11
11
  import {
12
12
  ElicitationFailed,
package/js/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  defineDatabase,
6
6
  table,
7
7
  workflow
8
- } from "./chunk-O5G3NDEO.js";
8
+ } from "./chunk-TXFDBLWA.js";
9
9
  import "./chunk-ZQINWV4W.js";
10
10
  import {
11
11
  dynamicRouter,
@@ -17,8 +17,10 @@ import {
17
17
  query,
18
18
  router,
19
19
  routerDeclaration,
20
- withApproval
21
- } from "./chunk-SWXGYMUW.js";
20
+ toolAnnotations,
21
+ withApproval,
22
+ withApprovals
23
+ } from "./chunk-TEFD5OBS.js";
22
24
  import {
23
25
  accountProviderError
24
26
  } from "./chunk-MKWZPDR6.js";
@@ -422,7 +424,9 @@ export {
422
424
  secrets2 as secrets,
423
425
  string,
424
426
  table,
427
+ toolAnnotations,
425
428
  userId,
426
429
  withApproval,
430
+ withApprovals,
427
431
  workflow
428
432
  };
package/js/mcp/effect.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  mcpClientEffect,
3
3
  mcpToolsEffect
4
- } from "../chunk-GKHJITGG.js";
5
- import "../chunk-YHLXXXKH.js";
4
+ } from "../chunk-S2HMUOAV.js";
5
+ import "../chunk-QAXLPXKL.js";
6
6
  import "../chunk-BCSNKUAC.js";
7
- import "../chunk-JAKBOQ5T.js";
7
+ import "../chunk-ZBGV4RN4.js";
8
8
  import "../chunk-NKLWZJLE.js";
9
- import "../chunk-H34RQANV.js";
9
+ import "../chunk-CIUZ3HSV.js";
10
10
  import "../chunk-IPI4MFSN.js";
11
- import "../chunk-O5G3NDEO.js";
11
+ import "../chunk-TXFDBLWA.js";
12
12
  import "../chunk-ZQINWV4W.js";
13
- import "../chunk-SWXGYMUW.js";
13
+ import "../chunk-TEFD5OBS.js";
14
14
  import "../chunk-MKWZPDR6.js";
15
15
  import "../chunk-CL3O2NIN.js";
16
16
  import "../chunk-N7YDVXYJ.js";
package/js/mcp/stdio.js CHANGED
@@ -2,18 +2,18 @@ import {
2
2
  adaptMcpTools,
3
3
  mcpClient,
4
4
  mcpJsonSchemaValidator
5
- } from "../chunk-YHLXXXKH.js";
5
+ } from "../chunk-QAXLPXKL.js";
6
6
  import {
7
7
  protocolRouter
8
- } from "../chunk-4J3IQXFD.js";
8
+ } from "../chunk-L2QHGLWF.js";
9
9
  import "../chunk-BCSNKUAC.js";
10
- import "../chunk-JAKBOQ5T.js";
10
+ import "../chunk-ZBGV4RN4.js";
11
11
  import "../chunk-NKLWZJLE.js";
12
- import "../chunk-H34RQANV.js";
12
+ import "../chunk-CIUZ3HSV.js";
13
13
  import "../chunk-IPI4MFSN.js";
14
- import "../chunk-O5G3NDEO.js";
14
+ import "../chunk-TXFDBLWA.js";
15
15
  import "../chunk-ZQINWV4W.js";
16
- import "../chunk-SWXGYMUW.js";
16
+ import "../chunk-TEFD5OBS.js";
17
17
  import "../chunk-MKWZPDR6.js";
18
18
  import {
19
19
  McpError,
package/js/mcp.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import {
2
2
  mcpClientEffect
3
- } from "./chunk-GKHJITGG.js";
3
+ } from "./chunk-S2HMUOAV.js";
4
4
  import {
5
5
  catalogCache
6
6
  } from "./chunk-RFVIONFX.js";
7
7
  import {
8
8
  adaptMcpTool
9
- } from "./chunk-YHLXXXKH.js";
9
+ } from "./chunk-QAXLPXKL.js";
10
10
  import {
11
11
  protocolOperations
12
- } from "./chunk-4J3IQXFD.js";
12
+ } from "./chunk-L2QHGLWF.js";
13
13
  import "./chunk-BCSNKUAC.js";
14
- import "./chunk-JAKBOQ5T.js";
14
+ import "./chunk-ZBGV4RN4.js";
15
15
  import {
16
16
  cacheKey
17
17
  } from "./chunk-NKLWZJLE.js";
18
- import "./chunk-H34RQANV.js";
18
+ import "./chunk-CIUZ3HSV.js";
19
19
  import "./chunk-IPI4MFSN.js";
20
- import "./chunk-O5G3NDEO.js";
20
+ import "./chunk-TXFDBLWA.js";
21
21
  import "./chunk-ZQINWV4W.js";
22
22
  import {
23
23
  nativeOperation,
24
24
  routerDeclaration
25
- } from "./chunk-SWXGYMUW.js";
25
+ } from "./chunk-TEFD5OBS.js";
26
26
  import "./chunk-MKWZPDR6.js";
27
27
  import {
28
28
  McpError,
package/js/openapi.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  protocolOperations,
10
10
  protocolRouter
11
- } from "./chunk-4J3IQXFD.js";
11
+ } from "./chunk-L2QHGLWF.js";
12
12
  import {
13
13
  OpenapiError,
14
14
  OpenapiErrorResponse,
@@ -21,14 +21,14 @@ import {
21
21
  isOpenapiTextMedia,
22
22
  openapiBinaryResultSchema,
23
23
  openapiMediaKind
24
- } from "./chunk-H34RQANV.js";
24
+ } from "./chunk-CIUZ3HSV.js";
25
25
  import "./chunk-IPI4MFSN.js";
26
26
  import {
27
27
  fromPromise,
28
28
  nativeOperation,
29
29
  routerDeclaration,
30
30
  toPromise
31
- } from "./chunk-SWXGYMUW.js";
31
+ } from "./chunk-TEFD5OBS.js";
32
32
  import {
33
33
  accountProviderError,
34
34
  httpProviderError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.15",
3
+ "version": "0.0.1-beta.16",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,