@anthonyhaussman/opencode-agy-auth 1.2.7-alpha.0 → 1.2.7-alpha.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/index.js +129 -86
- package/dist/index.js.map +1 -1
- package/dist/src/plugin/types.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21085,97 +21085,140 @@ function createV2FetchInterceptor(getAuthSnapshot) {
|
|
|
21085
21085
|
};
|
|
21086
21086
|
}
|
|
21087
21087
|
async function setupOpenCodeV2(ctx) {
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21088
|
+
const resolveVariants = (modelId) => {
|
|
21089
|
+
const mapping = TIER_MAPPING[modelId];
|
|
21090
|
+
if (!mapping) return void 0;
|
|
21091
|
+
const variants = [];
|
|
21092
|
+
if (mapping.minimal !== void 0) variants.push({ id: "minimal" });
|
|
21093
|
+
if (mapping.low !== void 0) variants.push({ id: "low" });
|
|
21094
|
+
if (mapping.medium !== void 0) variants.push({ id: "medium" });
|
|
21095
|
+
if (mapping.high !== void 0) variants.push({ id: "high" });
|
|
21096
|
+
return variants.length > 0 ? variants : void 0;
|
|
21097
|
+
};
|
|
21098
|
+
const updateProviderRecord = (p) => {
|
|
21099
|
+
p.name = "Antigravity CLI";
|
|
21100
|
+
p.activation = "enabled";
|
|
21101
|
+
p.package = "aisdk:@ai-sdk/google";
|
|
21102
|
+
p.description = "Google Gemini Antigravity Code Assist OAuth provider";
|
|
21103
|
+
p.settings = { ...p.settings || {}, apiKey: "dummy" };
|
|
21104
|
+
p.integrationID = AGY_PROVIDER_ID;
|
|
21105
|
+
};
|
|
21106
|
+
const buildModelRecord = (modelId, simple, existingModel) => {
|
|
21107
|
+
const isClaude = modelId.startsWith("claude-");
|
|
21108
|
+
const isGpt = modelId.startsWith("gpt-");
|
|
21109
|
+
const variants = resolveVariants(modelId);
|
|
21110
|
+
return {
|
|
21111
|
+
id: modelId,
|
|
21112
|
+
providerID: AGY_PROVIDER_ID,
|
|
21113
|
+
name: simple.name,
|
|
21114
|
+
description: simple.description,
|
|
21115
|
+
family: modelId.includes("gemini") ? "gemini" : isClaude ? "claude" : isGpt ? "gpt" : "unknown",
|
|
21116
|
+
reasoning: simple.reasoning,
|
|
21117
|
+
attachment: simple.attachment,
|
|
21118
|
+
tool_call: simple.toolCall,
|
|
21119
|
+
limit: {
|
|
21120
|
+
context: simple.maxTokens,
|
|
21121
|
+
output: simple.maxOutputTokens
|
|
21122
|
+
},
|
|
21123
|
+
cost: simple.cost || { input: 0, output: 0 },
|
|
21124
|
+
...variants ? { variants } : {},
|
|
21125
|
+
...existingModel || {}
|
|
21099
21126
|
};
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
|
|
21109
|
-
|
|
21127
|
+
};
|
|
21128
|
+
const updateModelRecord = (m, modelId, simple) => {
|
|
21129
|
+
m.name = simple.name;
|
|
21130
|
+
m.capabilities = {
|
|
21131
|
+
tools: true,
|
|
21132
|
+
input: ["text", "image"],
|
|
21133
|
+
output: ["text"]
|
|
21134
|
+
};
|
|
21135
|
+
m.limit = {
|
|
21136
|
+
context: simple.maxTokens,
|
|
21137
|
+
output: simple.maxOutputTokens
|
|
21138
|
+
};
|
|
21139
|
+
m.family = "gemini";
|
|
21140
|
+
if (simple.cost) {
|
|
21141
|
+
m.cost = simple.cost;
|
|
21142
|
+
}
|
|
21143
|
+
const variants = resolveVariants(modelId);
|
|
21144
|
+
if (variants) {
|
|
21145
|
+
m.variants = variants;
|
|
21146
|
+
}
|
|
21147
|
+
};
|
|
21148
|
+
if (ctx.provider?.transform) {
|
|
21149
|
+
ctx.provider.transform(async (editor) => {
|
|
21150
|
+
if (!editor) return;
|
|
21151
|
+
if (typeof editor.update === "function") {
|
|
21152
|
+
editor.update(AGY_PROVIDER_ID, updateProviderRecord);
|
|
21153
|
+
} else if (typeof editor.set === "function") {
|
|
21154
|
+
const p = { id: AGY_PROVIDER_ID };
|
|
21155
|
+
updateProviderRecord(p);
|
|
21156
|
+
editor.set(AGY_PROVIDER_ID, p);
|
|
21157
|
+
} else if (typeof editor === "object") {
|
|
21158
|
+
const p = editor[AGY_PROVIDER_ID] || { id: AGY_PROVIDER_ID };
|
|
21159
|
+
updateProviderRecord(p);
|
|
21160
|
+
editor[AGY_PROVIDER_ID] = p;
|
|
21161
|
+
}
|
|
21162
|
+
});
|
|
21163
|
+
}
|
|
21164
|
+
if (ctx.model?.transform) {
|
|
21165
|
+
ctx.model.transform(async (editor) => {
|
|
21166
|
+
if (!editor) return;
|
|
21167
|
+
if (typeof editor.update === "function") {
|
|
21110
21168
|
for (const [modelId, simple] of Object.entries(STATIC_MODELS_SIMPLE)) {
|
|
21111
|
-
editor.
|
|
21112
|
-
|
|
21113
|
-
|
|
21114
|
-
|
|
21115
|
-
|
|
21116
|
-
|
|
21117
|
-
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
|
|
21121
|
-
|
|
21122
|
-
m.family = "gemini";
|
|
21123
|
-
if (simple.cost) {
|
|
21124
|
-
m.cost = simple.cost;
|
|
21125
|
-
}
|
|
21126
|
-
const variants = resolveVariants(modelId);
|
|
21127
|
-
if (variants) {
|
|
21128
|
-
m.variants = variants;
|
|
21129
|
-
}
|
|
21130
|
-
});
|
|
21169
|
+
editor.update(AGY_PROVIDER_ID, modelId, (m) => updateModelRecord(m, modelId, simple));
|
|
21170
|
+
}
|
|
21171
|
+
} else if (typeof editor.set === "function") {
|
|
21172
|
+
for (const [modelId, simple] of Object.entries(STATIC_MODELS_SIMPLE)) {
|
|
21173
|
+
const m = buildModelRecord(modelId, simple);
|
|
21174
|
+
editor.set(`${AGY_PROVIDER_ID}:${modelId}`, m);
|
|
21175
|
+
}
|
|
21176
|
+
} else if (typeof editor === "object") {
|
|
21177
|
+
for (const [modelId, simple] of Object.entries(STATIC_MODELS_SIMPLE)) {
|
|
21178
|
+
const key = `${AGY_PROVIDER_ID}:${modelId}`;
|
|
21179
|
+
editor[key] = buildModelRecord(modelId, simple, editor[key]);
|
|
21131
21180
|
}
|
|
21132
21181
|
}
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
catalog.
|
|
21137
|
-
|
|
21138
|
-
|
|
21139
|
-
|
|
21140
|
-
|
|
21141
|
-
|
|
21142
|
-
|
|
21143
|
-
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
catalog
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
|
|
21155
|
-
|
|
21156
|
-
|
|
21157
|
-
const isClaude = modelId.startsWith("claude-");
|
|
21158
|
-
const isGpt = modelId.startsWith("gpt-");
|
|
21159
|
-
const variants = resolveVariants(modelId);
|
|
21160
|
-
targetModels[modelId] = {
|
|
21161
|
-
id: modelId,
|
|
21162
|
-
providerID: AGY_PROVIDER_ID,
|
|
21163
|
-
name: simple.name,
|
|
21164
|
-
description: simple.description,
|
|
21165
|
-
family: modelId.includes("gemini") ? "gemini" : isClaude ? "claude" : isGpt ? "gpt" : "unknown",
|
|
21166
|
-
reasoning: simple.reasoning,
|
|
21167
|
-
attachment: simple.attachment,
|
|
21168
|
-
tool_call: simple.toolCall,
|
|
21169
|
-
limit: {
|
|
21170
|
-
context: simple.maxTokens,
|
|
21171
|
-
output: simple.maxOutputTokens
|
|
21172
|
-
},
|
|
21173
|
-
cost: simple.cost || { input: 0, output: 0 },
|
|
21174
|
-
...variants ? { variants } : {},
|
|
21175
|
-
...targetModels[modelId] || {}
|
|
21182
|
+
});
|
|
21183
|
+
}
|
|
21184
|
+
if (ctx.catalog?.transform) {
|
|
21185
|
+
ctx.catalog.transform(async (editor) => {
|
|
21186
|
+
if (!editor) return;
|
|
21187
|
+
if (typeof editor?.provider?.update === "function") {
|
|
21188
|
+
editor.provider.update(AGY_PROVIDER_ID, updateProviderRecord);
|
|
21189
|
+
if (typeof editor?.model?.update === "function") {
|
|
21190
|
+
for (const [modelId, simple] of Object.entries(STATIC_MODELS_SIMPLE)) {
|
|
21191
|
+
editor.model.update(AGY_PROVIDER_ID, modelId, (m) => updateModelRecord(m, modelId, simple));
|
|
21192
|
+
}
|
|
21193
|
+
}
|
|
21194
|
+
return;
|
|
21195
|
+
}
|
|
21196
|
+
const catalog = editor;
|
|
21197
|
+
catalog.providers = catalog.providers || {};
|
|
21198
|
+
catalog.providers[AGY_PROVIDER_ID] = {
|
|
21199
|
+
id: AGY_PROVIDER_ID,
|
|
21200
|
+
name: "Antigravity CLI",
|
|
21201
|
+
npm: "aisdk:@ai-sdk/google",
|
|
21202
|
+
settings: { apiKey: "dummy" },
|
|
21203
|
+
integrationID: AGY_PROVIDER_ID,
|
|
21204
|
+
models: { ...catalog.providers[AGY_PROVIDER_ID]?.models || {} },
|
|
21205
|
+
...catalog.providers[AGY_PROVIDER_ID]
|
|
21176
21206
|
};
|
|
21177
|
-
|
|
21178
|
-
|
|
21207
|
+
if (catalog.providers[AGY_PROVIDER_ID].settings) {
|
|
21208
|
+
catalog.providers[AGY_PROVIDER_ID].settings = {
|
|
21209
|
+
...catalog.providers[AGY_PROVIDER_ID].settings,
|
|
21210
|
+
apiKey: "dummy"
|
|
21211
|
+
};
|
|
21212
|
+
} else {
|
|
21213
|
+
catalog.providers[AGY_PROVIDER_ID].settings = { apiKey: "dummy" };
|
|
21214
|
+
}
|
|
21215
|
+
catalog.providers[AGY_PROVIDER_ID].integrationID = AGY_PROVIDER_ID;
|
|
21216
|
+
const targetModels = catalog.providers[AGY_PROVIDER_ID].models;
|
|
21217
|
+
for (const [modelId, simple] of Object.entries(STATIC_MODELS_SIMPLE)) {
|
|
21218
|
+
targetModels[modelId] = buildModelRecord(modelId, simple, targetModels[modelId]);
|
|
21219
|
+
}
|
|
21220
|
+
});
|
|
21221
|
+
}
|
|
21179
21222
|
ctx.tool.transform(async (editor) => {
|
|
21180
21223
|
if (!editor) return;
|
|
21181
21224
|
const quotaTool = createAgyQuotaTool({
|