@oai2lmapi/opencode-provider 0.1.0 → 0.1.1

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/dist/utils.js DELETED
@@ -1,44 +0,0 @@
1
- /**
2
- * Utility to match model IDs against wildcard patterns
3
- */
4
- /**
5
- * Convert a wildcard pattern to a RegExp
6
- * Supports: * (any characters), ? (single character)
7
- */
8
- export function wildcardToRegex(pattern) {
9
- // Escape special regex characters except * and ?
10
- const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, '\\$&');
11
- // Convert * to .* and ? to .
12
- const regex = escaped.replace(/\*/g, '.*').replace(/\?/g, '.');
13
- return new RegExp(`^${regex}$`, 'i');
14
- }
15
- /**
16
- * Check if a model ID matches a wildcard pattern
17
- */
18
- export function matchesWildcard(modelId, pattern) {
19
- const regex = wildcardToRegex(pattern);
20
- return regex.test(modelId);
21
- }
22
- /**
23
- * Find the most specific matching pattern for a model ID
24
- * More specific = longer literal prefix before wildcard
25
- */
26
- export function findBestMatch(modelId, patterns) {
27
- const matches = patterns.filter((p) => matchesWildcard(modelId, p));
28
- if (matches.length === 0) {
29
- return undefined;
30
- }
31
- // Sort by specificity: longer patterns are more specific
32
- // Also prioritize patterns without wildcards
33
- matches.sort((a, b) => {
34
- const aHasWildcard = a.includes('*') || a.includes('?');
35
- const bHasWildcard = b.includes('*') || b.includes('?');
36
- if (!aHasWildcard && bHasWildcard)
37
- return -1;
38
- if (aHasWildcard && !bHasWildcard)
39
- return 1;
40
- return b.length - a.length;
41
- });
42
- return matches[0];
43
- }
44
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,iDAAiD;IACjD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC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