@anthonyhaussman/opencode-agy-auth 1.2.3-alpha.0 → 1.2.3-alpha.2
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/index.js +75 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20677,13 +20677,57 @@ Immediately call \`${AGY_QUOTA_SUMMARY_TOOL_NAME}\` with no arguments and return
|
|
|
20677
20677
|
Do not call other tools.
|
|
20678
20678
|
`;
|
|
20679
20679
|
async function setupOpenCodeV2(ctx) {
|
|
20680
|
-
ctx.catalog.transform(async (
|
|
20681
|
-
if (!
|
|
20680
|
+
ctx.catalog.transform(async (editor) => {
|
|
20681
|
+
if (!editor) return;
|
|
20682
|
+
const resolveVariants = (modelId) => {
|
|
20683
|
+
const mapping = TIER_MAPPING[modelId];
|
|
20684
|
+
if (!mapping) return void 0;
|
|
20685
|
+
const variants = [];
|
|
20686
|
+
if (mapping.minimal !== void 0) variants.push({ id: "minimal" });
|
|
20687
|
+
if (mapping.low !== void 0) variants.push({ id: "low" });
|
|
20688
|
+
if (mapping.medium !== void 0) variants.push({ id: "medium" });
|
|
20689
|
+
if (mapping.high !== void 0) variants.push({ id: "high" });
|
|
20690
|
+
return variants.length > 0 ? variants : void 0;
|
|
20691
|
+
};
|
|
20692
|
+
if (typeof editor?.provider?.update === "function") {
|
|
20693
|
+
editor.provider.update(AGY_PROVIDER_ID, (p) => {
|
|
20694
|
+
p.name = "Antigravity CLI";
|
|
20695
|
+
p.activation = "enabled";
|
|
20696
|
+
p.package = "aisdk:@ai-sdk/google";
|
|
20697
|
+
p.description = "Google Gemini Antigravity Code Assist OAuth provider";
|
|
20698
|
+
});
|
|
20699
|
+
if (typeof editor?.model?.update === "function") {
|
|
20700
|
+
for (const [modelId, simple] of Object.entries(STATIC_MODELS_SIMPLE)) {
|
|
20701
|
+
editor.model.update(AGY_PROVIDER_ID, modelId, (m) => {
|
|
20702
|
+
m.name = simple.name;
|
|
20703
|
+
m.capabilities = {
|
|
20704
|
+
tools: true,
|
|
20705
|
+
input: ["text", "image"],
|
|
20706
|
+
output: ["text"]
|
|
20707
|
+
};
|
|
20708
|
+
m.limit = {
|
|
20709
|
+
context: simple.maxTokens,
|
|
20710
|
+
output: simple.maxOutputTokens
|
|
20711
|
+
};
|
|
20712
|
+
m.family = "gemini";
|
|
20713
|
+
if (simple.cost) {
|
|
20714
|
+
m.cost = simple.cost;
|
|
20715
|
+
}
|
|
20716
|
+
const variants = resolveVariants(modelId);
|
|
20717
|
+
if (variants) {
|
|
20718
|
+
m.variants = variants;
|
|
20719
|
+
}
|
|
20720
|
+
});
|
|
20721
|
+
}
|
|
20722
|
+
}
|
|
20723
|
+
return;
|
|
20724
|
+
}
|
|
20725
|
+
const catalog = editor;
|
|
20682
20726
|
catalog.providers = catalog.providers || {};
|
|
20683
20727
|
catalog.providers[AGY_PROVIDER_ID] = {
|
|
20684
20728
|
id: AGY_PROVIDER_ID,
|
|
20685
20729
|
name: "Antigravity CLI",
|
|
20686
|
-
npm: "
|
|
20730
|
+
npm: "aisdk:@ai-sdk/google",
|
|
20687
20731
|
models: { ...catalog.providers[AGY_PROVIDER_ID]?.models || {} },
|
|
20688
20732
|
...catalog.providers[AGY_PROVIDER_ID]
|
|
20689
20733
|
};
|
|
@@ -20691,6 +20735,7 @@ async function setupOpenCodeV2(ctx) {
|
|
|
20691
20735
|
for (const [modelId, simple] of Object.entries(STATIC_MODELS_SIMPLE)) {
|
|
20692
20736
|
const isClaude = modelId.startsWith("claude-");
|
|
20693
20737
|
const isGpt = modelId.startsWith("gpt-");
|
|
20738
|
+
const variants = resolveVariants(modelId);
|
|
20694
20739
|
targetModels[modelId] = {
|
|
20695
20740
|
id: modelId,
|
|
20696
20741
|
providerID: AGY_PROVIDER_ID,
|
|
@@ -20705,6 +20750,7 @@ async function setupOpenCodeV2(ctx) {
|
|
|
20705
20750
|
output: simple.maxOutputTokens
|
|
20706
20751
|
},
|
|
20707
20752
|
cost: simple.cost || { input: 0, output: 0 },
|
|
20753
|
+
...variants ? { variants } : {},
|
|
20708
20754
|
...targetModels[modelId] || {}
|
|
20709
20755
|
};
|
|
20710
20756
|
}
|
|
@@ -20723,7 +20769,20 @@ async function setupOpenCodeV2(ctx) {
|
|
|
20723
20769
|
getConfiguredProjectId: () => void 0,
|
|
20724
20770
|
getUserAgentModel: () => void 0
|
|
20725
20771
|
});
|
|
20726
|
-
if (typeof editor.
|
|
20772
|
+
if (typeof editor.add === "function") {
|
|
20773
|
+
editor.add({
|
|
20774
|
+
name: AGY_QUOTA_TOOL_NAME,
|
|
20775
|
+
description: quotaTool.description,
|
|
20776
|
+
input: {},
|
|
20777
|
+
execute: async (args, context) => quotaTool.execute(args, context)
|
|
20778
|
+
});
|
|
20779
|
+
editor.add({
|
|
20780
|
+
name: AGY_QUOTA_SUMMARY_TOOL_NAME,
|
|
20781
|
+
description: quotaSummaryTool.description,
|
|
20782
|
+
input: {},
|
|
20783
|
+
execute: async (args, context) => quotaSummaryTool.execute(args, context)
|
|
20784
|
+
});
|
|
20785
|
+
} else if (typeof editor.set === "function") {
|
|
20727
20786
|
editor.set(AGY_QUOTA_TOOL_NAME, quotaTool);
|
|
20728
20787
|
editor.set(AGY_QUOTA_SUMMARY_TOOL_NAME, quotaSummaryTool);
|
|
20729
20788
|
} else if (editor.tools && typeof editor.tools === "object") {
|
|
@@ -20746,7 +20805,18 @@ async function setupOpenCodeV2(ctx) {
|
|
|
20746
20805
|
template: AGY_V2_QUOTA_SUMMARY_COMMAND_TEMPLATE
|
|
20747
20806
|
}
|
|
20748
20807
|
};
|
|
20749
|
-
if (typeof editor.
|
|
20808
|
+
if (typeof editor.add === "function") {
|
|
20809
|
+
editor.add({
|
|
20810
|
+
name: AGY_V2_QUOTA_COMMAND,
|
|
20811
|
+
description: "Display current Antigravity quota usage",
|
|
20812
|
+
template: AGY_V2_QUOTA_COMMAND_TEMPLATE
|
|
20813
|
+
});
|
|
20814
|
+
editor.add({
|
|
20815
|
+
name: AGY_V2_QUOTA_SUMMARY_COMMAND,
|
|
20816
|
+
description: "Display Antigravity quota summary grouped by model family",
|
|
20817
|
+
template: AGY_V2_QUOTA_SUMMARY_COMMAND_TEMPLATE
|
|
20818
|
+
});
|
|
20819
|
+
} else if (typeof editor.set === "function") {
|
|
20750
20820
|
editor.set(AGY_V2_QUOTA_COMMAND, commands[AGY_V2_QUOTA_COMMAND]);
|
|
20751
20821
|
editor.set(AGY_V2_QUOTA_SUMMARY_COMMAND, commands[AGY_V2_QUOTA_SUMMARY_COMMAND]);
|
|
20752
20822
|
} else if (editor.commands && typeof editor.commands === "object") {
|