@adhd/apigen-core-client 0.1.1 → 0.1.3

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.
package/index.mjs CHANGED
@@ -3,7 +3,7 @@ import $e from "node:fs";
3
3
  import * as Ae from "node:path";
4
4
  import Q from "node:path";
5
5
  import { createParser as Pe, createFormatter as Ne, SchemaGenerator as Oe, AnnotatedType as ne, StringType as re } from "ts-json-schema-generator";
6
- const le = Symbol.for("adhd.apigen.extraction-session");
6
+ const fe = Symbol.for("adhd.apigen.extraction-session");
7
7
  function pe(e, t) {
8
8
  const r = [
9
9
  ...e.getImportDeclarations().map((o) => o.getModuleSpecifierSourceFile()),
@@ -23,7 +23,7 @@ function pe(e, t) {
23
23
  }
24
24
  }
25
25
  }
26
- function me(e) {
26
+ function ge(e) {
27
27
  try {
28
28
  const t = $e.statSync(e);
29
29
  return `${t.mtimeMs}:${t.size}`;
@@ -31,16 +31,16 @@ function me(e) {
31
31
  return "nostat";
32
32
  }
33
33
  }
34
- const I = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
35
- function Ee(e, t, r) {
36
- const o = t ?? "", n = I.get(o);
34
+ const C = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
35
+ function ke(e, t, r) {
36
+ const o = t ?? "", n = C.get(o);
37
37
  let i = r;
38
38
  if (n && n.fileVersions.size > 0) {
39
39
  const c = [r], u = [...n.fileVersions.entries()].sort(
40
- ([f], [l]) => f.localeCompare(l)
40
+ ([l], [f]) => l.localeCompare(f)
41
41
  );
42
- for (const [f, l] of u)
43
- f !== e && c.push(`${f}:${l}`);
42
+ for (const [l, f] of u)
43
+ l !== e && c.push(`${l}:${f}`);
44
44
  i = c.join("|");
45
45
  }
46
46
  const s = `${e}\0${t ?? ""}`;
@@ -48,9 +48,9 @@ function Ee(e, t, r) {
48
48
  return (!a || a.version !== i) && (a = { version: i, schemas: /* @__PURE__ */ new Map() }, B.set(s, a)), a.schemas;
49
49
  }
50
50
  function At() {
51
- I.clear(), B.clear();
51
+ C.clear(), B.clear();
52
52
  }
53
- function ge() {
53
+ function me() {
54
54
  const e = {
55
55
  projectsBuilt: 0,
56
56
  generatorsBuilt: 0,
@@ -59,7 +59,7 @@ function ge() {
59
59
  }, t = /* @__PURE__ */ new Map();
60
60
  let r = !1;
61
61
  return {
62
- [le]: !0,
62
+ [fe]: !0,
63
63
  stats: e,
64
64
  schemaCache: /* @__PURE__ */ new Map(),
65
65
  aliasCache: /* @__PURE__ */ new WeakMap(),
@@ -69,26 +69,26 @@ function ge() {
69
69
  if (r)
70
70
  throw new Error("apigen-core: ExtractionSession used after dispose()");
71
71
  const i = n ?? "", s = n ? this.statVersion(n) : "";
72
- let a = I.get(i);
72
+ let a = C.get(i);
73
73
  return a && a.tsconfigVersion !== s && (a = void 0), a || (a = { project: n ? new te({
74
74
  tsConfigFilePath: n,
75
75
  skipAddingFilesFromTsConfig: !0
76
- }) : new te({ skipAddingFilesFromTsConfig: !0 }), tsconfigVersion: s, fileVersions: /* @__PURE__ */ new Map() }, I.set(i, a), e.projectsBuilt++), a.project;
76
+ }) : new te({ skipAddingFilesFromTsConfig: !0 }), tsconfigVersion: s, fileVersions: /* @__PURE__ */ new Map() }, C.set(i, a), e.projectsBuilt++), a.project;
77
77
  },
78
78
  sourceFileFor(n, i) {
79
- const s = this.projectFor(i), a = I.get(i ?? ""), c = this.statVersion(n);
79
+ const s = this.projectFor(i), a = C.get(i ?? ""), c = this.statVersion(n);
80
80
  let u = s.getSourceFile(n);
81
81
  if (u === void 0 ? u = s.addSourceFileAtPath(n) : a && a.fileVersions.get(n) !== c && u.refreshFromFileSystemSync(), a == null || a.fileVersions.set(n, c), a) {
82
- const f = /* @__PURE__ */ new Set([n]);
83
- pe(u, f);
84
- for (const l of f)
85
- l !== n && a.fileVersions.set(l, this.statVersion(l));
82
+ const l = /* @__PURE__ */ new Set([n]);
83
+ pe(u, l);
84
+ for (const f of l)
85
+ f !== n && a.fileVersions.set(f, this.statVersion(f));
86
86
  }
87
87
  return u;
88
88
  },
89
89
  statVersion(n) {
90
90
  let i = t.get(n);
91
- return i === void 0 && (i = me(n), t.set(n, i)), i;
91
+ return i === void 0 && (i = ge(n), t.set(n, i)), i;
92
92
  },
93
93
  dispose() {
94
94
  r = !0, this.schemaCache.clear(), this.generatorCache.clear(), t.clear();
@@ -97,7 +97,7 @@ function ge() {
97
97
  }
98
98
  function de(e) {
99
99
  const t = e;
100
- if (t[le] !== !0)
100
+ if (t[fe] !== !0)
101
101
  throw new Error(
102
102
  "apigen-core: unknown ExtractionSession implementation — create sessions with createExtractionSession()"
103
103
  );
@@ -114,39 +114,39 @@ function oe(e, t) {
114
114
  const i = n.$ref;
115
115
  if (typeof i == "string") {
116
116
  if (t) {
117
- const l = t[i];
118
- if (!l) {
119
- const g = Object.keys(t).join(", ") || "(none)";
117
+ const f = t[i];
118
+ if (!f) {
119
+ const d = Object.keys(t).join(", ") || "(none)";
120
120
  throw new Error(
121
- `[apigen-logical] $ref "${i}" cannot be resolved. Available $defs: ${g}`
121
+ `[apigen-logical] $ref "${i}" cannot be resolved. Available $defs: ${d}`
122
122
  );
123
123
  }
124
- o.push(l);
124
+ o.push(f);
125
125
  }
126
126
  continue;
127
127
  }
128
128
  const s = n.oneOf;
129
129
  if (Array.isArray(s))
130
- for (const l of s)
131
- typeof l == "object" && l !== null && o.push(l);
130
+ for (const f of s)
131
+ typeof f == "object" && f !== null && o.push(f);
132
132
  const a = n.properties;
133
133
  if (a)
134
- for (const l of Object.values(a))
135
- o.push(l);
134
+ for (const f of Object.values(a))
135
+ o.push(f);
136
136
  const c = n.items;
137
137
  if (Array.isArray(c))
138
- for (const l of c)
139
- typeof l == "object" && l !== null && o.push(l);
138
+ for (const f of c)
139
+ typeof f == "object" && f !== null && o.push(f);
140
140
  else
141
141
  typeof c == "object" && c !== null && o.push(c);
142
142
  const u = n.additionalProperties;
143
143
  typeof u == "object" && u !== null && o.push(u);
144
- const f = n.propertyNames;
145
- typeof f == "object" && f !== null && o.push(f);
144
+ const l = n.propertyNames;
145
+ typeof l == "object" && l !== null && o.push(l);
146
146
  }
147
147
  }
148
148
  const ie = /* @__PURE__ */ new Set(["string", "number", "boolean", "integer"]);
149
- function ke(e) {
149
+ function Ee(e) {
150
150
  if (typeof e != "object" || e === null)
151
151
  return !1;
152
152
  const t = e;
@@ -155,15 +155,27 @@ function ke(e) {
155
155
  const { type: r } = t;
156
156
  return typeof r == "string" ? ie.has(r) : Array.isArray(r) ? r.every((o) => ie.has(o) || o === "null") : Array.isArray(t.enum) && t.enum.length > 0 ? t.enum.every((o) => ["string", "number", "boolean"].includes(typeof o)) : !1;
157
157
  }
158
- function Ce(e) {
158
+ function Ie(e) {
159
159
  if (!e || typeof e != "object")
160
160
  return !1;
161
161
  const t = e.properties;
162
162
  return t === void 0 || typeof t != "object" || t === null ? !1 : Object.values(t).every(
163
- ke
163
+ Ee
164
164
  );
165
165
  }
166
- function Ie(e) {
166
+ function Pt(e) {
167
+ var r, o;
168
+ const t = [];
169
+ for (const n of e) {
170
+ const i = {
171
+ ...(r = n.capabilities.layer) == null ? void 0 : r.envelopeFields,
172
+ ...(o = n.capabilities.envelope) == null ? void 0 : o.request
173
+ };
174
+ Object.keys(i).length > 0 && t.push({ id: n.id, envelope: i });
175
+ }
176
+ return t;
177
+ }
178
+ function Ce(e) {
167
179
  const t = {}, r = (o) => {
168
180
  for (const n of ["definitions", "$defs"]) {
169
181
  const i = o[n];
@@ -191,30 +203,30 @@ function Fe(e, t) {
191
203
  'apigen calling convention: all domain parameters go inside a "data" envelope — e.g. { "data": { ... } }' + (t ? "." : " (an empty object for this zero-parameter tool).")
192
204
  ];
193
205
  return e.length > 0 && r.push(
194
- `Field(s) ${e.map((o) => `"${o}"`).join(", ")} are transport-level envelope metadata, NOT domain data — do not nest them under "data". Over MCP they are read from arguments._meta["x-<pluginId>-<field>"] (default pluginId "adhd"); see @adhd/apigen-naming's envelopeMetaKey/envelopeCliFlag/envelopeEnvVar for the HTTP-header / CLI-flag / env-var equivalents.`
206
+ `Field(s) ${e.map((o) => `"${o}"`).join(", ")} are transport-level envelope metadata, NOT domain data — do not nest them under "data". Over MCP they are read from arguments._meta["x-<pluginId>-<field>"] (default pluginId "adhd"); see @adhd/apigen-engine-naming's envelopeMetaKey/envelopeCliFlag/envelopeEnvVar for the HTTP-header / CLI-flag / env-var equivalents.`
195
207
  ), r.join(" ");
196
208
  }
197
- function Pt(e, t, r) {
198
- Ie(e);
209
+ function Nt(e, t, r) {
210
+ Ce(e);
199
211
  const o = {};
200
212
  for (const [n, i] of Object.entries(e.schemas)) {
201
- const s = (r == null ? void 0 : r[n]) ?? {}, a = i.input.properties ?? {}, c = i.input.required ?? [], u = {}, f = [];
213
+ const s = (r == null ? void 0 : r[n]) ?? {}, a = i.input.properties ?? {}, c = i.input.required ?? [], u = {}, l = [], f = {};
202
214
  for (const y of t)
203
215
  if (y.envelope && s[y.id] !== !1)
204
- for (const [h, T] of Object.entries(y.envelope))
205
- u[h] = T, f.includes(h) || f.push(h);
206
- const l = {
216
+ for (const [m, v] of Object.entries(y.envelope))
217
+ u[m] = v, f[m] = y.id, l.includes(m) || l.push(m);
218
+ const d = {
207
219
  type: "object",
208
220
  properties: a,
209
221
  additionalProperties: !1,
210
222
  ...c.length > 0 ? { required: c } : {}
211
- }, g = i.safe === !0 || Ce(i.input), m = i.input.definitions, p = i.input.$defs;
223
+ }, g = i.safe === !0 || Ie(i.input), p = i.input.definitions, T = i.input.$defs;
212
224
  o[n] = {
213
225
  input: {
214
226
  type: "object",
215
- properties: { ...u, data: l },
227
+ properties: { ...u, data: d },
216
228
  required: [
217
- ...f,
229
+ ...l,
218
230
  ...c.length > 0 ? ["data"] : []
219
231
  ],
220
232
  // BUG-APIGEN-017: reject any property that isn't a declared envelope
@@ -225,13 +237,18 @@ function Pt(e, t, r) {
225
237
  Object.keys(u),
226
238
  Object.keys(a).length > 0
227
239
  ),
228
- ...m ? { definitions: m } : {},
229
- ...p ? { $defs: p } : {}
240
+ ...p ? { definitions: p } : {},
241
+ ...T ? { $defs: T } : {}
230
242
  },
231
243
  output: i.output,
232
244
  // Carry the ctx-param flag through to dispatch (BUG-APIGEN-001).
233
245
  ...i.hasCtx ? { hasCtx: !0 } : {},
234
- "x-apigen-safe": g
246
+ "x-apigen-safe": g,
247
+ // DEBT-APIGEN-ENVELOPE-CAPABILITY-UNWIRED-001: field → pluginId map,
248
+ // read by `op-plan.ts`'s `computeEnvelopeFields`. Omitted (not an empty
249
+ // object) when no middleware contributed an envelope field, matching
250
+ // `x-apigen-safe`'s own "absent means nothing to report" convention.
251
+ ...Object.keys(f).length > 0 ? { "x-apigen-envelope": f } : {}
235
252
  };
236
253
  }
237
254
  return o;
@@ -320,18 +337,18 @@ async function ye(e, t, r) {
320
337
  return { type: "object", additionalProperties: await t(i.getText()) };
321
338
  const a = {};
322
339
  for (const c of s) {
323
- const u = c.getName(), l = c.getDeclarations()[0];
324
- let g;
325
- if (l)
340
+ const u = c.getName(), f = c.getDeclarations()[0];
341
+ let d;
342
+ if (f)
326
343
  try {
327
- g = c.getTypeAtLocation(l);
344
+ d = c.getTypeAtLocation(f);
328
345
  } catch {
329
- g = void 0;
346
+ d = void 0;
330
347
  }
331
- if (g !== void 0 && g.getCallSignatures().length > 0)
348
+ if (d !== void 0 && d.getCallSignatures().length > 0)
332
349
  continue;
333
- const m = g !== void 0 ? Le(g, l) : void 0;
334
- a[u] = m !== void 0 ? await t(m) : {};
350
+ const g = d !== void 0 ? Le(d, f) : void 0;
351
+ a[u] = g !== void 0 ? await t(g) : {};
335
352
  }
336
353
  return Object.keys(a).length > 0 ? { type: "object", properties: a } : {};
337
354
  }
@@ -356,12 +373,12 @@ function J(e) {
356
373
  const n = [];
357
374
  let i = !0;
358
375
  for (const a of t) {
359
- const c = a[o], u = c && (c.type === "string" || c.type === "number"), f = c == null ? void 0 : c.enum;
360
- if (!u || !Array.isArray(f) || f.length !== 1) {
376
+ const c = a[o], u = c && (c.type === "string" || c.type === "number"), l = c == null ? void 0 : c.enum;
377
+ if (!u || !Array.isArray(l) || l.length !== 1) {
361
378
  i = !1;
362
379
  break;
363
380
  }
364
- n.push(String(f[0]));
381
+ n.push(String(l[0]));
365
382
  }
366
383
  if (!i || new Set(n).size !== n.length)
367
384
  continue;
@@ -415,7 +432,7 @@ function M(e, t, r) {
415
432
  if (o.startsWith("{") && o.endsWith("}")) {
416
433
  const i = o.slice(1, -1).trim(), s = {};
417
434
  for (const a of i.split(";").filter(Boolean)) {
418
- const [c, u] = a.split(":").map((f) => f.trim());
435
+ const [c, u] = a.split(":").map((l) => l.trim());
419
436
  c && u && (s[c.replace("?", "")] = M(u, t + 1, r));
420
437
  }
421
438
  return { type: "object", properties: s };
@@ -448,7 +465,7 @@ function Ke(e) {
448
465
  if (r.length !== 0)
449
466
  return he(r);
450
467
  }
451
- async function De(e, t) {
468
+ async function qe(e, t) {
452
469
  const r = e.trim(), o = Ve(r);
453
470
  if (o !== void 0) {
454
471
  const s = he(o);
@@ -516,7 +533,7 @@ function ae(e) {
516
533
  }
517
534
  return t;
518
535
  }
519
- function qe(e, t) {
536
+ function De(e, t) {
520
537
  return (r) => {
521
538
  r.addNodeParser({
522
539
  supportsNode(o) {
@@ -545,21 +562,21 @@ function qe(e, t) {
545
562
  });
546
563
  };
547
564
  }
548
- let k;
565
+ let E;
549
566
  function We() {
550
- if (k)
551
- return k;
567
+ if (E)
568
+ return E;
552
569
  try {
553
570
  const e = Q.dirname(
554
571
  require.resolve("ts-json-schema-generator/package.json")
555
572
  );
556
- k = require(require.resolve("typescript", {
573
+ E = require(require.resolve("typescript", {
557
574
  paths: [e]
558
575
  }));
559
576
  } catch {
560
- k = require("typescript");
577
+ E = require("typescript");
561
578
  }
562
- return k;
579
+ return E;
563
580
  }
564
581
  const O = /* @__PURE__ */ new Map();
565
582
  function Be() {
@@ -689,29 +706,29 @@ function Ye(e) {
689
706
  function et(e, t, r) {
690
707
  const { DEFAULT_CONFIG: o } = require("ts-json-schema-generator/dist/src/Config.js"), n = { ...o, ...e }, i = n.path, s = He(i, n.tsconfig);
691
708
  let a;
692
- a = r ? r.statVersion(i) : me(i);
709
+ a = r ? r.statVersion(i) : ge(i);
693
710
  let c;
694
711
  if (s !== void 0) {
695
- const f = (r == null ? void 0 : r.generatorCache.get(s)) ?? Ue(s);
696
- f && f.version === a && (c = f.gen);
712
+ const l = (r == null ? void 0 : r.generatorCache.get(s)) ?? Ue(s);
713
+ l && l.version === a && (c = l.gen);
697
714
  }
698
715
  if (!c) {
699
- const { createProgram: f } = require("ts-json-schema-generator/dist/factory/program.js"), l = We(), g = qe(
700
- l.SyntaxKind.BigIntKeyword,
701
- l.SyntaxKind.TypeReference
702
- ), m = f(n), p = Pe(
703
- m,
716
+ const { createProgram: l } = require("ts-json-schema-generator/dist/factory/program.js"), f = We(), d = De(
717
+ f.SyntaxKind.BigIntKeyword,
718
+ f.SyntaxKind.TypeReference
719
+ ), g = l(n), p = Pe(
720
+ g,
704
721
  n,
705
- g
706
- ), y = Ne(n);
722
+ d
723
+ ), T = Ne(n);
707
724
  if (c = new Oe(
708
- m,
725
+ g,
709
726
  p,
710
- y,
727
+ T,
711
728
  n
712
729
  ), r && r.stats.generatorsBuilt++, s !== void 0 && a !== void 0) {
713
- const h = { version: a, gen: c };
714
- Ge(s, h), r == null || r.generatorCache.set(s, h);
730
+ const y = { version: a, gen: c };
731
+ Ge(s, y), r == null || r.generatorCache.set(s, y);
715
732
  }
716
733
  }
717
734
  const u = c.createSchema(n.type);
@@ -778,50 +795,50 @@ async function A(e, t, r, o, n, i) {
778
795
  const u = n.schemaCache.get(a);
779
796
  if (u !== void 0)
780
797
  return n.stats.schemaCacheHits++, u;
781
- const f = Ee(
798
+ const l = ke(
782
799
  s,
783
800
  o,
784
801
  n.statVersion(s)
785
- ), l = f.get(r);
786
- if (l !== void 0)
787
- return n.stats.schemaCacheHits++, n.schemaCache.set(a, Promise.resolve(l)), l;
802
+ ), f = l.get(r);
803
+ if (f !== void 0)
804
+ return n.stats.schemaCacheHits++, n.schemaCache.set(a, Promise.resolve(f)), f;
788
805
  n.stats.schemaCacheMisses++;
789
- const g = new Set(c);
790
- g.add(a);
791
- const m = ce(
806
+ const d = new Set(c);
807
+ d.add(a);
808
+ const g = ce(
792
809
  e,
793
810
  t,
794
811
  r,
795
812
  o,
796
813
  n,
797
- g
798
- ).then((p) => (f.set(r, p), p)).catch((p) => {
814
+ d
815
+ ).then((p) => (l.set(r, p), p)).catch((p) => {
799
816
  throw n.schemaCache.delete(a), p;
800
817
  });
801
- return n.schemaCache.set(a, m), m;
818
+ return n.schemaCache.set(a, g), g;
802
819
  }
803
820
  async function ce(e, t, r, o, n, i) {
804
821
  if (["void", "undefined", "null", "Promise<void>"].includes(r))
805
822
  return { type: "null" };
806
823
  let s;
807
824
  if (n) {
808
- const g = n.aliasCache.get(t);
809
- s = g ?? ae(t), g || n.aliasCache.set(t, s);
825
+ const d = n.aliasCache.get(t);
826
+ s = d ?? ae(t), d || n.aliasCache.set(t, s);
810
827
  } else
811
828
  s = ae(t);
812
829
  const a = tt(r, s), c = U[a];
813
830
  if (c !== void 0)
814
831
  return c;
815
- const u = await De(
832
+ const u = await qe(
816
833
  a,
817
- (g) => A(e, t, g, o, n, i)
834
+ (d) => A(e, t, d, o, n, i)
818
835
  );
819
836
  if (u !== void 0)
820
837
  return u;
821
- const f = (n == null ? void 0 : n.zodImportCache.get(t)) ?? Qe(t);
822
- if (n && n.zodImportCache.set(t, f), !f)
838
+ const l = (n == null ? void 0 : n.zodImportCache.get(t)) ?? Qe(t);
839
+ if (n && n.zodImportCache.set(t, l), !l)
823
840
  try {
824
- const g = {
841
+ const d = {
825
842
  path: t.getFilePath(),
826
843
  type: a,
827
844
  skipTypeCheck: !0,
@@ -848,27 +865,27 @@ async function ce(e, t, r, o, n, i) {
848
865
  // dereference/hoist pass and is tracked separately, unresolved, in
849
866
  // BUG-APIGEN-026's BACKLOG entry.
850
867
  topRef: !1
851
- }, m = et(g, !0, n);
852
- return Ye(m);
868
+ }, g = et(d, !0, n);
869
+ return Ye(g);
853
870
  } catch {
854
871
  }
855
872
  try {
856
- const g = await Me(
873
+ const d = await Me(
857
874
  e,
858
875
  t,
859
876
  a,
860
- (m) => ye(
861
- m,
877
+ (g) => ye(
878
+ g,
862
879
  (p) => A(e, t, p, o, n, i),
863
880
  0
864
881
  )
865
882
  );
866
- if (g !== void 0)
867
- return g;
883
+ if (d !== void 0)
884
+ return d;
868
885
  } catch {
869
886
  }
870
- const l = rt(a, s);
871
- return M(l, 0, s);
887
+ const f = rt(a, s);
888
+ return M(f, 0, s);
872
889
  }
873
890
  function X(e, t, r) {
874
891
  if (e != null && e.hasInitializer()) {
@@ -918,8 +935,8 @@ function st(e, t) {
918
935
  const o = typeof r == "string" ? r : JSON.stringify(r), n = typeof e.description == "string" ? e.description : void 0;
919
936
  e.description = n ? `${n} (default: ${o})` : `(default: ${o})`;
920
937
  }
921
- async function Nt(e) {
922
- const t = e.session === void 0, r = de(e.session ?? ge());
938
+ async function Ot(e) {
939
+ const t = e.session === void 0, r = de(e.session ?? me());
923
940
  try {
924
941
  return await at(e, r);
925
942
  } finally {
@@ -927,77 +944,77 @@ async function Nt(e) {
927
944
  }
928
945
  }
929
946
  async function at(e, t) {
930
- const { sourceFile: r, namespace: o = "", tsconfig: n } = e, i = t.projectFor(n), s = t.sourceFileFor(r, n), a = Q.basename(r), c = P(ft(a)), u = P(o), f = [];
931
- for (const [m, p] of s.getExportedDeclarations()) {
932
- if (m === "default" || _(m))
947
+ const { sourceFile: r, namespace: o = "", tsconfig: n } = e, i = t.projectFor(n), s = t.sourceFileFor(r, n), a = Q.basename(r), c = P(lt(a)), u = P(o), l = [];
948
+ for (const [g, p] of s.getExportedDeclarations()) {
949
+ if (g === "default" || _(g))
933
950
  continue;
934
- const y = pt(p);
935
- if (y) {
936
- const d = y.getSignature(), S = ue(d, y), b = d.getReturnType().getText();
937
- f.push(
951
+ const T = pt(p);
952
+ if (T) {
953
+ const h = T.getSignature(), S = ue(h, T), b = h.getReturnType().getText();
954
+ l.push(
938
955
  await L(
939
956
  i,
940
957
  s,
941
958
  u,
942
959
  c,
943
- m,
960
+ g,
944
961
  S,
945
962
  b,
946
- y.isAsync(),
963
+ T.isAsync(),
947
964
  n,
948
965
  t
949
966
  )
950
967
  );
951
968
  continue;
952
969
  }
953
- const h = p.find(
954
- (d) => d.getKindName() === "VariableDeclaration"
970
+ const y = p.find(
971
+ (h) => h.getKindName() === "VariableDeclaration"
955
972
  );
956
- if (!h)
973
+ if (!y)
957
974
  continue;
958
- const T = h.getInitializer(), x = T == null ? void 0 : T.getKindName();
959
- if (T && ["ArrowFunction", "FunctionExpression"].includes(x ?? "")) {
960
- const S = h.getType().getCallSignatures();
975
+ const m = y.getInitializer(), v = m == null ? void 0 : m.getKindName();
976
+ if (m && ["ArrowFunction", "FunctionExpression"].includes(v ?? "")) {
977
+ const S = y.getType().getCallSignatures();
961
978
  if (S.length === 0)
962
979
  continue;
963
- const b = S[0], $ = fe(
980
+ const b = S[0], $ = le(
964
981
  b,
965
- h,
966
- h.getVariableStatement()
967
- ), j = b.getReturnType().getText(), v = T.isAsync();
968
- f.push(
982
+ y,
983
+ y.getVariableStatement()
984
+ ), j = b.getReturnType().getText(), x = m.isAsync();
985
+ l.push(
969
986
  await L(
970
987
  i,
971
988
  s,
972
989
  u,
973
990
  c,
974
- m,
991
+ g,
975
992
  $,
976
993
  j,
977
- v,
994
+ x,
978
995
  n,
979
996
  t
980
997
  )
981
998
  );
982
- } else if (x === "ObjectLiteralExpression") {
983
- const d = h.getType();
984
- for (const S of d.getProperties()) {
999
+ } else if (v === "ObjectLiteralExpression") {
1000
+ const h = y.getType();
1001
+ for (const S of h.getProperties()) {
985
1002
  const b = S.getName();
986
1003
  if (_(b))
987
1004
  continue;
988
- const j = S.getTypeAtLocation(h).getCallSignatures();
1005
+ const j = S.getTypeAtLocation(y).getCallSignatures();
989
1006
  if (j.length === 0)
990
1007
  continue;
991
- const v = j[0], w = fe(
992
- v,
993
- h,
994
- h.getVariableStatement()
995
- ), F = v.getReturnType().getText(), K = [
1008
+ const x = j[0], w = le(
1009
+ x,
1010
+ y,
1011
+ y.getVariableStatement()
1012
+ ), F = x.getReturnType().getText(), K = [
996
1013
  c,
997
- P(m),
1014
+ P(g),
998
1015
  P(b)
999
1016
  ];
1000
- f.push(
1017
+ l.push(
1001
1018
  await V(
1002
1019
  i,
1003
1020
  s,
@@ -1013,8 +1030,8 @@ async function at(e, t) {
1013
1030
  );
1014
1031
  }
1015
1032
  } else {
1016
- const d = h.getType(), S = d.getText();
1017
- if (E(d, h)) {
1033
+ const h = y.getType(), S = h.getText();
1034
+ if (k(h, y)) {
1018
1035
  const b = await A(
1019
1036
  i,
1020
1037
  s,
@@ -1022,32 +1039,32 @@ async function at(e, t) {
1022
1039
  n,
1023
1040
  t
1024
1041
  );
1025
- f.push(
1026
- ut(u, c, m, b)
1042
+ l.push(
1043
+ ut(u, c, g, b)
1027
1044
  );
1028
1045
  } else
1029
1046
  console.warn(
1030
- `[apigen-core] Skipping non-callable, non-serializable export: ${m}`
1047
+ `[apigen-core] Skipping non-callable, non-serializable export: ${g}`
1031
1048
  );
1032
1049
  }
1033
1050
  }
1034
- const l = s.getDefaultExportSymbol();
1035
- if (l) {
1036
- const m = s.getExportAssignment((p) => !p.isExportEquals());
1037
- if (m) {
1038
- const p = m.getExpression(), y = p.getKindName();
1039
- if (["ArrowFunction", "FunctionExpression"].includes(y)) {
1040
- const T = p.getType().getCallSignatures();
1041
- if (T.length > 0) {
1042
- const x = T[0], d = D(x, m), S = x.getReturnType().getText(), b = p.isAsync();
1043
- f.push(
1051
+ const f = s.getDefaultExportSymbol();
1052
+ if (f) {
1053
+ const g = s.getExportAssignment((p) => !p.isExportEquals());
1054
+ if (g) {
1055
+ const p = g.getExpression(), T = p.getKindName();
1056
+ if (["ArrowFunction", "FunctionExpression"].includes(T)) {
1057
+ const m = p.getType().getCallSignatures();
1058
+ if (m.length > 0) {
1059
+ const v = m[0], h = q(v, g), S = v.getReturnType().getText(), b = p.isAsync();
1060
+ l.push(
1044
1061
  await L(
1045
1062
  i,
1046
1063
  s,
1047
1064
  u,
1048
1065
  c,
1049
1066
  "default",
1050
- d,
1067
+ h,
1051
1068
  S,
1052
1069
  b,
1053
1070
  n,
@@ -1056,26 +1073,26 @@ async function at(e, t) {
1056
1073
  );
1057
1074
  }
1058
1075
  } else {
1059
- const h = p.getType();
1060
- for (const T of h.getProperties()) {
1061
- const x = T.getName();
1062
- if (_(x))
1076
+ const y = p.getType();
1077
+ for (const m of y.getProperties()) {
1078
+ const v = m.getName();
1079
+ if (_(v))
1063
1080
  continue;
1064
- const S = T.getTypeAtLocation(m).getCallSignatures();
1081
+ const S = m.getTypeAtLocation(g).getCallSignatures();
1065
1082
  if (S.length === 0)
1066
1083
  continue;
1067
- const b = S[0], $ = D(b, m), j = b.getReturnType().getText(), v = [
1084
+ const b = S[0], $ = q(b, g), j = b.getReturnType().getText(), x = [
1068
1085
  c,
1069
1086
  P("default"),
1070
- P(x)
1087
+ P(v)
1071
1088
  ];
1072
- f.push(
1089
+ l.push(
1073
1090
  await V(
1074
1091
  i,
1075
1092
  s,
1076
1093
  u,
1077
- v,
1078
1094
  x,
1095
+ v,
1079
1096
  $,
1080
1097
  j,
1081
1098
  !1,
@@ -1086,21 +1103,21 @@ async function at(e, t) {
1086
1103
  }
1087
1104
  }
1088
1105
  } else {
1089
- const p = l.getDeclarations();
1090
- for (const y of p) {
1091
- if (y.getKindName() !== "FunctionDeclaration")
1106
+ const p = f.getDeclarations();
1107
+ for (const T of p) {
1108
+ if (T.getKindName() !== "FunctionDeclaration")
1092
1109
  continue;
1093
- const h = y, T = h.getName(), x = T && T.length > 0 ? T : "default", d = h.getSignature(), S = ue(d, h), b = d.getReturnType().getText();
1094
- f.push(
1110
+ const y = T, m = y.getName(), v = m && m.length > 0 ? m : "default", h = y.getSignature(), S = ue(h, y), b = h.getReturnType().getText();
1111
+ l.push(
1095
1112
  await L(
1096
1113
  i,
1097
1114
  s,
1098
1115
  u,
1099
1116
  c,
1100
- x,
1117
+ v,
1101
1118
  S,
1102
1119
  b,
1103
- h.isAsync(),
1120
+ y.isAsync(),
1104
1121
  n,
1105
1122
  t
1106
1123
  )
@@ -1108,28 +1125,28 @@ async function at(e, t) {
1108
1125
  }
1109
1126
  }
1110
1127
  }
1111
- const g = lt(s);
1112
- if (g.length > 0)
1113
- for (const { name: m, sig: p } of g) {
1114
- if (_(m))
1128
+ const d = ft(s);
1129
+ if (d.length > 0)
1130
+ for (const { name: g, sig: p } of d) {
1131
+ if (_(g))
1115
1132
  continue;
1116
- const y = D(p), h = p.getReturnType().getText(), T = [c, P(m)];
1117
- f.push(
1133
+ const T = q(p), y = p.getReturnType().getText(), m = [c, P(g)];
1134
+ l.push(
1118
1135
  await V(
1119
1136
  i,
1120
1137
  s,
1121
1138
  u,
1122
- T,
1123
1139
  m,
1140
+ g,
1141
+ T,
1124
1142
  y,
1125
- h,
1126
1143
  !1,
1127
1144
  n,
1128
1145
  t
1129
1146
  )
1130
1147
  );
1131
1148
  }
1132
- return f;
1149
+ return l;
1133
1150
  }
1134
1151
  function ct(e, t, r, o) {
1135
1152
  const n = /* @__PURE__ */ new Set(), i = (s) => {
@@ -1140,22 +1157,22 @@ function ct(e, t, r, o) {
1140
1157
  n.add(s);
1141
1158
  try {
1142
1159
  const a = s, c = {};
1143
- for (const [u, f] of Object.entries(a)) {
1160
+ for (const [u, l] of Object.entries(a)) {
1144
1161
  if (u === "definitions" || u === "$defs") {
1145
- const l = u, g = t[l];
1146
- for (const [m, p] of Object.entries(
1147
- f
1162
+ const f = u, d = t[f];
1163
+ for (const [g, p] of Object.entries(
1164
+ l
1148
1165
  )) {
1149
- const y = i(p), h = g[m];
1150
- if (h !== void 0 && JSON.stringify(h) !== JSON.stringify(y))
1166
+ const T = i(p), y = d[g];
1167
+ if (y !== void 0 && JSON.stringify(y) !== JSON.stringify(T))
1151
1168
  throw new Error(
1152
- `[apigen-core-client] Function "${r}": param "${o}" contributes a "${l}.${m}" definition that conflicts with an identically-named definition already hoisted from another param/output in the same function. Two structurally different types share the same generated definition key, so apigen cannot safely merge them into one function-level schema.`
1169
+ `[apigen-core-client] Function "${r}": param "${o}" contributes a "${f}.${g}" definition that conflicts with an identically-named definition already hoisted from another param/output in the same function. Two structurally different types share the same generated definition key, so apigen cannot safely merge them into one function-level schema.`
1153
1170
  );
1154
- g[m] = y;
1171
+ d[g] = T;
1155
1172
  }
1156
1173
  continue;
1157
1174
  }
1158
- c[u] = i(f);
1175
+ c[u] = i(l);
1159
1176
  }
1160
1177
  return c;
1161
1178
  } finally {
@@ -1165,12 +1182,12 @@ function ct(e, t, r, o) {
1165
1182
  return i(e);
1166
1183
  }
1167
1184
  async function L(e, t, r, o, n, i, s, a, c, u) {
1168
- const f = P(n);
1185
+ const l = P(n);
1169
1186
  return V(
1170
1187
  e,
1171
1188
  t,
1172
1189
  r,
1173
- [o, f],
1190
+ [o, l],
1174
1191
  n,
1175
1192
  i,
1176
1193
  s,
@@ -1180,24 +1197,24 @@ async function L(e, t, r, o, n, i, s, a, c, u) {
1180
1197
  );
1181
1198
  }
1182
1199
  async function V(e, t, r, o, n, i, s, a, c, u) {
1183
- const f = i.length > 0 && i[0].name === "ctx", l = i.filter((d) => d.name !== "ctx"), g = l.filter((d) => !d.optional).map((d) => d.name), m = {}, p = {
1200
+ const l = i.length > 0 && i[0].name === "ctx", f = i.filter((h) => h.name !== "ctx"), d = f.filter((h) => !h.optional).map((h) => h.name), g = {}, p = {
1184
1201
  definitions: {},
1185
1202
  $defs: {}
1186
1203
  };
1187
- for (const d of l) {
1188
- const S = await A(e, t, d.type, c, u), b = ct(S, p, n, d.name);
1189
- d.defaultValue !== void 0 && st(b, d.defaultValue), m[d.name] = b;
1204
+ for (const h of f) {
1205
+ const S = await A(e, t, h.type, c, u), b = ct(S, p, n, h.name);
1206
+ h.defaultValue !== void 0 && st(b, h.defaultValue), g[h.name] = b;
1190
1207
  }
1191
- const y = s.replace(/^Promise<(.+)>$/, "$1").trim(), h = await A(
1208
+ const T = s.replace(/^Promise<(.+)>$/, "$1").trim(), y = await A(
1192
1209
  e,
1193
1210
  t,
1194
- y,
1211
+ T,
1195
1212
  c,
1196
1213
  u
1197
- ), T = {
1214
+ ), m = {
1198
1215
  type: "object",
1199
- properties: m,
1200
- required: g,
1216
+ properties: g,
1217
+ required: d,
1201
1218
  // BUG-APIGEN-029: hoisted definitions from param fragments — see
1202
1219
  // hoistNestedDefs. Only attached when non-empty so the common
1203
1220
  // (no-recursive-type) case's schema shape is unchanged.
@@ -1205,7 +1222,7 @@ async function V(e, t, r, o, n, i, s, a, c, u) {
1205
1222
  ...Object.keys(p.$defs).length > 0 ? { $defs: p.$defs } : {}
1206
1223
  };
1207
1224
  return {
1208
- id: xe(r, o),
1225
+ id: ve(r, o),
1209
1226
  host: "ts",
1210
1227
  namespace: r,
1211
1228
  path: o,
@@ -1214,21 +1231,21 @@ async function V(e, t, r, o, n, i, s, a, c, u) {
1214
1231
  streaming: !1,
1215
1232
  safe: !1,
1216
1233
  // action → false per §4
1217
- input: T,
1218
- output: h,
1234
+ input: m,
1235
+ output: y,
1219
1236
  envelope: {},
1220
1237
  typeText: {
1221
1238
  lang: "ts",
1222
- input: mt(i),
1223
- output: y
1239
+ input: gt(i),
1240
+ output: T
1224
1241
  },
1225
- ...f ? { hasCtx: !0 } : {}
1242
+ ...l ? { hasCtx: !0 } : {}
1226
1243
  };
1227
1244
  }
1228
1245
  function ut(e, t, r, o) {
1229
1246
  const n = P(r), i = [t, n];
1230
1247
  return {
1231
- id: xe(e, i),
1248
+ id: ve(e, i),
1232
1249
  host: "ts",
1233
1250
  namespace: e,
1234
1251
  path: i,
@@ -1243,10 +1260,10 @@ function ut(e, t, r, o) {
1243
1260
  typeText: null
1244
1261
  };
1245
1262
  }
1246
- function xe(e, t) {
1263
+ function ve(e, t) {
1247
1264
  return (e.raw ? [e, ...t] : t).map((o) => o.words.join("-")).join("/");
1248
1265
  }
1249
- function ve(e) {
1266
+ function xe(e) {
1250
1267
  return e.split(/[-_.]+/).flatMap(
1251
1268
  (t) => (
1252
1269
  // Then split PascalCase / camelCase transitions
@@ -1255,12 +1272,12 @@ function ve(e) {
1255
1272
  ).map((t) => t.toLowerCase()).filter(Boolean);
1256
1273
  }
1257
1274
  function P(e) {
1258
- return { raw: e, words: ve(e) };
1275
+ return { raw: e, words: xe(e) };
1259
1276
  }
1260
- function ft(e) {
1277
+ function lt(e) {
1261
1278
  return e.replace(/\.[^.]+$/, "").replace(/[._]+/g, "-");
1262
1279
  }
1263
- function lt(e) {
1280
+ function ft(e) {
1264
1281
  const t = [];
1265
1282
  for (const r of e.getStatements()) {
1266
1283
  if (r.getKindName() !== "ExpressionStatement")
@@ -1273,8 +1290,8 @@ function lt(e) {
1273
1290
  continue;
1274
1291
  const s = n.getRight(), a = s.getType();
1275
1292
  for (const c of a.getProperties()) {
1276
- const f = c.getTypeAtLocation(s).getCallSignatures();
1277
- f.length !== 0 && t.push({ name: c.getName(), sig: f[0] });
1293
+ const l = c.getTypeAtLocation(s).getCallSignatures();
1294
+ l.length !== 0 && t.push({ name: c.getName(), sig: l[0] });
1278
1295
  }
1279
1296
  }
1280
1297
  return t;
@@ -1302,7 +1319,7 @@ function ue(e, t) {
1302
1319
  };
1303
1320
  });
1304
1321
  }
1305
- function fe(e, t, r) {
1322
+ function le(e, t, r) {
1306
1323
  return e.getParameters().map((o) => {
1307
1324
  var a;
1308
1325
  const n = o.getDeclarations(), i = n.length > 0 && n[0].getKindName() === "Parameter" ? n[0] : null, s = o.isOptional() || ((i == null ? void 0 : i.hasInitializer()) ?? !1) || (((a = i == null ? void 0 : i.hasQuestionToken) == null ? void 0 : a.call(i)) ?? !1);
@@ -1318,7 +1335,7 @@ function fe(e, t, r) {
1318
1335
  };
1319
1336
  });
1320
1337
  }
1321
- function D(e, t) {
1338
+ function q(e, t) {
1322
1339
  return e.getParameters().map((r) => {
1323
1340
  var s, a, c;
1324
1341
  const o = r.getDeclarations(), n = o.length > 0 && o[0].getKindName() === "Parameter" ? o[0] : null, i = r.isOptional() || ((n == null ? void 0 : n.hasInitializer()) ?? !1) || (((s = n == null ? void 0 : n.hasQuestionToken) == null ? void 0 : s.call(n)) ?? !1);
@@ -1330,28 +1347,28 @@ function D(e, t) {
1330
1347
  };
1331
1348
  });
1332
1349
  }
1333
- function mt(e) {
1350
+ function gt(e) {
1334
1351
  const t = e.filter((r) => r.name !== "ctx");
1335
1352
  return t.length === 0 ? "()" : "(" + t.map((r) => `${r.name}${r.optional ? "?" : ""}: ${r.type}`).join(", ") + ")";
1336
1353
  }
1337
1354
  function _(e) {
1338
1355
  return !!(e === "__samples__" || e.startsWith("__"));
1339
1356
  }
1340
- function E(e, t, r = /* @__PURE__ */ new Set()) {
1357
+ function k(e, t, r = /* @__PURE__ */ new Set()) {
1341
1358
  if (e.getCallSignatures().length > 0 || e.getConstructSignatures().length > 0)
1342
1359
  return !1;
1343
1360
  if (e.isString() || e.isNumber() || e.isBoolean() || e.isNull() || e.isUndefined() || e.isStringLiteral() || e.isNumberLiteral() || e.isBooleanLiteral() || e.isEnumLiteral())
1344
1361
  return !0;
1345
1362
  if (e.isArray() || e.isReadonlyArray()) {
1346
1363
  const o = e.getArrayElementType();
1347
- return o ? E(o, t, r) : !1;
1364
+ return o ? k(o, t, r) : !1;
1348
1365
  }
1349
1366
  if (e.isTuple())
1350
- return e.getTupleElements().every((o) => E(o, t, r));
1367
+ return e.getTupleElements().every((o) => k(o, t, r));
1351
1368
  if (e.isUnion())
1352
- return e.getUnionTypes().every((o) => E(o, t, r));
1369
+ return e.getUnionTypes().every((o) => k(o, t, r));
1353
1370
  if (e.isIntersection())
1354
- return e.getIntersectionTypes().every((o) => E(o, t, r));
1371
+ return e.getIntersectionTypes().every((o) => k(o, t, r));
1355
1372
  if (e.isObject()) {
1356
1373
  const o = e.getText(t);
1357
1374
  if (r.has(o))
@@ -1360,55 +1377,55 @@ function E(e, t, r = /* @__PURE__ */ new Set()) {
1360
1377
  const n = e.getStringIndexType(), i = e.getNumberIndexType();
1361
1378
  if (n || i)
1362
1379
  return [n, i].every(
1363
- (a) => !a || E(a, t, r)
1380
+ (a) => !a || k(a, t, r)
1364
1381
  );
1365
1382
  const s = e.getProperties();
1366
1383
  return s.length === 0 ? !0 : s.every((a) => {
1367
1384
  const c = a.getTypeAtLocation(t);
1368
- return E(c, t, r);
1385
+ return k(c, t, r);
1369
1386
  });
1370
1387
  }
1371
1388
  return !1;
1372
1389
  }
1373
- async function Ot(e) {
1374
- const t = e.session === void 0, r = de(e.session ?? ge());
1390
+ async function kt(e) {
1391
+ const t = e.session === void 0, r = de(e.session ?? me());
1375
1392
  try {
1376
- return await gt(e, r);
1393
+ return await mt(e, r);
1377
1394
  } finally {
1378
1395
  t && r.dispose();
1379
1396
  }
1380
1397
  }
1381
- async function gt(e, t) {
1398
+ async function mt(e, t) {
1382
1399
  const {
1383
1400
  sourceFile: r,
1384
1401
  namespace: o = "",
1385
1402
  tsconfig: n,
1386
1403
  includeInstances: i = !1
1387
- } = e, s = t.projectFor(n), a = t.sourceFileFor(r, n), c = Q.basename(r), u = C(yt(c)), f = C(o), l = [];
1388
- for (const [g, m] of a.getExportedDeclarations()) {
1389
- const p = m.find(
1390
- (T) => T.getKindName() === "ClassDeclaration"
1404
+ } = e, s = t.projectFor(n), a = t.sourceFileFor(r, n), c = Q.basename(r), u = I(yt(c)), l = I(o), f = [];
1405
+ for (const [d, g] of a.getExportedDeclarations()) {
1406
+ const p = g.find(
1407
+ (m) => m.getKindName() === "ClassDeclaration"
1391
1408
  );
1392
1409
  if (!p)
1393
1410
  continue;
1394
- const y = g === "default" ? p.getName() : g;
1395
- if (!y || W(y))
1411
+ const T = d === "default" ? p.getName() : d;
1412
+ if (!T || W(T))
1396
1413
  continue;
1397
- const h = C(y);
1398
- for (const T of p.getStaticMethods()) {
1399
- const x = T.getName();
1400
- if (W(x))
1414
+ const y = I(T);
1415
+ for (const m of p.getStaticMethods()) {
1416
+ const v = m.getName();
1417
+ if (W(v))
1401
1418
  continue;
1402
- const d = T.getScope();
1403
- if (d === R.Private || d === R.Protected)
1419
+ const h = m.getScope();
1420
+ if (h === R.Private || h === R.Protected)
1404
1421
  continue;
1405
- const S = T.getSignature(), b = q(S, T), $ = S.getReturnType().getText(), j = T.isAsync(), v = [u, h, C(x)];
1406
- l.push(
1422
+ const S = m.getSignature(), b = D(S, m), $ = S.getReturnType().getText(), j = m.isAsync(), x = [u, y, I(v)];
1423
+ f.push(
1407
1424
  await dt(
1408
1425
  s,
1409
1426
  a,
1410
- f,
1411
- v,
1427
+ l,
1428
+ x,
1412
1429
  b,
1413
1430
  $,
1414
1431
  j,
@@ -1419,31 +1436,31 @@ async function gt(e, t) {
1419
1436
  }
1420
1437
  if (i) {
1421
1438
  {
1422
- const x = p.getConstructors()[0] ?? null;
1423
- let d = [];
1424
- if (x) {
1425
- const w = x.getSignature();
1426
- d = q(w, x);
1439
+ const v = p.getConstructors()[0] ?? null;
1440
+ let h = [];
1441
+ if (v) {
1442
+ const w = v.getSignature();
1443
+ h = D(w, v);
1427
1444
  }
1428
- const S = [u, h], b = Z(f, S), $ = d.filter((w) => w.name !== "ctx"), j = $.filter((w) => !w.optional).map((w) => w.name), v = {};
1445
+ const S = [u, y], b = Z(l, S), $ = h.filter((w) => w.name !== "ctx"), j = $.filter((w) => !w.optional).map((w) => w.name), x = {};
1429
1446
  for (const w of $)
1430
- v[w.name] = await A(
1447
+ x[w.name] = await A(
1431
1448
  s,
1432
1449
  a,
1433
1450
  w.type,
1434
1451
  n,
1435
1452
  t
1436
1453
  );
1437
- l.push({
1454
+ f.push({
1438
1455
  id: b,
1439
1456
  host: "ts",
1440
- namespace: f,
1457
+ namespace: l,
1441
1458
  path: S,
1442
1459
  kind: "constructor",
1443
1460
  async: !1,
1444
1461
  streaming: !1,
1445
1462
  safe: !1,
1446
- input: { type: "object", properties: v, required: j },
1463
+ input: { type: "object", properties: x, required: j },
1447
1464
  output: {
1448
1465
  type: "object",
1449
1466
  properties: { instanceId: { type: "string" } },
@@ -1452,19 +1469,19 @@ async function gt(e, t) {
1452
1469
  envelope: {},
1453
1470
  typeText: {
1454
1471
  lang: "ts",
1455
- input: ht(d),
1472
+ input: ht(h),
1456
1473
  output: "{ instanceId: string }"
1457
1474
  }
1458
1475
  });
1459
1476
  }
1460
- for (const T of p.getInstanceMethods()) {
1461
- const x = T.getName();
1462
- if (W(x))
1477
+ for (const m of p.getInstanceMethods()) {
1478
+ const v = m.getName();
1479
+ if (W(v))
1463
1480
  continue;
1464
- const d = T.getScope();
1465
- if (d === R.Private || d === R.Protected)
1481
+ const h = m.getScope();
1482
+ if (h === R.Private || h === R.Protected)
1466
1483
  continue;
1467
- const S = T.getSignature(), b = q(S, T), $ = S.getReturnType().getText(), j = T.isAsync(), v = [u, h, C(x)], w = Z(f, v), F = b.filter((N) => N.name !== "ctx"), K = F.filter((N) => !N.optional).map((N) => N.name), Y = {};
1484
+ const S = m.getSignature(), b = D(S, m), $ = S.getReturnType().getText(), j = m.isAsync(), x = [u, y, I(v)], w = Z(l, x), F = b.filter((N) => N.name !== "ctx"), K = F.filter((N) => !N.optional).map((N) => N.name), Y = {};
1468
1485
  for (const N of F)
1469
1486
  Y[N.name] = await A(
1470
1487
  s,
@@ -1480,11 +1497,11 @@ async function gt(e, t) {
1480
1497
  n,
1481
1498
  t
1482
1499
  );
1483
- l.push({
1500
+ f.push({
1484
1501
  id: w,
1485
1502
  host: "ts",
1486
- namespace: f,
1487
- path: v,
1503
+ namespace: l,
1504
+ path: x,
1488
1505
  kind: "instance-method",
1489
1506
  async: j,
1490
1507
  streaming: !1,
@@ -1505,22 +1522,22 @@ async function gt(e, t) {
1505
1522
  }
1506
1523
  }
1507
1524
  }
1508
- return l;
1525
+ return f;
1509
1526
  }
1510
1527
  async function dt(e, t, r, o, n, i, s, a, c) {
1511
- const u = n.filter((y) => y.name !== "ctx"), f = u.filter((y) => !y.optional).map((y) => y.name), l = {};
1512
- for (const y of u)
1513
- l[y.name] = await A(
1528
+ const u = n.filter((T) => T.name !== "ctx"), l = u.filter((T) => !T.optional).map((T) => T.name), f = {};
1529
+ for (const T of u)
1530
+ f[T.name] = await A(
1514
1531
  e,
1515
1532
  t,
1516
- y.type,
1533
+ T.type,
1517
1534
  a,
1518
1535
  c
1519
1536
  );
1520
- const g = i.replace(/^Promise<(.+)>$/, "$1").trim(), m = await A(
1537
+ const d = i.replace(/^Promise<(.+)>$/, "$1").trim(), g = await A(
1521
1538
  e,
1522
1539
  t,
1523
- g,
1540
+ d,
1524
1541
  a,
1525
1542
  c
1526
1543
  );
@@ -1534,26 +1551,26 @@ async function dt(e, t, r, o, n, i, s, a, c) {
1534
1551
  streaming: !1,
1535
1552
  safe: !1,
1536
1553
  // action → false per §4
1537
- input: { type: "object", properties: l, required: f },
1538
- output: m,
1554
+ input: { type: "object", properties: f, required: l },
1555
+ output: g,
1539
1556
  envelope: {},
1540
1557
  typeText: {
1541
1558
  lang: "ts",
1542
1559
  input: we(n),
1543
- output: g
1560
+ output: d
1544
1561
  }
1545
1562
  };
1546
1563
  }
1547
1564
  function Z(e, t) {
1548
1565
  return (e.raw ? [e, ...t] : t).map((o) => o.words.join("-")).join("/");
1549
1566
  }
1550
- function C(e) {
1551
- return { raw: e, words: ve(e) };
1567
+ function I(e) {
1568
+ return { raw: e, words: xe(e) };
1552
1569
  }
1553
1570
  function yt(e) {
1554
1571
  return e.replace(/\.[^.]+$/, "").replace(/[._]+/g, "-");
1555
1572
  }
1556
- function q(e, t) {
1573
+ function D(e, t) {
1557
1574
  return e.getParameters().map((r) => {
1558
1575
  var s;
1559
1576
  const o = r.getDeclarations(), n = o.length > 0 && o[0].getKindName() === "Parameter" ? o[0] : null, i = r.isOptional() || ((n == null ? void 0 : n.hasInitializer()) ?? !1) || (((s = n == null ? void 0 : n.hasQuestionToken) == null ? void 0 : s.call(n)) ?? !1);
@@ -1596,23 +1613,24 @@ function St(e) {
1596
1613
  function bt(e) {
1597
1614
  return e.language ?? "ts";
1598
1615
  }
1599
- function xt(e, t) {
1616
+ function vt(e, t) {
1600
1617
  const r = St(t);
1601
1618
  return r === void 0 ? !1 : r === bt(e);
1602
1619
  }
1603
1620
  function Et(e, t) {
1604
- return t.filter((r) => xt(e, r));
1621
+ return t.filter((r) => vt(e, r));
1605
1622
  }
1606
1623
  export {
1607
1624
  At as clearPersistentProjectCache,
1608
- Pt as composeSchemas,
1609
- ge as createExtractionSession,
1625
+ Nt as composeSchemas,
1626
+ me as createExtractionSession,
1610
1627
  bt as effectiveLanguage,
1611
- Nt as extract,
1612
- Ot as extractClasses,
1613
- Ce as isPrimitiveOnlyInputSchema,
1628
+ Ot as extract,
1629
+ kt as extractClasses,
1630
+ Ie as isPrimitiveOnlyInputSchema,
1614
1631
  St as languageOfSource,
1615
- xt as pluginConsumesSource,
1632
+ vt as pluginConsumesSource,
1633
+ Pt as pluginsToEnvelopeMiddlewares,
1616
1634
  Et as sourcesForPlugin,
1617
- ve as tokenize
1635
+ xe as tokenize
1618
1636
  };