apps 0.0.1-beta.94 → 0.0.1-beta.99

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.
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  fromPromise
3
- } from "./chunk-MN5XVRKW.js";
3
+ } from "./chunk-7STIP5CS.js";
4
4
  import {
5
5
  HostedTool,
6
6
  RouterKey,
7
7
  RouterMeta,
8
8
  reservedRouterKeys
9
- } from "./chunk-6WC2OWHV.js";
9
+ } from "./chunk-4UPC36ZL.js";
10
10
  import {
11
11
  decoderOf,
12
12
  schemaArgument
13
- } from "./chunk-RKFLB36H.js";
13
+ } from "./chunk-VAI3EVCS.js";
14
14
  import {
15
15
  Effect_exports,
16
16
  Schema_exports
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  fixedRouter
3
- } from "./chunk-DYE2CKHG.js";
3
+ } from "./chunk-QI66R4FP.js";
4
4
  import {
5
5
  nativeOperation,
6
6
  operationDeclaration,
7
7
  routerDeclaration
8
- } from "./chunk-6F3WAXVN.js";
8
+ } from "./chunk-2CURR5Y7.js";
9
9
 
10
10
  // src/implementation/protocol-operations.ts
11
11
  var protocolOperations = (operations, kinds = {}) => {
@@ -4474,7 +4474,12 @@ var DeclaredRequirements8 = Schema_exports.Struct({
4474
4474
  /** Accepts skills sources and reports whether the catalog includes a live loader. */
4475
4475
  skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
4476
4476
  /** Accepts scheduled inspection. Earlier builds reject it as an excess field. */
4477
- scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
4477
+ scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true)),
4478
+ /**
4479
+ * Accepts inspect definitions and answers it with a shared catalog. Earlier builds reject it
4480
+ * as an excess field.
4481
+ */
4482
+ sharedDefinitions: Schema_exports.optionalKey(Schema_exports.Literal(true))
4478
4483
  })
4479
4484
  ),
4480
4485
  /**
@@ -4567,6 +4572,18 @@ var HostedCatalogSummary4 = Schema_exports.Struct({
4567
4572
  tools: Schema_exports.Array(HostedToolSummary3),
4568
4573
  routers: Schema_exports.Array(HostedRouter4)
4569
4574
  });
4575
+ var SharedSchemaKey = Schema_exports.Literals(["inputSchema", "outputSchema"]);
4576
+ var HostedSharedTool = Schema_exports.Struct({
4577
+ ...HostedTool3.fields,
4578
+ shared: Schema_exports.optionalKey(Schema_exports.Array(SharedSchemaKey))
4579
+ });
4580
+ var HostedSharedCatalog = Schema_exports.Struct({
4581
+ tools: Schema_exports.Array(HostedSharedTool),
4582
+ routers: Schema_exports.Array(HostedRouter4),
4583
+ definitions: Schema_exports.Array(JsonValue),
4584
+ /** Each distinct `$defs`, its entries naming positions in `definitions`. */
4585
+ defs: Schema_exports.Array(Schema_exports.Record(Schema_exports.String, Schema_exports.Int))
4586
+ });
4570
4587
  var SkillSources3 = Schema_exports.Struct({
4571
4588
  skills: AppSkills,
4572
4589
  dynamic: Schema_exports.Boolean,
@@ -4596,7 +4613,12 @@ var HostRequest5 = Schema_exports.Union([
4596
4613
  * Describe only declared operations that have schedules, without dynamic tool discovery.
4597
4614
  * Only builds that declare the scheduledTools capability accept this.
4598
4615
  */
4599
- scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
4616
+ scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true)),
4617
+ /**
4618
+ * Answer with a HostedSharedCatalog, each shared `$defs` entry sent once. Only builds that
4619
+ * declare the sharedDefinitions capability accept this.
4620
+ */
4621
+ definitions: Schema_exports.optionalKey(Schema_exports.Literal("shared"))
4600
4622
  }),
4601
4623
  Schema_exports.Struct({
4602
4624
  operation: Schema_exports.Literal("skills"),
@@ -4732,6 +4754,7 @@ var current = {
4732
4754
  requirements: DeclaredRequirements8,
4733
4755
  catalog: HostedCatalog4,
4734
4756
  catalogSummary: HostedCatalogSummary4,
4757
+ sharedCatalog: HostedSharedCatalog,
4735
4758
  skills: SkillCatalogResponse3,
4736
4759
  elicitationRequest: FormElicitation,
4737
4760
  elicitationReply: ElicitationReply,
@@ -4746,6 +4769,110 @@ var current = {
4746
4769
  }
4747
4770
  };
4748
4771
 
4772
+ // ../utils/src/schema-definitions.ts
4773
+ var putEntry = (target, name, value) => {
4774
+ if (name === "__proto__")
4775
+ Object.defineProperty(target, name, {
4776
+ value,
4777
+ enumerable: true,
4778
+ writable: true,
4779
+ configurable: true
4780
+ });
4781
+ else target[name] = value;
4782
+ };
4783
+ var isEntries = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4784
+ var schemaDefinitions = (schema2) => {
4785
+ const definitions = schema2?.$defs;
4786
+ return isEntries(definitions) ? definitions : void 0;
4787
+ };
4788
+
4789
+ // src/contracts/shared-catalog.ts
4790
+ var shareCatalog = (catalog) => {
4791
+ const definitions = [];
4792
+ const positions = /* @__PURE__ */ new Map();
4793
+ const position = (definition) => {
4794
+ let at = positions.get(definition);
4795
+ if (at === void 0) positions.set(definition, at = definitions.push(definition) - 1);
4796
+ return at;
4797
+ };
4798
+ const defs = [];
4799
+ const entries = /* @__PURE__ */ new Map();
4800
+ let entryCount = 0;
4801
+ const entry = (name, at) => {
4802
+ let named = entries.get(name);
4803
+ if (named === void 0) entries.set(name, named = /* @__PURE__ */ new Map());
4804
+ let number = named.get(at);
4805
+ if (number === void 0) named.set(at, number = entryCount++);
4806
+ return number;
4807
+ };
4808
+ const byObject = /* @__PURE__ */ new Map();
4809
+ const byEntries = /* @__PURE__ */ new Map();
4810
+ const defsOf = (own) => {
4811
+ const known = byObject.get(own);
4812
+ if (known !== void 0) return known;
4813
+ const named = {};
4814
+ const key = [];
4815
+ for (const [name, definition] of Object.entries(own)) {
4816
+ const at2 = position(definition);
4817
+ putEntry(named, name, at2);
4818
+ key.push(entry(name, at2));
4819
+ }
4820
+ const text = key.join(",");
4821
+ let at = byEntries.get(text);
4822
+ if (at === void 0) byEntries.set(text, at = defs.push(named) - 1);
4823
+ byObject.set(own, at);
4824
+ return at;
4825
+ };
4826
+ const share = (schema2) => {
4827
+ const own = schemaDefinitions(schema2);
4828
+ return schema2 === void 0 || own === void 0 ? void 0 : { ...schema2, $defs: defsOf(own) };
4829
+ };
4830
+ const tools = catalog.tools.map((tool) => {
4831
+ const input = share(tool.inputSchema);
4832
+ const output = share(tool.outputSchema);
4833
+ if (input === void 0 && output === void 0) return tool;
4834
+ return {
4835
+ ...tool,
4836
+ ...input === void 0 ? {} : { inputSchema: input },
4837
+ ...output === void 0 ? {} : { outputSchema: output },
4838
+ shared: [
4839
+ ...input === void 0 ? [] : ["inputSchema"],
4840
+ ...output === void 0 ? [] : ["outputSchema"]
4841
+ ]
4842
+ };
4843
+ });
4844
+ return { tools, routers: catalog.routers, definitions, defs };
4845
+ };
4846
+ var restoreSharedCatalog = (catalog) => {
4847
+ const { definitions } = catalog;
4848
+ const defs = [];
4849
+ for (const named of catalog.defs) {
4850
+ const restored = {};
4851
+ for (const [name, at] of Object.entries(named)) {
4852
+ const definition = definitions[at];
4853
+ if (definition === void 0) return void 0;
4854
+ putEntry(restored, name, definition);
4855
+ }
4856
+ defs.push(restored);
4857
+ }
4858
+ const restore = (schema2) => {
4859
+ const at = schema2?.$defs;
4860
+ const found = typeof at === "number" ? defs[at] : void 0;
4861
+ return schema2 === void 0 || found === void 0 ? void 0 : { ...schema2, $defs: found };
4862
+ };
4863
+ const tools = [];
4864
+ for (const { shared, ...tool } of catalog.tools) {
4865
+ let restored = tool;
4866
+ for (const key of shared ?? []) {
4867
+ const schema2 = restore(restored[key]);
4868
+ if (schema2 === void 0) return void 0;
4869
+ restored = key === "inputSchema" ? { ...restored, inputSchema: schema2 } : { ...restored, outputSchema: schema2 };
4870
+ }
4871
+ tools.push(restored);
4872
+ }
4873
+ return { tools, routers: catalog.routers };
4874
+ };
4875
+
4749
4876
  // src/contracts/host.ts
4750
4877
  var HostAccount = Schema_exports.Struct({
4751
4878
  ...ResolvedAccount5.fields,
@@ -4765,10 +4892,11 @@ var scopedSlots = (accounts) => [
4765
4892
  ];
4766
4893
  var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
4767
4894
  var skillCatalog = (response) => Schema_exports.is(SkillSources3)(response) ? response : { skills: response };
4768
- var inspectCommand = (tools, scheduled) => ({
4895
+ var inspectCommand = (options) => ({
4769
4896
  operation: "inspect",
4770
- ...tools === void 0 ? {} : { tools: [...tools] },
4771
- ...scheduled === void 0 ? {} : { scheduled }
4897
+ ...options.tools === void 0 ? {} : { tools: [...options.tools] },
4898
+ ...options.scheduled === void 0 ? {} : { scheduled: options.scheduled },
4899
+ ...options.definitions === void 0 ? {} : { definitions: options.definitions }
4772
4900
  });
4773
4901
  var indexCommand = { operation: "inspect", detail: "summary" };
4774
4902
  var selectTools = (tools) => (catalog) => tools === void 0 ? catalog : { ...catalog, tools: catalog.tools.filter((tool) => tools.includes(tool.name)) };
@@ -5009,6 +5137,9 @@ export {
5009
5137
  HostedRouter4 as HostedRouter,
5010
5138
  HostedCatalog4 as HostedCatalog,
5011
5139
  HostedCatalogSummary4 as HostedCatalogSummary,
5140
+ SharedSchemaKey,
5141
+ HostedSharedTool,
5142
+ HostedSharedCatalog,
5012
5143
  SkillSources3 as SkillSources,
5013
5144
  SkillCatalogResponse3 as SkillCatalogResponse,
5014
5145
  AccountCheckCommand2 as AccountCheckCommand,
@@ -5032,6 +5163,8 @@ export {
5032
5163
  HostResponse7 as HostResponse,
5033
5164
  HostInvocation8 as HostInvocation,
5034
5165
  current,
5166
+ shareCatalog,
5167
+ restoreSharedCatalog,
5035
5168
  HostAccount,
5036
5169
  HostAccountSlots,
5037
5170
  HostAccounts,
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  appInvocationFetch
3
- } from "./chunk-2GPX2E57.js";
3
+ } from "./chunk-VCYWAA4N.js";
4
4
  import {
5
5
  fromPromise,
6
6
  method,
7
7
  toPromise
8
- } from "./chunk-MN5XVRKW.js";
8
+ } from "./chunk-7STIP5CS.js";
9
9
  import {
10
10
  CacheAcquired,
11
11
  CacheEntry,
12
12
  CacheError,
13
13
  cacheLimits,
14
14
  scopedSlots
15
- } from "./chunk-6WC2OWHV.js";
15
+ } from "./chunk-4UPC36ZL.js";
16
16
  import {
17
17
  decoderOf
18
- } from "./chunk-RKFLB36H.js";
18
+ } from "./chunk-VAI3EVCS.js";
19
19
  import {
20
20
  captureTelemetry,
21
21
  owned,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ProviderError,
3
3
  maxUpstreamMessageLength
4
- } from "./chunk-6WC2OWHV.js";
4
+ } from "./chunk-4UPC36ZL.js";
5
5
  import {
6
6
  owned
7
7
  } from "./chunk-URKOTNDA.js";
@@ -2,11 +2,11 @@ import {
2
2
  declaredOperations,
3
3
  nativeOperation,
4
4
  nativeRouter
5
- } from "./chunk-6F3WAXVN.js";
5
+ } from "./chunk-2CURR5Y7.js";
6
6
  import {
7
7
  fromPromise,
8
8
  method
9
- } from "./chunk-MN5XVRKW.js";
9
+ } from "./chunk-7STIP5CS.js";
10
10
  import {
11
11
  EmittedEvent,
12
12
  EventName,
@@ -17,13 +17,13 @@ import {
17
17
  normalizePlacements,
18
18
  placementFields,
19
19
  renderPlacement
20
- } from "./chunk-6WC2OWHV.js";
20
+ } from "./chunk-4UPC36ZL.js";
21
21
  import {
22
22
  decoderOf,
23
23
  isSchema,
24
24
  jsonSchemaDocument,
25
25
  schemaArgument
26
- } from "./chunk-RKFLB36H.js";
26
+ } from "./chunk-VAI3EVCS.js";
27
27
  import {
28
28
  JsonValue
29
29
  } from "./chunk-7HG422GB.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-FA5MLNYL.js";
3
+ } from "./chunk-RN4YB4JT.js";
4
4
  import {
5
5
  failOnNetworkRefusal
6
- } from "./chunk-2GPX2E57.js";
6
+ } from "./chunk-VCYWAA4N.js";
7
7
  import {
8
8
  accountProviderError,
9
9
  bodyUpstreamError,
10
10
  fromPromise,
11
11
  httpProviderError,
12
12
  providerErrorDetail
13
- } from "./chunk-MN5XVRKW.js";
13
+ } from "./chunk-7STIP5CS.js";
14
14
  import {
15
15
  ElicitationFailed,
16
16
  McpCredentialsUnverified,
@@ -28,12 +28,12 @@ import {
28
28
  defaultMcpClientLimits,
29
29
  mcpHealthReserveMs,
30
30
  mcpSdkTimerCeilingMs
31
- } from "./chunk-6WC2OWHV.js";
31
+ } from "./chunk-4UPC36ZL.js";
32
32
  import {
33
33
  jsonSchemaDecoder,
34
34
  nestJsonSchema,
35
35
  preparedJsonSchemaDecoder
36
- } from "./chunk-RKFLB36H.js";
36
+ } from "./chunk-VAI3EVCS.js";
37
37
  import {
38
38
  captureTelemetry,
39
39
  owned
@@ -4,12 +4,12 @@ import {
4
4
  import {
5
5
  joinPath,
6
6
  mergeMeta
7
- } from "./chunk-6F3WAXVN.js";
7
+ } from "./chunk-2CURR5Y7.js";
8
8
  import {
9
9
  isShortenedUpstream,
10
10
  parseProviderError,
11
11
  providerError
12
- } from "./chunk-MN5XVRKW.js";
12
+ } from "./chunk-7STIP5CS.js";
13
13
  import {
14
14
  ApiErrorResponse,
15
15
  CacheError,
@@ -31,14 +31,14 @@ import {
31
31
  maxFailureFields,
32
32
  maxFailureMessageLength,
33
33
  maxUpstreamMessageLength
34
- } from "./chunk-6WC2OWHV.js";
34
+ } from "./chunk-4UPC36ZL.js";
35
35
  import {
36
36
  SkillLoadFailed,
37
37
  skillFormatLimits
38
38
  } from "./chunk-4PIQKACY.js";
39
39
  import {
40
40
  jsonSchemaDocument
41
- } from "./chunk-RKFLB36H.js";
41
+ } from "./chunk-VAI3EVCS.js";
42
42
  import {
43
43
  AccountId,
44
44
  HttpUrl,
@@ -607,6 +607,22 @@ var fixedRouter = (operations, meta) => ({
607
607
  },
608
608
  resolve: (name) => Effect_exports.succeed(Object.hasOwn(operations, name) ? operations[name] : void 0)
609
609
  });
610
+ var ListedEntries = Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown);
611
+ var ListedTool = HostedTool.mapFields((fields) => ({
612
+ ...fields,
613
+ inputSchema: ListedEntries,
614
+ outputSchema: Schema_exports.optionalKey(ListedEntries),
615
+ _meta: Schema_exports.optionalKey(ListedEntries)
616
+ }));
617
+ var isJson = Schema_exports.is(Schema_exports.Json);
618
+ var jsonTools = (tools) => isJson(
619
+ tools.flatMap(
620
+ (tool) => [tool.inputSchema, tool.outputSchema, tool._meta].flatMap(
621
+ (schema) => schema === void 0 ? [] : Object.values(schema)
622
+ )
623
+ )
624
+ );
625
+ var DescribedTools = Schema_exports.Array(ListedTool).pipe(Schema_exports.refine(jsonTools));
610
626
  var within = (wanted, path) => [...wanted].flatMap(
611
627
  (name) => path === "" ? [name] : name.startsWith(`${path}.`) ? [name.slice(path.length + 1)] : []
612
628
  );
@@ -628,9 +644,7 @@ var readCatalog = (root, options) => Effect_exports.gen(function* () {
628
644
  ],
629
645
  { concurrency: "unbounded" }
630
646
  );
631
- const parsed = yield* Schema_exports.decodeUnknownEffect(
632
- Schema_exports.Array(options.summary ? HostedToolSummary : HostedTool)
633
- )(listed).pipe(Effect_exports.mapError(() => new HostDeclarationInvalid()));
647
+ const parsed = yield* (options.summary ? Schema_exports.decodeUnknownEffect(Schema_exports.Array(HostedToolSummary))(listed) : Schema_exports.decodeUnknownEffect(DescribedTools)(listed)).pipe(Effect_exports.mapError(() => new HostDeclarationInvalid()));
634
648
  const names = /* @__PURE__ */ new Set();
635
649
  const found = [];
636
650
  for (const tool of parsed) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  authorCache,
3
3
  unavailableCache
4
- } from "./chunk-JJZZLNJY.js";
4
+ } from "./chunk-5C6RAGAS.js";
5
5
  import {
6
6
  accountSecrets,
7
7
  boundFailureMessage,
@@ -12,10 +12,10 @@ import {
12
12
  parseSkillLoadFailed,
13
13
  readCatalog,
14
14
  routerSkills
15
- } from "./chunk-DYE2CKHG.js";
15
+ } from "./chunk-QI66R4FP.js";
16
16
  import {
17
17
  appInvocationFetch
18
- } from "./chunk-2GPX2E57.js";
18
+ } from "./chunk-VCYWAA4N.js";
19
19
  import {
20
20
  folderSkillsEffect
21
21
  } from "./chunk-PBGPES67.js";
@@ -26,12 +26,12 @@ import {
26
26
  makeEmitter,
27
27
  toEffectApp,
28
28
  withPlacements
29
- } from "./chunk-TNVB3KLB.js";
29
+ } from "./chunk-ILYCJ3HV.js";
30
30
  import {
31
31
  declaredOperations,
32
32
  locate,
33
33
  nativeOperation
34
- } from "./chunk-6F3WAXVN.js";
34
+ } from "./chunk-2CURR5Y7.js";
35
35
  import {
36
36
  accountProviderError,
37
37
  appCode,
@@ -39,7 +39,7 @@ import {
39
39
  httpProviderError,
40
40
  parseProviderError,
41
41
  toPromise
42
- } from "./chunk-MN5XVRKW.js";
42
+ } from "./chunk-7STIP5CS.js";
43
43
  import {
44
44
  AccountCheckResult,
45
45
  DeclaredProvider,
@@ -63,6 +63,7 @@ import {
63
63
  HostToolNotFound,
64
64
  HostToolPolicyFailed,
65
65
  HostedRouter,
66
+ HostedSharedCatalog,
66
67
  HostedTool,
67
68
  HostedToolSummary,
68
69
  HostedWebhook,
@@ -89,9 +90,10 @@ import {
89
90
  migrationsDirectory,
90
91
  normalizePlacements,
91
92
  reservedTablePrefix,
93
+ shareCatalog,
92
94
  sqlBindingsLimit,
93
95
  workflowDurationMillis
94
- } from "./chunk-6WC2OWHV.js";
96
+ } from "./chunk-4UPC36ZL.js";
95
97
  import {
96
98
  AppSkills,
97
99
  SkillFile
@@ -108,7 +110,7 @@ import {
108
110
  missingKeyText,
109
111
  objectShape,
110
112
  unionShape
111
- } from "./chunk-RKFLB36H.js";
113
+ } from "./chunk-VAI3EVCS.js";
112
114
  import {
113
115
  captureTelemetry,
114
116
  makeOwnershipAccounting,
@@ -1178,7 +1180,13 @@ function requirements(slots, sql, events, icons) {
1178
1180
  return Effect_exports.gen(function* () {
1179
1181
  return yield* Schema_exports.decodeUnknownEffect(DeclaredRequirements)({
1180
1182
  accounts: { app: yield* declaredSlots(slots.app), user: yield* declaredSlots(slots.user) },
1181
- capabilities: { skills: true, toolIndex: true, skillSources: true, scheduledTools: true },
1183
+ capabilities: {
1184
+ skills: true,
1185
+ toolIndex: true,
1186
+ skillSources: true,
1187
+ scheduledTools: true,
1188
+ sharedDefinitions: true
1189
+ },
1182
1190
  ...sql ? { sql: true } : {},
1183
1191
  ...events === void 0 || Object.keys(events).length === 0 ? {} : {
1184
1192
  events: yield* declarationSafe(
@@ -1604,10 +1612,9 @@ function dispatch(app, request, context, signal, emitted) {
1604
1612
  ...request.scheduled === true ? { scheduled: true } : {},
1605
1613
  schedules: (name) => Object.entries(definition.schedules ?? {}).filter(([, schedule]) => schedule.tool === name).map(([name2, { tool: _tool, ...schedule }]) => ({ name: name2, ...schedule }))
1606
1614
  }).pipe(Effect_exports.withSpan("app.catalog.read"));
1615
+ const { tools, routers } = catalog;
1607
1616
  return yield* safe2(
1608
- () => Schema_exports.encodeEffect(WireCatalog)(catalog).pipe(
1609
- Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(JsonValue))
1610
- ),
1617
+ () => (request.definitions === "shared" && !summary && tools.every((tool2) => "inputSchema" in tool2) ? Schema_exports.encodeEffect(HostedSharedCatalog)(shareCatalog({ tools, routers })) : Schema_exports.encodeEffect(WireCatalog)(catalog)).pipe(Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(JsonValue))),
1611
1618
  new HostDeclarationInvalid()
1612
1619
  );
1613
1620
  }
@@ -1264,6 +1264,65 @@ var nestJsonSchema = (input, pointer) => {
1264
1264
  Schema_exports.Record(Schema_exports.String, Schema_exports.Json)
1265
1265
  )(rewrite(document));
1266
1266
  };
1267
+ var identifiers = /* @__PURE__ */ new Set([
1268
+ "$id",
1269
+ "id",
1270
+ "$anchor",
1271
+ "$recursiveAnchor",
1272
+ "$recursiveRef",
1273
+ "$dynamicAnchor",
1274
+ "$dynamicRef"
1275
+ ]);
1276
+ var ownDefinition = (reference) => {
1277
+ if (typeof reference !== "string" || !reference.startsWith("#/$defs/")) return void 0;
1278
+ const segments = pointerSegments(reference);
1279
+ return segments.length === 2 ? segments[1] : void 0;
1280
+ };
1281
+ var rootDefinitions = (schema) => {
1282
+ const definitions = schema.$defs ?? {};
1283
+ if (!isJsonRecord(definitions)) return void 0;
1284
+ const pending = [schema];
1285
+ for (let value = pending.pop(); value !== void 0; value = pending.pop()) {
1286
+ if (!isSchemaObject(value)) continue;
1287
+ for (const [key, item] of Object.entries(value)) {
1288
+ if (identifiers.has(key)) return void 0;
1289
+ if (key === "$ref") {
1290
+ const name = ownDefinition(item);
1291
+ if (name === void 0 || !Object.hasOwn(definitions, name)) return void 0;
1292
+ } else if (Array.isArray(item)) {
1293
+ if (schemaArrays.has(key) || key === "items") pending.push(...item);
1294
+ } else if (schemaMaps.has(key) || key === "dependencies") {
1295
+ if (isJsonRecord(item)) pending.push(...Object.values(item));
1296
+ } else if (schemaNodes.has(key)) pending.push(item);
1297
+ }
1298
+ }
1299
+ return definitions;
1300
+ };
1301
+ var combineJsonSchemas = (schemas, pointer) => {
1302
+ const shared = {};
1303
+ const texts = /* @__PURE__ */ new Map();
1304
+ const combined = schemas.map((schema, index) => {
1305
+ const definitions = rootDefinitions(schema);
1306
+ const entries = Object.entries(definitions ?? {}).map(
1307
+ ([name, definition]) => [name, definition, JSON.stringify(definition)]
1308
+ );
1309
+ if (definitions === void 0 || entries.some(([name, , text]) => texts.has(name) && texts.get(name) !== text))
1310
+ return nestJsonSchema(schema, pointer(index));
1311
+ for (const [name, definition, text] of entries) {
1312
+ if (texts.has(name)) continue;
1313
+ texts.set(name, text);
1314
+ Object.defineProperty(shared, name, {
1315
+ value: definition,
1316
+ enumerable: true,
1317
+ writable: true,
1318
+ configurable: true
1319
+ });
1320
+ }
1321
+ const { $defs: _, ...rest } = schema;
1322
+ return rest;
1323
+ });
1324
+ return texts.size === 0 ? { schemas: combined } : { $defs: shared, schemas: combined };
1325
+ };
1267
1326
  var schemaMaps = /* @__PURE__ */ new Set([
1268
1327
  "$defs",
1269
1328
  "definitions",
@@ -1924,6 +1983,7 @@ export {
1924
1983
  once,
1925
1984
  withLazyJsonSchemaDocument,
1926
1985
  nestJsonSchema,
1986
+ combineJsonSchemas,
1927
1987
  echoableKey,
1928
1988
  objectShape,
1929
1989
  allowedValues,
@@ -5,7 +5,7 @@ import {
5
5
  networkRefusalHeader,
6
6
  networkRefusalStatus,
7
7
  supportedFetchOptions
8
- } from "./chunk-6WC2OWHV.js";
8
+ } from "./chunk-4UPC36ZL.js";
9
9
  import {
10
10
  invocationFetch
11
11
  } from "./chunk-URKOTNDA.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  getWithReads
3
- } from "./chunk-JJZZLNJY.js";
3
+ } from "./chunk-5C6RAGAS.js";
4
4
  import {
5
5
  fromPromise,
6
6
  method,
7
7
  toPromise
8
- } from "./chunk-MN5XVRKW.js";
8
+ } from "./chunk-7STIP5CS.js";
9
9
  import {
10
10
  CacheError
11
- } from "./chunk-6WC2OWHV.js";
11
+ } from "./chunk-4UPC36ZL.js";
12
12
  import {
13
13
  wrap
14
- } from "./chunk-RKFLB36H.js";
14
+ } from "./chunk-VAI3EVCS.js";
15
15
  import {
16
16
  JsonObject
17
17
  } from "./chunk-7HG422GB.js";
package/js/client.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-KLSEU35Y.js";
13
13
  import {
14
14
  decoderOf
15
- } from "./chunk-RKFLB36H.js";
15
+ } from "./chunk-VAI3EVCS.js";
16
16
  import {
17
17
  OtlpExporter_exports,
18
18
  externalTrace,
package/js/contracts.js CHANGED
@@ -67,6 +67,8 @@ import {
67
67
  HostedCatalog,
68
68
  HostedCatalogSummary,
69
69
  HostedRouter,
70
+ HostedSharedCatalog,
71
+ HostedSharedTool,
70
72
  HostedTool,
71
73
  HostedToolSummary,
72
74
  HostedWebhook,
@@ -108,6 +110,7 @@ import {
108
110
  RouterKey,
109
111
  RouterMeta,
110
112
  ScheduleTiming,
113
+ SharedSchemaKey,
111
114
  SkillCatalogResponse,
112
115
  SkillLoadFailed,
113
116
  SkillSources,
@@ -173,12 +176,13 @@ import {
173
176
  protocol9,
174
177
  renderPlacement,
175
178
  reservedAuthorizationParams,
179
+ restoreSharedCatalog,
176
180
  scopedSlots,
177
181
  selectTools,
178
182
  skillCatalog,
179
183
  skillsCommand,
180
184
  workflowDurationMillis
181
- } from "./chunk-6WC2OWHV.js";
185
+ } from "./chunk-4UPC36ZL.js";
182
186
  import {
183
187
  AppSkillMetadata,
184
188
  AppSkillName,
@@ -274,6 +278,8 @@ export {
274
278
  HostedCatalog,
275
279
  HostedCatalogSummary,
276
280
  HostedRouter,
281
+ HostedSharedCatalog,
282
+ HostedSharedTool,
277
283
  HostedTool,
278
284
  HostedToolSummary,
279
285
  HostedWebhook,
@@ -316,6 +322,7 @@ export {
316
322
  RouterKey,
317
323
  RouterMeta,
318
324
  ScheduleTiming,
325
+ SharedSchemaKey,
319
326
  SkillCatalogResponse,
320
327
  SkillDefinitionInvalid,
321
328
  SkillFile,
@@ -385,6 +392,7 @@ export {
385
392
  protocol9,
386
393
  renderPlacement,
387
394
  reservedAuthorizationParams,
395
+ restoreSharedCatalog,
388
396
  scopedSlots,
389
397
  selectTools,
390
398
  skillCatalog,