@moldea.ai/adapter-openai-agents-sdk 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +54 -29
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -186,14 +186,8 @@ var classifyPackageDeclarations = (declarations, supportedRange) => {
|
|
|
186
186
|
if (classifications.every((classification) => classification === "unsupported")) return "unsupported";
|
|
187
187
|
return "ambiguous";
|
|
188
188
|
};
|
|
189
|
-
|
|
190
|
-
|
|
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;
|
|
189
|
+
var readOwningManifest = async (options) => {
|
|
190
|
+
const { reader, signal, sourcePath } = options;
|
|
197
191
|
for (const manifestPath of createPackageManifestCandidatePaths(sourcePath)) {
|
|
198
192
|
signal?.throwIfAborted();
|
|
199
193
|
const entry = await reader.getEntry(manifestPath);
|
|
@@ -221,28 +215,48 @@ var discoverPackage = async (options) => {
|
|
|
221
215
|
});
|
|
222
216
|
}
|
|
223
217
|
signal?.throwIfAborted();
|
|
224
|
-
|
|
225
|
-
kind: "
|
|
218
|
+
return isRecord(parsed) ? Object.freeze({
|
|
219
|
+
kind: "present",
|
|
220
|
+
manifest: parsed,
|
|
226
221
|
path: manifestPath
|
|
227
|
-
})
|
|
228
|
-
const declarations = extractPackageDeclarations(parsed, packageName);
|
|
229
|
-
if (declarations === null) return Object.freeze({
|
|
222
|
+
}) : Object.freeze({
|
|
230
223
|
kind: "invalid",
|
|
231
224
|
path: manifestPath
|
|
232
225
|
});
|
|
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
226
|
}
|
|
243
227
|
return Object.freeze({ kind: "absent" });
|
|
244
228
|
};
|
|
245
229
|
/**
|
|
230
|
+
* Discovers the nearest package declaration without repository enumeration.
|
|
231
|
+
* @param options The package target, repository callbacks, path, range, and signal.
|
|
232
|
+
* @returns The first observed declaration, invalid manifest, or absence result.
|
|
233
|
+
* @throws If repository reading or the active inspection is aborted.
|
|
234
|
+
*/
|
|
235
|
+
var discoverPackage = async (options) => {
|
|
236
|
+
const { includeManifestPackageName, packageName, reader, signal, sourcePath, supportedRange } = options;
|
|
237
|
+
const owningManifest = await readOwningManifest({
|
|
238
|
+
reader,
|
|
239
|
+
...signal === void 0 ? {} : { signal },
|
|
240
|
+
sourcePath
|
|
241
|
+
});
|
|
242
|
+
if (owningManifest.kind !== "present") return owningManifest;
|
|
243
|
+
const declarations = extractPackageDeclarations(owningManifest.manifest, packageName);
|
|
244
|
+
if (declarations === null) return Object.freeze({
|
|
245
|
+
kind: "invalid",
|
|
246
|
+
path: owningManifest.path
|
|
247
|
+
});
|
|
248
|
+
if (declarations.length === 0) return Object.freeze({ kind: "absent" });
|
|
249
|
+
return Object.freeze({
|
|
250
|
+
kind: "observed",
|
|
251
|
+
observation: Object.freeze({
|
|
252
|
+
compatibility: classifyPackageDeclarations(declarations, supportedRange),
|
|
253
|
+
declarations: Object.freeze(declarations),
|
|
254
|
+
...includeManifestPackageName === true ? { manifestPackageName: typeof owningManifest.manifest["name"] === "string" ? owningManifest.manifest["name"] : null } : {},
|
|
255
|
+
path: owningManifest.path
|
|
256
|
+
})
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
246
260
|
* Removes the transparent expression wrappers supported by runtime adapters.
|
|
247
261
|
* @param expression The expression to normalize.
|
|
248
262
|
* @returns The underlying expression used by static matching.
|
|
@@ -664,9 +678,10 @@ var analyzeMutationCall = (identifier, mutatedMembers) => {
|
|
|
664
678
|
* @param analysis The indexed source containing the binding.
|
|
665
679
|
* @param declaration The module-local constant declaration.
|
|
666
680
|
* @param allowedReferences Bare identifier uses proven to be supported registrations or targets.
|
|
681
|
+
* @param safeMethodCalls Read-only method calls that preserve the value's runtime configuration.
|
|
667
682
|
* @returns Member-specific mutations and whether an unknown use can affect every relationship.
|
|
668
683
|
*/
|
|
669
|
-
var analyzeModuleValueMutations = (analysis, declaration, allowedReferences) => {
|
|
684
|
+
var analyzeModuleValueMutations = (analysis, declaration, allowedReferences, safeMethodCalls = /* @__PURE__ */ new Set()) => {
|
|
670
685
|
if (!ts.isIdentifier(declaration.name)) return Object.freeze({
|
|
671
686
|
hasUnknownMutation: true,
|
|
672
687
|
mutatedMembers: /* @__PURE__ */ new Set()
|
|
@@ -686,7 +701,9 @@ var analyzeModuleValueMutations = (analysis, declaration, allowedReferences) =>
|
|
|
686
701
|
const memberExpression = skipTransparentParents(member);
|
|
687
702
|
const memberParent = memberExpression.parent;
|
|
688
703
|
if ((ts.isPropertyAccessExpression(memberParent) || ts.isElementAccessExpression(memberParent)) && memberParent.expression === memberExpression && ts.isCallExpression(skipTransparentParents(memberParent).parent)) mutatedMembers.add(memberName);
|
|
689
|
-
else if (ts.isCallExpression(memberParent) && memberParent.expression === memberExpression)
|
|
704
|
+
else if (ts.isCallExpression(memberParent) && memberParent.expression === memberExpression) {
|
|
705
|
+
if (!safeMethodCalls.has(memberName)) mutatedMembers.add(memberName);
|
|
706
|
+
}
|
|
690
707
|
}
|
|
691
708
|
continue;
|
|
692
709
|
}
|
|
@@ -702,6 +719,17 @@ var analyzeModuleValueMutations = (analysis, declaration, allowedReferences) =>
|
|
|
702
719
|
mutatedMembers: new Set(mutatedMembers)
|
|
703
720
|
});
|
|
704
721
|
};
|
|
722
|
+
var TYPESCRIPT_DECLARATION_EXTENSIONS = [
|
|
723
|
+
".d.ts",
|
|
724
|
+
".d.tsx",
|
|
725
|
+
".d.mts",
|
|
726
|
+
".d.cts"
|
|
727
|
+
];
|
|
728
|
+
var TYPESCRIPT_SOURCE_EXTENSIONS = [
|
|
729
|
+
".ts",
|
|
730
|
+
".tsx",
|
|
731
|
+
".mts"
|
|
732
|
+
];
|
|
705
733
|
var getScriptKind = (path) => path.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
|
|
706
734
|
var createSyntaxProgram = (sourceFile, text) => {
|
|
707
735
|
return ts.createProgram({
|
|
@@ -784,11 +812,7 @@ var analyzeTypeScriptModule = (path, bytes, importConfig, signal) => {
|
|
|
784
812
|
* @param path The bound source path.
|
|
785
813
|
* @returns Whether its extension is supported.
|
|
786
814
|
*/
|
|
787
|
-
var isSupportedTypeScriptSourcePath = (path) =>
|
|
788
|
-
".ts",
|
|
789
|
-
".tsx",
|
|
790
|
-
".mts"
|
|
791
|
-
].some((extension) => path.endsWith(extension));
|
|
815
|
+
var isSupportedTypeScriptSourcePath = (path) => !TYPESCRIPT_DECLARATION_EXTENSIONS.some((extension) => path.endsWith(extension)) && TYPESCRIPT_SOURCE_EXTENSIONS.some((extension) => path.endsWith(extension));
|
|
792
816
|
/**
|
|
793
817
|
* Classifies a direct exported runtime-agent function and exposes its body.
|
|
794
818
|
* @param analysis The indexed runtime source.
|
|
@@ -886,6 +910,7 @@ var resolveStaticStringExpression = async (options, analysis, expression, visite
|
|
|
886
910
|
visited.add(key);
|
|
887
911
|
const importedResult = await options.analyzeSource(importedPath);
|
|
888
912
|
if (importedResult.kind !== "valid") {
|
|
913
|
+
options.onSourceFailure?.(importedPath, importedResult);
|
|
889
914
|
visited.delete(key);
|
|
890
915
|
return Object.freeze({ kind: "unsupported" });
|
|
891
916
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moldea.ai/adapter-openai-agents-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Deterministic runtime evidence and diagnostics for direct OpenAI Agents SDK integrations.",
|
|
5
5
|
"homepage": "https://github.com/moldea-ai/packages/tree/main/projects/adapter-openai-agents-sdk#readme",
|
|
6
6
|
"bugs": {
|