import { randomUUID } from "node:crypto"; import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { type Api, completeSimple, type Model } from "@mariozechner/pi-ai"; import { describe, expect, it } from "vitest"; import {
ANTHROPIC_SETUP_TOKEN_PREFIX,
validateAnthropicSetupToken,
} from "../commands/auth-token.js"; import { loadConfig } from "../config/config.js"; import { resolveOpenClawAgentDir } from "./agent-paths.js"; import {
type AuthProfileCredential,
ensureAuthProfileStore,
saveAuthProfileStore,
} from "./auth-profiles.js"; import { isLiveTestEnabled } from "./live-test-helpers.js"; import { getApiKeyForModel, requireApiKey } from "./model-auth.js"; import { normalizeProviderId, parseModelRef } from "./model-selection.js"; import { ensureOpenClawModelsJson } from "./models-config.js"; import { discoverAuthStorage, discoverModels } from "./pi-model-discovery.js";
const candidates = listSetupTokenProfiles(store); if (SETUP_TOKEN_PROFILE) { if (!candidates.includes(SETUP_TOKEN_PROFILE)) { const available = candidates.length > 0 ? candidates.join(", ") : "(none)"; thrownew Error(
`Setup-token profile "${SETUP_TOKEN_PROFILE}" not found. Available: ${available}.`,
);
} return { agentDir, profileId: SETUP_TOKEN_PROFILE };
}
if (SETUP_TOKEN_RAW && SETUP_TOKEN_RAW !== "1" && SETUP_TOKEN_RAW !== "auto") { thrownew Error( "OPENCLAW_LIVE_SETUP_TOKEN did not look like a setup-token. Use OPENCLAW_LIVE_SETUP_TOKEN_VALUE for raw tokens.",
);
}
if (candidates.length === 0) { thrownew Error( "No Anthropics setup-token profiles found. Set OPENCLAW_LIVE_SETUP_TOKEN_VALUE or OPENCLAW_LIVE_SETUP_TOKEN_PROFILE.",
);
} return { agentDir, profileId: pickSetupTokenProfile(candidates) };
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.