@moldea.ai/adapter-openai-agents-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/cover.png +0 -0
  4. package/dist/adapter/index.d.ts +3 -0
  5. package/dist/adapter/index.d.ts.map +1 -0
  6. package/dist/constants/index.d.ts +7 -0
  7. package/dist/constants/index.d.ts.map +1 -0
  8. package/dist/contracts/index.d.ts +164 -0
  9. package/dist/contracts/index.d.ts.map +1 -0
  10. package/dist/diagnostics/index.d.ts +32 -0
  11. package/dist/diagnostics/index.d.ts.map +1 -0
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +1993 -0
  15. package/dist/inspection/common.d.ts +36 -0
  16. package/dist/inspection/common.d.ts.map +1 -0
  17. package/dist/inspection/handoffs.d.ts +6 -0
  18. package/dist/inspection/handoffs.d.ts.map +1 -0
  19. package/dist/inspection/index.d.ts +2 -0
  20. package/dist/inspection/index.d.ts.map +1 -0
  21. package/dist/inspection/inspection.d.ts +18 -0
  22. package/dist/inspection/inspection.d.ts.map +1 -0
  23. package/dist/inspection/package-inspection.d.ts +7 -0
  24. package/dist/inspection/package-inspection.d.ts.map +1 -0
  25. package/dist/inspection/relationships.d.ts +6 -0
  26. package/dist/inspection/relationships.d.ts.map +1 -0
  27. package/dist/inspection/session.d.ts +5 -0
  28. package/dist/inspection/session.d.ts.map +1 -0
  29. package/dist/package-discovery/index.d.ts +27 -0
  30. package/dist/package-discovery/index.d.ts.map +1 -0
  31. package/dist/source-analysis/agent-definitions.d.ts +20 -0
  32. package/dist/source-analysis/agent-definitions.d.ts.map +1 -0
  33. package/dist/source-analysis/bindings.d.ts +11 -0
  34. package/dist/source-analysis/bindings.d.ts.map +1 -0
  35. package/dist/source-analysis/function-tools.d.ts +9 -0
  36. package/dist/source-analysis/function-tools.d.ts.map +1 -0
  37. package/dist/source-analysis/handoffs.d.ts +27 -0
  38. package/dist/source-analysis/handoffs.d.ts.map +1 -0
  39. package/dist/source-analysis/index.d.ts +11 -0
  40. package/dist/source-analysis/index.d.ts.map +1 -0
  41. package/dist/source-analysis/instruction-loaders.d.ts +11 -0
  42. package/dist/source-analysis/instruction-loaders.d.ts.map +1 -0
  43. package/dist/source-analysis/mutations.d.ts +15 -0
  44. package/dist/source-analysis/mutations.d.ts.map +1 -0
  45. package/dist/source-analysis/source-analysis.d.ts +11 -0
  46. package/dist/source-analysis/source-analysis.d.ts.map +1 -0
  47. package/dist/source-analysis/static-strings.d.ts +11 -0
  48. package/dist/source-analysis/static-strings.d.ts.map +1 -0
  49. package/dist/source-analysis/tool-collections.d.ts +27 -0
  50. package/dist/source-analysis/tool-collections.d.ts.map +1 -0
  51. package/package.json +60 -0
package/dist/index.js ADDED
@@ -0,0 +1,1993 @@
1
+ import { posix } from "node:path";
2
+ import { intersects, subset, validRange } from "semver";
3
+ import ts from "typescript";
4
+ import { parseRepositoryPath } from "@moldea.ai/repository";
5
+ //#region src/constants/index.ts
6
+ var OPENAI_AGENTS_SDK_ADAPTER_ID = "openai-agents-sdk";
7
+ var OPENAI_AGENTS_SDK_PACKAGE_NAME = "@openai/agents";
8
+ var OPENAI_AGENTS_SDK_SUPPORTED_RANGE = ">=0.16.1 <0.17.0";
9
+ var OPENAI_AGENTS_SDK_SUPPORTED_REPOSITORY_FORMAT_VERSIONS = Object.freeze([1]);
10
+ var OPENAI_AGENTS_SDK_TOOL_NAME_PATTERN = /^[A-Za-z0-9_]+$/;
11
+ //#endregion
12
+ //#region ../../packages/adapter-static-analysis/dist/index.js
13
+ /**
14
+ * Creates an operation-local inspection session with deterministic promise caches.
15
+ * @param options Provider callbacks and the optional operation signal.
16
+ * @returns Cached source, package, and entry inspection functions.
17
+ * @throws If the inspection is aborted.
18
+ */
19
+ var createInspectionSession = (options) => {
20
+ const sourceCache = /* @__PURE__ */ new Map();
21
+ const packageCache = /* @__PURE__ */ new Map();
22
+ const entryCache = /* @__PURE__ */ new Map();
23
+ const analyzeSource = (path) => {
24
+ options.signal?.throwIfAborted();
25
+ const existing = sourceCache.get(path);
26
+ if (existing !== void 0) return existing;
27
+ const analysis = (async () => {
28
+ options.signal?.throwIfAborted();
29
+ const bytes = await options.readFile(path, options.signal);
30
+ options.signal?.throwIfAborted();
31
+ const result = await options.analyzeSource(path, bytes, options.signal);
32
+ options.signal?.throwIfAborted();
33
+ return result;
34
+ })();
35
+ sourceCache.set(path, analysis);
36
+ return analysis;
37
+ };
38
+ const discoverPackage = (path) => {
39
+ options.signal?.throwIfAborted();
40
+ const existing = packageCache.get(path);
41
+ if (existing !== void 0) return existing;
42
+ const discovery = options.discoverPackage(path, options.signal);
43
+ packageCache.set(path, discovery);
44
+ return discovery;
45
+ };
46
+ const getEntry = (path) => {
47
+ options.signal?.throwIfAborted();
48
+ const existing = entryCache.get(path);
49
+ if (existing !== void 0) return existing;
50
+ const entry = options.getEntry(path, options.signal);
51
+ entryCache.set(path, entry);
52
+ return entry;
53
+ };
54
+ return Object.freeze({
55
+ analyzeSource,
56
+ discoverPackage,
57
+ getEntry,
58
+ ...options.signal === void 0 ? {} : { signal: options.signal }
59
+ });
60
+ };
61
+ var decoder = new TextDecoder("utf-8", {
62
+ fatal: true,
63
+ ignoreBOM: true
64
+ });
65
+ var findLineIndex = (lineStarts, offset) => {
66
+ let lower = 0;
67
+ let upper = lineStarts.length - 1;
68
+ while (lower < upper) {
69
+ const middle = Math.ceil((lower + upper) / 2);
70
+ if ((lineStarts[middle] ?? 0) <= offset) lower = middle;
71
+ else upper = middle - 1;
72
+ }
73
+ return lower;
74
+ };
75
+ /**
76
+ * Creates a TypeScript UTF-16-offset to Unicode-scalar source locator.
77
+ * @param value The normalized valid Unicode-scalar text.
78
+ * @returns The scalar-aware source locator.
79
+ */
80
+ var createSourceLocator = (value) => {
81
+ const scalarOffsets = new Uint32Array(value.length + 1);
82
+ const lineStarts = [0];
83
+ let scalarOffset = 0;
84
+ for (let codeUnitOffset = 0; codeUnitOffset < value.length;) {
85
+ const codePoint = value.codePointAt(codeUnitOffset);
86
+ const width = codePoint !== void 0 && codePoint > 65535 ? 2 : 1;
87
+ scalarOffsets[codeUnitOffset] = scalarOffset;
88
+ for (let interiorOffset = 1; interiorOffset < width; interiorOffset += 1) scalarOffsets[codeUnitOffset + interiorOffset] = scalarOffset;
89
+ codeUnitOffset += width;
90
+ scalarOffset += 1;
91
+ scalarOffsets[codeUnitOffset] = scalarOffset;
92
+ if (codePoint === 10) lineStarts.push(codeUnitOffset);
93
+ }
94
+ const locatePosition = (candidateOffset) => {
95
+ const codeUnitOffset = Math.max(0, Math.min(value.length, candidateOffset));
96
+ const lineIndex = findLineIndex(lineStarts, codeUnitOffset);
97
+ const lineStart = lineStarts[lineIndex] ?? 0;
98
+ const positionScalarOffset = scalarOffsets[codeUnitOffset] ?? 0;
99
+ return {
100
+ column: positionScalarOffset - (scalarOffsets[lineStart] ?? 0) + 1,
101
+ line: lineIndex + 1,
102
+ offset: positionScalarOffset
103
+ };
104
+ };
105
+ return Object.freeze({ locateRange: (startOffset, endOffset) => ({
106
+ end: locatePosition(endOffset),
107
+ start: locatePosition(startOffset)
108
+ }) });
109
+ };
110
+ /**
111
+ * Decodes and normalizes source bytes through the runtime-adapter text contract.
112
+ * @param bytes The exact reader-owned source bytes.
113
+ * @returns The normalized text and locator or an invalid-text result.
114
+ */
115
+ var normalizeText = (bytes) => {
116
+ let decoded;
117
+ try {
118
+ decoded = decoder.decode(bytes);
119
+ } catch {
120
+ return Object.freeze({ valid: false });
121
+ }
122
+ const value = (decoded.startsWith("") ? decoded.slice(1) : decoded).replace(/\r\n?/gu, "\n");
123
+ if (value.includes("\0")) return Object.freeze({ valid: false });
124
+ return Object.freeze({
125
+ locator: createSourceLocator(value),
126
+ valid: true,
127
+ value
128
+ });
129
+ };
130
+ var PACKAGE_DEPENDENCY_FIELDS = Object.freeze([
131
+ "dependencies",
132
+ "optionalDependencies",
133
+ "peerDependencies",
134
+ "devDependencies"
135
+ ]);
136
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
137
+ /**
138
+ * Creates nearest-to-root package-manifest candidates for one source path.
139
+ * @param sourcePath The normalized source path.
140
+ * @returns Deterministically ordered manifest paths.
141
+ */
142
+ var createPackageManifestCandidatePaths = (sourcePath) => {
143
+ const candidates = [];
144
+ let directory = posix.dirname(sourcePath);
145
+ while (true) {
146
+ candidates.push(posix.join(directory, "package.json"));
147
+ if (directory === "/") break;
148
+ directory = posix.dirname(directory);
149
+ }
150
+ return Object.freeze(candidates);
151
+ };
152
+ var extractPackageDeclarations = (manifest, packageName) => {
153
+ const declarations = [];
154
+ for (const field of PACKAGE_DEPENDENCY_FIELDS) {
155
+ const dependencies = manifest[field];
156
+ if (dependencies === void 0) continue;
157
+ if (!isRecord(dependencies)) return null;
158
+ const declaration = dependencies[packageName];
159
+ if (declaration === void 0) continue;
160
+ if (typeof declaration !== "string" || declaration.trim().length === 0) return null;
161
+ declarations.push(Object.freeze({
162
+ declaredRange: declaration,
163
+ dependencyKind: field
164
+ }));
165
+ }
166
+ return declarations;
167
+ };
168
+ var classifyPackageDeclarations = (declarations, supportedRange) => {
169
+ const classifications = declarations.map(({ declaredRange }) => {
170
+ const normalizedRange = validRange(declaredRange, {
171
+ loose: false,
172
+ includePrerelease: false
173
+ });
174
+ if (normalizedRange === null) return "ambiguous";
175
+ if (subset(normalizedRange, supportedRange, {
176
+ loose: false,
177
+ includePrerelease: false
178
+ })) return "supported";
179
+ if (!intersects(normalizedRange, supportedRange, {
180
+ loose: false,
181
+ includePrerelease: false
182
+ })) return "unsupported";
183
+ return "ambiguous";
184
+ });
185
+ if (classifications.every((classification) => classification === "supported")) return "supported";
186
+ if (classifications.every((classification) => classification === "unsupported")) return "unsupported";
187
+ return "ambiguous";
188
+ };
189
+ /**
190
+ * Discovers the nearest package declaration without repository enumeration.
191
+ * @param options The package target, repository callbacks, path, range, and signal.
192
+ * @returns The first observed declaration, invalid manifest, or absence result.
193
+ * @throws If repository reading or the active inspection is aborted.
194
+ */
195
+ var discoverPackage = async (options) => {
196
+ const { packageName, reader, signal, sourcePath, supportedRange } = options;
197
+ for (const manifestPath of createPackageManifestCandidatePaths(sourcePath)) {
198
+ signal?.throwIfAborted();
199
+ const entry = await reader.getEntry(manifestPath);
200
+ signal?.throwIfAborted();
201
+ if (entry === null) continue;
202
+ if (entry.type !== "file") return Object.freeze({
203
+ kind: "invalid",
204
+ path: manifestPath
205
+ });
206
+ const bytes = await reader.readFile(manifestPath);
207
+ signal?.throwIfAborted();
208
+ const text = normalizeText(bytes);
209
+ signal?.throwIfAborted();
210
+ if (!text.valid) return Object.freeze({
211
+ kind: "invalid",
212
+ path: manifestPath
213
+ });
214
+ let parsed;
215
+ try {
216
+ parsed = JSON.parse(text.value);
217
+ } catch {
218
+ return Object.freeze({
219
+ kind: "invalid",
220
+ path: manifestPath
221
+ });
222
+ }
223
+ signal?.throwIfAborted();
224
+ if (!isRecord(parsed)) return Object.freeze({
225
+ kind: "invalid",
226
+ path: manifestPath
227
+ });
228
+ const declarations = extractPackageDeclarations(parsed, packageName);
229
+ if (declarations === null) return Object.freeze({
230
+ kind: "invalid",
231
+ path: manifestPath
232
+ });
233
+ if (declarations.length === 0) return Object.freeze({ kind: "absent" });
234
+ return Object.freeze({
235
+ kind: "observed",
236
+ observation: Object.freeze({
237
+ compatibility: classifyPackageDeclarations(declarations, supportedRange),
238
+ declarations: Object.freeze(declarations),
239
+ path: manifestPath
240
+ })
241
+ });
242
+ }
243
+ return Object.freeze({ kind: "absent" });
244
+ };
245
+ /**
246
+ * Removes the transparent expression wrappers supported by runtime adapters.
247
+ * @param expression The expression to normalize.
248
+ * @returns The underlying expression used by static matching.
249
+ */
250
+ var unwrapExpression = (expression) => {
251
+ let current = expression;
252
+ while (ts.isAsExpression(current) || ts.isParenthesizedExpression(current) || ts.isSatisfiesExpression(current)) current = current.expression;
253
+ return current;
254
+ };
255
+ /**
256
+ * Resolves one direct call with an optional outer `await` wrapper.
257
+ * @param expression The candidate call expression.
258
+ * @returns The direct call or `null` when the form is unsupported.
259
+ */
260
+ var getDirectCall = (expression) => {
261
+ const unwrapped = unwrapExpression(expression);
262
+ const candidate = ts.isAwaitExpression(unwrapped) ? unwrapExpression(unwrapped.expression) : unwrapped;
263
+ return ts.isCallExpression(candidate) ? candidate : null;
264
+ };
265
+ /**
266
+ * Reads an exact static string literal from one expression.
267
+ * @param expression The candidate string expression.
268
+ * @returns Its exact value or `null` when dynamic.
269
+ */
270
+ var getStaticString = (expression) => {
271
+ if (expression === null || expression === void 0) return null;
272
+ const candidate = unwrapExpression(expression);
273
+ return ts.isStringLiteral(candidate) || ts.isNoSubstitutionTemplateLiteral(candidate) ? candidate.text : null;
274
+ };
275
+ var hasModifier = (node, kind) => ts.canHaveModifiers(node) && (ts.getModifiers(node)?.some((modifier) => modifier.kind === kind) ?? false);
276
+ var isConstDeclarationList = (declarationList) => (declarationList.flags & ts.NodeFlags.Const) !== 0;
277
+ /**
278
+ * Indexes static value imports and supported SDK constructor imports.
279
+ * @param sourceFile The parsed TypeScript source.
280
+ * @param config The provider package and constructor import forms.
281
+ * @returns Module-owned import bindings needed by static checks.
282
+ */
283
+ var indexImports = (sourceFile, config) => {
284
+ const constructorNames = /* @__PURE__ */ new Set();
285
+ const namedImports = /* @__PURE__ */ new Map();
286
+ const supportedNamedImports = new Set(config.namedConstructorImports);
287
+ for (const statement of sourceFile.statements) {
288
+ if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) continue;
289
+ const importClause = statement.importClause;
290
+ if (importClause?.isTypeOnly === true) continue;
291
+ const moduleSpecifier = statement.moduleSpecifier.text;
292
+ if (moduleSpecifier === config.packageName && config.supportsDefaultConstructorImport && importClause?.name !== void 0) constructorNames.add(importClause.name.text);
293
+ if (moduleSpecifier === config.packageName && importClause?.namedBindings !== void 0 && ts.isNamedImports(importClause.namedBindings)) for (const element of importClause.namedBindings.elements) {
294
+ const importedName = element.propertyName?.text ?? element.name.text;
295
+ if (!element.isTypeOnly && supportedNamedImports.has(importedName)) constructorNames.add(element.name.text);
296
+ }
297
+ if (!moduleSpecifier.startsWith(".") || importClause?.namedBindings === void 0 || !ts.isNamedImports(importClause.namedBindings)) continue;
298
+ for (const element of importClause.namedBindings.elements) {
299
+ if (element.isTypeOnly) continue;
300
+ namedImports.set(element.name.text, Object.freeze({
301
+ importedName: element.propertyName?.text ?? element.name.text,
302
+ moduleSpecifier
303
+ }));
304
+ }
305
+ }
306
+ return {
307
+ constructorNames,
308
+ namedImports
309
+ };
310
+ };
311
+ /**
312
+ * Indexes direct exports, module-level SDK clients, and constant arrays.
313
+ * @param sourceFile The parsed TypeScript source.
314
+ * @param constructorNames The supported constructor bindings.
315
+ * @returns Static module declarations used by adapter inspection.
316
+ */
317
+ var indexModuleDeclarations = (sourceFile, constructorNames) => {
318
+ const clientNames = /* @__PURE__ */ new Set();
319
+ const exports = /* @__PURE__ */ new Map();
320
+ const moduleArrays = /* @__PURE__ */ new Map();
321
+ const moduleConstDeclarations = /* @__PURE__ */ new Map();
322
+ for (const statement of sourceFile.statements) {
323
+ if (ts.isFunctionDeclaration(statement) && statement.name !== void 0) {
324
+ if (hasModifier(statement, ts.SyntaxKind.ExportKeyword)) exports.set(statement.name.text, Object.freeze({
325
+ declaration: statement,
326
+ kind: statement.body === void 0 || hasModifier(statement, ts.SyntaxKind.DefaultKeyword) ? "present-unsupported" : "present-supported"
327
+ }));
328
+ continue;
329
+ }
330
+ if (ts.isExportDeclaration(statement) && statement.exportClause !== void 0) {
331
+ if (!ts.isNamedExports(statement.exportClause) || statement.isTypeOnly) continue;
332
+ for (const element of statement.exportClause.elements) if (!element.isTypeOnly) exports.set(element.name.text, Object.freeze({
333
+ declaration: element,
334
+ kind: "present-unsupported"
335
+ }));
336
+ continue;
337
+ }
338
+ if (!ts.isVariableStatement(statement)) {
339
+ if (hasModifier(statement, ts.SyntaxKind.ExportKeyword) && (ts.isClassDeclaration(statement) || ts.isEnumDeclaration(statement) || ts.isModuleDeclaration(statement)) && statement.name !== void 0 && ts.isIdentifier(statement.name)) exports.set(statement.name.text, Object.freeze({
340
+ declaration: statement,
341
+ kind: "present-unsupported"
342
+ }));
343
+ continue;
344
+ }
345
+ const isConst = isConstDeclarationList(statement.declarationList);
346
+ const isExported = hasModifier(statement, ts.SyntaxKind.ExportKeyword);
347
+ for (const declaration of statement.declarationList.declarations) {
348
+ if (!ts.isIdentifier(declaration.name)) continue;
349
+ if (isExported) exports.set(declaration.name.text, Object.freeze({
350
+ declaration,
351
+ kind: isConst && declaration.initializer !== void 0 ? "present-supported" : "present-unsupported"
352
+ }));
353
+ if (!isConst || declaration.initializer === void 0) continue;
354
+ moduleConstDeclarations.set(declaration.name.text, declaration);
355
+ const initializer = unwrapExpression(declaration.initializer);
356
+ if (ts.isNewExpression(initializer)) {
357
+ const constructor = unwrapExpression(initializer.expression);
358
+ if (ts.isIdentifier(constructor) && constructorNames.has(constructor.text)) clientNames.add(declaration.name.text);
359
+ }
360
+ if (ts.isArrayLiteralExpression(initializer)) moduleArrays.set(declaration.name.text, Object.freeze({
361
+ declaration,
362
+ expression: initializer
363
+ }));
364
+ }
365
+ }
366
+ return {
367
+ clientNames,
368
+ exports,
369
+ moduleArrays,
370
+ moduleConstDeclarations
371
+ };
372
+ };
373
+ var addBindingNames = (names, bindingName) => {
374
+ if (ts.isIdentifier(bindingName)) {
375
+ names.add(bindingName.text);
376
+ return;
377
+ }
378
+ for (const element of bindingName.elements) if (!ts.isOmittedExpression(element)) addBindingNames(names, element.name);
379
+ };
380
+ var addVariableDeclarationListBindings = (names, declarationList) => {
381
+ for (const declaration of declarationList.declarations) addBindingNames(names, declaration.name);
382
+ };
383
+ var addStatementBindings = (names, statement) => {
384
+ if (ts.isVariableStatement(statement)) {
385
+ addVariableDeclarationListBindings(names, statement.declarationList);
386
+ return;
387
+ }
388
+ if (ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement) || ts.isEnumDeclaration(statement) || ts.isModuleDeclaration(statement)) {
389
+ if (statement.name !== void 0 && ts.isIdentifier(statement.name)) names.add(statement.name.text);
390
+ }
391
+ };
392
+ var isFunctionScope = (node) => ts.isArrowFunction(node) || ts.isConstructorDeclaration(node) || ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isGetAccessorDeclaration(node) || ts.isMethodDeclaration(node) || ts.isSetAccessorDeclaration(node);
393
+ var getLocalBindingNames = (bindings, scope) => {
394
+ const existingNames = bindings.get(scope);
395
+ if (existingNames !== void 0) return existingNames;
396
+ const names = /* @__PURE__ */ new Set();
397
+ bindings.set(scope, names);
398
+ return names;
399
+ };
400
+ /**
401
+ * Indexes local runtime bindings that can shadow module-owned identifiers.
402
+ * @param sourceFile The parsed TypeScript source.
403
+ * @returns Local binding names keyed by lexical or function scope.
404
+ */
405
+ var indexLocalBindingNames = (sourceFile) => {
406
+ const bindings = /* @__PURE__ */ new Map();
407
+ const visit = (node, functionScope) => {
408
+ let childFunctionScope = functionScope;
409
+ if (isFunctionScope(node)) {
410
+ const names = getLocalBindingNames(bindings, node);
411
+ for (const parameter of node.parameters) addBindingNames(names, parameter.name);
412
+ if (node.name !== void 0 && ts.isIdentifier(node.name)) names.add(node.name.text);
413
+ childFunctionScope = node;
414
+ }
415
+ if (ts.isBlock(node) || ts.isModuleBlock(node)) {
416
+ const names = getLocalBindingNames(bindings, node);
417
+ for (const statement of node.statements) addStatementBindings(names, statement);
418
+ } else if (ts.isCaseBlock(node)) {
419
+ const names = getLocalBindingNames(bindings, node);
420
+ for (const clause of node.clauses) for (const statement of clause.statements) addStatementBindings(names, statement);
421
+ } else if (ts.isCatchClause(node) && node.variableDeclaration !== void 0) addBindingNames(getLocalBindingNames(bindings, node), node.variableDeclaration.name);
422
+ else if ((ts.isForStatement(node) || ts.isForInStatement(node) || ts.isForOfStatement(node)) && node.initializer !== void 0 && ts.isVariableDeclarationList(node.initializer)) addVariableDeclarationListBindings(getLocalBindingNames(bindings, node), node.initializer);
423
+ else if (ts.isClassExpression(node) && node.name !== void 0) getLocalBindingNames(bindings, node).add(node.name.text);
424
+ if (childFunctionScope !== null && ts.isVariableDeclarationList(node) && (node.flags & ts.NodeFlags.BlockScoped) === 0) addVariableDeclarationListBindings(getLocalBindingNames(bindings, childFunctionScope), node);
425
+ ts.forEachChild(node, (child) => visit(child, childFunctionScope));
426
+ };
427
+ visit(sourceFile, null);
428
+ return bindings;
429
+ };
430
+ /**
431
+ * Indexes identifier occurrences once for binding-specific safety analysis.
432
+ * @param sourceFile The parsed TypeScript source.
433
+ * @returns Identifier occurrences grouped by exact source spelling.
434
+ */
435
+ var indexIdentifierUses = (sourceFile) => {
436
+ const identifierUses = /* @__PURE__ */ new Map();
437
+ const visit = (node) => {
438
+ if (ts.isIdentifier(node)) {
439
+ const uses = identifierUses.get(node.text) ?? [];
440
+ uses.push(node);
441
+ identifierUses.set(node.text, uses);
442
+ }
443
+ ts.forEachChild(node, visit);
444
+ };
445
+ visit(sourceFile);
446
+ return new Map([...identifierUses].map(([name, uses]) => [name, Object.freeze(uses)]));
447
+ };
448
+ /**
449
+ * Determines whether a module-bound name is visible at one identifier use.
450
+ * @param identifier The identifier whose lexical environment is inspected.
451
+ * @param analysis The indexed source containing the identifier.
452
+ * @returns Whether no parameter or local declaration shadows the module binding.
453
+ */
454
+ var isModuleBindingVisible = (identifier, analysis) => {
455
+ let current = identifier.parent;
456
+ while (current !== void 0 && !ts.isSourceFile(current)) {
457
+ if (analysis.localBindingNames.get(current)?.has(identifier.text) === true) return false;
458
+ current = current.parent;
459
+ }
460
+ return true;
461
+ };
462
+ /**
463
+ * Resolves TypeScript source candidates for a supported relative ESM specifier.
464
+ * @param containingPath The importing source path.
465
+ * @param moduleSpecifier The exact relative ESM specifier.
466
+ * @returns Supported logical source candidates in deterministic order.
467
+ */
468
+ var resolveImportCandidatePaths = (containingPath, moduleSpecifier) => {
469
+ const resolved = posix.resolve(posix.dirname(containingPath), moduleSpecifier);
470
+ if (resolved.endsWith(".js")) return [`${resolved.slice(0, -3)}.ts`, `${resolved.slice(0, -3)}.tsx`];
471
+ if (resolved.endsWith(".mjs")) return [`${resolved.slice(0, -4)}.mts`];
472
+ return [
473
+ ".ts",
474
+ ".tsx",
475
+ ".mts"
476
+ ].some((extension) => resolved.endsWith(extension)) ? [resolved] : [];
477
+ };
478
+ /**
479
+ * Resolves the explicit module references an identifier can denote.
480
+ * @param identifier The local source identifier.
481
+ * @param analysis The source containing that identifier.
482
+ * @returns Same-file or relative-import candidates in deterministic order.
483
+ */
484
+ var resolveBindingReferences = (identifier, analysis) => {
485
+ if (!isModuleBindingVisible(identifier, analysis)) return [];
486
+ const references = [];
487
+ if (analysis.exports.has(identifier.text)) references.push(Object.freeze({
488
+ path: analysis.path,
489
+ symbol: identifier.text
490
+ }));
491
+ const namedImport = analysis.namedImports.get(identifier.text);
492
+ if (namedImport !== void 0) references.push(...resolveImportCandidatePaths(analysis.path, namedImport.moduleSpecifier).map((path) => Object.freeze({
493
+ path,
494
+ symbol: namedImport.importedName
495
+ })));
496
+ return references;
497
+ };
498
+ /**
499
+ * Checks whether an identifier resolves directly to an explicit bound reference.
500
+ * @param identifier The local source identifier.
501
+ * @param analysis The source containing that identifier.
502
+ * @param reference The explicit source binding to match.
503
+ * @returns Whether local or named-import identity proves the relationship.
504
+ */
505
+ var isBoundIdentifier = (identifier, analysis, reference) => {
506
+ if (reference.symbol === void 0) return false;
507
+ return resolveBindingReferences(identifier, analysis).some((candidate) => candidate.path === reference.path && candidate.symbol === reference.symbol);
508
+ };
509
+ var READONLY_ARRAY_METHODS = /* @__PURE__ */ new Set([
510
+ "at",
511
+ "concat",
512
+ "entries",
513
+ "flat",
514
+ "includes",
515
+ "indexOf",
516
+ "join",
517
+ "keys",
518
+ "lastIndexOf",
519
+ "slice",
520
+ "toLocaleString",
521
+ "toReversed",
522
+ "toSpliced",
523
+ "toString",
524
+ "values",
525
+ "with"
526
+ ]);
527
+ var skipTransparentParents$1 = (node) => {
528
+ let current = node;
529
+ while (ts.isAsExpression(current.parent) || ts.isParenthesizedExpression(current.parent) || ts.isSatisfiesExpression(current.parent)) current = current.parent;
530
+ return current;
531
+ };
532
+ var isAssignmentOperator$1 = (kind) => kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;
533
+ var isAssignmentTarget = (expression) => {
534
+ let current = skipTransparentParents$1(expression);
535
+ while (true) {
536
+ const parent = current.parent;
537
+ if (ts.isBinaryExpression(parent) && isAssignmentOperator$1(parent.operatorToken.kind)) return parent.left === current;
538
+ if ((ts.isPrefixUnaryExpression(parent) || ts.isPostfixUnaryExpression(parent)) && parent.operand === current && (parent.operator === ts.SyntaxKind.PlusPlusToken || parent.operator === ts.SyntaxKind.MinusMinusToken)) return true;
539
+ if (ts.isDeleteExpression(parent) && parent.expression === current) return true;
540
+ if ((ts.isForInStatement(parent) || ts.isForOfStatement(parent)) && parent.initializer === current) return true;
541
+ if (ts.isPropertyAccessExpression(parent) || ts.isElementAccessExpression(parent) || ts.isPropertyAssignment(parent) || ts.isSpreadAssignment(parent) || ts.isSpreadElement(parent) || ts.isArrayLiteralExpression(parent) || ts.isObjectLiteralExpression(parent)) {
542
+ current = skipTransparentParents$1(parent);
543
+ continue;
544
+ }
545
+ return false;
546
+ }
547
+ };
548
+ var getStaticMemberName$1 = (member) => {
549
+ if (ts.isPropertyAccessExpression(member)) return member.name.text;
550
+ const argument = member.argumentExpression;
551
+ return argument !== void 0 && (ts.isStringLiteral(argument) || ts.isNoSubstitutionTemplateLiteral(argument)) ? argument.text : null;
552
+ };
553
+ var isSafeArrayMemberUse = (member) => {
554
+ if (isAssignmentTarget(member)) return false;
555
+ const candidate = skipTransparentParents$1(member);
556
+ const parent = candidate.parent;
557
+ if (!ts.isCallExpression(parent) || parent.expression !== candidate) return ts.isPropertyAccessExpression(member) && member.name.text === "length";
558
+ const memberName = getStaticMemberName$1(member);
559
+ const call = skipTransparentParents$1(parent);
560
+ return memberName !== null && READONLY_ARRAY_METHODS.has(memberName) && ts.isExpressionStatement(call.parent);
561
+ };
562
+ var isIgnoredIdentifierPosition = (identifier, declarationName) => identifier === declarationName || ts.isImportSpecifier(identifier.parent) || ts.isPropertyAssignment(identifier.parent) && identifier.parent.name === identifier || ts.isPropertyAccessExpression(identifier.parent) && identifier.parent.name === identifier;
563
+ /**
564
+ * Determines whether a module value binding has only explicitly allowed value uses.
565
+ * @param analysis The indexed source containing the binding references.
566
+ * @param bindingName The exact lexically visible module binding name.
567
+ * @param declarationName The optional local declaration identifier to exclude.
568
+ * @param allowedReferences Exact bare identifier occurrences owned by supported relationships.
569
+ * @param kind Whether array read-only member access is permitted for the value.
570
+ * @returns Whether the binding cannot be aliased, escaped, reassigned, or mutated.
571
+ */
572
+ var isModuleValueBindingSafe = (analysis, bindingName, declarationName, allowedReferences, kind) => {
573
+ const identifierUses = analysis.identifierUses.get(bindingName) ?? [];
574
+ for (const identifier of identifierUses) {
575
+ if (isIgnoredIdentifierPosition(identifier, declarationName) || !isModuleBindingVisible(identifier, analysis)) continue;
576
+ if (allowedReferences.has(identifier)) continue;
577
+ const expression = skipTransparentParents$1(identifier);
578
+ const parent = expression.parent;
579
+ const member = (ts.isPropertyAccessExpression(parent) || ts.isElementAccessExpression(parent)) && parent.expression === expression ? parent : null;
580
+ if (kind !== "array" || member === null || !isSafeArrayMemberUse(member)) return false;
581
+ }
582
+ return true;
583
+ };
584
+ /**
585
+ * Determines whether a module-local constant literal has only explicitly allowed value uses.
586
+ * @param analysis The indexed source containing the declaration and its references.
587
+ * @param declaration The module-local constant declaration to inspect.
588
+ * @param allowedReferences Exact bare identifier occurrences owned by supported relationships.
589
+ * @param kind Whether array read-only member access is permitted for the value.
590
+ * @returns Whether the binding cannot be aliased, escaped, reassigned, or mutated.
591
+ */
592
+ var isModuleConstValueSafe = (analysis, declaration, allowedReferences, kind) => {
593
+ if (!ts.isIdentifier(declaration.name)) return false;
594
+ return isModuleValueBindingSafe(analysis, declaration.name.text, declaration.name, allowedReferences, kind);
595
+ };
596
+ function getSafeModuleConstLiteral(expression, analysis, allowedReferences, kind) {
597
+ const candidate = unwrapExpression(expression);
598
+ if (!ts.isIdentifier(candidate) || !isModuleBindingVisible(candidate, analysis)) return null;
599
+ const declaration = analysis.moduleConstDeclarations.get(candidate.text);
600
+ const initializer = declaration?.initializer === void 0 ? null : unwrapExpression(declaration.initializer);
601
+ const isExpectedLiteral = initializer !== null && (kind === "array" ? ts.isArrayLiteralExpression(initializer) : ts.isObjectLiteralExpression(initializer));
602
+ if (declaration === void 0 || !isExpectedLiteral || !isModuleConstValueSafe(analysis, declaration, allowedReferences, kind)) return null;
603
+ return Object.freeze({
604
+ declaration,
605
+ expression: initializer
606
+ });
607
+ }
608
+ var getScriptKind = (path) => path.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
609
+ var createSyntaxProgram = (sourceFile, text) => {
610
+ return ts.createProgram({
611
+ host: {
612
+ fileExists: (fileName) => fileName === sourceFile.fileName,
613
+ getCanonicalFileName: (fileName) => fileName,
614
+ getCurrentDirectory: () => "/",
615
+ getDefaultLibFileName: () => "/lib.d.ts",
616
+ getDirectories: () => [],
617
+ getNewLine: () => "\n",
618
+ getSourceFile: (fileName) => fileName === sourceFile.fileName ? sourceFile : void 0,
619
+ readFile: (fileName) => fileName === sourceFile.fileName ? text : void 0,
620
+ useCaseSensitiveFileNames: () => true,
621
+ writeFile: () => void 0
622
+ },
623
+ options: {
624
+ jsx: ts.JsxEmit.Preserve,
625
+ module: ts.ModuleKind.ESNext,
626
+ noLib: true,
627
+ noResolve: true,
628
+ target: ts.ScriptTarget.ES2023
629
+ },
630
+ rootNames: [sourceFile.fileName]
631
+ });
632
+ };
633
+ /**
634
+ * Parses and indexes one TypeScript module without provider request assumptions.
635
+ * @param path The normalized logical source path.
636
+ * @param bytes The exact source bytes returned by the adapter reader.
637
+ * @param importConfig The provider constructor-import contract.
638
+ * @param signal The active inspection signal.
639
+ * @returns A source analysis or stable invalid-text or invalid-syntax result.
640
+ * @throws If source analysis is aborted.
641
+ */
642
+ var analyzeTypeScriptModule = (path, bytes, importConfig, signal) => {
643
+ signal?.throwIfAborted();
644
+ const text = normalizeText(bytes);
645
+ if (!text.valid) return Object.freeze({ kind: "invalid-text" });
646
+ signal?.throwIfAborted();
647
+ const sourceFile = ts.createSourceFile(path, text.value, ts.ScriptTarget.ES2023, true, getScriptKind(path));
648
+ const syntaxDiagnostic = createSyntaxProgram(sourceFile, text.value).getSyntacticDiagnostics(sourceFile).filter(({ category }) => category === ts.DiagnosticCategory.Error).sort((left, right) => (left.start ?? 0) - (right.start ?? 0))[0];
649
+ signal?.throwIfAborted();
650
+ if (syntaxDiagnostic !== void 0) {
651
+ const start = syntaxDiagnostic.start;
652
+ return Object.freeze({
653
+ kind: "invalid-syntax",
654
+ range: start === void 0 ? null : text.locator.locateRange(start, start + (syntaxDiagnostic.length ?? 0))
655
+ });
656
+ }
657
+ const { constructorNames, namedImports } = indexImports(sourceFile, importConfig);
658
+ signal?.throwIfAborted();
659
+ const { clientNames, exports, moduleArrays, moduleConstDeclarations } = indexModuleDeclarations(sourceFile, constructorNames);
660
+ signal?.throwIfAborted();
661
+ const identifierUses = indexIdentifierUses(sourceFile);
662
+ signal?.throwIfAborted();
663
+ const localBindingNames = indexLocalBindingNames(sourceFile);
664
+ signal?.throwIfAborted();
665
+ const analysis = Object.freeze({
666
+ clientNames,
667
+ constructorNames,
668
+ exports,
669
+ identifierUses,
670
+ localBindingNames,
671
+ moduleArrays,
672
+ moduleConstDeclarations,
673
+ namedImports,
674
+ path,
675
+ safeModuleArrayNames: /* @__PURE__ */ new Set(),
676
+ sourceFile,
677
+ text
678
+ });
679
+ signal?.throwIfAborted();
680
+ return Object.freeze({
681
+ analysis,
682
+ kind: "valid"
683
+ });
684
+ };
685
+ /**
686
+ * Determines whether a path uses a supported TypeScript source extension.
687
+ * @param path The bound source path.
688
+ * @returns Whether its extension is supported.
689
+ */
690
+ var isSupportedTypeScriptSourcePath = (path) => [
691
+ ".ts",
692
+ ".tsx",
693
+ ".mts"
694
+ ].some((extension) => path.endsWith(extension));
695
+ /**
696
+ * Classifies a direct exported runtime-agent function and exposes its body.
697
+ * @param analysis The indexed runtime source.
698
+ * @param symbol The bound runtime-agent symbol.
699
+ * @returns The symbol state and supported body when available.
700
+ */
701
+ var getRuntimeExport = (analysis, symbol) => {
702
+ const exported = analysis.exports.get(symbol);
703
+ if (exported === void 0) return Object.freeze({ kind: "absent" });
704
+ if (exported.kind === "present-unsupported") return exported;
705
+ const { declaration } = exported;
706
+ if (ts.isFunctionDeclaration(declaration) && declaration.body !== void 0) return Object.freeze({
707
+ body: declaration.body,
708
+ declaration,
709
+ kind: "present-supported"
710
+ });
711
+ if (ts.isVariableDeclaration(declaration) && declaration.initializer !== void 0) {
712
+ const initializer = unwrapExpression(declaration.initializer);
713
+ if (ts.isArrowFunction(initializer) || ts.isFunctionExpression(initializer)) return Object.freeze({
714
+ body: initializer.body,
715
+ declaration,
716
+ kind: "present-supported"
717
+ });
718
+ }
719
+ return Object.freeze({
720
+ declaration,
721
+ kind: "present-unsupported"
722
+ });
723
+ };
724
+ /**
725
+ * Classifies a directly exported callable value such as an instruction loader.
726
+ * @param analysis The indexed source.
727
+ * @param symbol The exact bound symbol.
728
+ * @returns The symbol state for conservative call matching.
729
+ */
730
+ var getCallableExportState = (analysis, symbol) => {
731
+ const runtimeExport = getRuntimeExport(analysis, symbol);
732
+ return runtimeExport.kind === "present-supported" ? Object.freeze({
733
+ declaration: runtimeExport.declaration,
734
+ kind: "present-supported"
735
+ }) : runtimeExport;
736
+ };
737
+ /**
738
+ * Classifies a directly exported constant and returns its static initializer.
739
+ * @param analysis The indexed source.
740
+ * @param symbol The exact bound symbol.
741
+ * @returns The symbol state and initializer when supported.
742
+ */
743
+ var getConstExport = (analysis, symbol) => {
744
+ const exported = analysis.exports.get(symbol);
745
+ if (exported === void 0) return Object.freeze({ kind: "absent" });
746
+ if (exported.kind === "present-supported" && ts.isVariableDeclaration(exported.declaration) && exported.declaration.initializer !== void 0) return Object.freeze({
747
+ declaration: exported.declaration,
748
+ expression: unwrapExpression(exported.declaration.initializer),
749
+ kind: "present-supported"
750
+ });
751
+ return Object.freeze({
752
+ declaration: exported.declaration,
753
+ kind: "present-unsupported"
754
+ });
755
+ };
756
+ //#endregion
757
+ //#region src/source-analysis/mutations.ts
758
+ var skipTransparentParents = (node) => {
759
+ let current = node;
760
+ while (ts.isAsExpression(current.parent) || ts.isParenthesizedExpression(current.parent) || ts.isSatisfiesExpression(current.parent)) current = current.parent;
761
+ return current;
762
+ };
763
+ var isAssignmentOperator = (kind) => kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;
764
+ var isMutatingTarget = (expression) => {
765
+ const candidate = skipTransparentParents(expression);
766
+ const parent = candidate.parent;
767
+ return ts.isBinaryExpression(parent) && parent.left === candidate && isAssignmentOperator(parent.operatorToken.kind) || (ts.isPrefixUnaryExpression(parent) || ts.isPostfixUnaryExpression(parent)) && parent.operand === candidate && (parent.operator === ts.SyntaxKind.PlusPlusToken || parent.operator === ts.SyntaxKind.MinusMinusToken) || ts.isDeleteExpression(parent) && parent.expression === candidate || (ts.isForInStatement(parent) || ts.isForOfStatement(parent)) && parent.initializer === candidate;
768
+ };
769
+ var getStaticMemberName = (member) => {
770
+ if (ts.isPropertyAccessExpression(member)) return member.name.text;
771
+ const argument = member.argumentExpression;
772
+ return argument !== void 0 && (ts.isStringLiteral(argument) || ts.isNoSubstitutionTemplateLiteral(argument)) ? argument.text : null;
773
+ };
774
+ var isIgnoredIdentifier = (identifier, declarationName) => identifier === declarationName || ts.isImportSpecifier(identifier.parent) || ts.isPropertyAccessExpression(identifier.parent) && identifier.parent.name === identifier || ts.isPropertyAssignment(identifier.parent) && identifier.parent.name === identifier;
775
+ var addObjectAssignmentMembers = (object, mutatedMembers) => {
776
+ let hasUnknownMutation = false;
777
+ for (const property of object.properties) {
778
+ if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property) || ts.isComputedPropertyName(property.name)) {
779
+ hasUnknownMutation = true;
780
+ continue;
781
+ }
782
+ const propertyName = ts.isIdentifier(property.name) || ts.isStringLiteral(property.name) ? property.name.text : null;
783
+ if (propertyName === null) hasUnknownMutation = true;
784
+ else mutatedMembers.add(propertyName);
785
+ }
786
+ return hasUnknownMutation;
787
+ };
788
+ var analyzeMutationCall = (identifier, mutatedMembers) => {
789
+ const candidate = skipTransparentParents(identifier);
790
+ const parent = candidate.parent;
791
+ if (!ts.isCallExpression(parent)) return null;
792
+ const callee = unwrapExpression(parent.expression);
793
+ if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression) && callee.expression.text === "Object" && callee.name.text === "assign" && parent.arguments[0] === candidate) {
794
+ let hasUnknownMutation = parent.arguments.length < 2;
795
+ for (const source of parent.arguments.slice(1)) {
796
+ const assignmentSource = unwrapExpression(source);
797
+ if (!ts.isObjectLiteralExpression(assignmentSource)) hasUnknownMutation = true;
798
+ else if (addObjectAssignmentMembers(assignmentSource, mutatedMembers)) hasUnknownMutation = true;
799
+ }
800
+ return hasUnknownMutation;
801
+ }
802
+ if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression) && callee.expression.text === "Reflect" && callee.name.text === "set" && parent.arguments[0] === candidate) {
803
+ const member = parent.arguments[1];
804
+ if (member !== void 0 && (ts.isStringLiteral(member) || ts.isNoSubstitutionTemplateLiteral(member))) {
805
+ mutatedMembers.add(member.text);
806
+ return false;
807
+ }
808
+ return true;
809
+ }
810
+ return true;
811
+ };
812
+ /**
813
+ * Classifies module-local mutations and escapes for one returned SDK object.
814
+ * @param analysis The indexed source containing the binding.
815
+ * @param declaration The module-local constant declaration.
816
+ * @param allowedReferences Bare identifier uses proven to be supported registrations or targets.
817
+ * @returns Member-specific mutations and whether an unknown use can affect every relationship.
818
+ */
819
+ var analyzeOpenAiAgentsSdkMutations = (analysis, declaration, allowedReferences) => {
820
+ if (!ts.isIdentifier(declaration.name)) return Object.freeze({
821
+ hasUnknownMutation: true,
822
+ mutatedMembers: /* @__PURE__ */ new Set()
823
+ });
824
+ const mutatedMembers = /* @__PURE__ */ new Set();
825
+ let hasUnknownMutation = false;
826
+ for (const identifier of analysis.identifierUses.get(declaration.name.text) ?? []) {
827
+ if (isIgnoredIdentifier(identifier, declaration.name) || !isModuleBindingVisible(identifier, analysis) || allowedReferences.has(identifier)) continue;
828
+ const expression = skipTransparentParents(identifier);
829
+ const parent = expression.parent;
830
+ const member = (ts.isPropertyAccessExpression(parent) || ts.isElementAccessExpression(parent)) && parent.expression === expression ? parent : null;
831
+ if (member !== null) {
832
+ const memberName = getStaticMemberName(member);
833
+ if (memberName === null) hasUnknownMutation = true;
834
+ else if (isMutatingTarget(member)) mutatedMembers.add(memberName);
835
+ else {
836
+ const memberExpression = skipTransparentParents(member);
837
+ const memberParent = memberExpression.parent;
838
+ if ((ts.isPropertyAccessExpression(memberParent) || ts.isElementAccessExpression(memberParent)) && memberParent.expression === memberExpression && ts.isCallExpression(skipTransparentParents(memberParent).parent)) mutatedMembers.add(memberName);
839
+ else if (ts.isCallExpression(memberParent) && memberParent.expression === memberExpression) mutatedMembers.add(memberName);
840
+ }
841
+ continue;
842
+ }
843
+ if (isMutatingTarget(identifier)) {
844
+ hasUnknownMutation = true;
845
+ continue;
846
+ }
847
+ const mutationCall = analyzeMutationCall(identifier, mutatedMembers);
848
+ hasUnknownMutation ||= mutationCall ?? true;
849
+ }
850
+ return Object.freeze({
851
+ hasUnknownMutation,
852
+ mutatedMembers: new Set(mutatedMembers)
853
+ });
854
+ };
855
+ //#endregion
856
+ //#region src/source-analysis/agent-definitions.ts
857
+ var RELATIONSHIP_NAMES = [
858
+ "handoffDescription",
859
+ "handoffs",
860
+ "instructions",
861
+ "name",
862
+ "outputType",
863
+ "tools"
864
+ ];
865
+ var getStaticPropertyName$2 = (name) => ts.isIdentifier(name) || ts.isStringLiteral(name) ? name.text : null;
866
+ var createAbsentRelationships = () => ({
867
+ handoffDescription: { kind: "absent" },
868
+ handoffs: { kind: "absent" },
869
+ instructions: { kind: "absent" },
870
+ name: { kind: "absent" },
871
+ outputType: { kind: "absent" },
872
+ tools: { kind: "absent" }
873
+ });
874
+ var markAllRelationshipsUnresolved = (relationships) => {
875
+ for (const relationshipName of RELATIONSHIP_NAMES) relationships[relationshipName] = { kind: "unresolved" };
876
+ };
877
+ var analyzeAgentRelationships = (config) => {
878
+ const relationships = createAbsentRelationships();
879
+ const relationshipNames = new Set(RELATIONSHIP_NAMES);
880
+ for (const property of config.properties) {
881
+ if (ts.isSpreadAssignment(property) || ts.isComputedPropertyName(property.name)) {
882
+ markAllRelationshipsUnresolved(relationships);
883
+ continue;
884
+ }
885
+ const propertyName = getStaticPropertyName$2(property.name);
886
+ if (propertyName === null || !relationshipNames.has(propertyName)) continue;
887
+ const relationshipName = propertyName;
888
+ if (relationships[relationshipName].kind !== "absent") {
889
+ relationships[relationshipName] = { kind: "unresolved" };
890
+ continue;
891
+ }
892
+ if (ts.isPropertyAssignment(property)) relationships[relationshipName] = {
893
+ expression: unwrapExpression(property.initializer),
894
+ kind: "present"
895
+ };
896
+ else if (ts.isShorthandPropertyAssignment(property)) relationships[relationshipName] = {
897
+ expression: property.name,
898
+ kind: "present"
899
+ };
900
+ else relationships[relationshipName] = { kind: "unresolved" };
901
+ }
902
+ return relationships;
903
+ };
904
+ var getAgentConfig = (initializer, analysis) => {
905
+ const candidate = unwrapExpression(initializer);
906
+ let callArguments;
907
+ if (ts.isNewExpression(candidate)) {
908
+ const constructor = unwrapExpression(candidate.expression);
909
+ if (!ts.isIdentifier(constructor) || !analysis.imports.agentNames.has(constructor.text) || !isModuleBindingVisible(constructor, analysis)) return null;
910
+ callArguments = candidate.arguments;
911
+ } else if (ts.isCallExpression(candidate)) {
912
+ const callee = unwrapExpression(candidate.expression);
913
+ if (!ts.isPropertyAccessExpression(callee) || callee.name.text !== "create" || !ts.isIdentifier(unwrapExpression(callee.expression))) return null;
914
+ const agentIdentifier = unwrapExpression(callee.expression);
915
+ if (!analysis.imports.agentNames.has(agentIdentifier.text) || !isModuleBindingVisible(agentIdentifier, analysis)) return null;
916
+ callArguments = candidate.arguments;
917
+ } else return null;
918
+ if (callArguments?.length !== 1) return null;
919
+ const config = unwrapExpression(callArguments[0]);
920
+ return ts.isObjectLiteralExpression(config) ? config : null;
921
+ };
922
+ /**
923
+ * Classifies one directly exported Agent binding and its relationship-specific configuration.
924
+ * @param analysis The indexed source module.
925
+ * @param symbol The exact exported Agent symbol.
926
+ * @returns The absent, unsupported, or supported definition state.
927
+ */
928
+ var getOpenAiAgentsSdkAgentDefinition = (analysis, symbol) => {
929
+ const exported = analysis.exports.get(symbol);
930
+ if (exported === void 0) return Object.freeze({ kind: "absent" });
931
+ if (exported.kind !== "present-supported" || !ts.isVariableDeclaration(exported.declaration) || exported.declaration.initializer === void 0) return Object.freeze({
932
+ declaration: exported.declaration,
933
+ kind: "present-unsupported"
934
+ });
935
+ const config = getAgentConfig(exported.declaration.initializer, analysis);
936
+ if (config === null) return Object.freeze({
937
+ declaration: exported.declaration,
938
+ kind: "present-unsupported"
939
+ });
940
+ const relationships = analyzeAgentRelationships(config);
941
+ const definition = Object.freeze({
942
+ config,
943
+ declaration: exported.declaration,
944
+ ...relationships
945
+ });
946
+ return Object.freeze({
947
+ config,
948
+ declaration: exported.declaration,
949
+ definition,
950
+ kind: "present-supported"
951
+ });
952
+ };
953
+ /**
954
+ * Applies relationship-specific post-construction Agent mutation uncertainty.
955
+ * @param analysis The Agent source analysis.
956
+ * @param definition The supported initial Agent definition.
957
+ * @param allowedTargetReferences Direct uses as supported handoff targets.
958
+ * @returns The definition with only affected relationships marked unresolved.
959
+ */
960
+ var applyOpenAiAgentsSdkAgentMutations = (analysis, definition, allowedTargetReferences) => {
961
+ const mutations = analyzeOpenAiAgentsSdkMutations(analysis, definition.declaration, allowedTargetReferences);
962
+ if (!mutations.hasUnknownMutation && mutations.mutatedMembers.size === 0) return definition;
963
+ const relationship = (name) => mutations.hasUnknownMutation || mutations.mutatedMembers.has(name) ? { kind: "unresolved" } : definition[name];
964
+ return Object.freeze({
965
+ ...definition,
966
+ handoffDescription: relationship("handoffDescription"),
967
+ handoffs: relationship("handoffs"),
968
+ instructions: relationship("instructions"),
969
+ name: relationship("name"),
970
+ outputType: relationship("outputType"),
971
+ tools: relationship("tools")
972
+ });
973
+ };
974
+ //#endregion
975
+ //#region src/source-analysis/bindings.ts
976
+ /**
977
+ * Classifies a direct relationship to one explicitly bound runtime symbol.
978
+ * @param relationship The supported configuration relationship.
979
+ * @param analysis The source containing the relationship.
980
+ * @param reference The exact manifest binding.
981
+ * @returns `true` for a match, `false` for proved absence, or `null` when unresolved.
982
+ */
983
+ var classifyOpenAiAgentsSdkDirectBinding = (relationship, analysis, reference) => {
984
+ if (relationship.kind === "absent") return false;
985
+ if (relationship.kind === "unresolved" || reference.symbol === void 0) return null;
986
+ const candidate = unwrapExpression(relationship.expression);
987
+ if (!ts.isIdentifier(candidate) || !isModuleBindingVisible(candidate, analysis)) return ts.isStringLiteral(candidate) || ts.isNoSubstitutionTemplateLiteral(candidate) || ts.isNumericLiteral(candidate) || ts.isObjectLiteralExpression(candidate) || ts.isArrayLiteralExpression(candidate) || ts.isArrowFunction(candidate) || ts.isFunctionExpression(candidate) || ts.isClassExpression(candidate) || candidate.kind === ts.SyntaxKind.NullKeyword || candidate.kind === ts.SyntaxKind.TrueKeyword || candidate.kind === ts.SyntaxKind.FalseKeyword ? false : null;
988
+ if (isBoundIdentifier(candidate, analysis, reference)) return true;
989
+ return resolveBindingReferences(candidate, analysis).length > 0 ? false : null;
990
+ };
991
+ //#endregion
992
+ //#region src/source-analysis/function-tools.ts
993
+ var REQUIRED_PROPERTIES = /* @__PURE__ */ new Set([
994
+ "description",
995
+ "execute",
996
+ "name",
997
+ "parameters"
998
+ ]);
999
+ var SUPPORTED_PROPERTIES = /* @__PURE__ */ new Set([
1000
+ ...REQUIRED_PROPERTIES,
1001
+ "allowedCallers",
1002
+ "customDataExtractor",
1003
+ "deferLoading",
1004
+ "errorFunction",
1005
+ "inputGuardrails",
1006
+ "isEnabled",
1007
+ "needsApproval",
1008
+ "outputGuardrails",
1009
+ "outputSchema",
1010
+ "providerData",
1011
+ "strict",
1012
+ "timeoutBehavior",
1013
+ "timeoutErrorFunction",
1014
+ "timeoutMs"
1015
+ ]);
1016
+ var getStaticPropertyName$1 = (name) => ts.isIdentifier(name) || ts.isStringLiteral(name) ? name.text : null;
1017
+ var createRelationship = (properties, name) => {
1018
+ const expression = properties.get(name);
1019
+ return expression === void 0 ? { kind: "absent" } : {
1020
+ expression,
1021
+ kind: "present"
1022
+ };
1023
+ };
1024
+ var getToolProperties = (object) => {
1025
+ const properties = /* @__PURE__ */ new Map();
1026
+ for (const property of object.properties) {
1027
+ if (!ts.isPropertyAssignment(property) || ts.isComputedPropertyName(property.name)) return null;
1028
+ const propertyName = getStaticPropertyName$1(property.name);
1029
+ if (propertyName === null || !SUPPORTED_PROPERTIES.has(propertyName) || properties.has(propertyName)) return null;
1030
+ properties.set(propertyName, unwrapExpression(property.initializer));
1031
+ }
1032
+ return [...REQUIRED_PROPERTIES].every((propertyName) => properties.has(propertyName)) ? properties : null;
1033
+ };
1034
+ /**
1035
+ * Classifies one directly exported root tool(...) declaration.
1036
+ * @param analysis The indexed tool source.
1037
+ * @param symbol The exact exported tool registration symbol.
1038
+ * @returns The absent, unsupported, or structurally supported function-tool state.
1039
+ */
1040
+ var getOpenAiAgentsSdkFunctionTool = (analysis, symbol) => {
1041
+ const exported = analysis.exports.get(symbol);
1042
+ if (exported === void 0) return Object.freeze({ kind: "absent" });
1043
+ if (exported.kind !== "present-supported" || !ts.isVariableDeclaration(exported.declaration) || exported.declaration.initializer === void 0) return Object.freeze({
1044
+ declaration: exported.declaration,
1045
+ kind: "present-unsupported"
1046
+ });
1047
+ const initializer = unwrapExpression(exported.declaration.initializer);
1048
+ if (!ts.isCallExpression(initializer) || initializer.arguments.length !== 1) return Object.freeze({
1049
+ declaration: exported.declaration,
1050
+ kind: "present-unsupported"
1051
+ });
1052
+ const helper = unwrapExpression(initializer.expression);
1053
+ if (!ts.isIdentifier(helper) || !analysis.imports.toolNames.has(helper.text) || !isModuleBindingVisible(helper, analysis)) return Object.freeze({
1054
+ declaration: exported.declaration,
1055
+ kind: "present-unsupported"
1056
+ });
1057
+ const object = unwrapExpression(initializer.arguments[0]);
1058
+ if (!ts.isObjectLiteralExpression(object)) return Object.freeze({
1059
+ declaration: exported.declaration,
1060
+ kind: "present-unsupported"
1061
+ });
1062
+ const properties = getToolProperties(object);
1063
+ if (properties === null) return Object.freeze({
1064
+ declaration: exported.declaration,
1065
+ kind: "present-unsupported"
1066
+ });
1067
+ const tool = Object.freeze({
1068
+ declaration: exported.declaration,
1069
+ execute: createRelationship(properties, "execute"),
1070
+ name: properties.get("name"),
1071
+ object,
1072
+ outputSchema: createRelationship(properties, "outputSchema"),
1073
+ parameters: createRelationship(properties, "parameters")
1074
+ });
1075
+ return Object.freeze({
1076
+ kind: "present-supported",
1077
+ tool
1078
+ });
1079
+ };
1080
+ //#endregion
1081
+ //#region src/source-analysis/handoffs.ts
1082
+ var RECOGNIZED_OVERRIDE_NAMES = ["toolDescriptionOverride", "toolNameOverride"];
1083
+ var TOLERATED_CONFIG_NAMES = /* @__PURE__ */ new Set([
1084
+ "inputFilter",
1085
+ "inputType",
1086
+ "isEnabled",
1087
+ "onHandoff",
1088
+ ...RECOGNIZED_OVERRIDE_NAMES
1089
+ ]);
1090
+ var getStaticPropertyName = (name) => ts.isIdentifier(name) || ts.isStringLiteral(name) ? name.text : null;
1091
+ var analyzeHandoffConfig = (expression) => {
1092
+ const relationships = {
1093
+ toolDescriptionOverride: { kind: "absent" },
1094
+ toolNameOverride: { kind: "absent" }
1095
+ };
1096
+ if (expression === void 0) return relationships;
1097
+ const config = unwrapExpression(expression);
1098
+ if (!ts.isObjectLiteralExpression(config)) {
1099
+ relationships.toolDescriptionOverride = { kind: "unresolved" };
1100
+ relationships.toolNameOverride = { kind: "unresolved" };
1101
+ return relationships;
1102
+ }
1103
+ for (const property of config.properties) {
1104
+ if (ts.isSpreadAssignment(property) || ts.isComputedPropertyName(property.name)) {
1105
+ relationships.toolDescriptionOverride = { kind: "unresolved" };
1106
+ relationships.toolNameOverride = { kind: "unresolved" };
1107
+ continue;
1108
+ }
1109
+ const propertyName = getStaticPropertyName(property.name);
1110
+ if (propertyName === null || !TOLERATED_CONFIG_NAMES.has(propertyName)) {
1111
+ relationships.toolDescriptionOverride = { kind: "unresolved" };
1112
+ relationships.toolNameOverride = { kind: "unresolved" };
1113
+ continue;
1114
+ }
1115
+ if (!RECOGNIZED_OVERRIDE_NAMES.includes(propertyName)) continue;
1116
+ const relationshipName = propertyName;
1117
+ if (relationships[relationshipName].kind !== "absent") relationships[relationshipName] = { kind: "unresolved" };
1118
+ else if (ts.isPropertyAssignment(property)) relationships[relationshipName] = {
1119
+ expression: unwrapExpression(property.initializer),
1120
+ kind: "present"
1121
+ };
1122
+ else if (ts.isShorthandPropertyAssignment(property)) relationships[relationshipName] = {
1123
+ expression: property.name,
1124
+ kind: "present"
1125
+ };
1126
+ else relationships[relationshipName] = { kind: "unresolved" };
1127
+ }
1128
+ return relationships;
1129
+ };
1130
+ var analyzeHandoffCall = (expression, analysis) => {
1131
+ const candidate = unwrapExpression(expression);
1132
+ if (!ts.isCallExpression(candidate) || candidate.arguments.length < 1 || candidate.arguments.length > 2) return null;
1133
+ const helper = unwrapExpression(candidate.expression);
1134
+ if (!ts.isIdentifier(helper) || !analysis.imports.handoffNames.has(helper.text) || !isModuleBindingVisible(helper, analysis)) return null;
1135
+ const target = unwrapExpression(candidate.arguments[0]);
1136
+ if (!ts.isIdentifier(target) || !isModuleBindingVisible(target, analysis)) return null;
1137
+ return Object.freeze({
1138
+ expression: candidate,
1139
+ kind: "handoff",
1140
+ target,
1141
+ ...analyzeHandoffConfig(candidate.arguments[1])
1142
+ });
1143
+ };
1144
+ var getClosedHandoffArray = (relationship, analysis, allowedCollectionReferences) => {
1145
+ if (relationship.kind !== "present") return null;
1146
+ const candidate = unwrapExpression(relationship.expression);
1147
+ const moduleArray = ts.isArrayLiteralExpression(candidate) ? null : getSafeModuleConstLiteral(candidate, analysis, allowedCollectionReferences, "array");
1148
+ const array = ts.isArrayLiteralExpression(candidate) ? candidate : moduleArray?.expression;
1149
+ if (array === void 0 || array.elements.some((element) => ts.isOmittedExpression(element) || ts.isSpreadElement(element))) return null;
1150
+ return array.elements.map((element) => unwrapExpression(element));
1151
+ };
1152
+ /** Collects direct module-array references from supported Agent handoff relationships. */
1153
+ var collectOpenAiAgentsSdkHandoffCollectionReferences = (relationships) => new Set(relationships.flatMap((relationship) => {
1154
+ if (relationship.kind !== "present") return [];
1155
+ const candidate = unwrapExpression(relationship.expression);
1156
+ return ts.isIdentifier(candidate) ? [candidate] : [];
1157
+ }));
1158
+ /**
1159
+ * Returns every supported expression in one closed Agent handoff collection.
1160
+ * @param relationship The Agent handoffs relationship.
1161
+ * @param analysis The source containing the collection.
1162
+ * @param allowedCollectionReferences All supported references to shared module arrays.
1163
+ * @returns Closed collection elements or `null` when the collection is unresolved.
1164
+ */
1165
+ var getOpenAiAgentsSdkHandoffElements = (relationship, analysis, allowedCollectionReferences) => getClosedHandoffArray(relationship, analysis, allowedCollectionReferences);
1166
+ /**
1167
+ * Classifies one direct Agent or handoff(...) registration element.
1168
+ * @param element The closed collection element.
1169
+ * @param analysis The source containing the element.
1170
+ * @param allowedWrapperReferences All direct supported collection uses of module wrappers.
1171
+ * @returns The supported registration or `null` for an unresolved target form.
1172
+ */
1173
+ var analyzeOpenAiAgentsSdkHandoffElement = (element, analysis, allowedWrapperReferences) => {
1174
+ const directCall = analyzeHandoffCall(element, analysis);
1175
+ if (directCall !== null) return directCall;
1176
+ const candidate = unwrapExpression(element);
1177
+ if (!ts.isIdentifier(candidate) || !isModuleBindingVisible(candidate, analysis)) return null;
1178
+ const declaration = analysis.moduleConstDeclarations.get(candidate.text);
1179
+ if (declaration?.initializer !== void 0) {
1180
+ const wrapper = analyzeHandoffCall(declaration.initializer, analysis);
1181
+ if (wrapper !== null) {
1182
+ const mutations = analyzeOpenAiAgentsSdkMutations(analysis, declaration, allowedWrapperReferences);
1183
+ if (mutations.hasUnknownMutation || mutations.mutatedMembers.has("onInvokeHandoff")) return null;
1184
+ const toolDescriptionOverride = mutations.mutatedMembers.has("toolDescription") ? { kind: "unresolved" } : wrapper.toolDescriptionOverride;
1185
+ const toolNameOverride = mutations.mutatedMembers.has("toolName") ? { kind: "unresolved" } : wrapper.toolNameOverride;
1186
+ return Object.freeze({
1187
+ ...wrapper,
1188
+ expression: candidate,
1189
+ toolDescriptionOverride,
1190
+ toolNameOverride
1191
+ });
1192
+ }
1193
+ }
1194
+ return Object.freeze({
1195
+ expression: candidate,
1196
+ kind: "agent",
1197
+ target: candidate,
1198
+ toolDescriptionOverride: { kind: "absent" },
1199
+ toolNameOverride: { kind: "absent" }
1200
+ });
1201
+ };
1202
+ /**
1203
+ * Collects Agent identifier uses that are mechanically supported handoff targets.
1204
+ * @param analysis The source containing Agent definitions and handoff collections.
1205
+ * @returns Exact target identifiers allowed by Agent mutation analysis.
1206
+ */
1207
+ var collectOpenAiAgentsSdkHandoffTargetReferences = (analysis) => {
1208
+ const definitions = [...analysis.exports.keys()].flatMap((symbol) => {
1209
+ const result = getOpenAiAgentsSdkAgentDefinition(analysis, symbol);
1210
+ return result.kind === "present-supported" && result.definition !== void 0 ? [result.definition] : [];
1211
+ });
1212
+ const collectionReferences = collectOpenAiAgentsSdkHandoffCollectionReferences(definitions.map(({ handoffs }) => handoffs));
1213
+ const elements = definitions.flatMap(({ handoffs }) => getOpenAiAgentsSdkHandoffElements(handoffs, analysis, collectionReferences) ?? []);
1214
+ const allowedWrapperReferences = new Set(elements.filter((element) => ts.isIdentifier(element)));
1215
+ const targets = /* @__PURE__ */ new Set();
1216
+ for (const element of elements) {
1217
+ const registration = analyzeOpenAiAgentsSdkHandoffElement(element, analysis, allowedWrapperReferences);
1218
+ if (registration !== null && ts.isIdentifier(registration.target)) targets.add(registration.target);
1219
+ }
1220
+ return targets;
1221
+ };
1222
+ //#endregion
1223
+ //#region src/source-analysis/instruction-loaders.ts
1224
+ var getWrapperReturn = (expression) => {
1225
+ const candidate = unwrapExpression(expression);
1226
+ if (!ts.isArrowFunction(candidate) && !ts.isFunctionExpression(candidate)) return null;
1227
+ if (!ts.isBlock(candidate.body)) return candidate.body;
1228
+ if (candidate.body.statements.length !== 1) return null;
1229
+ const statement = candidate.body.statements[0];
1230
+ return statement !== void 0 && ts.isReturnStatement(statement) && statement.expression !== void 0 ? statement.expression : null;
1231
+ };
1232
+ var classifyCall = (expression, analysis, reference) => {
1233
+ const call = getDirectCall(expression);
1234
+ if (call === null) return null;
1235
+ const callee = unwrapExpression(call.expression);
1236
+ if (!ts.isIdentifier(callee) || !isModuleBindingVisible(callee, analysis)) return null;
1237
+ if (isBoundIdentifier(callee, analysis, reference)) return true;
1238
+ return resolveBindingReferences(callee, analysis).length > 0 ? false : null;
1239
+ };
1240
+ /**
1241
+ * Classifies the supported direct, called, or single-return instruction-loader relationship.
1242
+ * @param relationship The Agent instructions relationship.
1243
+ * @param analysis The source containing the Agent definition.
1244
+ * @param reference The exact declared instruction-loader binding.
1245
+ * @returns `true` for wired, `false` for provably unwired, or `null` when unresolved.
1246
+ */
1247
+ var classifyOpenAiAgentsSdkInstructionLoader = (relationship, analysis, reference) => {
1248
+ if (relationship.kind === "absent") return false;
1249
+ if (relationship.kind === "unresolved" || reference.symbol === void 0) return null;
1250
+ const candidate = unwrapExpression(relationship.expression);
1251
+ if (ts.isIdentifier(candidate) && isModuleBindingVisible(candidate, analysis)) {
1252
+ if (isBoundIdentifier(candidate, analysis, reference)) return true;
1253
+ return resolveBindingReferences(candidate, analysis).length > 0 ? false : null;
1254
+ }
1255
+ const directCall = classifyCall(candidate, analysis, reference);
1256
+ if (directCall !== null) return directCall;
1257
+ const wrapperReturn = getWrapperReturn(candidate);
1258
+ if (wrapperReturn !== null) return classifyCall(wrapperReturn, analysis, reference);
1259
+ return ts.isStringLiteral(candidate) || ts.isNoSubstitutionTemplateLiteral(candidate) || ts.isNumericLiteral(candidate) || candidate.kind === ts.SyntaxKind.NullKeyword || candidate.kind === ts.SyntaxKind.TrueKeyword || candidate.kind === ts.SyntaxKind.FalseKeyword ? false : null;
1260
+ };
1261
+ //#endregion
1262
+ //#region src/source-analysis/source-analysis.ts
1263
+ var OPENAI_AGENTS_SDK_IMPORT_CONFIG = Object.freeze({
1264
+ namedConstructorImports: ["Agent"],
1265
+ packageName: OPENAI_AGENTS_SDK_PACKAGE_NAME,
1266
+ supportsDefaultConstructorImport: false
1267
+ });
1268
+ var indexOpenAiAgentsSdkImports = (sourceFile) => {
1269
+ const agentNames = /* @__PURE__ */ new Set();
1270
+ const handoffNames = /* @__PURE__ */ new Set();
1271
+ const toolNames = /* @__PURE__ */ new Set();
1272
+ for (const statement of sourceFile.statements) {
1273
+ if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier) || statement.moduleSpecifier.text !== "@openai/agents" || statement.importClause?.isTypeOnly === true || statement.importClause?.namedBindings === void 0 || !ts.isNamedImports(statement.importClause.namedBindings)) continue;
1274
+ for (const element of statement.importClause.namedBindings.elements) {
1275
+ if (element.isTypeOnly) continue;
1276
+ const importedName = element.propertyName?.text ?? element.name.text;
1277
+ if (importedName === "Agent") agentNames.add(element.name.text);
1278
+ else if (importedName === "handoff") handoffNames.add(element.name.text);
1279
+ else if (importedName === "tool") toolNames.add(element.name.text);
1280
+ }
1281
+ }
1282
+ return Object.freeze({
1283
+ agentNames,
1284
+ handoffNames,
1285
+ toolNames
1286
+ });
1287
+ };
1288
+ /**
1289
+ * Parses and indexes one OpenAI Agents SDK TypeScript module without executing it.
1290
+ * @param path The normalized repository source path.
1291
+ * @param bytes The exact repository bytes.
1292
+ * @param signal The active inspection signal.
1293
+ * @returns The source analysis or a stable invalid source result.
1294
+ */
1295
+ var analyzeOpenAiAgentsSdkSource = (path, bytes, signal) => {
1296
+ const result = analyzeTypeScriptModule(path, bytes, OPENAI_AGENTS_SDK_IMPORT_CONFIG, signal);
1297
+ if (result.kind !== "valid") return result;
1298
+ const analysis = Object.freeze({
1299
+ ...result.analysis,
1300
+ imports: indexOpenAiAgentsSdkImports(result.analysis.sourceFile),
1301
+ path
1302
+ });
1303
+ return Object.freeze({
1304
+ analysis,
1305
+ kind: "valid"
1306
+ });
1307
+ };
1308
+ //#endregion
1309
+ //#region src/source-analysis/static-strings.ts
1310
+ var resolveCandidatePath = async (session, containingPath, moduleSpecifier) => {
1311
+ const matchingPaths = [];
1312
+ for (const candidate of resolveImportCandidatePaths(containingPath, moduleSpecifier)) {
1313
+ const path = parseRepositoryPath(candidate);
1314
+ if ((await session.getEntry(path))?.type === "file") matchingPaths.push(path);
1315
+ }
1316
+ return matchingPaths.length === 1 ? matchingPaths[0] : null;
1317
+ };
1318
+ var resolveStaticString = async (session, analysis, expression, visited) => {
1319
+ session.signal?.throwIfAborted();
1320
+ const candidate = unwrapExpression(expression);
1321
+ const literal = getStaticString(candidate);
1322
+ if (literal !== null) return Object.freeze({
1323
+ expression: candidate,
1324
+ kind: "supported",
1325
+ value: literal
1326
+ });
1327
+ if (!ts.isIdentifier(candidate) || !isModuleBindingVisible(candidate, analysis)) return Object.freeze({ kind: "unsupported" });
1328
+ const localDeclaration = analysis.moduleConstDeclarations.get(candidate.text);
1329
+ if (localDeclaration?.initializer !== void 0) {
1330
+ const key = `${analysis.path}\0local\0${candidate.text}`;
1331
+ if (visited.has(key)) return Object.freeze({ kind: "unsupported" });
1332
+ visited.add(key);
1333
+ const result = await resolveStaticString(session, analysis, localDeclaration.initializer, visited);
1334
+ visited.delete(key);
1335
+ return result;
1336
+ }
1337
+ const namedImport = analysis.namedImports.get(candidate.text);
1338
+ if (namedImport === void 0) return Object.freeze({ kind: "unsupported" });
1339
+ const importedPath = await resolveCandidatePath(session, analysis.path, namedImport.moduleSpecifier);
1340
+ if (importedPath === null) return Object.freeze({ kind: "unsupported" });
1341
+ const key = `${importedPath}\0export\0${namedImport.importedName}`;
1342
+ if (visited.has(key)) return Object.freeze({ kind: "unsupported" });
1343
+ visited.add(key);
1344
+ const importedResult = await session.analyzeSource(importedPath);
1345
+ if (importedResult.kind !== "valid") {
1346
+ visited.delete(key);
1347
+ return Object.freeze({ kind: "unsupported" });
1348
+ }
1349
+ const exported = getConstExport(importedResult.analysis, namedImport.importedName);
1350
+ if (exported.kind !== "present-supported" || exported.expression === void 0) {
1351
+ visited.delete(key);
1352
+ return Object.freeze({ kind: "unsupported" });
1353
+ }
1354
+ const result = await resolveStaticString(session, importedResult.analysis, exported.expression, visited);
1355
+ visited.delete(key);
1356
+ return result;
1357
+ };
1358
+ /**
1359
+ * Resolves one exact supported static string without normalization or execution.
1360
+ * @param session The operation-local source session.
1361
+ * @param analysis The source containing the expression.
1362
+ * @param expression The candidate static string expression.
1363
+ * @returns The exact compiler-parsed string or an unsupported state.
1364
+ */
1365
+ var resolveOpenAiAgentsSdkStaticString = (session, analysis, expression) => resolveStaticString(session, analysis, expression, /* @__PURE__ */ new Set());
1366
+ //#endregion
1367
+ //#region src/source-analysis/tool-collections.ts
1368
+ var getClosedToolArray = (relationship, analysis, allowedCollectionReferences) => {
1369
+ if (relationship.kind !== "present") return null;
1370
+ const candidate = unwrapExpression(relationship.expression);
1371
+ const moduleArray = ts.isArrayLiteralExpression(candidate) ? null : getSafeModuleConstLiteral(candidate, analysis, allowedCollectionReferences, "array");
1372
+ const array = ts.isArrayLiteralExpression(candidate) ? candidate : moduleArray?.expression;
1373
+ if (array === void 0 || array.elements.some((element) => ts.isOmittedExpression(element) || ts.isSpreadElement(element))) return null;
1374
+ return array.elements.map((element) => unwrapExpression(element));
1375
+ };
1376
+ /**
1377
+ * Collects module-array references that are direct supported Agent tool relationships.
1378
+ * @param relationships Agent tool relationships in one source module.
1379
+ * @returns Bare collection identifiers allowed to share one immutable module array.
1380
+ */
1381
+ var collectOpenAiAgentsSdkToolCollectionReferences = (relationships) => new Set(relationships.flatMap((relationship) => {
1382
+ if (relationship.kind !== "present") return [];
1383
+ const candidate = unwrapExpression(relationship.expression);
1384
+ return ts.isIdentifier(candidate) ? [candidate] : [];
1385
+ }));
1386
+ /**
1387
+ * Classifies whether one declared function tool appears in a closed Agent tools collection.
1388
+ * @param relationship The Agent tools relationship.
1389
+ * @param analysis The Agent source analysis.
1390
+ * @param reference The exact declared tool registration binding.
1391
+ * @param allowedCollectionReferences All supported references to shared module arrays.
1392
+ * @returns `true` for registered, `false` for proved absence, or `null` when unresolved.
1393
+ */
1394
+ var classifyOpenAiAgentsSdkToolRegistration = (relationship, analysis, reference, allowedCollectionReferences) => {
1395
+ if (relationship.kind === "absent") return false;
1396
+ if (relationship.kind === "unresolved" || reference.symbol === void 0) return null;
1397
+ const elements = getClosedToolArray(relationship, analysis, allowedCollectionReferences);
1398
+ if (elements === null) return null;
1399
+ let hasUnresolvedElement = false;
1400
+ for (const element of elements) {
1401
+ if (!ts.isIdentifier(element) || !isModuleBindingVisible(element, analysis)) {
1402
+ hasUnresolvedElement = true;
1403
+ continue;
1404
+ }
1405
+ if (isBoundIdentifier(element, analysis, reference)) return true;
1406
+ if (resolveBindingReferences(element, analysis).length === 0) hasUnresolvedElement = true;
1407
+ }
1408
+ return hasUnresolvedElement ? null : false;
1409
+ };
1410
+ /**
1411
+ * Returns identifier elements from one supported tools collection.
1412
+ * @param relationship The Agent tools relationship.
1413
+ * @param analysis The source containing the collection.
1414
+ * @param allowedCollectionReferences All supported references to shared module arrays.
1415
+ * @returns Direct identifier elements or an empty collection for unsupported forms.
1416
+ */
1417
+ var getOpenAiAgentsSdkToolElements = (relationship, analysis, allowedCollectionReferences) => (getClosedToolArray(relationship, analysis, allowedCollectionReferences) ?? []).filter((element) => ts.isIdentifier(element));
1418
+ //#endregion
1419
+ //#region src/diagnostics/index.ts
1420
+ var OPENAI_AGENTS_SDK_ADAPTER_DIAGNOSTICS = Object.freeze({
1421
+ OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_NOT_WIRED: "The declared agent output schema is not wired to the detected OpenAI Agents SDK agent output type.",
1422
+ OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND: "The declared agent output-schema symbol was not found.",
1423
+ OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING: "The detected OpenAI Agents SDK handoff registration is missing its effective routing description.",
1424
+ OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED: "The detected OpenAI Agents SDK handoff registration does not use the target agent's effective routing description.",
1425
+ OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS: "The detected OpenAI Agents SDK handoff target matches more than one registered moldea agent.",
1426
+ OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_NOT_WIRED: "The declared instruction loader is not wired to the detected OpenAI Agents SDK agent.",
1427
+ OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_SYMBOL_NOT_FOUND: "The declared instruction-loader symbol was not found.",
1428
+ OPENAI_AGENTS_SDK_PACKAGE_MANIFEST_INVALID: "The owning package manifest is invalid for OpenAI Agents SDK dependency detection.",
1429
+ OPENAI_AGENTS_SDK_RUNTIME_AGENT_SYMBOL_NOT_FOUND: "The declared runtime-agent symbol was not found.",
1430
+ OPENAI_AGENTS_SDK_SOURCE_SYNTAX_INVALID: "The referenced OpenAI Agents SDK source file contains invalid TypeScript syntax.",
1431
+ OPENAI_AGENTS_SDK_SOURCE_TEXT_INVALID: "The referenced OpenAI Agents SDK source file is not valid normalized text.",
1432
+ OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_NOT_WIRED: "The declared tool implementation is not wired to the detected OpenAI Agents SDK function tool.",
1433
+ OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_SYMBOL_NOT_FOUND: "The declared tool-implementation symbol was not found.",
1434
+ OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_NOT_WIRED: "The declared tool input schema is not wired to the detected OpenAI Agents SDK function tool.",
1435
+ OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_SYMBOL_NOT_FOUND: "The declared tool input-schema symbol was not found.",
1436
+ OPENAI_AGENTS_SDK_TOOL_NAME_MISMATCH: "The declared tool name does not match the detected OpenAI Agents SDK function-tool name.",
1437
+ OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_NOT_WIRED: "The declared tool output schema is not wired to the detected OpenAI Agents SDK function tool.",
1438
+ OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND: "The declared tool output-schema symbol was not found.",
1439
+ OPENAI_AGENTS_SDK_TOOL_REGISTRATION_NOT_WIRED: "The declared tool registration is not wired to the detected OpenAI Agents SDK agent.",
1440
+ OPENAI_AGENTS_SDK_TOOL_REGISTRATION_SYMBOL_NOT_FOUND: "The declared tool-registration symbol was not found.",
1441
+ OPENAI_AGENTS_SDK_VERSION_UNSUPPORTED: "The observed OpenAI Agents SDK dependency range is disjoint from the supported range."
1442
+ });
1443
+ /**
1444
+ * Creates one frozen, safely namespaced OpenAI Agents SDK adapter diagnostic.
1445
+ * @param input The complete code, location, entity, and safe scalar details.
1446
+ * @returns The immutable adapter diagnostic.
1447
+ */
1448
+ var createOpenAiAgentsSdkDiagnostic = (input) => Object.freeze({
1449
+ ...input,
1450
+ details: Object.freeze({ ...input.details }),
1451
+ entity: input.entity === null ? null : Object.freeze({ ...input.entity }),
1452
+ message: OPENAI_AGENTS_SDK_ADAPTER_DIAGNOSTICS[input.code],
1453
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1454
+ });
1455
+ //#endregion
1456
+ //#region src/inspection/common.ts
1457
+ var LINE_BREAK_CODE_POINTS = /* @__PURE__ */ new Set([
1458
+ 10,
1459
+ 13,
1460
+ 133,
1461
+ 8232,
1462
+ 8233
1463
+ ]);
1464
+ var isUnicodeWhiteSpace = (codePoint) => codePoint >= 9 && codePoint <= 13 || codePoint === 32 || codePoint === 133 || codePoint === 160 || codePoint === 5760 || codePoint >= 8192 && codePoint <= 8202 || codePoint >= 8232 && codePoint <= 8233 || codePoint === 8239 || codePoint === 8287 || codePoint === 12288;
1465
+ /** Compares exact strings without locale-dependent behavior. */
1466
+ var compareOpenAiAgentsSdkStrings = (left, right) => left < right ? -1 : left > right ? 1 : 0;
1467
+ /** Determines whether a runtime-visible value satisfies Core's machine-string contract. */
1468
+ var isOpenAiAgentsSdkMachineString = (value) => {
1469
+ const codePoints = [...value].map((character) => character.codePointAt(0));
1470
+ return codePoints.length > 0 && codePoints.every((codePoint) => codePoint < 55296 || codePoint > 57343) && !codePoints.includes(0) && !codePoints.some((codePoint) => LINE_BREAK_CODE_POINTS.has(codePoint)) && !isUnicodeWhiteSpace(codePoints[0]) && !isUnicodeWhiteSpace(codePoints.at(-1));
1471
+ };
1472
+ var freezeReference = (reference) => Object.freeze({
1473
+ path: reference.path,
1474
+ ...reference.symbol === void 0 ? {} : { symbol: reference.symbol }
1475
+ });
1476
+ /** Creates one deeply immutable OpenAI Agents SDK evidence record. */
1477
+ var createOpenAiAgentsSdkEvidence = (evidence) => Object.freeze({
1478
+ ...evidence,
1479
+ details: Object.freeze({ ...evidence.details }),
1480
+ references: Object.freeze(evidence.references.map(freezeReference))
1481
+ });
1482
+ var createEntity = (agentId, capabilityId) => Object.freeze({
1483
+ adapterId: OPENAI_AGENTS_SDK_ADAPTER_ID,
1484
+ agentId,
1485
+ ...capabilityId === void 0 ? {} : {
1486
+ capabilityId,
1487
+ capabilityKind: "tool"
1488
+ }
1489
+ });
1490
+ /**
1491
+ * Appends one stable package-owned diagnostic.
1492
+ * @param diagnostics The operation result collection.
1493
+ * @param code The stable diagnostic code.
1494
+ * @param path The exact affected path.
1495
+ * @param agentId The owning source-agent identifier.
1496
+ * @param range The optional scalar source range.
1497
+ * @param capabilityId The optional owning tool capability.
1498
+ * @param details Safe scalar diagnostic details.
1499
+ */
1500
+ var addOpenAiAgentsSdkDiagnostic = (diagnostics, code, path, agentId, range = null, capabilityId, details = {}) => {
1501
+ diagnostics.push(createOpenAiAgentsSdkDiagnostic({
1502
+ code,
1503
+ details,
1504
+ entity: createEntity(agentId, capabilityId),
1505
+ path,
1506
+ pointer: null,
1507
+ range
1508
+ }));
1509
+ };
1510
+ /** Returns the Core scalar range for one node in its analyzed source. */
1511
+ var locateOpenAiAgentsSdkNode = (analysis, node) => analysis.text.locator.locateRange(node.getStart(analysis.sourceFile), node.getEnd());
1512
+ /**
1513
+ * Loads and validates one supported bound TypeScript source.
1514
+ * @param session The operation-local inspection session.
1515
+ * @param reference The exact manifest reference.
1516
+ * @param diagnostics The operation result collection.
1517
+ * @param agentId The owning agent identifier.
1518
+ * @param capabilityId The optional owning tool capability.
1519
+ * @returns The indexed source or `null` after unsupported or invalid input.
1520
+ */
1521
+ var analyzeOpenAiAgentsSdkBoundReference = async (session, reference, diagnostics, agentId, capabilityId) => {
1522
+ if (!isSupportedTypeScriptSourcePath(reference.path)) return null;
1523
+ const result = await session.analyzeSource(reference.path);
1524
+ if (result.kind === "invalid-text") {
1525
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_SOURCE_TEXT_INVALID", reference.path, agentId, null, capabilityId);
1526
+ return null;
1527
+ }
1528
+ if (result.kind === "invalid-syntax") {
1529
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_SOURCE_SYNTAX_INVALID", reference.path, agentId, result.range, capabilityId);
1530
+ return null;
1531
+ }
1532
+ return result.analysis;
1533
+ };
1534
+ //#endregion
1535
+ //#region src/inspection/handoffs.ts
1536
+ var getLocalAgentDefinitions = (analysis) => [...analysis.exports.keys()].flatMap((symbol) => {
1537
+ const result = getOpenAiAgentsSdkAgentDefinition(analysis, symbol);
1538
+ return result.kind === "present-supported" && result.definition !== void 0 ? [result.definition] : [];
1539
+ });
1540
+ var resolveTarget = async (session, sourceAnalysis, expression) => {
1541
+ const candidate = unwrapExpression(expression);
1542
+ if (!ts.isIdentifier(candidate)) return null;
1543
+ const resolvedTargets = [];
1544
+ for (const reference of resolveBindingReferences(candidate, sourceAnalysis)) {
1545
+ const path = parseRepositoryPath(reference.path);
1546
+ if ((await session.getEntry(path))?.type !== "file") continue;
1547
+ const sourceResult = await session.analyzeSource(path);
1548
+ if (sourceResult.kind !== "valid") continue;
1549
+ const definitionResult = getOpenAiAgentsSdkAgentDefinition(sourceResult.analysis, reference.symbol);
1550
+ if (definitionResult.kind !== "present-supported" || definitionResult.definition === void 0) continue;
1551
+ const definition = applyOpenAiAgentsSdkAgentMutations(sourceResult.analysis, definitionResult.definition, collectOpenAiAgentsSdkHandoffTargetReferences(sourceResult.analysis));
1552
+ const staticName = definition.name.kind === "present" ? await resolveOpenAiAgentsSdkStaticString(session, sourceResult.analysis, definition.name.expression) : { kind: "unsupported" };
1553
+ resolvedTargets.push(Object.freeze({
1554
+ analysis: sourceResult.analysis,
1555
+ definition,
1556
+ path,
1557
+ runtimeName: staticName.kind === "supported" && isOpenAiAgentsSdkMachineString(staticName.value) ? staticName.value : null,
1558
+ symbol: reference.symbol
1559
+ }));
1560
+ }
1561
+ return resolvedTargets.length === 1 ? resolvedTargets[0] : null;
1562
+ };
1563
+ var getMappedAgents = (context, target) => context.project.agents.filter(({ declaration }) => {
1564
+ const runtimeAgent = declaration.bindings?.runtimeAgent;
1565
+ return runtimeAgent?.path === target.path && runtimeAgent.symbol === target.symbol;
1566
+ });
1567
+ var getSafeDetails = (registration, routingDescriptionSource, target, targetAgentId) => ({
1568
+ registrationKind: registration.kind,
1569
+ routingDescriptionSource,
1570
+ ...targetAgentId === void 0 ? {} : { targetAgentId },
1571
+ ...target.runtimeName === null ? {} : { targetRuntimeName: target.runtimeName }
1572
+ });
1573
+ var getAmbiguousTargetDetails = (registration, target) => ({
1574
+ registrationKind: registration.kind,
1575
+ ...target.runtimeName === null ? {} : { targetRuntimeName: target.runtimeName }
1576
+ });
1577
+ var getRuntimeName = async (session, sourceAnalysis, registration) => {
1578
+ if (registration.toolNameOverride.kind !== "present") return null;
1579
+ const result = await resolveOpenAiAgentsSdkStaticString(session, sourceAnalysis, registration.toolNameOverride.expression);
1580
+ return result.kind === "supported" && isOpenAiAgentsSdkMachineString(result.value) ? result.value : null;
1581
+ };
1582
+ var inspectRoutingDescription = async (session, sourceAgent, sourceAnalysis, registration, target, targetAgent, diagnostics) => {
1583
+ const canonicalDescription = targetAgent.handoffDescription?.value ?? targetAgent.description.value;
1584
+ if (registration.toolDescriptionOverride.kind === "unresolved") return "unresolved";
1585
+ if (registration.toolDescriptionOverride.kind === "present") {
1586
+ const override = await resolveOpenAiAgentsSdkStaticString(session, sourceAnalysis, registration.toolDescriptionOverride.expression);
1587
+ if (override.kind !== "supported") return "unresolved";
1588
+ if (override.value.length > 0) {
1589
+ if (override.value !== canonicalDescription) addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED", sourceAnalysis.path, sourceAgent.id, locateOpenAiAgentsSdkNode(sourceAnalysis, registration.toolDescriptionOverride.expression), void 0, getSafeDetails(registration, "override", target, targetAgent.id));
1590
+ return "override";
1591
+ }
1592
+ }
1593
+ if (target.definition.handoffDescription.kind === "unresolved") return "unresolved";
1594
+ if (target.definition.handoffDescription.kind === "absent") {
1595
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING", target.path, sourceAgent.id, locateOpenAiAgentsSdkNode(target.analysis, target.definition.declaration), void 0, getSafeDetails(registration, "target", target, targetAgent.id));
1596
+ return "target";
1597
+ }
1598
+ const description = await resolveOpenAiAgentsSdkStaticString(session, target.analysis, target.definition.handoffDescription.expression);
1599
+ if (description.kind !== "supported") return "unresolved";
1600
+ const diagnosticCode = description.value.length === 0 ? "OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING" : description.value !== canonicalDescription ? "OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED" : null;
1601
+ if (diagnosticCode !== null) addOpenAiAgentsSdkDiagnostic(diagnostics, diagnosticCode, target.path, sourceAgent.id, locateOpenAiAgentsSdkNode(target.analysis, target.definition.handoffDescription.expression), void 0, getSafeDetails(registration, "target", target, targetAgent.id));
1602
+ return "target";
1603
+ };
1604
+ /** Inspects runtime-native handoff registrations and routing-description wiring. */
1605
+ var inspectOpenAiAgentsSdkHandoffs = async (context, session, agent, analysis, definition, evidence, diagnostics) => {
1606
+ const localDefinitions = getLocalAgentDefinitions(analysis);
1607
+ const collectionReferences = collectOpenAiAgentsSdkHandoffCollectionReferences(localDefinitions.map(({ handoffs }) => handoffs));
1608
+ const elements = getOpenAiAgentsSdkHandoffElements(definition.handoffs, analysis, collectionReferences);
1609
+ if (elements === null) return;
1610
+ const allowedWrapperReferences = new Set(localDefinitions.flatMap(({ handoffs }) => (getOpenAiAgentsSdkHandoffElements(handoffs, analysis, collectionReferences) ?? []).filter((element) => ts.isIdentifier(element))));
1611
+ for (const element of elements) {
1612
+ session.signal?.throwIfAborted();
1613
+ const registration = analyzeOpenAiAgentsSdkHandoffElement(element, analysis, allowedWrapperReferences);
1614
+ if (registration === null) continue;
1615
+ const target = await resolveTarget(session, analysis, registration.target);
1616
+ if (target === null) continue;
1617
+ const mappedAgents = getMappedAgents(context, target);
1618
+ const runtimeName = await getRuntimeName(session, analysis, registration);
1619
+ let routingDescriptionSource = "unresolved";
1620
+ if (mappedAgents.length > 1) addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS", analysis.path, agent.id, locateOpenAiAgentsSdkNode(analysis, registration.target), void 0, getAmbiguousTargetDetails(registration, target));
1621
+ else if (mappedAgents.length === 1) routingDescriptionSource = await inspectRoutingDescription(session, agent, analysis, registration, target, mappedAgents[0], diagnostics);
1622
+ const targetAgent = mappedAgents.length === 1 ? mappedAgents[0] : void 0;
1623
+ evidence.push(createOpenAiAgentsSdkEvidence({
1624
+ agentId: agent.id,
1625
+ capabilityId: null,
1626
+ capabilityKind: null,
1627
+ details: getSafeDetails(registration, routingDescriptionSource, target, targetAgent?.id),
1628
+ kind: "handoff-registration",
1629
+ references: [{ path: analysis.path }, {
1630
+ path: target.path,
1631
+ symbol: target.symbol
1632
+ }],
1633
+ runtimeName,
1634
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1635
+ }));
1636
+ }
1637
+ };
1638
+ //#endregion
1639
+ //#region src/inspection/package-inspection.ts
1640
+ /** Inspects the nearest owning package manifest for one runtime source. */
1641
+ var inspectOpenAiAgentsSdkPackage = async (session, sourcePath, evidence, diagnostics, agentId) => {
1642
+ const discovery = await session.discoverPackage(sourcePath);
1643
+ if (discovery.kind === "absent") return;
1644
+ if (discovery.kind === "invalid") {
1645
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_PACKAGE_MANIFEST_INVALID", discovery.path, agentId);
1646
+ return;
1647
+ }
1648
+ const { observation } = discovery;
1649
+ if (observation.compatibility === "unsupported") {
1650
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_VERSION_UNSUPPORTED", observation.path, agentId);
1651
+ return;
1652
+ }
1653
+ for (const declaration of observation.declarations) evidence.push(createOpenAiAgentsSdkEvidence({
1654
+ agentId,
1655
+ capabilityId: null,
1656
+ capabilityKind: null,
1657
+ details: {
1658
+ compatibility: observation.compatibility,
1659
+ declaredRange: declaration.declaredRange,
1660
+ dependencyKind: declaration.dependencyKind
1661
+ },
1662
+ kind: "runtime-package",
1663
+ references: [{ path: observation.path }],
1664
+ runtimeName: OPENAI_AGENTS_SDK_PACKAGE_NAME,
1665
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1666
+ }));
1667
+ };
1668
+ //#endregion
1669
+ //#region src/inspection/relationships.ts
1670
+ var getAgentDefinitions = (analysis) => [...analysis.exports.keys()].flatMap((symbol) => {
1671
+ const definition = getOpenAiAgentsSdkAgentDefinition(analysis, symbol);
1672
+ return definition.kind === "present-supported" && definition.definition !== void 0 ? [definition.definition] : [];
1673
+ });
1674
+ var getAllowedToolReferences = (analysis) => {
1675
+ const definitions = getAgentDefinitions(analysis);
1676
+ const collectionReferences = collectOpenAiAgentsSdkToolCollectionReferences(definitions.map(({ tools }) => tools));
1677
+ return new Set(definitions.flatMap(({ tools }) => getOpenAiAgentsSdkToolElements(tools, analysis, collectionReferences)));
1678
+ };
1679
+ var getRelationshipRange = (analysis, relationship) => relationship.kind === "present" ? locateOpenAiAgentsSdkNode(analysis, relationship.expression) : null;
1680
+ var inspectConstSymbol = async (session, reference, diagnosticCode, agentId, diagnostics, capabilityId) => {
1681
+ if (reference.symbol === void 0) return null;
1682
+ const analysis = await analyzeOpenAiAgentsSdkBoundReference(session, reference, diagnostics, agentId, capabilityId);
1683
+ if (analysis === null) return null;
1684
+ const exported = getConstExport(analysis, reference.symbol);
1685
+ if (exported.kind === "absent") {
1686
+ addOpenAiAgentsSdkDiagnostic(diagnostics, diagnosticCode, reference.path, agentId, null, capabilityId);
1687
+ return false;
1688
+ }
1689
+ return exported.kind === "present-supported" ? true : null;
1690
+ };
1691
+ var inspectInstructionLoader = async (session, agent, analysis, definition, evidence, diagnostics) => {
1692
+ const reference = agent.declaration.bindings?.instructionLoader;
1693
+ if (reference?.symbol === void 0) return;
1694
+ const loaderAnalysis = await analyzeOpenAiAgentsSdkBoundReference(session, reference, diagnostics, agent.id);
1695
+ if (loaderAnalysis === null) return;
1696
+ const loader = getCallableExportState(loaderAnalysis, reference.symbol);
1697
+ if (loader.kind === "absent") {
1698
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_SYMBOL_NOT_FOUND", reference.path, agent.id);
1699
+ return;
1700
+ }
1701
+ if (loader.kind !== "present-supported") return;
1702
+ const relationship = classifyOpenAiAgentsSdkInstructionLoader(definition.instructions, analysis, reference);
1703
+ if (relationship === true) evidence.push(createOpenAiAgentsSdkEvidence({
1704
+ agentId: agent.id,
1705
+ capabilityId: null,
1706
+ capabilityKind: null,
1707
+ details: { configurationProperty: "instructions" },
1708
+ kind: "instruction-loader",
1709
+ references: [{ path: analysis.path }, {
1710
+ path: reference.path,
1711
+ symbol: reference.symbol
1712
+ }],
1713
+ runtimeName: reference.symbol,
1714
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1715
+ }));
1716
+ else if (relationship === false) addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_NOT_WIRED", analysis.path, agent.id, getRelationshipRange(analysis, definition.instructions));
1717
+ };
1718
+ var inspectAgentOutputSchema = async (session, agent, analysis, definition, evidence, diagnostics) => {
1719
+ const reference = agent.declaration.bindings?.outputSchema;
1720
+ if (reference?.symbol === void 0) return;
1721
+ if (await inspectConstSymbol(session, reference, "OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND", agent.id, diagnostics) !== true) return;
1722
+ const relationship = classifyOpenAiAgentsSdkDirectBinding(definition.outputType, analysis, reference);
1723
+ if (relationship === true) evidence.push(createOpenAiAgentsSdkEvidence({
1724
+ agentId: agent.id,
1725
+ capabilityId: null,
1726
+ capabilityKind: null,
1727
+ details: {
1728
+ configurationProperty: "outputType",
1729
+ schemaRole: "agent-output"
1730
+ },
1731
+ kind: "schema",
1732
+ references: [{ path: analysis.path }, {
1733
+ path: reference.path,
1734
+ symbol: reference.symbol
1735
+ }],
1736
+ runtimeName: reference.symbol,
1737
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1738
+ }));
1739
+ else if (relationship === false) addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_NOT_WIRED", analysis.path, agent.id, getRelationshipRange(analysis, definition.outputType));
1740
+ };
1741
+ var inspectImplementationSymbol = async (session, agent, capabilityId, reference, diagnostics) => {
1742
+ if (reference.symbol === void 0) return null;
1743
+ const analysis = await analyzeOpenAiAgentsSdkBoundReference(session, reference, diagnostics, agent.id, capabilityId);
1744
+ if (analysis === null) return null;
1745
+ const implementation = getCallableExportState(analysis, reference.symbol);
1746
+ if (implementation.kind === "absent") {
1747
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_SYMBOL_NOT_FOUND", reference.path, agent.id, null, capabilityId);
1748
+ return false;
1749
+ }
1750
+ return implementation.kind === "present-supported" ? true : null;
1751
+ };
1752
+ var inspectFunctionTool = async (session, agent, capabilityId, toolDeclaration, diagnostics) => {
1753
+ const reference = toolDeclaration.registration;
1754
+ if (reference?.symbol === void 0) return null;
1755
+ const analysis = await analyzeOpenAiAgentsSdkBoundReference(session, reference, diagnostics, agent.id, capabilityId);
1756
+ if (analysis === null) return null;
1757
+ const registration = getOpenAiAgentsSdkFunctionTool(analysis, reference.symbol);
1758
+ if (registration.kind === "absent") {
1759
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_TOOL_REGISTRATION_SYMBOL_NOT_FOUND", reference.path, agent.id, null, capabilityId);
1760
+ return null;
1761
+ }
1762
+ if (registration.kind !== "present-supported") return null;
1763
+ const staticName = await resolveOpenAiAgentsSdkStaticString(session, analysis, registration.tool.name);
1764
+ if (staticName.kind !== "supported" || !OPENAI_AGENTS_SDK_TOOL_NAME_PATTERN.test(staticName.value)) return null;
1765
+ const mutations = analyzeOpenAiAgentsSdkMutations(analysis, registration.tool.declaration, getAllowedToolReferences(analysis));
1766
+ if (mutations.hasUnknownMutation || mutations.mutatedMembers.has("type")) return null;
1767
+ const isNameMutable = mutations.mutatedMembers.has("name");
1768
+ const isNameMatch = !isNameMutable && staticName.value === toolDeclaration.name;
1769
+ const execute = mutations.mutatedMembers.has("invoke") ? { kind: "unresolved" } : registration.tool.execute;
1770
+ const outputSchema = mutations.mutatedMembers.has("outputSchema") ? { kind: "unresolved" } : registration.tool.outputSchema;
1771
+ const parameters = mutations.mutatedMembers.has("parameters") ? { kind: "unresolved" } : registration.tool.parameters;
1772
+ if (!isNameMutable && !isNameMatch) addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_TOOL_NAME_MISMATCH", analysis.path, agent.id, locateOpenAiAgentsSdkNode(analysis, registration.tool.name), capabilityId);
1773
+ return Object.freeze({
1774
+ analysis,
1775
+ capabilityId,
1776
+ execute,
1777
+ isNameMatch,
1778
+ name: isNameMutable ? null : staticName.value,
1779
+ outputSchema,
1780
+ parameters,
1781
+ reference: Object.freeze({
1782
+ path: reference.path,
1783
+ symbol: reference.symbol
1784
+ }),
1785
+ tool: registration.tool
1786
+ });
1787
+ };
1788
+ var inspectToolSchema = async (session, agent, capabilityId, reference, registration, relationshipName, evidence, diagnostics) => {
1789
+ if (reference.symbol === void 0) return;
1790
+ const isOutput = relationshipName === "outputSchema";
1791
+ if (await inspectConstSymbol(session, reference, isOutput ? "OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND" : "OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_SYMBOL_NOT_FOUND", agent.id, diagnostics, capabilityId) !== true || registration === null) return;
1792
+ const relationship = classifyOpenAiAgentsSdkDirectBinding(registration[relationshipName], registration.analysis, reference);
1793
+ if (relationship === true) evidence.push(createOpenAiAgentsSdkEvidence({
1794
+ agentId: agent.id,
1795
+ capabilityId,
1796
+ capabilityKind: "tool",
1797
+ details: {
1798
+ configurationProperty: relationshipName,
1799
+ schemaRole: isOutput ? "tool-output" : "tool-input"
1800
+ },
1801
+ kind: "schema",
1802
+ references: [{ path: registration.analysis.path }, {
1803
+ path: reference.path,
1804
+ symbol: reference.symbol
1805
+ }],
1806
+ runtimeName: reference.symbol,
1807
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1808
+ }));
1809
+ else if (relationship === false) addOpenAiAgentsSdkDiagnostic(diagnostics, isOutput ? "OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_NOT_WIRED" : "OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_NOT_WIRED", registration.analysis.path, agent.id, getRelationshipRange(registration.analysis, registration[relationshipName]), capabilityId);
1810
+ };
1811
+ var inspectTools = async (session, agent, runtimeAnalysis, definition, evidence, diagnostics) => {
1812
+ const collectionReferences = collectOpenAiAgentsSdkToolCollectionReferences(getAgentDefinitions(runtimeAnalysis).map(({ tools }) => tools));
1813
+ for (const capabilityId of Object.keys(agent.declaration.tools ?? {}).sort(compareOpenAiAgentsSdkStrings)) {
1814
+ const toolDeclaration = agent.declaration.tools?.[capabilityId];
1815
+ if (toolDeclaration === void 0) continue;
1816
+ const implementationState = await inspectImplementationSymbol(session, agent, capabilityId, toolDeclaration.implementation, diagnostics);
1817
+ const registration = await inspectFunctionTool(session, agent, capabilityId, toolDeclaration, diagnostics);
1818
+ if (toolDeclaration.inputSchema !== void 0) await inspectToolSchema(session, agent, capabilityId, toolDeclaration.inputSchema, registration, "parameters", evidence, diagnostics);
1819
+ if (toolDeclaration.outputSchema !== void 0) await inspectToolSchema(session, agent, capabilityId, toolDeclaration.outputSchema, registration, "outputSchema", evidence, diagnostics);
1820
+ if (registration === null) continue;
1821
+ const implementationRelationship = classifyOpenAiAgentsSdkDirectBinding(registration.execute, registration.analysis, toolDeclaration.implementation);
1822
+ if (implementationState === true && implementationRelationship === false) addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_NOT_WIRED", registration.analysis.path, agent.id, getRelationshipRange(registration.analysis, registration.execute), capabilityId);
1823
+ const registrationRelationship = classifyOpenAiAgentsSdkToolRegistration(definition.tools, runtimeAnalysis, registration.reference, collectionReferences);
1824
+ if (registrationRelationship === false) addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_TOOL_REGISTRATION_NOT_WIRED", runtimeAnalysis.path, agent.id, getRelationshipRange(runtimeAnalysis, definition.tools), capabilityId);
1825
+ else if (registrationRelationship === true && implementationState === true && implementationRelationship === true && registration.isNameMatch && registration.name !== null) evidence.push(createOpenAiAgentsSdkEvidence({
1826
+ agentId: agent.id,
1827
+ capabilityId,
1828
+ capabilityKind: "tool",
1829
+ details: { toolType: "function" },
1830
+ kind: "tool-registration",
1831
+ references: [
1832
+ { path: runtimeAnalysis.path },
1833
+ {
1834
+ path: registration.reference.path,
1835
+ symbol: registration.reference.symbol
1836
+ },
1837
+ {
1838
+ path: toolDeclaration.implementation.path,
1839
+ ...toolDeclaration.implementation.symbol === void 0 ? {} : { symbol: toolDeclaration.implementation.symbol }
1840
+ }
1841
+ ],
1842
+ runtimeName: registration.name,
1843
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1844
+ }));
1845
+ }
1846
+ };
1847
+ /** Inspects instruction, agent-schema, function-tool, and tool-schema relationships. */
1848
+ var inspectOpenAiAgentsSdkRelationships = async (session, agent, analysis, definition, evidence, diagnostics) => {
1849
+ await inspectInstructionLoader(session, agent, analysis, definition, evidence, diagnostics);
1850
+ await inspectAgentOutputSchema(session, agent, analysis, definition, evidence, diagnostics);
1851
+ await inspectTools(session, agent, analysis, definition, evidence, diagnostics);
1852
+ };
1853
+ //#endregion
1854
+ //#region src/package-discovery/index.ts
1855
+ /**
1856
+ * Discovers the nearest relevant OpenAI Agents SDK package declaration.
1857
+ * @param repository The Core-owned budget-aware repository reader.
1858
+ * @param sourcePath The bound source whose package scope is inspected.
1859
+ * @param signal The active inspection signal.
1860
+ * @returns The first observed declaration, invalid manifest, or absence result.
1861
+ * @throws
1862
+ * - INVALID_REPOSITORY_PATH: The repository path is invalid.
1863
+ * - ENTRY_NOT_FOUND: The requested repository entry was not found.
1864
+ * - ENTRY_NOT_FILE: The requested repository entry is not a file.
1865
+ * - ACCESS_DENIED: Access to the repository source was denied.
1866
+ * - SOURCE_UNAVAILABLE: The repository source is unavailable.
1867
+ * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
1868
+ * - INVALID_SOURCE_DATA: The repository source returned invalid data.
1869
+ * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.
1870
+ * - ABORTED: The repository operation was aborted.
1871
+ */
1872
+ var discoverOpenAiAgentsSdkPackage = async (repository, sourcePath, signal) => {
1873
+ const repositoryOptions = signal === void 0 ? void 0 : { signal };
1874
+ const result = await discoverPackage({
1875
+ packageName: OPENAI_AGENTS_SDK_PACKAGE_NAME,
1876
+ reader: {
1877
+ getEntry: (path) => repository.getEntry(parseRepositoryPath(path), repositoryOptions),
1878
+ readFile: (path) => repository.readFile(parseRepositoryPath(path), repositoryOptions)
1879
+ },
1880
+ ...signal === void 0 ? {} : { signal },
1881
+ sourcePath,
1882
+ supportedRange: OPENAI_AGENTS_SDK_SUPPORTED_RANGE
1883
+ });
1884
+ if (result.kind === "invalid") return Object.freeze({
1885
+ kind: "invalid",
1886
+ path: parseRepositoryPath(result.path)
1887
+ });
1888
+ if (result.kind === "observed") return Object.freeze({
1889
+ kind: "observed",
1890
+ observation: Object.freeze({
1891
+ ...result.observation,
1892
+ path: parseRepositoryPath(result.observation.path)
1893
+ })
1894
+ });
1895
+ return result;
1896
+ };
1897
+ //#endregion
1898
+ //#region src/inspection/session.ts
1899
+ /** Creates one operation-local OpenAI Agents SDK inspection session. */
1900
+ var createOpenAiAgentsSdkInspectionSession = (context) => createInspectionSession({
1901
+ analyzeSource: analyzeOpenAiAgentsSdkSource,
1902
+ discoverPackage: (path, signal) => discoverOpenAiAgentsSdkPackage(context.repository, path, signal),
1903
+ getEntry: (path, signal) => context.repository.getEntry(path, signal === void 0 ? void 0 : { signal }),
1904
+ readFile: (path, signal) => context.repository.readFile(path, signal === void 0 ? void 0 : { signal }),
1905
+ ...context.signal === void 0 ? {} : { signal: context.signal }
1906
+ });
1907
+ //#endregion
1908
+ //#region src/inspection/inspection.ts
1909
+ var inspectAgent = async (context, session, agent, evidence, diagnostics) => {
1910
+ const runtimeAgent = agent.declaration.bindings?.runtimeAgent;
1911
+ if (runtimeAgent === void 0) return;
1912
+ await inspectOpenAiAgentsSdkPackage(session, runtimeAgent.path, evidence, diagnostics, agent.id);
1913
+ if (!isSupportedTypeScriptSourcePath(runtimeAgent.path)) return;
1914
+ evidence.push(createOpenAiAgentsSdkEvidence({
1915
+ agentId: agent.id,
1916
+ capabilityId: null,
1917
+ capabilityKind: null,
1918
+ details: { language: "typescript" },
1919
+ kind: "language",
1920
+ references: [runtimeAgent.symbol === void 0 ? { path: runtimeAgent.path } : {
1921
+ path: runtimeAgent.path,
1922
+ symbol: runtimeAgent.symbol
1923
+ }],
1924
+ runtimeName: null,
1925
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1926
+ }));
1927
+ if (runtimeAgent.symbol === void 0) return;
1928
+ const analysis = await analyzeOpenAiAgentsSdkBoundReference(session, runtimeAgent, diagnostics, agent.id);
1929
+ if (analysis === null) return;
1930
+ const definitionResult = getOpenAiAgentsSdkAgentDefinition(analysis, runtimeAgent.symbol);
1931
+ if (definitionResult.kind === "absent") {
1932
+ addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_RUNTIME_AGENT_SYMBOL_NOT_FOUND", runtimeAgent.path, agent.id);
1933
+ return;
1934
+ }
1935
+ if (definitionResult.kind !== "present-supported" || definitionResult.definition === void 0) return;
1936
+ const definition = applyOpenAiAgentsSdkAgentMutations(analysis, definitionResult.definition, collectOpenAiAgentsSdkHandoffTargetReferences(analysis));
1937
+ const runtimeName = definition.name.kind === "present" ? await resolveOpenAiAgentsSdkStaticString(session, analysis, definition.name.expression) : { kind: "unsupported" };
1938
+ evidence.push(createOpenAiAgentsSdkEvidence({
1939
+ agentId: agent.id,
1940
+ capabilityId: null,
1941
+ capabilityKind: null,
1942
+ details: { definitionKind: "agent" },
1943
+ kind: "agent-definition",
1944
+ references: [{
1945
+ path: runtimeAgent.path,
1946
+ symbol: runtimeAgent.symbol
1947
+ }],
1948
+ runtimeName: runtimeName.kind === "supported" && isOpenAiAgentsSdkMachineString(runtimeName.value) ? runtimeName.value : runtimeAgent.symbol,
1949
+ source: OPENAI_AGENTS_SDK_ADAPTER_ID
1950
+ }));
1951
+ await inspectOpenAiAgentsSdkRelationships(session, agent, analysis, definition, evidence, diagnostics);
1952
+ await inspectOpenAiAgentsSdkHandoffs(context, session, agent, analysis, definition, evidence, diagnostics);
1953
+ };
1954
+ /**
1955
+ * Inspects all scoped OpenAI Agents SDK agents through one deterministic session.
1956
+ * @param context The Core-provided immutable adapter context.
1957
+ * @returns A promise resolving to source-grounded evidence and diagnostics.
1958
+ * @throws
1959
+ * - INVALID_REPOSITORY_PATH: The repository path is invalid.
1960
+ * - ENTRY_NOT_FOUND: The requested repository entry was not found.
1961
+ * - ENTRY_NOT_FILE: The requested repository entry is not a file.
1962
+ * - ACCESS_DENIED: Access to the repository source was denied.
1963
+ * - SOURCE_UNAVAILABLE: The repository source is unavailable.
1964
+ * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
1965
+ * - INVALID_SOURCE_DATA: The repository source returned invalid data.
1966
+ * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.
1967
+ * - ABORTED: The repository operation or inspection signal was aborted.
1968
+ */
1969
+ var inspectOpenAiAgentsSdk = async (context) => {
1970
+ context.signal?.throwIfAborted();
1971
+ const session = createOpenAiAgentsSdkInspectionSession(context);
1972
+ const evidence = [];
1973
+ const diagnostics = [];
1974
+ const agents = [...context.agents].sort((left, right) => compareOpenAiAgentsSdkStrings(left.id, right.id));
1975
+ for (const agent of agents) {
1976
+ context.signal?.throwIfAborted();
1977
+ await inspectAgent(context, session, agent, evidence, diagnostics);
1978
+ }
1979
+ context.signal?.throwIfAborted();
1980
+ return Object.freeze({
1981
+ diagnostics: Object.freeze(diagnostics),
1982
+ evidence: Object.freeze(evidence)
1983
+ });
1984
+ };
1985
+ //#endregion
1986
+ //#region src/adapter/index.ts
1987
+ var openAiAgentsSdkAdapter = Object.freeze({
1988
+ id: OPENAI_AGENTS_SDK_ADAPTER_ID,
1989
+ inspect: inspectOpenAiAgentsSdk,
1990
+ supportedRepositoryFormatVersions: OPENAI_AGENTS_SDK_SUPPORTED_REPOSITORY_FORMAT_VERSIONS
1991
+ });
1992
+ //#endregion
1993
+ export { openAiAgentsSdkAdapter };