Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@slkiser/opencode-quota",
"version": "3.8.1",
"version": "3.8.2",
"description": "OpenCode quota & tokens usage with zero context window pollution. Supports GitHub Copilot, OpenAI (Plus/Pro), Qwen Code, Chutes AI, Synthetic, Google Antigravity, Z.ai coding plan and more.",
"type": "module",
"main": "./dist/index.js",
Expand Down
20 changes: 19 additions & 1 deletion src/lib/google-antigravity-companion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { readFile } from "fs/promises";
import { readdirSync } from "node:fs";
import { createRequire } from "node:module";
import { dirname, join } from "node:path";
import { pathToFileURL } from "node:url";
Expand Down Expand Up @@ -103,7 +104,24 @@ function normalizeCredential(value: unknown): string {
}

function getCompanionResolvePaths(): string[] {
return getOpencodeRuntimeDirCandidates().cacheDirs;
const cacheDirs = getOpencodeRuntimeDirCandidates().cacheDirs;
const resolvePaths: string[] = [...cacheDirs];

for (const cacheDir of cacheDirs) {
try {
const packagesDir = join(cacheDir, "packages");
const entries = readdirSync(packagesDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory() && entry.name.startsWith(COMPANION_PACKAGE_NAME)) {
resolvePaths.push(join(packagesDir, entry.name));
}
}
} catch {
// Ignore if packages dir doesn't exist
}
}

return resolvePaths;
}

function markPackageFoundForExportBlock(
Expand Down
20 changes: 19 additions & 1 deletion src/lib/google-gemini-cli-companion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { readFile } from "fs/promises";
import { readdirSync } from "node:fs";
import { createRequire } from "node:module";
import { dirname, join } from "node:path";
import { pathToFileURL } from "node:url";
Expand Down Expand Up @@ -93,7 +94,24 @@ function normalizeCredential(value: unknown): string {
}

function getCompanionResolvePaths(): string[] {
return getOpencodeRuntimeDirCandidates().cacheDirs;
const cacheDirs = getOpencodeRuntimeDirCandidates().cacheDirs;
const resolvePaths: string[] = [...cacheDirs];

for (const cacheDir of cacheDirs) {
try {
const packagesDir = join(cacheDir, "packages");
const entries = readdirSync(packagesDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory() && entry.name.startsWith(COMPANION_PACKAGE_NAME)) {
resolvePaths.push(join(packagesDir, entry.name));
}
}
} catch {
// Ignore if packages dir doesn't exist
}
}

return resolvePaths;
}

function resolveCompanionSpecifier(specifier: string): string {
Expand Down