apps 0.0.1-beta.57 → 0.0.1-beta.59

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.
@@ -3,7 +3,7 @@ import {
3
3
  answeredError,
4
4
  mcpClient,
5
5
  mcpJsonSchemaValidator
6
- } from "./chunk-JK5S2N2S.js";
6
+ } from "./chunk-MP2X75VS.js";
7
7
  import {
8
8
  failOnNetworkRefusal
9
9
  } from "./chunk-7UUHJR2Q.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-BTSIG4NQ.js";
3
+ } from "./chunk-V7W36RYE.js";
4
4
  import {
5
5
  bodyUpstreamError,
6
6
  fromPromise
@@ -261,6 +261,29 @@ var OpenapiCompileError = class extends Schema_exports.TaggedError()(
261
261
  return compileMessage(this);
262
262
  }
263
263
  };
264
+ var OpenapiToolName = Schema_exports.Struct({
265
+ /** The tool name relative to the router, as `withApprovals` receives it. */
266
+ name: Schema_exports.String,
267
+ /** The HTTP method, such as `GET`. */
268
+ method: Schema_exports.String,
269
+ /** The request path, including any `pathPrefix`. */
270
+ path: Schema_exports.String,
271
+ operationId: Schema_exports.optionalKey(Schema_exports.String),
272
+ /** After `kinds` (keyed by `operationId`, else `name`); otherwise reading methods are queries. */
273
+ kind: Schema_exports.Literals(["query", "mutation"]),
274
+ /** Callable without credentials, so every account and a router without one expose it. */
275
+ public: Schema_exports.Boolean,
276
+ /** The `methods` and `oauth` entries whose accounts expose it. */
277
+ methods: Schema_exports.Array(Schema_exports.String)
278
+ });
279
+ var OpenapiToolNames = Schema_exports.Struct({
280
+ tools: Schema_exports.Array(OpenapiToolName),
281
+ /**
282
+ * Operations the compiler left out, and why. An operation it imports but no configured `methods`
283
+ * or `oauth` entry can authorize is missing from `tools` and is not listed here.
284
+ */
285
+ skipped: Schema_exports.Array(OpenapiSkippedOperation)
286
+ });
264
287
 
265
288
  // src/implementation/failure-detail.ts
266
289
  var cacheMessages = {
@@ -715,6 +738,8 @@ export {
715
738
  OpenapiCompileErrorCode,
716
739
  OpenapiSkippedOperation,
717
740
  OpenapiCompileError,
741
+ OpenapiToolName,
742
+ OpenapiToolNames,
718
743
  accountSecrets,
719
744
  boundFailureMessage,
720
745
  leavingProviderError,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fixedRouter
3
- } from "./chunk-QEBRH5AP.js";
3
+ } from "./chunk-QNDZFQYQ.js";
4
4
  import {
5
5
  nativeOperation,
6
6
  operationDeclaration,
@@ -11,7 +11,7 @@ import {
11
11
  parseSkillLoadFailed,
12
12
  readCatalog,
13
13
  routerSkills
14
- } from "./chunk-QEBRH5AP.js";
14
+ } from "./chunk-QNDZFQYQ.js";
15
15
  import {
16
16
  appInvocationFetch
17
17
  } from "./chunk-7UUHJR2Q.js";
package/js/effect.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  ApprovalDecision,
4
4
  createAppHandler,
5
5
  prepareElicitation
6
- } from "./chunk-BTSIG4NQ.js";
6
+ } from "./chunk-V7W36RYE.js";
7
7
  import "./chunk-AQU56EPI.js";
8
- import "./chunk-QEBRH5AP.js";
8
+ import "./chunk-QNDZFQYQ.js";
9
9
  import "./chunk-7UUHJR2Q.js";
10
10
  import "./chunk-XBG7HHXC.js";
11
11
  import "./chunk-PXXZ6ABC.js";
package/js/graphql.js CHANGED
@@ -4,13 +4,13 @@ import {
4
4
  } from "./chunk-UM62MBJQ.js";
5
5
  import {
6
6
  protocolOperations
7
- } from "./chunk-L4K2K22P.js";
7
+ } from "./chunk-S5QJEWH7.js";
8
8
  import "./chunk-BCSNKUAC.js";
9
- import "./chunk-BTSIG4NQ.js";
9
+ import "./chunk-V7W36RYE.js";
10
10
  import {
11
11
  cacheKey
12
12
  } from "./chunk-AQU56EPI.js";
13
- import "./chunk-QEBRH5AP.js";
13
+ import "./chunk-QNDZFQYQ.js";
14
14
  import {
15
15
  failOnNetworkRefusal
16
16
  } from "./chunk-7UUHJR2Q.js";
package/js/host.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-BTSIG4NQ.js";
3
+ } from "./chunk-V7W36RYE.js";
4
4
  import "./chunk-AQU56EPI.js";
5
- import "./chunk-QEBRH5AP.js";
5
+ import "./chunk-QNDZFQYQ.js";
6
6
  import "./chunk-7UUHJR2Q.js";
7
7
  import "./chunk-XBG7HHXC.js";
8
8
  import "./chunk-PXXZ6ABC.js";
package/js/mcp/effect.js CHANGED
@@ -2,12 +2,12 @@ import {
2
2
  mcpClientEffect,
3
3
  mcpHealthEffect,
4
4
  mcpToolsEffect
5
- } from "../chunk-XCSG7FT7.js";
6
- import "../chunk-JK5S2N2S.js";
5
+ } from "../chunk-J5QUUEK6.js";
6
+ import "../chunk-MP2X75VS.js";
7
7
  import "../chunk-BCSNKUAC.js";
8
- import "../chunk-BTSIG4NQ.js";
8
+ import "../chunk-V7W36RYE.js";
9
9
  import "../chunk-AQU56EPI.js";
10
- import "../chunk-QEBRH5AP.js";
10
+ import "../chunk-QNDZFQYQ.js";
11
11
  import "../chunk-7UUHJR2Q.js";
12
12
  import "../chunk-XBG7HHXC.js";
13
13
  import "../chunk-PXXZ6ABC.js";
package/js/mcp/stdio.js CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  answeredError,
4
4
  mcpClient,
5
5
  mcpJsonSchemaValidator
6
- } from "../chunk-JK5S2N2S.js";
6
+ } from "../chunk-MP2X75VS.js";
7
7
  import {
8
8
  protocolRouter
9
- } from "../chunk-L4K2K22P.js";
9
+ } from "../chunk-S5QJEWH7.js";
10
10
  import "../chunk-BCSNKUAC.js";
11
- import "../chunk-BTSIG4NQ.js";
11
+ import "../chunk-V7W36RYE.js";
12
12
  import "../chunk-AQU56EPI.js";
13
- import "../chunk-QEBRH5AP.js";
13
+ import "../chunk-QNDZFQYQ.js";
14
14
  import "../chunk-7UUHJR2Q.js";
15
15
  import "../chunk-XBG7HHXC.js";
16
16
  import "../chunk-PXXZ6ABC.js";
package/js/mcp.js CHANGED
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  mcpClientEffect,
3
3
  mcpHealthEffect
4
- } from "./chunk-XCSG7FT7.js";
4
+ } from "./chunk-J5QUUEK6.js";
5
5
  import {
6
6
  catalogCache,
7
7
  catalogScope
8
8
  } from "./chunk-UM62MBJQ.js";
9
9
  import {
10
10
  adaptMcpTool
11
- } from "./chunk-JK5S2N2S.js";
11
+ } from "./chunk-MP2X75VS.js";
12
12
  import {
13
13
  protocolOperations
14
- } from "./chunk-L4K2K22P.js";
14
+ } from "./chunk-S5QJEWH7.js";
15
15
  import "./chunk-BCSNKUAC.js";
16
- import "./chunk-BTSIG4NQ.js";
16
+ import "./chunk-V7W36RYE.js";
17
17
  import {
18
18
  cacheKey
19
19
  } from "./chunk-AQU56EPI.js";
20
20
  import {
21
21
  operationDescription
22
- } from "./chunk-QEBRH5AP.js";
22
+ } from "./chunk-QNDZFQYQ.js";
23
23
  import "./chunk-7UUHJR2Q.js";
24
24
  import "./chunk-XBG7HHXC.js";
25
25
  import "./chunk-PXXZ6ABC.js";
package/js/openapi.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  protocolOperations,
10
10
  protocolRouter
11
- } from "./chunk-L4K2K22P.js";
11
+ } from "./chunk-S5QJEWH7.js";
12
12
  import {
13
13
  OpenapiCompileError,
14
14
  OpenapiCompileErrorCode,
@@ -19,6 +19,8 @@ import {
19
19
  OpenapiParameter,
20
20
  OpenapiRequestBody,
21
21
  OpenapiSkippedOperation,
22
+ OpenapiToolName,
23
+ OpenapiToolNames,
22
24
  OpenapiToolsOptions,
23
25
  defaultOpenapiResponseLimits,
24
26
  isOpenapiFileSchema,
@@ -27,7 +29,7 @@ import {
27
29
  isOpenapiTextMedia,
28
30
  openapiBinaryResultSchema,
29
31
  openapiMediaKind
30
- } from "./chunk-QEBRH5AP.js";
32
+ } from "./chunk-QNDZFQYQ.js";
31
33
  import {
32
34
  failOnNetworkRefusal
33
35
  } from "./chunk-7UUHJR2Q.js";
@@ -5349,7 +5351,10 @@ var parseYaml = (text) => {
5349
5351
  };
5350
5352
  var download = (url, context) => Effect_exports.gen(function* () {
5351
5353
  const response = yield* Effect_exports.tryPromise({
5352
- try: () => context.fetch(url, { signal: context.signal, redirect: "manual" }),
5354
+ try: () => context.fetch(url, {
5355
+ ...context.signal === void 0 ? {} : { signal: context.signal },
5356
+ redirect: "manual"
5357
+ }),
5353
5358
  catch: (error) => error
5354
5359
  });
5355
5360
  if (!response.ok || response.body === null) return yield* invalid();
@@ -5387,6 +5392,30 @@ var download = (url, context) => Effect_exports.gen(function* () {
5387
5392
  catch: invalid
5388
5393
  });
5389
5394
  });
5395
+ var sourceDocument = (options, context) => Effect_exports.gen(function* () {
5396
+ return patchOpenapi(
5397
+ "url" in options.source ? yield* download(options.source.url, context) : (
5398
+ // A copy the compilation can own, as a tree.
5399
+ Schema_exports.decodeUnknownSync(JsonObject)(JSON.parse(JSON.stringify(options.source.document)))
5400
+ ),
5401
+ options.patches
5402
+ );
5403
+ });
5404
+ var compileSource = (options, document) => compileOpenApiDocument(
5405
+ { name: "API", ..."url" in options.source ? { connectUrl: options.source.url } : {} },
5406
+ document,
5407
+ {
5408
+ allowedOrigin: options.allowedOrigin,
5409
+ securitySchemes: options.securitySchemes,
5410
+ ...options.fallbackSecurity === void 0 ? {} : { fallbackSecurity: options.fallbackSecurity },
5411
+ ...options.baseUrl === void 0 ? {} : { baseUrl: options.baseUrl },
5412
+ ...options.pathPrefix === void 0 ? {} : { pathPrefix: options.pathPrefix }
5413
+ }
5414
+ );
5415
+ var operationKind = (kinds, op) => {
5416
+ const key = op.operationId ?? op.name;
5417
+ return Object.hasOwn(kinds ?? {}, key) ? kinds?.[key] ?? "mutation" : isOpenapiReadMethod(op.method) ? "query" : "mutation";
5418
+ };
5390
5419
  var liveOpenapiRouter = (options) => {
5391
5420
  const freshFor = options.freshFor ?? "5 minutes";
5392
5421
  const staleFor = options.staleFor ?? "1 day";
@@ -5423,15 +5452,7 @@ var liveOpenapiRouter = (options) => {
5423
5452
  name
5424
5453
  ];
5425
5454
  const compile = (context) => Effect_exports.gen(function* () {
5426
- let document = patchOpenapi(
5427
- "url" in options.source ? yield* download(options.source.url, context) : (
5428
- // A copy the compilation can own, as a tree.
5429
- Schema_exports.decodeUnknownSync(JsonObject)(
5430
- JSON.parse(JSON.stringify(options.source.document))
5431
- )
5432
- ),
5433
- options.patches
5434
- );
5455
+ let document = yield* sourceDocument(options, context);
5435
5456
  yield* Effect_exports.promise(yieldToRuntime);
5436
5457
  const revision = yield* sha256Json([format, yield* sourceId, document]);
5437
5458
  const meta = documentMeta(document);
@@ -5441,17 +5462,7 @@ var liveOpenapiRouter = (options) => {
5441
5462
  if (owned2 === void 0) throw new Error("The document was already handed over.");
5442
5463
  return owned2;
5443
5464
  };
5444
- const compiled = yield* compileOpenApiDocument(
5445
- { name: "API", ..."url" in options.source ? { connectUrl: options.source.url } : {} },
5446
- handOver(),
5447
- {
5448
- allowedOrigin: options.allowedOrigin,
5449
- securitySchemes: options.securitySchemes,
5450
- ...options.fallbackSecurity === void 0 ? {} : { fallbackSecurity: options.fallbackSecurity },
5451
- ...options.baseUrl === void 0 ? {} : { baseUrl: options.baseUrl },
5452
- ...options.pathPrefix === void 0 ? {} : { pathPrefix: options.pathPrefix }
5453
- }
5454
- );
5465
+ const compiled = yield* compileSource(options, handOver());
5455
5466
  return { revision, meta, compiled };
5456
5467
  });
5457
5468
  const serialize = (context) => Effect_exports.gen(function* () {
@@ -5677,11 +5688,7 @@ var liveOpenapiRouter = (options) => {
5677
5688
  Object.keys(values ?? {}).sort()
5678
5689
  ])
5679
5690
  );
5680
- const kindOf = (op) => {
5681
- const key = op.operationId ?? op.name;
5682
- const kinds = options.kinds ?? {};
5683
- return Object.hasOwn(kinds, key) ? kinds[key] ?? "mutation" : isOpenapiReadMethod(op.method) ? "query" : "mutation";
5684
- };
5691
+ const kindOf = (op) => operationKind(options.kinds, op);
5685
5692
  const readOnly = (op) => kindOf(op) === "query";
5686
5693
  const summarize = (operation) => ({
5687
5694
  name: operation.name,
@@ -5769,6 +5776,40 @@ var liveOpenapiRouter = (options) => {
5769
5776
  )
5770
5777
  });
5771
5778
  };
5779
+ var openapiToolNames = (options) => Effect_exports.runPromise(
5780
+ Effect_exports.gen(function* () {
5781
+ const document = yield* sourceDocument(options, {
5782
+ fetch: options.fetch ?? globalThis.fetch,
5783
+ ...options.signal === void 0 ? {} : { signal: options.signal }
5784
+ });
5785
+ const compiled = yield* compileSource(options, document);
5786
+ const request = createRequest(options);
5787
+ const accounts = [
5788
+ ...Object.entries(options.methods).map(([method2, bindings]) => ({
5789
+ method: method2,
5790
+ fields: Object.fromEntries(bindings.map(({ field }) => [field, "placeholder"]))
5791
+ })),
5792
+ ...options.oauth.map((method2) => ({ method: method2, fields: { access_token: "placeholder" } }))
5793
+ ];
5794
+ const tools = compiled.operations.flatMap((op) => {
5795
+ const methods = accounts.filter((account) => request.available(op, account)).map((account) => account.method);
5796
+ const anonymous = request.available(op, void 0);
5797
+ return methods.length === 0 && !anonymous ? [] : [
5798
+ {
5799
+ name: op.name,
5800
+ method: op.method,
5801
+ path: op.path,
5802
+ ...op.operationId === void 0 ? {} : { operationId: op.operationId },
5803
+ kind: operationKind(options.kinds, op),
5804
+ public: anonymous,
5805
+ methods
5806
+ }
5807
+ ];
5808
+ });
5809
+ return { tools, skipped: compiled.skipped };
5810
+ }),
5811
+ options.signal === void 0 ? {} : { signal: options.signal }
5812
+ );
5772
5813
 
5773
5814
  // src/openapi.ts
5774
5815
  var openapiRouter = (options, kinds = {}) => Effect_exports.runPromise(
@@ -5783,11 +5824,14 @@ export {
5783
5824
  OpenapiParameter,
5784
5825
  OpenapiRequestBody,
5785
5826
  OpenapiSkippedOperation,
5827
+ OpenapiToolName,
5828
+ OpenapiToolNames,
5786
5829
  isOpenapiTextMedia,
5787
5830
  liveOpenapiRouter,
5788
5831
  openapiBinaryResultSchema,
5789
5832
  openapiMediaKind,
5790
- openapiRouter
5833
+ openapiRouter,
5834
+ openapiToolNames
5791
5835
  };
5792
5836
  /*! Bundled license information:
5793
5837
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.57",
3
+ "version": "0.0.1-beta.59",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,