apps 0.0.1-beta.5 → 0.0.1-beta.7

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 (66) hide show
  1. package/README.md +65 -43
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-FWQC6I3C.js → chunk-5T57N25Q.js} +13 -1
  4. package/js/{chunk-TDNYXSIX.js → chunk-72JNVHPK.js} +21 -9
  5. package/js/{chunk-UDDE5KOR.js → chunk-CMYUWAX7.js} +26 -7
  6. package/js/chunk-FL2QR3XW.js +507 -0
  7. package/js/{chunk-G7T27IWB.js → chunk-MKWZPDR6.js} +1 -1
  8. package/js/{chunk-CYYBFC2K.js → chunk-NKLWZJLE.js} +1 -1
  9. package/js/{chunk-67EVWIGJ.js → chunk-OCYUEU47.js} +4 -4
  10. package/js/{chunk-YEPYT6SD.js → chunk-R3EV5FTO.js} +12 -0
  11. package/js/{chunk-XHO2ZX6W.js → chunk-RFVIONFX.js} +27 -10
  12. package/js/{chunk-LUVSFETN.js → chunk-UESPOTUI.js} +127 -231
  13. package/js/{chunk-DQAZTA4I.js → chunk-WLE7WX2U.js} +290 -20
  14. package/js/{chunk-C3VAOK5B.js → chunk-YXQHV65J.js} +53 -26
  15. package/js/chunk-Z5M2LQOZ.js +209 -0
  16. package/js/client.js +1 -1
  17. package/js/contracts.js +34 -11
  18. package/js/effect.js +9 -11
  19. package/js/graphql.js +25 -32
  20. package/js/host.js +9 -11
  21. package/js/index.js +194 -192
  22. package/js/mcp/effect.js +11 -13
  23. package/js/mcp/stdio.js +15 -17
  24. package/js/mcp.js +50 -36
  25. package/js/openapi.js +166 -108
  26. package/js/skills.js +6 -7
  27. package/package.json +1 -1
  28. package/runtime.json +1 -1
  29. package/types/apps/src/contracts/app.d.ts +2 -5
  30. package/types/apps/src/contracts/host.d.ts +19 -7
  31. package/types/apps/src/contracts/mcp.d.ts +16 -0
  32. package/types/apps/src/contracts/openapi.d.ts +4 -0
  33. package/types/apps/src/contracts/operations.d.ts +0 -5
  34. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  35. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  36. package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
  37. package/types/apps/src/contracts/provider.d.ts +51 -5
  38. package/types/apps/src/contracts/router.d.ts +59 -0
  39. package/types/apps/src/graphql.d.ts +1 -3
  40. package/types/apps/src/implementation/account-router.d.ts +12 -0
  41. package/types/apps/src/implementation/app.d.ts +5 -4
  42. package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
  43. package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
  44. package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
  45. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  46. package/types/apps/src/implementation/mcp.d.ts +35 -19
  47. package/types/apps/src/implementation/openapi-compile.d.ts +2 -1
  48. package/types/apps/src/implementation/openapi-source.d.ts +2 -6
  49. package/types/apps/src/implementation/operations.d.ts +26 -3
  50. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  51. package/types/apps/src/implementation/provider.d.ts +9 -4
  52. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  53. package/types/apps/src/implementation/router.d.ts +59 -0
  54. package/types/apps/src/implementation/schema.d.ts +5 -1
  55. package/types/apps/src/implementation/workflow-context.d.ts +1 -1
  56. package/types/apps/src/index.d.ts +5 -4
  57. package/types/apps/src/mcp-stdio.d.ts +2 -5
  58. package/types/apps/src/mcp.d.ts +5 -4
  59. package/types/apps/src/openapi.d.ts +6 -6
  60. package/js/chunk-3XKZDQLM.js +0 -93
  61. package/js/chunk-4M277YTM.js +0 -136
  62. package/js/chunk-SB3V4YVR.js +0 -18
  63. package/js/chunk-W4DMKWAB.js +0 -35
  64. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  65. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  66. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -0,0 +1,209 @@
1
+ import {
2
+ HostedTool,
3
+ RouterKey,
4
+ RouterMeta,
5
+ reservedRouterKeys
6
+ } from "./chunk-WLE7WX2U.js";
7
+ import {
8
+ decoderOf
9
+ } from "./chunk-5T57N25Q.js";
10
+ import {
11
+ Effect_exports,
12
+ Schema_exports
13
+ } from "./chunk-CDL5PM2Q.js";
14
+
15
+ // src/implementation/authoring.ts
16
+ var NativeCallback = /* @__PURE__ */ Symbol("apps.NativeCallback");
17
+ var fromPromise = (callback) => (...args) => {
18
+ if (NativeCallback in callback) {
19
+ const native = callback[NativeCallback];
20
+ return native(...args);
21
+ }
22
+ return Effect_exports.tryPromise({ try: () => callback(...args), catch: (error) => error });
23
+ };
24
+ var toPromise = (operation, signal) => {
25
+ const native = (...args) => Effect_exports.suspend(() => {
26
+ if (signal === void 0) return operation(...args);
27
+ if (signal.aborted) return Effect_exports.interrupt;
28
+ const cancelled = Effect_exports.callback((resume) => {
29
+ if (signal.aborted) {
30
+ resume(Effect_exports.interrupt);
31
+ return;
32
+ }
33
+ const abort = () => resume(Effect_exports.interrupt);
34
+ signal.addEventListener("abort", abort, { once: true });
35
+ return Effect_exports.sync(() => signal.removeEventListener("abort", abort));
36
+ });
37
+ return Effect_exports.raceFirst(
38
+ cancelled,
39
+ Effect_exports.suspend(() => operation(...args))
40
+ );
41
+ });
42
+ return Object.assign((...args) => Effect_exports.runPromise(native(...args)), {
43
+ [NativeCallback]: native
44
+ });
45
+ };
46
+
47
+ // src/implementation/operations.ts
48
+ var NativeOperation = /* @__PURE__ */ Symbol("apps.Operation");
49
+ var NativeRouterKey = /* @__PURE__ */ Symbol("apps.Router");
50
+ var operationDeclaration = (operation) => ({
51
+ kind: operation.kind,
52
+ [NativeOperation]: operation
53
+ });
54
+ var nativeOperation = (value) => {
55
+ if (typeof value !== "object" || value === null || !(NativeOperation in value)) return void 0;
56
+ return value[NativeOperation];
57
+ };
58
+ var operationOptions = (options) => {
59
+ const approval = options.approval;
60
+ return {
61
+ ...options.description === void 0 ? {} : { description: options.description },
62
+ ...options.title === void 0 ? {} : { title: options.title },
63
+ ...options.annotations === void 0 ? {} : { annotations: options.annotations },
64
+ ...options._meta === void 0 ? {} : { _meta: options._meta },
65
+ input: decoderOf(options.input),
66
+ ...approval === void 0 ? {} : {
67
+ approval: (context) => Effect_exports.tryPromise({ try: async () => approval(context), catch: (error) => error })
68
+ }
69
+ };
70
+ };
71
+ var withApproval = (operation, approval) => ({
72
+ ...operation,
73
+ [NativeOperation]: {
74
+ ...operation[NativeOperation],
75
+ approval: (context) => Effect_exports.tryPromise({ try: async () => approval(context), catch: (error) => error })
76
+ }
77
+ });
78
+ var make = (kind, options, run) => operationDeclaration({
79
+ ...operationOptions(options),
80
+ kind,
81
+ // The host always validates JSON serialization, even without a stronger output declaration.
82
+ ...options.output === void 0 ? {} : { output: decoderOf(options.output) },
83
+ run: (context, input) => Effect_exports.tryPromise({
84
+ // SAFETY: defineApp checks the handler context against its requirements.
85
+ // The host validates account bindings and creates the matching storage facade.
86
+ try: () => run(context, input),
87
+ catch: (error) => error
88
+ })
89
+ });
90
+ var query = (options, run) => make("query", options, run);
91
+ var mutation = (options, run) => make("mutation", options, run);
92
+
93
+ // src/implementation/router.ts
94
+ var routerDeclaration = (node) => ({
95
+ [NativeRouterKey]: node
96
+ });
97
+ var nativeRouter = (value) => {
98
+ if (typeof value !== "object" || value === null || !(NativeRouterKey in value)) return void 0;
99
+ return value[NativeRouterKey];
100
+ };
101
+ var nativeNode = (value) => nativeOperation(value) ?? nativeRouter(value);
102
+ var metaOf = (options) => {
103
+ if (options === void 0) return void 0;
104
+ const defined = Object.fromEntries(
105
+ Object.entries(options).filter(([, value]) => value !== void 0)
106
+ );
107
+ return Object.keys(defined).length === 0 ? void 0 : Schema_exports.decodeUnknownSync(RouterMeta)(defined);
108
+ };
109
+ var mergeMeta = (base, override) => base === void 0 ? override : override === void 0 ? base : { ...base, ...override };
110
+ function router(children, options) {
111
+ const meta = metaOf(options);
112
+ const existing = nativeRouter(children);
113
+ if (existing !== void 0)
114
+ return routerDeclaration(
115
+ existing.kind === "router" ? { ...existing, ...withMeta(mergeMeta(existing.meta, meta)) } : { ...existing, ...withOverrides(mergeMeta(existing.overrides, meta)) }
116
+ );
117
+ const nodes = {};
118
+ for (const [key, value] of Object.entries(children)) {
119
+ if (reservedRouterKeys.has(key)) throw new Error(`Router key "${key}" is reserved`);
120
+ if (!Schema_exports.is(RouterKey)(key))
121
+ throw new Error(`Router key "${key}" must start with a letter or _ and contain no dots`);
122
+ const node = nativeNode(value);
123
+ if (node === void 0)
124
+ throw new Error(`Router key "${key}" must be a query, mutation or router`);
125
+ nodes[key] = node;
126
+ }
127
+ return routerDeclaration({ kind: "router", ...withMeta(meta), children: nodes });
128
+ }
129
+ var withMeta = (meta) => meta === void 0 ? {} : { meta };
130
+ var withOverrides = (overrides) => overrides === void 0 ? {} : { overrides };
131
+ var dynamicRouter = (source) => {
132
+ const meta = source.meta;
133
+ return routerDeclaration({
134
+ kind: "dynamic",
135
+ ...meta === void 0 ? {} : {
136
+ meta: () => fromPromise(async () => meta())().pipe(
137
+ Effect_exports.flatMap((options) => Schema_exports.decodeUnknownEffect(RouterMeta)(options))
138
+ )
139
+ },
140
+ list: () => fromPromise(async () => source.list())().pipe(
141
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(Schema_exports.Array(HostedTool)))
142
+ ),
143
+ resolve: (name) => fromPromise(async () => source.resolve(name))().pipe(
144
+ Effect_exports.map((value) => {
145
+ if (value === void 0) return void 0;
146
+ const operation = nativeOperation(value);
147
+ if (operation === void 0) throw new Error("Expected an operation declaration");
148
+ return operation;
149
+ })
150
+ )
151
+ });
152
+ };
153
+ var joinPath = (path, name) => path === "" ? name : `${path}.${name}`;
154
+ var locate = (root, name) => {
155
+ if (root?.kind === "dynamic") return { kind: "dynamic", source: root, router: "", name };
156
+ let current = root;
157
+ let path = "";
158
+ let rest = name;
159
+ while (current !== void 0) {
160
+ const dot = rest.indexOf(".");
161
+ const key = dot < 0 ? rest : rest.slice(0, dot);
162
+ const child = Object.hasOwn(current.children, key) ? current.children[key] : void 0;
163
+ if (child === void 0) return void 0;
164
+ const remaining = dot < 0 ? void 0 : rest.slice(dot + 1);
165
+ switch (child.kind) {
166
+ case "query":
167
+ case "mutation":
168
+ return remaining === void 0 ? { kind: "operation", operation: child, router: path } : void 0;
169
+ case "dynamic":
170
+ return remaining === void 0 || remaining === "" ? void 0 : { kind: "dynamic", source: child, router: joinPath(path, key), name: remaining };
171
+ case "router":
172
+ if (remaining === void 0) return void 0;
173
+ current = child;
174
+ path = joinPath(path, key);
175
+ rest = remaining;
176
+ }
177
+ }
178
+ return void 0;
179
+ };
180
+ var declaredOperations = (root, path = "") => Object.entries(root?.children ?? {}).flatMap(([key, child]) => {
181
+ const name = joinPath(path, key);
182
+ switch (child.kind) {
183
+ case "query":
184
+ case "mutation":
185
+ return [{ name, router: path, operation: child }];
186
+ case "router":
187
+ return declaredOperations(child, name);
188
+ case "dynamic":
189
+ return [];
190
+ }
191
+ });
192
+
193
+ export {
194
+ fromPromise,
195
+ toPromise,
196
+ operationDeclaration,
197
+ nativeOperation,
198
+ withApproval,
199
+ query,
200
+ mutation,
201
+ routerDeclaration,
202
+ nativeRouter,
203
+ mergeMeta,
204
+ router,
205
+ dynamicRouter,
206
+ joinPath,
207
+ locate,
208
+ declaredOperations
209
+ };
package/js/client.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-UK573G7W.js";
29
29
  import {
30
30
  decoderOf
31
- } from "./chunk-FWQC6I3C.js";
31
+ } from "./chunk-5T57N25Q.js";
32
32
  import {
33
33
  StorageName
34
34
  } from "./chunk-PZB6T6KU.js";
package/js/contracts.js CHANGED
@@ -1,4 +1,8 @@
1
1
  import {
2
+ AccountCheckCommand,
3
+ AccountCheckResult,
4
+ AccountInfo,
5
+ ApiErrorResponse,
2
6
  ApprovalElicitation,
3
7
  ApprovalResponse,
4
8
  CalendarSchedule,
@@ -15,6 +19,7 @@ import {
15
19
  FailureName,
16
20
  FailureSource,
17
21
  FormElicitation,
22
+ HostAccountCheckError,
18
23
  HostAccountsInvalid,
19
24
  HostCallError,
20
25
  HostDataError,
@@ -24,6 +29,7 @@ import {
24
29
  HostInputInvalid,
25
30
  HostInspectError,
26
31
  HostInvocation,
32
+ HostKindMismatch,
27
33
  HostOperationFailed,
28
34
  HostOperationNotFound,
29
35
  HostOutputInvalid,
@@ -31,10 +37,14 @@ import {
31
37
  HostRequestInvalid,
32
38
  HostRequirementsError,
33
39
  HostResponse,
40
+ HostRouterError,
34
41
  HostToolApprovalRequired,
35
42
  HostToolBlocked,
36
43
  HostToolNotFound,
37
44
  HostToolPolicyFailed,
45
+ HostedCatalog,
46
+ HostedCatalogSummary,
47
+ HostedRouter,
38
48
  HostedTool,
39
49
  HostedToolSummary,
40
50
  HostedWebhook,
@@ -49,10 +59,13 @@ import {
49
59
  NonRetryableError,
50
60
  OAuthClientAuth,
51
61
  OAuthSecretClientAuth,
62
+ OpenapiResponseError,
52
63
  OperationSchedule,
53
- OperationToolPrefixes,
54
64
  ResolvedAccount,
55
65
  ResolvedAccounts,
66
+ RouterIcon,
67
+ RouterKey,
68
+ RouterMeta,
56
69
  ScheduleTiming,
57
70
  SkillCatalogResponse,
58
71
  SkillSources,
@@ -90,16 +103,20 @@ import {
90
103
  protocol1,
91
104
  protocol2,
92
105
  protocol3,
106
+ protocol4,
107
+ protocol5,
93
108
  selectTools,
94
109
  skillCatalog,
95
110
  skillsCommand,
96
111
  workflowDurationMillis
97
- } from "./chunk-DQAZTA4I.js";
112
+ } from "./chunk-WLE7WX2U.js";
98
113
  import {
99
114
  DatabaseFieldReserved,
100
115
  DatabaseLimitExceeded
101
116
  } from "./chunk-N7YDVXYJ.js";
102
- import "./chunk-YEPYT6SD.js";
117
+ import {
118
+ ProviderError
119
+ } from "./chunk-R3EV5FTO.js";
103
120
  import {
104
121
  AppSkillMetadata,
105
122
  AppSkillName,
@@ -113,13 +130,6 @@ import {
113
130
  skillFormatLimits,
114
131
  skillLoadLimits
115
132
  } from "./chunk-JU7VHODU.js";
116
- import {
117
- ApiErrorResponse,
118
- OpenapiResponseError
119
- } from "./chunk-W4DMKWAB.js";
120
- import {
121
- ProviderError
122
- } from "./chunk-SB3V4YVR.js";
123
133
  import {
124
134
  AppStorageError,
125
135
  AppStorageUnavailable,
@@ -132,7 +142,10 @@ import {
132
142
  import "./chunk-CDL5PM2Q.js";
133
143
  import "./chunk-CZ7CSFO4.js";
134
144
  export {
145
+ AccountCheckCommand,
146
+ AccountCheckResult,
135
147
  AccountId,
148
+ AccountInfo,
136
149
  ApiErrorResponse,
137
150
  AppSkillMetadata,
138
151
  AppSkillName,
@@ -158,6 +171,7 @@ export {
158
171
  FailureName,
159
172
  FailureSource,
160
173
  FormElicitation,
174
+ HostAccountCheckError,
161
175
  HostAccountsInvalid,
162
176
  HostCallError,
163
177
  HostDataError,
@@ -167,6 +181,7 @@ export {
167
181
  HostInputInvalid,
168
182
  HostInspectError,
169
183
  HostInvocation,
184
+ HostKindMismatch,
170
185
  HostOperationFailed,
171
186
  HostOperationNotFound,
172
187
  HostOutputInvalid,
@@ -174,10 +189,14 @@ export {
174
189
  HostRequestInvalid,
175
190
  HostRequirementsError,
176
191
  HostResponse,
192
+ HostRouterError,
177
193
  HostToolApprovalRequired,
178
194
  HostToolBlocked,
179
195
  HostToolNotFound,
180
196
  HostToolPolicyFailed,
197
+ HostedCatalog,
198
+ HostedCatalogSummary,
199
+ HostedRouter,
181
200
  HostedTool,
182
201
  HostedToolSummary,
183
202
  HostedWebhook,
@@ -195,10 +214,12 @@ export {
195
214
  OAuthSecretClientAuth,
196
215
  OpenapiResponseError,
197
216
  OperationSchedule,
198
- OperationToolPrefixes,
199
217
  ProviderError,
200
218
  ResolvedAccount,
201
219
  ResolvedAccounts,
220
+ RouterIcon,
221
+ RouterKey,
222
+ RouterMeta,
202
223
  ScheduleTiming,
203
224
  SkillCatalogResponse,
204
225
  SkillDefinitionInvalid,
@@ -242,6 +263,8 @@ export {
242
263
  protocol1,
243
264
  protocol2,
244
265
  protocol3,
266
+ protocol4,
267
+ protocol5,
245
268
  selectTools,
246
269
  skillCatalog,
247
270
  skillFormatLimits,
package/js/effect.js CHANGED
@@ -3,22 +3,20 @@ import {
3
3
  ApprovalDecision,
4
4
  createAppHandler,
5
5
  prepareElicitation
6
- } from "./chunk-LUVSFETN.js";
7
- import "./chunk-CYYBFC2K.js";
6
+ } from "./chunk-UESPOTUI.js";
7
+ import "./chunk-NKLWZJLE.js";
8
+ import "./chunk-FL2QR3XW.js";
8
9
  import "./chunk-IPI4MFSN.js";
9
- import "./chunk-4M277YTM.js";
10
- import "./chunk-C3VAOK5B.js";
10
+ import "./chunk-YXQHV65J.js";
11
11
  import "./chunk-ZQINWV4W.js";
12
- import "./chunk-3XKZDQLM.js";
13
- import "./chunk-G7T27IWB.js";
12
+ import "./chunk-Z5M2LQOZ.js";
13
+ import "./chunk-MKWZPDR6.js";
14
14
  import {
15
15
  ToolAnnotations
16
- } from "./chunk-DQAZTA4I.js";
16
+ } from "./chunk-WLE7WX2U.js";
17
17
  import "./chunk-N7YDVXYJ.js";
18
- import "./chunk-YEPYT6SD.js";
18
+ import "./chunk-R3EV5FTO.js";
19
19
  import "./chunk-JU7VHODU.js";
20
- import "./chunk-W4DMKWAB.js";
21
- import "./chunk-SB3V4YVR.js";
22
20
  import "./chunk-RJDDBDSN.js";
23
21
  import "./chunk-57RKNWL2.js";
24
22
  import "./chunk-UK573G7W.js";
@@ -27,7 +25,7 @@ import {
27
25
  decoderOf,
28
26
  jsonSchemaDecoder,
29
27
  wrap
30
- } from "./chunk-FWQC6I3C.js";
28
+ } from "./chunk-5T57N25Q.js";
31
29
  import "./chunk-PZB6T6KU.js";
32
30
  import {
33
31
  HttpUrl,
package/js/graphql.js CHANGED
@@ -1,34 +1,33 @@
1
1
  import {
2
2
  catalogCache
3
- } from "./chunk-XHO2ZX6W.js";
3
+ } from "./chunk-RFVIONFX.js";
4
4
  import {
5
5
  protocolOperations
6
- } from "./chunk-TDNYXSIX.js";
6
+ } from "./chunk-72JNVHPK.js";
7
7
  import "./chunk-BCSNKUAC.js";
8
- import "./chunk-LUVSFETN.js";
8
+ import "./chunk-UESPOTUI.js";
9
9
  import {
10
10
  cacheKey
11
- } from "./chunk-CYYBFC2K.js";
11
+ } from "./chunk-NKLWZJLE.js";
12
+ import "./chunk-FL2QR3XW.js";
12
13
  import "./chunk-IPI4MFSN.js";
13
- import "./chunk-4M277YTM.js";
14
- import "./chunk-C3VAOK5B.js";
14
+ import "./chunk-YXQHV65J.js";
15
15
  import "./chunk-ZQINWV4W.js";
16
16
  import {
17
- nativeOperation
18
- } from "./chunk-3XKZDQLM.js";
17
+ nativeOperation,
18
+ routerDeclaration
19
+ } from "./chunk-Z5M2LQOZ.js";
19
20
  import {
20
21
  accountProviderError,
21
22
  graphqlProviderError,
22
23
  httpProviderError
23
- } from "./chunk-G7T27IWB.js";
24
- import "./chunk-DQAZTA4I.js";
24
+ } from "./chunk-MKWZPDR6.js";
25
+ import "./chunk-WLE7WX2U.js";
25
26
  import "./chunk-N7YDVXYJ.js";
26
- import "./chunk-YEPYT6SD.js";
27
- import "./chunk-JU7VHODU.js";
28
- import "./chunk-W4DMKWAB.js";
29
27
  import {
30
28
  ProviderError
31
- } from "./chunk-SB3V4YVR.js";
29
+ } from "./chunk-R3EV5FTO.js";
30
+ import "./chunk-JU7VHODU.js";
32
31
  import "./chunk-RJDDBDSN.js";
33
32
  import {
34
33
  FetchHttpClient_exports
@@ -39,7 +38,7 @@ import {
39
38
  } from "./chunk-UK573G7W.js";
40
39
  import {
41
40
  jsonSchemaDecoder
42
- } from "./chunk-FWQC6I3C.js";
41
+ } from "./chunk-5T57N25Q.js";
43
42
  import "./chunk-PZB6T6KU.js";
44
43
  import {
45
44
  AccountId,
@@ -449,13 +448,13 @@ var graphqlCatalog = (options, kinds) => Effect_exports.gen(function* () {
449
448
  },
450
449
  load: (context) => (context === void 0 ? Effect_exports.succeed(client) : graphqlClientEffect({ ...parsed, signal: context.signal })).pipe(
451
450
  Effect_exports.flatMap((source) => source.discover),
452
- Effect_exports.flatMap(graphqlDefinitions)
451
+ Effect_exports.flatMap(graphqlDefinitions),
452
+ Effect_exports.map((tools) => ({ tools }))
453
453
  )
454
454
  });
455
455
  const kindOf = (tool) => Object.hasOwn(kinds, tool.name) ? kinds[tool.name] ?? "mutation" : tool.kind;
456
- const qualified = (tool) => `${kindOf(tool) === "query" ? "queries" : "mutations"}.${tool.name}`;
457
456
  const summarize = (tool) => ({
458
- name: qualified(tool),
457
+ name: tool.name,
459
458
  description: tool.description,
460
459
  readOnly: kindOf(tool) === "query"
461
460
  });
@@ -463,34 +462,28 @@ var graphqlCatalog = (options, kinds) => Effect_exports.gen(function* () {
463
462
  ...summarize(tool),
464
463
  inputSchema: tool.inputSchema
465
464
  });
466
- const selected = (name) => Effect_exports.gen(function* () {
467
- if (!name.startsWith("queries.") && !name.startsWith("mutations.")) return void 0;
468
- const tool = yield* catalog.resolve(name.slice(name.indexOf(".") + 1));
469
- return tool === void 0 || qualified(tool) !== name ? void 0 : tool;
470
- });
471
- const dynamicTools = {
465
+ const router = {
466
+ kind: "dynamic",
472
467
  list: () => catalog.list().pipe(Effect_exports.map((tools) => tools.map(describe))),
473
468
  summaries: () => catalog.summaries().pipe(Effect_exports.map((tools) => tools.map(summarize))),
474
- describe: (name) => selected(name).pipe(
475
- Effect_exports.map((tool) => tool === void 0 ? void 0 : describe(tool))
476
- ),
469
+ describe: (name) => catalog.resolve(name).pipe(Effect_exports.map((tool) => tool === void 0 ? void 0 : describe(tool))),
477
470
  resolve: (name) => Effect_exports.gen(function* () {
478
- const tool = yield* selected(name);
471
+ const tool = yield* catalog.resolve(name);
479
472
  if (tool === void 0) return void 0;
480
473
  const adapted = yield* adaptGraphqlTool(client, tool);
481
474
  const operations = protocolOperations({ selected: adapted }, { selected: kindOf(tool) });
482
- return nativeOperation(operations.queries.selected ?? operations.mutations.selected);
475
+ return nativeOperation(operations.selected);
483
476
  })
484
477
  };
485
- return { dynamicTools };
478
+ return routerDeclaration(router);
486
479
  });
487
480
 
488
481
  // src/graphql.ts
489
- var graphqlOperations = (options, kinds = {}) => Effect_exports.runPromise(
482
+ var graphqlRouter = (options, kinds = {}) => Effect_exports.runPromise(
490
483
  graphqlCatalog(options, kinds),
491
484
  options.signal === void 0 ? {} : { signal: options.signal }
492
485
  );
493
486
  export {
494
487
  GraphqlError,
495
- graphqlOperations
488
+ graphqlRouter
496
489
  };
package/js/host.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-LUVSFETN.js";
4
- import "./chunk-CYYBFC2K.js";
3
+ } from "./chunk-UESPOTUI.js";
4
+ import "./chunk-NKLWZJLE.js";
5
+ import "./chunk-FL2QR3XW.js";
5
6
  import "./chunk-IPI4MFSN.js";
6
- import "./chunk-4M277YTM.js";
7
- import "./chunk-C3VAOK5B.js";
7
+ import "./chunk-YXQHV65J.js";
8
8
  import "./chunk-ZQINWV4W.js";
9
- import "./chunk-3XKZDQLM.js";
10
- import "./chunk-G7T27IWB.js";
9
+ import "./chunk-Z5M2LQOZ.js";
10
+ import "./chunk-MKWZPDR6.js";
11
11
  import {
12
12
  ElicitationFailed,
13
13
  ElicitationReply,
@@ -21,23 +21,21 @@ import {
21
21
  WorkflowRun,
22
22
  WorkflowRunId,
23
23
  WorkflowRunPage
24
- } from "./chunk-DQAZTA4I.js";
24
+ } from "./chunk-WLE7WX2U.js";
25
25
  import "./chunk-N7YDVXYJ.js";
26
26
  import {
27
27
  CacheCommand,
28
28
  CacheError,
29
29
  CacheReply
30
- } from "./chunk-YEPYT6SD.js";
30
+ } from "./chunk-R3EV5FTO.js";
31
31
  import "./chunk-JU7VHODU.js";
32
- import "./chunk-W4DMKWAB.js";
33
- import "./chunk-SB3V4YVR.js";
34
32
  import {
35
33
  collectTelemetry,
36
34
  withRemoteSpan
37
35
  } from "./chunk-RJDDBDSN.js";
38
36
  import "./chunk-57RKNWL2.js";
39
37
  import "./chunk-UK573G7W.js";
40
- import "./chunk-FWQC6I3C.js";
38
+ import "./chunk-5T57N25Q.js";
41
39
  import "./chunk-PZB6T6KU.js";
42
40
  import "./chunk-27F7W2LG.js";
43
41
  import {