@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
3 lines (2 loc) • 1.44 kB
JavaScript
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
import{apiKeyEnvProviders,getApiKeyEnvVars}from"./chunk-Z6TEQEZO.js";import{normalizeProviderId}from"./chunk-AFDUWYAX.js";var MAX_ENV_SLOT_INDEX=16;function primaryEnvVar(providerId){if(normalizeProviderId(providerId)==="anthropic-subscription")return"CLAUDE_CODE_OAUTH_TOKEN";let envVars=getApiKeyEnvVars(providerId);if(!(!envVars||envVars.length===0))return envVars.find(name=>name.endsWith("_API_KEY"))??envVars[0]}function envSlotVarNames(){let names=new Set;for(let provider of[...apiKeyEnvProviders(),"anthropic-subscription"]){let primary=primaryEnvVar(provider);if(primary){names.add(primary);for(let index=2;index<=MAX_ENV_SLOT_INDEX;index++)names.add(`${primary}_${index}`)}}return[...names]}function discoverEnvSlots(providerId,env){let primary=primaryEnvVar(providerId);if(!primary)return[];let slots=[],base=env(primary);base&&slots.push({name:"env",envVarName:primary,key:base,source:"env"});for(let index=2;index<=MAX_ENV_SLOT_INDEX;index++){let envVarName=`${primary}_${index}`,value=env(envVarName);value&&slots.push({name:`env-${index}`,envVarName,key:value,source:"env"})}return slots}export{envSlotVarNames,discoverEnvSlots};