apps 0.0.1-beta.82 → 0.0.1-beta.84

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.
@@ -2,7 +2,7 @@ import {
2
2
  declaredOperations,
3
3
  nativeOperation,
4
4
  nativeRouter
5
- } from "./chunk-OY47QPQY.js";
5
+ } from "./chunk-HNCCRVIT.js";
6
6
  import {
7
7
  fromPromise,
8
8
  method
@@ -3,7 +3,7 @@ import {
3
3
  answeredError,
4
4
  mcpClient,
5
5
  mcpJsonSchemaValidator
6
- } from "./chunk-YQUG4CES.js";
6
+ } from "./chunk-IGOYMUWZ.js";
7
7
  import {
8
8
  failOnNetworkRefusal
9
9
  } from "./chunk-I6Q7ZPKJ.js";
@@ -201,6 +201,43 @@ var withApprovals = (source, policy) => {
201
201
  };
202
202
  return routerDeclaration(walk(native, ""));
203
203
  };
204
+ var renameTools = (source, rename) => {
205
+ const native = nativeRouter(source);
206
+ if (native?.kind !== "dynamic") throw new Error("renameTools expects a protocol router");
207
+ const exposed = (tools) => {
208
+ const seen = /* @__PURE__ */ new Set();
209
+ return tools.flatMap((tool) => {
210
+ const name = rename(tool.name);
211
+ if (name === void 0 || seen.has(name)) return [];
212
+ seen.add(name);
213
+ return [{ ...tool, name, source: tool.name }];
214
+ });
215
+ };
216
+ const listed = native.summaries ?? native.list;
217
+ const original = (name) => listed().pipe(Effect_exports.map((tools) => exposed(tools).find((tool) => tool.name === name)?.source));
218
+ const strip = ({
219
+ source: _source,
220
+ ...tool
221
+ }) => tool;
222
+ return routerDeclaration({
223
+ ...native,
224
+ list: () => native.list().pipe(Effect_exports.map((tools) => exposed(tools).map(strip))),
225
+ ...native.summaries === void 0 ? {} : {
226
+ summaries: () => listed().pipe(Effect_exports.map((tools) => exposed(tools).map(strip)))
227
+ },
228
+ describe: (name) => original(name).pipe(
229
+ Effect_exports.flatMap(
230
+ (found) => found === void 0 ? Effect_exports.succeed(void 0) : native.describe?.(found) ?? native.list().pipe(Effect_exports.map((tools) => tools.find((tool) => tool.name === found)))
231
+ ),
232
+ Effect_exports.map((tool) => tool === void 0 ? void 0 : { ...tool, name })
233
+ ),
234
+ resolve: (name) => original(name).pipe(
235
+ Effect_exports.flatMap(
236
+ (found) => found === void 0 ? Effect_exports.succeed(void 0) : native.resolve(found)
237
+ )
238
+ )
239
+ });
240
+ };
204
241
 
205
242
  export {
206
243
  operationDeclaration,
@@ -217,5 +254,6 @@ export {
217
254
  joinPath,
218
255
  locate,
219
256
  declaredOperations,
220
- withApprovals
257
+ withApprovals,
258
+ renameTools
221
259
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-Z2SWTZCF.js";
3
+ } from "./chunk-OHBKJ54H.js";
4
4
  import {
5
5
  bodyUpstreamError,
6
6
  fromPromise
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  joinPath,
6
6
  mergeMeta
7
- } from "./chunk-OY47QPQY.js";
7
+ } from "./chunk-HNCCRVIT.js";
8
8
  import {
9
9
  isShortenedUpstream,
10
10
  parseProviderError,
@@ -12,7 +12,7 @@ import {
12
12
  parseSkillLoadFailed,
13
13
  readCatalog,
14
14
  routerSkills
15
- } from "./chunk-HJG4RBYM.js";
15
+ } from "./chunk-JKH7ALFN.js";
16
16
  import {
17
17
  appInvocationFetch
18
18
  } from "./chunk-I6Q7ZPKJ.js";
@@ -26,12 +26,12 @@ import {
26
26
  makeEmitter,
27
27
  toEffectApp,
28
28
  withPlacements
29
- } from "./chunk-5WGONRKQ.js";
29
+ } from "./chunk-AIXYBMMI.js";
30
30
  import {
31
31
  declaredOperations,
32
32
  locate,
33
33
  nativeOperation
34
- } from "./chunk-OY47QPQY.js";
34
+ } from "./chunk-HNCCRVIT.js";
35
35
  import {
36
36
  accountProviderError,
37
37
  appCode,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  fixedRouter
3
- } from "./chunk-HJG4RBYM.js";
3
+ } from "./chunk-JKH7ALFN.js";
4
4
  import {
5
5
  nativeOperation,
6
6
  operationDeclaration,
7
7
  routerDeclaration
8
- } from "./chunk-OY47QPQY.js";
8
+ } from "./chunk-HNCCRVIT.js";
9
9
 
10
10
  // src/implementation/protocol-operations.ts
11
11
  var protocolOperations = (operations, kinds = {}) => {
package/js/effect.js CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  ApprovalDecision,
4
4
  createAppHandler,
5
5
  prepareElicitation
6
- } from "./chunk-Z2SWTZCF.js";
6
+ } from "./chunk-OHBKJ54H.js";
7
7
  import "./chunk-PL5KOEZD.js";
8
- import "./chunk-HJG4RBYM.js";
8
+ import "./chunk-JKH7ALFN.js";
9
9
  import "./chunk-I6Q7ZPKJ.js";
10
10
  import "./chunk-XBG7HHXC.js";
11
- import "./chunk-5WGONRKQ.js";
12
- import "./chunk-OY47QPQY.js";
11
+ import "./chunk-AIXYBMMI.js";
12
+ import "./chunk-HNCCRVIT.js";
13
13
  import "./chunk-W6XCQAXP.js";
14
14
  import {
15
15
  ToolAnnotations
package/js/graphql.js CHANGED
@@ -4,22 +4,22 @@ import {
4
4
  } from "./chunk-TE25A7D6.js";
5
5
  import {
6
6
  protocolOperations
7
- } from "./chunk-4NFSABEA.js";
7
+ } from "./chunk-T2B6GUVY.js";
8
8
  import "./chunk-BCSNKUAC.js";
9
- import "./chunk-Z2SWTZCF.js";
9
+ import "./chunk-OHBKJ54H.js";
10
10
  import {
11
11
  cacheKey
12
12
  } from "./chunk-PL5KOEZD.js";
13
- import "./chunk-HJG4RBYM.js";
13
+ import "./chunk-JKH7ALFN.js";
14
14
  import {
15
15
  failOnNetworkRefusal
16
16
  } from "./chunk-I6Q7ZPKJ.js";
17
17
  import "./chunk-XBG7HHXC.js";
18
- import "./chunk-5WGONRKQ.js";
18
+ import "./chunk-AIXYBMMI.js";
19
19
  import {
20
20
  nativeOperation,
21
21
  routerDeclaration
22
- } from "./chunk-OY47QPQY.js";
22
+ } from "./chunk-HNCCRVIT.js";
23
23
  import {
24
24
  accountProviderError,
25
25
  graphqlProviderError,
package/js/host.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-Z2SWTZCF.js";
3
+ } from "./chunk-OHBKJ54H.js";
4
4
  import "./chunk-PL5KOEZD.js";
5
- import "./chunk-HJG4RBYM.js";
5
+ import "./chunk-JKH7ALFN.js";
6
6
  import "./chunk-I6Q7ZPKJ.js";
7
7
  import "./chunk-XBG7HHXC.js";
8
- import "./chunk-5WGONRKQ.js";
9
- import "./chunk-OY47QPQY.js";
8
+ import "./chunk-AIXYBMMI.js";
9
+ import "./chunk-HNCCRVIT.js";
10
10
  import "./chunk-W6XCQAXP.js";
11
11
  import {
12
12
  ElicitationFailed,
package/js/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  query,
12
12
  t,
13
13
  workflow
14
- } from "./chunk-5WGONRKQ.js";
14
+ } from "./chunk-AIXYBMMI.js";
15
15
  import {
16
16
  dynamicRouter,
17
17
  mutation,
@@ -19,12 +19,13 @@ import {
19
19
  nativeRouter,
20
20
  operationDeclaration,
21
21
  query as query2,
22
+ renameTools,
22
23
  router,
23
24
  routerDeclaration,
24
25
  toolAnnotations,
25
26
  withApproval,
26
27
  withApprovals
27
- } from "./chunk-OY47QPQY.js";
28
+ } from "./chunk-HNCCRVIT.js";
28
29
  import {
29
30
  accountProviderError,
30
31
  fromPromise
@@ -502,6 +503,7 @@ export {
502
503
  query3 as query,
503
504
  raw,
504
505
  record,
506
+ renameTools,
505
507
  router,
506
508
  secrets2 as secrets,
507
509
  string,
package/js/mcp/effect.js CHANGED
@@ -2,16 +2,16 @@ import {
2
2
  mcpClientEffect,
3
3
  mcpHealthEffect,
4
4
  mcpToolsEffect
5
- } from "../chunk-WCGAO3X5.js";
6
- import "../chunk-YQUG4CES.js";
5
+ } from "../chunk-BX2S3T2R.js";
6
+ import "../chunk-IGOYMUWZ.js";
7
7
  import "../chunk-BCSNKUAC.js";
8
- import "../chunk-Z2SWTZCF.js";
8
+ import "../chunk-OHBKJ54H.js";
9
9
  import "../chunk-PL5KOEZD.js";
10
- import "../chunk-HJG4RBYM.js";
10
+ import "../chunk-JKH7ALFN.js";
11
11
  import "../chunk-I6Q7ZPKJ.js";
12
12
  import "../chunk-XBG7HHXC.js";
13
- import "../chunk-5WGONRKQ.js";
14
- import "../chunk-OY47QPQY.js";
13
+ import "../chunk-AIXYBMMI.js";
14
+ import "../chunk-HNCCRVIT.js";
15
15
  import "../chunk-W6XCQAXP.js";
16
16
  import "../chunk-NG56RPCA.js";
17
17
  import "../chunk-Q4IZAUIF.js";
package/js/mcp/stdio.js CHANGED
@@ -3,18 +3,18 @@ import {
3
3
  answeredError,
4
4
  mcpClient,
5
5
  mcpJsonSchemaValidator
6
- } from "../chunk-YQUG4CES.js";
6
+ } from "../chunk-IGOYMUWZ.js";
7
7
  import {
8
8
  protocolRouter
9
- } from "../chunk-4NFSABEA.js";
9
+ } from "../chunk-T2B6GUVY.js";
10
10
  import "../chunk-BCSNKUAC.js";
11
- import "../chunk-Z2SWTZCF.js";
11
+ import "../chunk-OHBKJ54H.js";
12
12
  import "../chunk-PL5KOEZD.js";
13
- import "../chunk-HJG4RBYM.js";
13
+ import "../chunk-JKH7ALFN.js";
14
14
  import "../chunk-I6Q7ZPKJ.js";
15
15
  import "../chunk-XBG7HHXC.js";
16
- import "../chunk-5WGONRKQ.js";
17
- import "../chunk-OY47QPQY.js";
16
+ import "../chunk-AIXYBMMI.js";
17
+ import "../chunk-HNCCRVIT.js";
18
18
  import "../chunk-W6XCQAXP.js";
19
19
  import {
20
20
  McpError,
package/js/mcp.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  mcpClientEffect,
3
3
  mcpHealthEffect
4
- } from "./chunk-WCGAO3X5.js";
4
+ } from "./chunk-BX2S3T2R.js";
5
5
  import {
6
6
  catalogCache,
7
7
  catalogScope
8
8
  } from "./chunk-TE25A7D6.js";
9
9
  import {
10
10
  adaptMcpTool
11
- } from "./chunk-YQUG4CES.js";
11
+ } from "./chunk-IGOYMUWZ.js";
12
12
  import {
13
13
  protocolOperations
14
- } from "./chunk-4NFSABEA.js";
14
+ } from "./chunk-T2B6GUVY.js";
15
15
  import "./chunk-BCSNKUAC.js";
16
- import "./chunk-Z2SWTZCF.js";
16
+ import "./chunk-OHBKJ54H.js";
17
17
  import {
18
18
  cacheKey
19
19
  } from "./chunk-PL5KOEZD.js";
20
20
  import {
21
21
  operationDescription
22
- } from "./chunk-HJG4RBYM.js";
22
+ } from "./chunk-JKH7ALFN.js";
23
23
  import "./chunk-I6Q7ZPKJ.js";
24
24
  import "./chunk-XBG7HHXC.js";
25
- import "./chunk-5WGONRKQ.js";
25
+ import "./chunk-AIXYBMMI.js";
26
26
  import {
27
27
  nativeOperation,
28
28
  routerDeclaration
29
- } from "./chunk-OY47QPQY.js";
29
+ } from "./chunk-HNCCRVIT.js";
30
30
  import {
31
31
  fromPromise,
32
32
  method
package/js/openapi.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  protocolOperations,
10
10
  protocolRouter
11
- } from "./chunk-4NFSABEA.js";
11
+ } from "./chunk-T2B6GUVY.js";
12
12
  import {
13
13
  OpenapiCompileError,
14
14
  OpenapiCompileErrorCode,
@@ -29,7 +29,7 @@ import {
29
29
  isOpenapiTextMedia,
30
30
  openapiBinaryResultSchema,
31
31
  openapiMediaKind
32
- } from "./chunk-HJG4RBYM.js";
32
+ } from "./chunk-JKH7ALFN.js";
33
33
  import {
34
34
  failOnNetworkRefusal
35
35
  } from "./chunk-I6Q7ZPKJ.js";
@@ -37,7 +37,7 @@ import "./chunk-XBG7HHXC.js";
37
37
  import {
38
38
  nativeOperation,
39
39
  routerDeclaration
40
- } from "./chunk-OY47QPQY.js";
40
+ } from "./chunk-HNCCRVIT.js";
41
41
  import {
42
42
  accountProviderError,
43
43
  bodyUpstreamError,
@@ -583,6 +583,83 @@ var openapiToolsEffect = (options, prepared) => Effect_exports.gen(function* ()
583
583
  return Object.fromEntries(entries);
584
584
  });
585
585
 
586
+ // src/implementation/openapi-names.ts
587
+ var words = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, "$1 $2").replace(/[^a-zA-Z0-9]+/g, " ").trim().split(/\s+/).filter((word) => word.length > 0).map((word) => word.toLowerCase());
588
+ var camel = (value) => {
589
+ const [first, ...rest] = words(value);
590
+ return first === void 0 ? "" : `${first}${rest.map((word) => `${word[0]?.toUpperCase() ?? ""}${word.slice(1)}`).join("")}`;
591
+ };
592
+ var pascal = (value) => {
593
+ const name = camel(value);
594
+ return `${name[0]?.toUpperCase() ?? ""}${name.slice(1)}`;
595
+ };
596
+ var version = /^v\d+(?:[._-]\d+)?$/i;
597
+ var segments = (path) => path.split("/").map((segment) => segment.trim()).filter((segment) => segment.length > 0);
598
+ var resourceSegments = (path) => segments(path).filter(
599
+ (segment) => !version.test(segment) && segment.toLowerCase() !== "api" && !(segment.startsWith("{") && segment.endsWith("}")) && camel(segment) !== ""
600
+ );
601
+ var groupOf = (input) => camel(input.tag ?? "") || camel(resourceSegments(input.path)[0] ?? "") || // Keep "root" for an operation on `/` or a path of only versions and parameters.
602
+ "root";
603
+ var fallbackLeaf = (input, group) => {
604
+ const resources = resourceSegments(input.path).map(camel);
605
+ const others = resources.filter((segment) => segment !== group);
606
+ const suffix = (others.length ? others : resources).map(pascal).join("");
607
+ return camel(`${input.method.toLowerCase()}${suffix || "Operation"}`);
608
+ };
609
+ var leafOf = (input, group) => {
610
+ if (input.operationId === void 0) return fallbackLeaf(input, group);
611
+ const [first, ...rest] = input.operationId.split(/[._/]+/).filter((part) => part.length > 0);
612
+ const seed = first !== void 0 && rest.length > 0 && camel(first).toLowerCase() === group.toLowerCase() ? rest.join(" ") : input.operationId;
613
+ const leaf = camel(seed);
614
+ return leaf === "" || leaf === group ? fallbackLeaf(input, group) : leaf;
615
+ };
616
+ var pathTokens = (path) => segments(path).flatMap((segment) => {
617
+ if (version.test(segment) || segment.toLowerCase() === "api") return [];
618
+ const parameter = segment.startsWith("{") && segment.endsWith("}");
619
+ const word = camel(parameter ? segment.slice(1, -1) : segment);
620
+ return word === "" ? [] : [{ key: `${parameter ? "{" : ""}${word}`, word, parameter }];
621
+ });
622
+ var describePath = (tokens) => tokens.map(
623
+ (token, index) => token.parameter ? `${tokens[index - 1]?.parameter === true ? "And" : "By"}${pascal(token.word)}` : pascal(token.word)
624
+ ).join("");
625
+ var hash = (input) => {
626
+ const text = JSON.stringify([input.method.toUpperCase(), input.path, input.operationId ?? null]);
627
+ let value = 0;
628
+ for (let i = 0; i < text.length; i++) value = (value << 5) - value + text.charCodeAt(i) | 0;
629
+ return Math.abs(value).toString(36).padStart(8, "0").slice(0, 8);
630
+ };
631
+ var planOperationNames = (inputs) => {
632
+ const staged = inputs.map((input) => {
633
+ const group = groupOf(input);
634
+ const leaf = leafOf(input, group);
635
+ const versionSegment = segments(input.path).map((segment) => segment.toLowerCase()).find((segment) => version.test(segment));
636
+ const prefix = versionSegment === void 0 ? group : `${group}.${camel(versionSegment)}`;
637
+ const tokens = pathTokens(input.path);
638
+ return { input, group, leaf, prefix, versionSegment, tokens, name: `${group}.${leaf}` };
639
+ });
640
+ const refine = (rename) => {
641
+ const buckets = /* @__PURE__ */ new Map();
642
+ for (const item of staged) buckets.set(item.name, [...buckets.get(item.name) ?? [], item]);
643
+ for (const bucket of buckets.values())
644
+ if (bucket.length > 1) {
645
+ const names = bucket.map((item) => rename(item, bucket));
646
+ for (const [index, item] of bucket.entries()) item.name = names[index] ?? item.name;
647
+ }
648
+ };
649
+ refine((item) => item.versionSegment === void 0 ? item.name : `${item.prefix}.${item.leaf}`);
650
+ refine((item, bucket) => {
651
+ const shared = new Set(
652
+ item.tokens.map((token) => token.key).filter((key) => bucket.every((other) => other.tokens.some((token) => token.key === key)))
653
+ );
654
+ const distinct = item.tokens.filter((token) => !shared.has(token.key));
655
+ return distinct.length === 0 ? item.name : `${item.prefix}.${item.leaf}${describePath(distinct)}`;
656
+ });
657
+ refine((item) => `${item.prefix}.${item.leaf}${describePath(item.tokens)}`);
658
+ refine((item) => `${item.prefix}.${item.leaf}${pascal(item.input.method)}`);
659
+ refine((item) => `${item.prefix}.${item.leaf}${pascal(item.input.method)}${hash(item.input)}`);
660
+ return staged.map((item) => ({ ...item.input, name: item.name }));
661
+ };
662
+
586
663
  // ../../node_modules/.bun/js-yaml@5.4.2/node_modules/js-yaml/dist/js-yaml.mjs
587
664
  var NOT_RESOLVED = /* @__PURE__ */ Symbol("NOT_RESOLVED");
588
665
  function defineScalarTag(tagName, options) {
@@ -4319,83 +4396,6 @@ async function openApiDocument(input) {
4319
4396
  };
4320
4397
  }
4321
4398
 
4322
- // src/implementation/openapi-names.ts
4323
- var words = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, "$1 $2").replace(/[^a-zA-Z0-9]+/g, " ").trim().split(/\s+/).filter((word) => word.length > 0).map((word) => word.toLowerCase());
4324
- var camel = (value) => {
4325
- const [first, ...rest] = words(value);
4326
- return first === void 0 ? "" : `${first}${rest.map((word) => `${word[0]?.toUpperCase() ?? ""}${word.slice(1)}`).join("")}`;
4327
- };
4328
- var pascal = (value) => {
4329
- const name = camel(value);
4330
- return `${name[0]?.toUpperCase() ?? ""}${name.slice(1)}`;
4331
- };
4332
- var version = /^v\d+(?:[._-]\d+)?$/i;
4333
- var segments = (path) => path.split("/").map((segment) => segment.trim()).filter((segment) => segment.length > 0);
4334
- var resourceSegments = (path) => segments(path).filter(
4335
- (segment) => !version.test(segment) && segment.toLowerCase() !== "api" && !(segment.startsWith("{") && segment.endsWith("}")) && camel(segment) !== ""
4336
- );
4337
- var groupOf = (input) => camel(input.tag ?? "") || camel(resourceSegments(input.path)[0] ?? "") || // Keep "root" for an operation on `/` or a path of only versions and parameters.
4338
- "root";
4339
- var fallbackLeaf = (input, group) => {
4340
- const resources = resourceSegments(input.path).map(camel);
4341
- const others = resources.filter((segment) => segment !== group);
4342
- const suffix = (others.length ? others : resources).map(pascal).join("");
4343
- return camel(`${input.method.toLowerCase()}${suffix || "Operation"}`);
4344
- };
4345
- var leafOf = (input, group) => {
4346
- if (input.operationId === void 0) return fallbackLeaf(input, group);
4347
- const [first, ...rest] = input.operationId.split(/[._/]+/).filter((part) => part.length > 0);
4348
- const seed = first !== void 0 && rest.length > 0 && camel(first).toLowerCase() === group.toLowerCase() ? rest.join(" ") : input.operationId;
4349
- const leaf = camel(seed);
4350
- return leaf === "" || leaf === group ? fallbackLeaf(input, group) : leaf;
4351
- };
4352
- var pathTokens = (path) => segments(path).flatMap((segment) => {
4353
- if (version.test(segment) || segment.toLowerCase() === "api") return [];
4354
- const parameter = segment.startsWith("{") && segment.endsWith("}");
4355
- const word = camel(parameter ? segment.slice(1, -1) : segment);
4356
- return word === "" ? [] : [{ key: `${parameter ? "{" : ""}${word}`, word, parameter }];
4357
- });
4358
- var describePath = (tokens) => tokens.map(
4359
- (token, index) => token.parameter ? `${tokens[index - 1]?.parameter === true ? "And" : "By"}${pascal(token.word)}` : pascal(token.word)
4360
- ).join("");
4361
- var hash = (input) => {
4362
- const text = JSON.stringify([input.method.toUpperCase(), input.path, input.operationId ?? null]);
4363
- let value = 0;
4364
- for (let i = 0; i < text.length; i++) value = (value << 5) - value + text.charCodeAt(i) | 0;
4365
- return Math.abs(value).toString(36).padStart(8, "0").slice(0, 8);
4366
- };
4367
- var planOperationNames = (inputs) => {
4368
- const staged = inputs.map((input) => {
4369
- const group = groupOf(input);
4370
- const leaf = leafOf(input, group);
4371
- const versionSegment = segments(input.path).map((segment) => segment.toLowerCase()).find((segment) => version.test(segment));
4372
- const prefix = versionSegment === void 0 ? group : `${group}.${camel(versionSegment)}`;
4373
- const tokens = pathTokens(input.path);
4374
- return { input, group, leaf, prefix, versionSegment, tokens, name: `${group}.${leaf}` };
4375
- });
4376
- const refine = (rename) => {
4377
- const buckets = /* @__PURE__ */ new Map();
4378
- for (const item of staged) buckets.set(item.name, [...buckets.get(item.name) ?? [], item]);
4379
- for (const bucket of buckets.values())
4380
- if (bucket.length > 1) {
4381
- const names = bucket.map((item) => rename(item, bucket));
4382
- for (const [index, item] of bucket.entries()) item.name = names[index] ?? item.name;
4383
- }
4384
- };
4385
- refine((item) => item.versionSegment === void 0 ? item.name : `${item.prefix}.${item.leaf}`);
4386
- refine((item, bucket) => {
4387
- const shared = new Set(
4388
- item.tokens.map((token) => token.key).filter((key) => bucket.every((other) => other.tokens.some((token) => token.key === key)))
4389
- );
4390
- const distinct = item.tokens.filter((token) => !shared.has(token.key));
4391
- return distinct.length === 0 ? item.name : `${item.prefix}.${item.leaf}${describePath(distinct)}`;
4392
- });
4393
- refine((item) => `${item.prefix}.${item.leaf}${describePath(item.tokens)}`);
4394
- refine((item) => `${item.prefix}.${item.leaf}${pascal(item.input.method)}`);
4395
- refine((item) => `${item.prefix}.${item.leaf}${pascal(item.input.method)}${hash(item.input)}`);
4396
- return staged.map((item) => ({ ...item.input, name: item.name }));
4397
- };
4398
-
4399
4399
  // src/implementation/openapi-compile.ts
4400
4400
  function fail2(code, reason) {
4401
4401
  throw new OpenapiCompileError({ code, reason });
@@ -5004,19 +5004,21 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
5004
5004
  } catch (error) {
5005
5005
  if (!(error instanceof OpenapiCompileError)) throw error;
5006
5006
  }
5007
- let pinnedOrigin = options.allowedOrigin;
5008
- for (const [origin, count] of options.allowedOrigin === void 0 ? counts : []) {
5009
- const best = pinnedOrigin === void 0 ? 0 : counts.get(pinnedOrigin) ?? 0;
5010
- if (count > best || count === best && origin === documentOrigin) pinnedOrigin = origin;
5007
+ const allowed = options.allowedOrigin === void 0 ? void 0 : typeof options.allowedOrigin === "string" ? [options.allowedOrigin] : options.allowedOrigin;
5008
+ let mostUsed;
5009
+ for (const [origin, count] of allowed === void 0 ? counts : []) {
5010
+ const best = mostUsed === void 0 ? 0 : counts.get(mostUsed) ?? 0;
5011
+ if (count > best || count === best && origin === documentOrigin) mostUsed = origin;
5011
5012
  }
5013
+ const pinnedOrigins = new Set(allowed ?? (mostUsed === void 0 ? [] : [mostUsed]));
5012
5014
  const imported = [];
5013
5015
  for (const { operation, methods: operationMethods, declared } of built) {
5014
5016
  const origin = new URL(operation.baseUrl).origin;
5015
- if (origin !== pinnedOrigin) {
5017
+ if (!pinnedOrigins.has(origin)) {
5016
5018
  skipped.push({
5017
5019
  ...declared,
5018
5020
  code: "multiple_hosts",
5019
- reason: options.allowedOrigin === void 0 ? `Its server origin ${origin} differs from ${pinnedOrigin ?? "the origin"} most operations use.` : `Its server origin ${origin} is not allowedOrigin ${options.allowedOrigin}.`
5021
+ reason: allowed === void 0 ? `Its server origin ${origin} differs from ${mostUsed ?? "the origin"} most operations use.` : `Its server origin ${origin} is not allowedOrigin ${allowed.join(", ")}.`
5020
5022
  });
5021
5023
  continue;
5022
5024
  }
@@ -5026,10 +5028,10 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
5026
5028
  const operations = imported.map(({ operation }) => operation);
5027
5029
  if (!operations.length) {
5028
5030
  const left = inDefinitionOrder(skipped);
5029
- if (options.allowedOrigin !== void 0 && built.length > 0)
5031
+ if (allowed !== void 0 && built.length > 0)
5030
5032
  throw new OpenapiCompileError({
5031
5033
  code: "no_supported_operations",
5032
- reason: `allowedOrigin ${options.allowedOrigin} is not the origin of any operation. They resolve to ${[...counts.keys()].join(", ")}. Set allowedOrigin to the origin that receives the account's credentials, or set baseUrl.`,
5034
+ reason: `allowedOrigin ${allowed.join(", ")} is not the origin of any operation. They resolve to ${[...counts.keys()].join(", ")}. Set allowedOrigin to the origin that receives the account's credentials, or set baseUrl.`,
5033
5035
  skipped: left,
5034
5036
  origins: [...counts.keys()]
5035
5037
  });
@@ -5094,7 +5096,7 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
5094
5096
  secrets: [...methods.values()],
5095
5097
  oauth,
5096
5098
  schemes,
5097
- pinnedOrigin,
5099
+ pinnedOrigins: [...pinnedOrigins],
5098
5100
  fallback
5099
5101
  };
5100
5102
  },
@@ -5849,7 +5851,8 @@ export {
5849
5851
  openapiBinaryResultSchema,
5850
5852
  openapiMediaKind,
5851
5853
  openapiRouter,
5852
- openapiToolNames
5854
+ openapiToolNames,
5855
+ planOperationNames
5853
5856
  };
5854
5857
  /*! Bundled license information:
5855
5858
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.82",
3
+ "version": "0.0.1-beta.84",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,