Commit 101ea131a820
Changed files (3)
dots
pi
agent
extensions
dots/pi/agent/extensions/subagent/index.ts
@@ -327,8 +327,8 @@ async function findModelAcrossProviders(
if (foundModelId) {
const model = modelRegistry.find(providerName, foundModelId);
if (model) {
- const apiKey = await modelRegistry.getApiKey(model);
- if (apiKey) {
+ const auth = await modelRegistry.getApiKeyAndHeaders(model);
+ if (auth.ok && auth.apiKey) {
return { provider: providerName, modelId: foundModelId };
}
}
@@ -343,8 +343,8 @@ async function findModelAcrossProviders(
if (foundModelId) {
const model = modelRegistry.find(providerName, foundModelId);
if (model) {
- const apiKey = await modelRegistry.getApiKey(model);
- if (apiKey) {
+ const auth = await modelRegistry.getApiKeyAndHeaders(model);
+ if (auth.ok && auth.apiKey) {
return { provider: providerName, modelId: foundModelId };
}
}
dots/pi/agent/extensions/custom-header.ts
@@ -92,27 +92,27 @@ export default function (pi: ExtensionAPI) {
const commands = pi.getCommands();
const extensions = commands
- .filter(cmd => cmd.source === "extension")
+ .filter(cmd => cmd.sourceInfo?.source === "extension")
.map(cmd => ({
name: cmd.name,
description: cmd.description,
- path: cmd.path,
+ path: cmd.sourceInfo?.path,
}));
const skills = commands
- .filter(cmd => cmd.source === "skill")
+ .filter(cmd => cmd.sourceInfo?.source === "skill")
.map(cmd => ({
name: cmd.name,
- location: cmd.location,
- path: cmd.path,
+ location: cmd.sourceInfo?.path,
+ path: cmd.sourceInfo?.path,
}));
const prompts = commands
- .filter(cmd => cmd.source === "prompt")
+ .filter(cmd => cmd.sourceInfo?.source === "prompt")
.map(cmd => ({
name: cmd.name,
- location: cmd.location,
- path: cmd.path,
+ location: cmd.sourceInfo?.path,
+ path: cmd.sourceInfo?.path,
}));
// Get themes
dots/pi/agent/extensions/handoff.ts
@@ -145,7 +145,8 @@ export default function (pi: ExtensionAPI) {
loader.onAbort = () => done(null);
const doGenerate = async () => {
- const apiKey = await ctx.modelRegistry.getApiKey(ctx.model!);
+ const auth = await ctx.modelRegistry.getApiKeyAndHeaders(ctx.model!);
+ if (!auth.ok) throw new Error(auth.error);
const userMessage: Message = {
role: "user",
@@ -161,7 +162,7 @@ export default function (pi: ExtensionAPI) {
const response = await complete(
ctx.model!,
{ systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
- { apiKey, signal: loader.signal },
+ { apiKey: auth.apiKey, headers: auth.headers, signal: loader.signal },
);
if (response.stopReason === "aborted") {