@moldea.ai/adapter-google-genai 1.0.3 → 1.0.4
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 +102 -63
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -187,14 +187,8 @@ var classifyPackageDeclarations = (declarations, supportedRange) => {
|
|
|
187
187
|
if (classifications.every((classification) => classification === "unsupported")) return "unsupported";
|
|
188
188
|
return "ambiguous";
|
|
189
189
|
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
* @param options The package target, repository callbacks, path, range, and signal.
|
|
193
|
-
* @returns The first observed declaration, invalid manifest, or absence result.
|
|
194
|
-
* @throws If repository reading or the active inspection is aborted.
|
|
195
|
-
*/
|
|
196
|
-
var discoverPackage = async (options) => {
|
|
197
|
-
const { packageName, reader, signal, sourcePath, supportedRange } = options;
|
|
190
|
+
var readOwningManifest = async (options) => {
|
|
191
|
+
const { reader, signal, sourcePath } = options;
|
|
198
192
|
for (const manifestPath of createPackageManifestCandidatePaths(sourcePath)) {
|
|
199
193
|
signal?.throwIfAborted();
|
|
200
194
|
const entry = await reader.getEntry(manifestPath);
|
|
@@ -222,28 +216,48 @@ var discoverPackage = async (options) => {
|
|
|
222
216
|
});
|
|
223
217
|
}
|
|
224
218
|
signal?.throwIfAborted();
|
|
225
|
-
|
|
226
|
-
kind: "
|
|
219
|
+
return isRecord(parsed) ? Object.freeze({
|
|
220
|
+
kind: "present",
|
|
221
|
+
manifest: parsed,
|
|
227
222
|
path: manifestPath
|
|
228
|
-
})
|
|
229
|
-
const declarations = extractPackageDeclarations(parsed, packageName);
|
|
230
|
-
if (declarations === null) return Object.freeze({
|
|
223
|
+
}) : Object.freeze({
|
|
231
224
|
kind: "invalid",
|
|
232
225
|
path: manifestPath
|
|
233
226
|
});
|
|
234
|
-
if (declarations.length === 0) return Object.freeze({ kind: "absent" });
|
|
235
|
-
return Object.freeze({
|
|
236
|
-
kind: "observed",
|
|
237
|
-
observation: Object.freeze({
|
|
238
|
-
compatibility: classifyPackageDeclarations(declarations, supportedRange),
|
|
239
|
-
declarations: Object.freeze(declarations),
|
|
240
|
-
path: manifestPath
|
|
241
|
-
})
|
|
242
|
-
});
|
|
243
227
|
}
|
|
244
228
|
return Object.freeze({ kind: "absent" });
|
|
245
229
|
};
|
|
246
230
|
/**
|
|
231
|
+
* Discovers the nearest package declaration without repository enumeration.
|
|
232
|
+
* @param options The package target, repository callbacks, path, range, and signal.
|
|
233
|
+
* @returns The first observed declaration, invalid manifest, or absence result.
|
|
234
|
+
* @throws If repository reading or the active inspection is aborted.
|
|
235
|
+
*/
|
|
236
|
+
var discoverPackage = async (options) => {
|
|
237
|
+
const { includeManifestPackageName, packageName, reader, signal, sourcePath, supportedRange } = options;
|
|
238
|
+
const owningManifest = await readOwningManifest({
|
|
239
|
+
reader,
|
|
240
|
+
...signal === void 0 ? {} : { signal },
|
|
241
|
+
sourcePath
|
|
242
|
+
});
|
|
243
|
+
if (owningManifest.kind !== "present") return owningManifest;
|
|
244
|
+
const declarations = extractPackageDeclarations(owningManifest.manifest, packageName);
|
|
245
|
+
if (declarations === null) return Object.freeze({
|
|
246
|
+
kind: "invalid",
|
|
247
|
+
path: owningManifest.path
|
|
248
|
+
});
|
|
249
|
+
if (declarations.length === 0) return Object.freeze({ kind: "absent" });
|
|
250
|
+
return Object.freeze({
|
|
251
|
+
kind: "observed",
|
|
252
|
+
observation: Object.freeze({
|
|
253
|
+
compatibility: classifyPackageDeclarations(declarations, supportedRange),
|
|
254
|
+
declarations: Object.freeze(declarations),
|
|
255
|
+
...includeManifestPackageName === true ? { manifestPackageName: typeof owningManifest.manifest["name"] === "string" ? owningManifest.manifest["name"] : null } : {},
|
|
256
|
+
path: owningManifest.path
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
247
261
|
* Removes the transparent expression wrappers supported by runtime adapters.
|
|
248
262
|
* @param expression The expression to normalize.
|
|
249
263
|
* @returns The underlying expression used by static matching.
|
|
@@ -648,42 +662,42 @@ var analyzeObjectRelationships = (object, relationshipNames) => {
|
|
|
648
662
|
});
|
|
649
663
|
};
|
|
650
664
|
var isNestedLexicalBoundary = (node) => ts.isFunctionLike(node) || ts.isClassLike(node) || ts.isClassStaticBlockDeclaration(node);
|
|
651
|
-
var skipTransparentParents$
|
|
665
|
+
var skipTransparentParents$2 = (node) => {
|
|
652
666
|
let current = node;
|
|
653
667
|
while (ts.isAsExpression(current.parent) || ts.isParenthesizedExpression(current.parent) || ts.isSatisfiesExpression(current.parent)) current = current.parent;
|
|
654
668
|
return current;
|
|
655
669
|
};
|
|
656
|
-
var isAssignmentOperator$
|
|
670
|
+
var isAssignmentOperator$2 = (kind) => kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;
|
|
657
671
|
var isResourceAccessCreateTarget = (expression, analysis, config) => {
|
|
658
|
-
const parent = skipTransparentParents$
|
|
672
|
+
const parent = skipTransparentParents$2(expression).parent;
|
|
659
673
|
if (!ts.isPropertyAccessExpression(parent) && !ts.isElementAccessExpression(parent)) return false;
|
|
660
674
|
const access = getAccessSegment(parent);
|
|
661
675
|
return access !== null && unwrapExpression(access.target) === unwrapExpression(expression) && classifyCreateAccess(parent, analysis, config) !== null;
|
|
662
676
|
};
|
|
663
677
|
var isKnownClientResourceTarget = (identifier, analysis, config) => {
|
|
664
|
-
const candidate = skipTransparentParents$
|
|
678
|
+
const candidate = skipTransparentParents$2(identifier);
|
|
665
679
|
const parent = candidate.parent;
|
|
666
680
|
return (ts.isPropertyAccessExpression(parent) || ts.isElementAccessExpression(parent)) && parent.expression === candidate && classifyKnownClientResourceAccess(parent, analysis, config) !== null;
|
|
667
681
|
};
|
|
668
682
|
var getClientValueExpression = (identifier) => {
|
|
669
|
-
let current = skipTransparentParents$
|
|
683
|
+
let current = skipTransparentParents$2(identifier);
|
|
670
684
|
while (true) {
|
|
671
685
|
const parent = current.parent;
|
|
672
686
|
const isFlowingConditionalBranch = ts.isConditionalExpression(parent) && parent.condition !== current;
|
|
673
687
|
const isFlowingBinaryBranch = ts.isBinaryExpression(parent) && (parent.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken || parent.operatorToken.kind === ts.SyntaxKind.BarBarToken || parent.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken || parent.operatorToken.kind === ts.SyntaxKind.CommaToken && parent.right === current);
|
|
674
688
|
const isFlowingWrapper = (ts.isAwaitExpression(parent) || ts.isNonNullExpression(parent)) && parent.expression === current;
|
|
675
689
|
if (!isFlowingConditionalBranch && !isFlowingBinaryBranch && !isFlowingWrapper) return current;
|
|
676
|
-
current = skipTransparentParents$
|
|
690
|
+
current = skipTransparentParents$2(parent);
|
|
677
691
|
}
|
|
678
692
|
};
|
|
679
693
|
var isClientEscape = (identifier) => {
|
|
680
694
|
const expression = getClientValueExpression(identifier);
|
|
681
695
|
const parent = expression.parent;
|
|
682
|
-
if (ts.isVariableDeclaration(parent) && parent.initializer !== void 0 && skipTransparentParents$
|
|
696
|
+
if (ts.isVariableDeclaration(parent) && parent.initializer !== void 0 && skipTransparentParents$2(parent.initializer) === expression) return true;
|
|
683
697
|
if (ts.isReturnStatement(parent) || ts.isYieldExpression(parent) || ts.isArrowFunction(parent) && parent.body === expression || ts.isSpreadElement(parent) || ts.isSpreadAssignment(parent) || ts.isShorthandPropertyAssignment(parent) || ts.isArrayLiteralExpression(parent) || ts.isExportAssignment(parent)) return true;
|
|
684
|
-
if (ts.isPropertyAssignment(parent)) return skipTransparentParents$
|
|
685
|
-
if ((ts.isCallExpression(parent) || ts.isNewExpression(parent)) && parent.arguments?.some((argument) => skipTransparentParents$
|
|
686
|
-
return ts.isBinaryExpression(parent) && isAssignmentOperator$
|
|
698
|
+
if (ts.isPropertyAssignment(parent)) return skipTransparentParents$2(parent.initializer) === expression;
|
|
699
|
+
if ((ts.isCallExpression(parent) || ts.isNewExpression(parent)) && parent.arguments?.some((argument) => skipTransparentParents$2(argument) === expression) === true) return true;
|
|
700
|
+
return ts.isBinaryExpression(parent) && isAssignmentOperator$2(parent.operatorToken.kind);
|
|
687
701
|
};
|
|
688
702
|
/**
|
|
689
703
|
* Finds direct provider requests owned by one runtime-agent body.
|
|
@@ -752,24 +766,24 @@ var SAFE_ARRAY_METHODS = /* @__PURE__ */ new Set([
|
|
|
752
766
|
]);
|
|
753
767
|
var isDirectToolRequestPropertyUse = (identifier, analysis, config) => {
|
|
754
768
|
if (config.toolRelationshipName === void 0) return false;
|
|
755
|
-
const expression = skipTransparentParents$
|
|
769
|
+
const expression = skipTransparentParents$2(identifier);
|
|
756
770
|
const property = expression.parent;
|
|
757
|
-
if (!(ts.isShorthandPropertyAssignment(property) && property.name.text === config.toolRelationshipName || ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) && property.name.text === config.toolRelationshipName || ts.isStringLiteral(property.name) && property.name.text === config.toolRelationshipName) && skipTransparentParents$
|
|
758
|
-
const request = skipTransparentParents$
|
|
771
|
+
if (!(ts.isShorthandPropertyAssignment(property) && property.name.text === config.toolRelationshipName || ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) && property.name.text === config.toolRelationshipName || ts.isStringLiteral(property.name) && property.name.text === config.toolRelationshipName) && skipTransparentParents$2(property.initializer) === expression) || !ts.isObjectLiteralExpression(property.parent)) return false;
|
|
772
|
+
const request = skipTransparentParents$2(property.parent);
|
|
759
773
|
const call = request.parent;
|
|
760
|
-
if (!ts.isCallExpression(call) || !config.acceptedArgumentCounts.includes(call.arguments.length) || skipTransparentParents$
|
|
774
|
+
if (!ts.isCallExpression(call) || !config.acceptedArgumentCounts.includes(call.arguments.length) || skipTransparentParents$2(call.arguments[0]) !== request) return false;
|
|
761
775
|
return classifyCreateAccess(call.expression, analysis, config) === "direct";
|
|
762
776
|
};
|
|
763
777
|
var isArrayMemberAssignmentTarget = (member) => {
|
|
764
|
-
let current = skipTransparentParents$
|
|
778
|
+
let current = skipTransparentParents$2(member);
|
|
765
779
|
while (true) {
|
|
766
780
|
const parent = current.parent;
|
|
767
|
-
if (ts.isBinaryExpression(parent) && isAssignmentOperator$
|
|
781
|
+
if (ts.isBinaryExpression(parent) && isAssignmentOperator$2(parent.operatorToken.kind)) return parent.left === current;
|
|
768
782
|
if ((ts.isPrefixUnaryExpression(parent) || ts.isPostfixUnaryExpression(parent)) && parent.operand === current && (parent.operator === ts.SyntaxKind.PlusPlusToken || parent.operator === ts.SyntaxKind.MinusMinusToken)) return true;
|
|
769
783
|
if (ts.isDeleteExpression(parent) && parent.expression === current) return true;
|
|
770
784
|
if ((ts.isForInStatement(parent) || ts.isForOfStatement(parent)) && parent.initializer === current) return true;
|
|
771
785
|
if (ts.isPropertyAssignment(parent) || ts.isSpreadAssignment(parent) || ts.isSpreadElement(parent) || ts.isArrayLiteralExpression(parent) || ts.isObjectLiteralExpression(parent)) {
|
|
772
|
-
current = skipTransparentParents$
|
|
786
|
+
current = skipTransparentParents$2(parent);
|
|
773
787
|
continue;
|
|
774
788
|
}
|
|
775
789
|
return false;
|
|
@@ -777,7 +791,7 @@ var isArrayMemberAssignmentTarget = (member) => {
|
|
|
777
791
|
};
|
|
778
792
|
var isDisallowedArrayMemberUse = (member) => {
|
|
779
793
|
if (isArrayMemberAssignmentTarget(member)) return true;
|
|
780
|
-
const candidate = skipTransparentParents$
|
|
794
|
+
const candidate = skipTransparentParents$2(member);
|
|
781
795
|
const parent = candidate.parent;
|
|
782
796
|
if (!ts.isCallExpression(parent) || parent.expression !== candidate) return false;
|
|
783
797
|
if (ts.isPropertyAccessExpression(member)) return !SAFE_ARRAY_METHODS.has(member.name.text);
|
|
@@ -787,7 +801,7 @@ var isDisallowedArrayMemberUse = (member) => {
|
|
|
787
801
|
};
|
|
788
802
|
var isDisallowedArrayUse = (identifier, analysis, config) => {
|
|
789
803
|
if (isDirectToolRequestPropertyUse(identifier, analysis, config)) return false;
|
|
790
|
-
const expression = skipTransparentParents$
|
|
804
|
+
const expression = skipTransparentParents$2(identifier);
|
|
791
805
|
const parent = expression.parent;
|
|
792
806
|
if (ts.isPropertyAccessExpression(parent) && parent.expression === expression) return isDisallowedArrayMemberUse(parent);
|
|
793
807
|
if (ts.isElementAccessExpression(parent) && parent.expression === expression) return isDisallowedArrayMemberUse(parent);
|
|
@@ -880,39 +894,39 @@ var READONLY_ARRAY_METHODS = /* @__PURE__ */ new Set([
|
|
|
880
894
|
"values",
|
|
881
895
|
"with"
|
|
882
896
|
]);
|
|
883
|
-
var skipTransparentParents = (node) => {
|
|
897
|
+
var skipTransparentParents$1 = (node) => {
|
|
884
898
|
let current = node;
|
|
885
899
|
while (ts.isAsExpression(current.parent) || ts.isParenthesizedExpression(current.parent) || ts.isSatisfiesExpression(current.parent)) current = current.parent;
|
|
886
900
|
return current;
|
|
887
901
|
};
|
|
888
|
-
var isAssignmentOperator = (kind) => kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;
|
|
902
|
+
var isAssignmentOperator$1 = (kind) => kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;
|
|
889
903
|
var isAssignmentTarget = (expression) => {
|
|
890
|
-
let current = skipTransparentParents(expression);
|
|
904
|
+
let current = skipTransparentParents$1(expression);
|
|
891
905
|
while (true) {
|
|
892
906
|
const parent = current.parent;
|
|
893
|
-
if (ts.isBinaryExpression(parent) && isAssignmentOperator(parent.operatorToken.kind)) return parent.left === current;
|
|
907
|
+
if (ts.isBinaryExpression(parent) && isAssignmentOperator$1(parent.operatorToken.kind)) return parent.left === current;
|
|
894
908
|
if ((ts.isPrefixUnaryExpression(parent) || ts.isPostfixUnaryExpression(parent)) && parent.operand === current && (parent.operator === ts.SyntaxKind.PlusPlusToken || parent.operator === ts.SyntaxKind.MinusMinusToken)) return true;
|
|
895
909
|
if (ts.isDeleteExpression(parent) && parent.expression === current) return true;
|
|
896
910
|
if ((ts.isForInStatement(parent) || ts.isForOfStatement(parent)) && parent.initializer === current) return true;
|
|
897
911
|
if (ts.isPropertyAccessExpression(parent) || ts.isElementAccessExpression(parent) || ts.isPropertyAssignment(parent) || ts.isSpreadAssignment(parent) || ts.isSpreadElement(parent) || ts.isArrayLiteralExpression(parent) || ts.isObjectLiteralExpression(parent)) {
|
|
898
|
-
current = skipTransparentParents(parent);
|
|
912
|
+
current = skipTransparentParents$1(parent);
|
|
899
913
|
continue;
|
|
900
914
|
}
|
|
901
915
|
return false;
|
|
902
916
|
}
|
|
903
917
|
};
|
|
904
|
-
var getStaticMemberName = (member) => {
|
|
918
|
+
var getStaticMemberName$1 = (member) => {
|
|
905
919
|
if (ts.isPropertyAccessExpression(member)) return member.name.text;
|
|
906
920
|
const argument = member.argumentExpression;
|
|
907
921
|
return argument !== void 0 && (ts.isStringLiteral(argument) || ts.isNoSubstitutionTemplateLiteral(argument)) ? argument.text : null;
|
|
908
922
|
};
|
|
909
923
|
var isSafeArrayMemberUse = (member) => {
|
|
910
924
|
if (isAssignmentTarget(member)) return false;
|
|
911
|
-
const candidate = skipTransparentParents(member);
|
|
925
|
+
const candidate = skipTransparentParents$1(member);
|
|
912
926
|
const parent = candidate.parent;
|
|
913
927
|
if (!ts.isCallExpression(parent) || parent.expression !== candidate) return ts.isPropertyAccessExpression(member) && member.name.text === "length";
|
|
914
|
-
const memberName = getStaticMemberName(member);
|
|
915
|
-
const call = skipTransparentParents(parent);
|
|
928
|
+
const memberName = getStaticMemberName$1(member);
|
|
929
|
+
const call = skipTransparentParents$1(parent);
|
|
916
930
|
return memberName !== null && READONLY_ARRAY_METHODS.has(memberName) && ts.isExpressionStatement(call.parent);
|
|
917
931
|
};
|
|
918
932
|
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;
|
|
@@ -930,7 +944,7 @@ var isModuleValueBindingSafe = (analysis, bindingName, declarationName, allowedR
|
|
|
930
944
|
for (const identifier of identifierUses) {
|
|
931
945
|
if (isIgnoredIdentifierPosition(identifier, declarationName) || !isModuleBindingVisible(identifier, analysis)) continue;
|
|
932
946
|
if (allowedReferences.has(identifier)) continue;
|
|
933
|
-
const expression = skipTransparentParents(identifier);
|
|
947
|
+
const expression = skipTransparentParents$1(identifier);
|
|
934
948
|
const parent = expression.parent;
|
|
935
949
|
const member = (ts.isPropertyAccessExpression(parent) || ts.isElementAccessExpression(parent)) && parent.expression === expression ? parent : null;
|
|
936
950
|
if (kind !== "array" || member === null || !isSafeArrayMemberUse(member)) return false;
|
|
@@ -961,6 +975,17 @@ function getSafeModuleConstLiteral(expression, analysis, allowedReferences, kind
|
|
|
961
975
|
expression: initializer
|
|
962
976
|
});
|
|
963
977
|
}
|
|
978
|
+
var TYPESCRIPT_DECLARATION_EXTENSIONS = [
|
|
979
|
+
".d.ts",
|
|
980
|
+
".d.tsx",
|
|
981
|
+
".d.mts",
|
|
982
|
+
".d.cts"
|
|
983
|
+
];
|
|
984
|
+
var TYPESCRIPT_SOURCE_EXTENSIONS = [
|
|
985
|
+
".ts",
|
|
986
|
+
".tsx",
|
|
987
|
+
".mts"
|
|
988
|
+
];
|
|
964
989
|
var getScriptKind = (path) => path.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
|
|
965
990
|
var createSyntaxProgram = (sourceFile, text) => {
|
|
966
991
|
return ts.createProgram({
|
|
@@ -987,15 +1012,15 @@ var createSyntaxProgram = (sourceFile, text) => {
|
|
|
987
1012
|
});
|
|
988
1013
|
};
|
|
989
1014
|
/**
|
|
990
|
-
* Parses and indexes one TypeScript
|
|
1015
|
+
* Parses and indexes one TypeScript module without provider request assumptions.
|
|
991
1016
|
* @param path The normalized logical source path.
|
|
992
1017
|
* @param bytes The exact source bytes returned by the adapter reader.
|
|
993
|
-
* @param
|
|
1018
|
+
* @param importConfig The provider constructor-import contract.
|
|
994
1019
|
* @param signal The active inspection signal.
|
|
995
1020
|
* @returns A source analysis or stable invalid-text or invalid-syntax result.
|
|
996
1021
|
* @throws If source analysis is aborted.
|
|
997
1022
|
*/
|
|
998
|
-
var
|
|
1023
|
+
var analyzeTypeScriptModule = (path, bytes, importConfig, signal) => {
|
|
999
1024
|
signal?.throwIfAborted();
|
|
1000
1025
|
const text = normalizeText(bytes);
|
|
1001
1026
|
if (!text.valid) return Object.freeze({ kind: "invalid-text" });
|
|
@@ -1010,7 +1035,7 @@ var analyzeSource = (path, bytes, config, signal) => {
|
|
|
1010
1035
|
range: start === void 0 ? null : text.locator.locateRange(start, start + (syntaxDiagnostic.length ?? 0))
|
|
1011
1036
|
});
|
|
1012
1037
|
}
|
|
1013
|
-
const { constructorNames, namedImports } = indexImports(sourceFile,
|
|
1038
|
+
const { constructorNames, namedImports } = indexImports(sourceFile, importConfig);
|
|
1014
1039
|
signal?.throwIfAborted();
|
|
1015
1040
|
const { clientNames, exports, moduleArrays, moduleConstDeclarations } = indexModuleDeclarations(sourceFile, constructorNames);
|
|
1016
1041
|
signal?.throwIfAborted();
|
|
@@ -1018,7 +1043,7 @@ var analyzeSource = (path, bytes, config, signal) => {
|
|
|
1018
1043
|
signal?.throwIfAborted();
|
|
1019
1044
|
const localBindingNames = indexLocalBindingNames(sourceFile);
|
|
1020
1045
|
signal?.throwIfAborted();
|
|
1021
|
-
const
|
|
1046
|
+
const analysis = Object.freeze({
|
|
1022
1047
|
clientNames,
|
|
1023
1048
|
constructorNames,
|
|
1024
1049
|
exports,
|
|
@@ -1032,9 +1057,27 @@ var analyzeSource = (path, bytes, config, signal) => {
|
|
|
1032
1057
|
sourceFile,
|
|
1033
1058
|
text
|
|
1034
1059
|
});
|
|
1060
|
+
signal?.throwIfAborted();
|
|
1061
|
+
return Object.freeze({
|
|
1062
|
+
analysis,
|
|
1063
|
+
kind: "valid"
|
|
1064
|
+
});
|
|
1065
|
+
};
|
|
1066
|
+
/**
|
|
1067
|
+
* Parses one TypeScript source and indexes provider request-specific array safety.
|
|
1068
|
+
* @param path The normalized logical source path.
|
|
1069
|
+
* @param bytes The exact source bytes returned by the adapter reader.
|
|
1070
|
+
* @param config The provider import and request analysis contract.
|
|
1071
|
+
* @param signal The active inspection signal.
|
|
1072
|
+
* @returns A source analysis or stable invalid-text or invalid-syntax result.
|
|
1073
|
+
* @throws If source analysis is aborted.
|
|
1074
|
+
*/
|
|
1075
|
+
var analyzeSource = (path, bytes, config, signal) => {
|
|
1076
|
+
const moduleResult = analyzeTypeScriptModule(path, bytes, config.importConfig, signal);
|
|
1077
|
+
if (moduleResult.kind !== "valid") return moduleResult;
|
|
1035
1078
|
const analysis = Object.freeze({
|
|
1036
|
-
...
|
|
1037
|
-
safeModuleArrayNames: indexSafeModuleArrayNames(
|
|
1079
|
+
...moduleResult.analysis,
|
|
1080
|
+
safeModuleArrayNames: indexSafeModuleArrayNames(moduleResult.analysis, config.requestConfig)
|
|
1038
1081
|
});
|
|
1039
1082
|
signal?.throwIfAborted();
|
|
1040
1083
|
return Object.freeze({
|
|
@@ -1047,11 +1090,7 @@ var analyzeSource = (path, bytes, config, signal) => {
|
|
|
1047
1090
|
* @param path The bound source path.
|
|
1048
1091
|
* @returns Whether its extension is supported.
|
|
1049
1092
|
*/
|
|
1050
|
-
var isSupportedTypeScriptSourcePath = (path) =>
|
|
1051
|
-
".ts",
|
|
1052
|
-
".tsx",
|
|
1053
|
-
".mts"
|
|
1054
|
-
].some((extension) => path.endsWith(extension));
|
|
1093
|
+
var isSupportedTypeScriptSourcePath = (path) => !TYPESCRIPT_DECLARATION_EXTENSIONS.some((extension) => path.endsWith(extension)) && TYPESCRIPT_SOURCE_EXTENSIONS.some((extension) => path.endsWith(extension));
|
|
1055
1094
|
/**
|
|
1056
1095
|
* Classifies a direct exported runtime-agent function and exposes its body.
|
|
1057
1096
|
* @param analysis The indexed runtime source.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moldea.ai/adapter-google-genai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Deterministic runtime evidence and diagnostics for direct Google Gen AI SDK integrations.",
|
|
5
5
|
"homepage": "https://github.com/moldea-ai/packages/tree/main/projects/adapter-google-genai#readme",
|
|
6
6
|
"bugs": {
|