bailian-cli-commands 2.10.0 → 2.10.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.
Files changed (2) hide show
  1. package/dist/index.mjs +2 -2
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{createRequire as e}from"node:module";import{AIGC_MCP_SERVER as t,AIGC_MCP_TOOL as n,ASYNC_FLAG as r,BATCH_STATUSES as i,BATCH_TERMINAL as a,BailianError as o,CONCURRENT_FLAG as s,CONSOLE_AUTH_FLAGS as c,CONSOLE_DATASET_BY_ID_API as l,CONSOLE_DATASET_GROUPS_API as u,CONSOLE_DATASET_VERSIONS_API as d,CONSOLE_DEPLOY_INSTANCES_API as f,CONSOLE_FILE_URL_API as p,DECISION_REGIONS as m,DEFAULT_DECISION_MODEL as h,DEFAULT_DECISION_REGION as g,DEFAULT_INSTALL_PS1_URL as _,DEFAULT_INSTALL_SCRIPT_URL as v,DEFAULT_LANGUAGE as y,DEFAULT_LLM_MODEL as b,DEFAULT_TRAINING_TYPE as x,DOCS_HOSTS as S,ExitCode as C,LLMError as ee,MAX_CPT_BYTES as te,MAX_DATASET_BYTES as ne,MAX_DECISION_DATASET_BYTES as re,MAX_MEDIA_ZIP_BYTES as ie,MCP_CALL_SERVICE as ae,MCP_TTS_VOICES as oe,MODEL_LIST_API as se,Modalities as ce,RAG_PATHS as w,REGIONS as le,SANDBOX_PATHS as ue,STRATEGIES as de,SUPPORTED_LANGUAGES as fe,TRAINING_TYPES_CLI as pe,TRAINING_TYPE_MAP as me,UsageError as T,agentLoop as he,agentStudioFilesPath as ge,agentStudioHost as _e,anonymousConsoleCall as ve,appCompletionPath as ye,bailianMcpPath as be,bailianMcpSsePath as xe,batchDataNotes as Se,batchUsage as Ce,buildAcsCanonicalQuery as we,buildAsrContextMessages as Te,buildAsrFlashRequest as Ee,buildAsyncAsrLanguageFields as De,buildCommandInvocation as Oe,buildConsoleDatasetGroupsRequest as ke,buildConsoleDatasetVersionsRequest as Ae,buildConsoleDeploymentInstancesRequest as je,buildImageEditArgs as Me,buildImageGenArgs as Ne,buildImageToVideoArgs as Pe,buildPrepaidInfo as Fe,buildReservationCapacity as Ie,buildSpeechToTextArgs as Le,buildTextToVideoArgs as Re,buildTtsArgs as ze,buildVideoFetchArgs as Be,buildVocabularyRequest as Ve,callConsoleGateway as He,cancelBatch as Ue,cancelCompressJob as We,cancelFineTune as Ge,chatPath as Ke,collectAsrTranscriptionItems as qe,commandRef as E,computeSkillStatuses as Je,consoleDatasetStatusAvailability as Ye,createBailianControlUser as Xe,createBatch as Ze,createCapacityInstance as Qe,createCompressJob as $e,createCustomModelImport as et,createDeployment as tt,createFineTune as nt,createInstrumentedFetch as rt,createLLMClient as it,createReadlineInteraction as at,createVocabulary as ot,decisionPath as st,defaultDeployPlan as ct,defineCommand as D,deleteCapacityInstance as lt,deleteCompressJob as ut,deleteConfigProfile as dt,deleteCustomModelImport as ft,deleteDataset as pt,deleteDeployment as mt,deleteFineTune as ht,deleteVocabulary as gt,detectInstalledAgents as _t,detectModality as vt,detectOutputFormat as yt,effectiveConsoleGatewayConfig as bt,estimateCptTokens as xt,estimateSftDpoTokens as St,exportBatchCsv as Ct,exportCheckpoint as wt,extractAsrFlashText as Tt,fanOutSkillToAgents as Et,fetchModelCapability as Dt,fetchModelDetail as Ot,fetchModelGroups as kt,fetchModelGroupsAll as At,fetchModelListAll as jt,fetchPredictConfig as Mt,fetchSkillsIndex as Nt,fetchTrainingModelPrice as Pt,findDeploymentEntry as Ft,findModelByName as It,findSupportImportModel as Lt,followParsexResult as Rt,formatCommand as O,formatIssue as zt,formatOutput as Bt,generateCLIAccessToken as Vt,generateFilename as Ht,getApiKeyLoginKind as Ut,getBatch as Wt,getBatchFileContent as Gt,getCapacityInstance as Kt,getCapacityOperation as qt,getCompressJob as Jt,getCompressJobLogs as Yt,getConfigDir as Xt,getConsoleDatasetById as Zt,getConsoleFileUrl as Qt,getCustomModelImport as $t,getDataset as en,getDeployment as tn,getFineTune as nn,getFineTuneHyperParameterDefaultNumber as rn,getFineTuneLogs as an,getFineTuneParams as on,getHermesHome as sn,getModelProfilePreset as cn,getParsexResult as ln,getProfile as un,getSkillRegistryBaseUrl as dn,getSkillsDir as fn,getUpdateInstallMethod as pn,hasPrepaidFlags as mn,httpTransport as hn,image2videoPath as gn,imageFileToDataUri as _n,inspectDecisionQuestions as vn,inspectDecisionState as yn,installSkillWithFanout as bn,isApiKeyCapability as xn,isDashScopeGateway as Sn,isDecisionObject as Cn,isLocalFile as wn,isMcpTtsVoice as Tn,isStreamableHttpUnsupported as En,isTrainingTypeCli as Dn,knowledgeChatEndpoint as On,knowledgeSearchEndpoint as kn,listBailianControlWorkspaces as An,listBasicMetrics as jn,listBatches as Mn,listCapacityInstances as Nn,listCheckpoints as Pn,listCompressJobs as Fn,listCompressTemplates as In,listConsoleDatasetGroups as Ln,listConsoleDatasetVersions as Rn,listConsoleDeploymentInstances as zn,listCustomModelImports as Bn,listDatasets as Vn,listDeployableModels as Hn,listDeployments as Un,listFineTunes as Wn,listIndependentDeployedModels as Gn,listSkillDirsOnDisk as Kn,listSupportImportModels as qn,listSupportedTrainingTypes as Jn,listVocabularies as Yn,loadCatalog as Xn,loadFamilies as Zn,mapApiError as Qn,maskToken as $n,maybeSyncWikiData as er,mcpWebSearchPath as tr,memoryAddAsyncPath as nr,memoryEndpoint as rr,memoryEventPath as ir,memoryListPath as ar,memoryNodePath as or,memorySearchPath as sr,memorySkillExportPath as cr,modelSupportsTrainingType as lr,modelsLimitsPath as ur,modelsPermissionsPath as dr,normalizeConfigName as fr,normalizeModelBaseUrl as pr,parseAigcAsrTexts as mr,parseAigcImageResults as hr,parseAigcToolResult as gr,parseAigcTtsResult as _r,parseAigcVideoTaskId as vr,parseAigcVideoTaskResult as yr,parseBooleanValue as br,parseDatasetSchemaFlag as xr,parseInstantVocabulary as Sr,parseSSE as Cr,parseSkillNames as wr,parseVocabularyEntries as Tr,parsexBaseUrl as Er,parsexEndpoint as Dr,pickPlanStrategy as Or,planUnlinkSkillFromAgents as kr,preflightBatchSizeGate as Ar,prepareBatch as jr,profileSchemaItemPath as Mr,profileSchemaPath as Nr,queryConsoleDatasetVersion as Pr,queryVocabulary as Fr,ragEndpoint as k,readBatchBlob as Ir,readConfigFile as Lr,readSkillLock as Rr,readTextFromPathOrStdin as zr,recommendEngine as Br,redactDataUri as Vr,removeSkillDir as Hr,renderCommandText as Ur,renewCapacityInstance as Wr,requestJson as Gr,requiredTrainTypeForWeightType as Kr,resetBailianControlPolicies4Agent as qr,resolveAsrApi as Jr,resolveBatchChatEndpoint as Yr,resolveBooleanFlag as Xr,resolveCLIAccessTokenTarget as Zr,resolveImageEditApi as Qr,resolveImageGenerateApi as $r,resolveMcpImageSize as ei,resolveModelConnectionProvenance as ti,resolveOutputDir as ni,resolveWatermark as ri,responsesPath as ii,runWithConcurrency as ai,sandboxApiPath as oi,sandboxBaseUrl as si,sandboxInstanceActionPath as ci,sandboxInstancePath as li,sandboxTemplateBuildStatusPath as ui,sandboxTemplatePath as di,scaleCapacityInstance as fi,scaleDeployment as pi,securityAgentLogsEndpoint as mi,securityGet as hi,securityOverviewEndpoint as gi,speechRecognizePath as _i,speechSynthesizePath as vi,speechVocabularyPath as yi,startModelService as bi,stopModelService as xi,stripDecisionTrainingFields as Si,stripUndefined as Ci,submitParsexTask as wi,taskPath as Ti,trackingHeaders as Ei,trainingTypeMethodVariant as Di,unlinkSkillFromAgents as Oi,unwrapConsoleResponse as ki,unwrapDecisionQuestions as Ai,unwrapResponse as ji,updateDeployment as Mi,updateDeploymentOverflow as Ni,updateVocabulary as Pi,uploadDataset as Fi,userProfilePath as Ii,validateBatch as Li,validateConsoleAccessToken as Ri,validateDataset as zi,validateFineTuneHyperParameterOverrides as Bi,validatePrepaidFlags as Vi,validateReservationCapacity as Hi,videoGeneratePath as Ui,workspaceMaaSBaseUrl as Wi,writeBatchFile as Gi,writeConfigFile as Ki,writeSkillLock as qi}from"bailian-cli-core";import{createHash as Ji,randomBytes as Yi,randomUUID as Xi,timingSafeEqual as Zi}from"node:crypto";import Qi from"node:http";import{execFile as $i,spawn as ea}from"node:child_process";import{API_KEY_PAGE as ta,BOOL_FLAG_PROMPT_EXTEND_API_DEFAULT as na,BOOL_FLAG_PROMPT_EXTEND_CLI_TRUE as ra,BOOL_FLAG_PROMPT_EXTEND_IMAGE_GENERATE as ia,BOOL_FLAG_WATERMARK as aa,KNOWLEDGE_BILLING_PAGE as oa,VOICE_TTS_PAGE as sa,ansi as A,collectPipelineHints as ca,collectPipelineIssues as la,displayWidth as ua,downloadFile as da,downloadParallel as fa,executePipeline as pa,fetchBinaryChannelVersion as ma,fetchLatestVersion as ha,formatBytes as ga,formatTable as _a,getConcurrency as va,initPipelineSteps as ya,isValidUpdateTargetVersion as ba,mcpMarketplaceDetailPage as xa,normalizeBinaryVersion as Sa,normalizeError as Ca,padEnd as j,performBinaryUpdate as wa,poll as Ta,refundConsolePage as Ea,registerInterruptHandler as Da,renderBoxTable as Oa,renderGauge as ka,resolveImageSize as Aa,runConcurrent as ja,streamPipelineEvents as Ma}from"bailian-cli-runtime";import{copyFileSync as Na,createWriteStream as Pa,existsSync as Fa,mkdirSync as Ia,readFileSync as La,renameSync as Ra,statSync as za,writeFileSync as Ba}from"fs";import{setTimeout as Va}from"node:timers/promises";import{basename as M,dirname as Ha,extname as Ua,join as N,relative as Wa,resolve as P,sep as Ga}from"node:path";import{basename as Ka,dirname as qa,extname as Ja,join as Ya}from"path";import*as Xa from"node:fs/promises";import{link as Za,lstat as Qa,mkdir as $a,mkdtemp as eo,open as to,readFile as no,realpath as ro,rename as io,rm as ao,stat as oo,unlink as so,writeFile as co}from"node:fs/promises";import{constants as lo,createReadStream as uo,existsSync as F,lstatSync as fo,mkdirSync as po,readFileSync as mo,readdirSync as ho,statSync as go,unlinkSync as _o,writeFileSync as vo}from"node:fs";import{homedir as yo,hostname as bo,tmpdir as xo}from"node:os";import{inflateRawSync as So}from"node:zlib";import Co,{parseDocument as wo}from"yaml";import{parse as To,stringify as Eo}from"smol-toml";import{homedir as Do,platform as Oo}from"os";import{execSync as ko,spawnSync as Ao}from"child_process";import*as jo from"@openagentpack/sdk";import{AGENTS_PROVIDER_FIELDS as Mo,LocalFileStateBackend as No,SessionEventSchema as Po,StateManager as Fo,UserError as Io,archiveRemoteSession as Lo,bootstrapRuntimeCredentialsSync as Ro,buildAgentDecl as zo,createManagedApiContext as Bo,createMemory as Vo,createProjectRuntime as Ho,createRemoteWebhookEndpoint as Uo,createSessionForAgent as Wo,createVaultCredentialWithStateBackend as Go,deleteFile as Ko,deleteMemory as qo,deleteRemoteWebhookEndpoint as Jo,deleteSession as Yo,destroyPlannedProjectResources as Xo,disableRemoteWebhookEndpoint as Zo,downloadRemoteFile as Qo,downloadRemoteSkill as $o,enableRemoteWebhookEndpoint as es,executePlannedProject as ts,getFileInfo as ns,getManagedAgentProviderCapabilities as rs,getMemory as is,getMemoryStore as as,getMemoryVersion as os,getRemoteAgent as ss,getRemoteDeployment as cs,getRemoteDeploymentRun as ls,getRemoteEnvironment as us,getRemoteSkill as ds,getRemoteVault as fs,getRemoteWebhookEndpoint as ps,getSession as ms,importResource as hs,inspectSkillSource as gs,isTerminalSessionStatus as _s,listMemories as vs,listMemoryStores as ys,listMemoryVersions as bs,listRemoteAgentVersions as xs,listRemoteAgents as Ss,listRemoteDeploymentRuns as Cs,listRemoteDeployments as ws,listRemoteEnvironments as Ts,listRemoteFiles as Es,listRemoteSkillVersions as Ds,listRemoteSkills as Os,listRemoteVaults as ks,listRemoteWebhookEndpoints as As,listRemoteWebhookEvents as js,listSessionEvents as Ms,listSessionSummaries as Ns,parseSessionResources as Ps,parseStateAddress as Fs,planDestroyProjectContext as Is,planProjectContext as Ls,planProjectWithStateBackend as Rs,planVaultCredentialCreateWithStateBackend as zs,redactMemoryVersion as Bs,resetRemoteWebhookSecret as Vs,resolveBailianApiBaseUrl as Hs,resolveProjectConfig as Us,resolveProjectConfigFromObject as Ws,runRemoteDeployment as Gs,sendRemoteSessionEvents as Ks,sendSessionMessagePolling as qs,sendSessionMessageStreaming as Js,setRemoteDeploymentPaused as Ys,startSessionRun as Xs,startSessionRunPolling as Zs,streamSessionEvents as Qs,syncProjectResourcesWithStateBackend as $s,testRemoteWebhookEndpoint as ec,updateMemory as tc,updateRemoteSession as nc,updateRemoteWebhookEndpoint as rc,uploadFile as ic,validateProjectConfig as ac}from"@openagentpack/sdk";import{AsyncLocalStorage as oc}from"node:async_hooks";import{promisify as sc}from"node:util";import{commitProjectBuild as cc,createDirectoryWorkspaceVersionService as lc,executeProjectPublish as uc,initializeDirectoryProject as dc,planProjectPublish as fc,previewProjectBuild as pc,resolveDirectoryProjectRoot as mc,validateDirectoryProject as hc}from"@openagentpack/sdk/project-workspace";import{sanitizeSessionEvents as gc}from"@openagentpack/sdk/session-events";const _c=[`cn-beijing`,`ap-southeast-1`,`cn-hongkong`,`ap-northeast-1`,`eu-central-1`,`us-east-1`],vc={ordinary:[`https://dashscope.aliyuncs.com`,`https://dashscope-intl.aliyuncs.com`,`https://dashscope-us.aliyuncs.com`,`https://cn-hongkong.dashscope.aliyuncs.com`],"token-plan":[`https://token-plan.cn-beijing.maas.aliyuncs.com`,`https://token-plan.ap-southeast-1.maas.aliyuncs.com`]};function yc(e,t){let n=new URL(pr(e)).hostname;return t===`token-plan`||n.endsWith(`.maas.aliyuncs.com`)}function bc(e,t){let n=yc(e,t),r=new URL(n?`/compatible-mode/v1/models`:`/api/v1/models`,`${e}/`);return n||(r.searchParams.set(`page_no`,`1`),r.searchParams.set(`page_size`,`1`)),r.toString()}function xc(e){return e===`unknown`?[`ordinary`,`token-plan`]:[e]}function Sc(e){return new URL(pr(e)).hostname.startsWith(`token-plan.`)}function Cc(e,t){return!Sc(t)||!e.includes(`token-plan`)?[...e]:[`token-plan`,...e.filter(e=>e!==`token-plan`)]}function wc(e,t,n,r){let i=pr(n),a=bc(i,r);t.has(a)||(t.add(a),e.push({baseUrl:i,kind:r,modelsUrl:a}))}function Tc(e,t){let n=Ut(e),r=xc(n),i=[],a=/* @__PURE__ */ new Set;if(t.explicitBaseUrl){for(let e of Cc(r,t.explicitBaseUrl))wc(i,a,t.explicitBaseUrl,e);return i}if(t.storedBaseUrl){let e=Sc(t.storedBaseUrl);for(let o of Cc(r,t.storedBaseUrl))(n===`unknown`||e===(o===`token-plan`))&&wc(i,a,t.storedBaseUrl,o)}if(t.workspaceId&&r.includes(`ordinary`))for(let e of _c)wc(i,a,`https://${t.workspaceId}.${e}.maas.aliyuncs.com`,`ordinary`);for(let e of r)for(let t of vc[e])wc(i,a,t,e);return i}function Ec(e){if(!(e instanceof o)||e.api?.httpStatus===void 0)return 0;let t=e.api.httpStatus;return t===429||t>=500?1:2}function Dc(e){let t,n=1/0;for(let r of e){if(r.error===void 0)continue;let e=Ec(r.error);e<n&&(t=r.error,n=e)}return t}async function Oc(e,t,n){let r=Tc(t,n),i=await Promise.all(r.map(async n=>{try{return await Gr(e,{url:n.modelsUrl,headers:{Authorization:`Bearer ${t}`},timeout:Math.min(e.settings.timeout,5)}),{candidate:n}}catch(e){return{candidate:n,error:e}}})),a=i.find(e=>e.error===void 0);if(a)return{baseUrl:a.candidate.baseUrl,kind:a.candidate.kind};let o=Dc(i);throw o===void 0?TypeError(`API key validation completed without a success or failure result.`):o}async function kc(e,t,n){let r=n.persistBaseUrl?pr(n.persistBaseUrl):void 0;await e.authStore.login({...n.persistPatch,api_key:t,base_url:r,default_text_model:n.defaultTextModel,default_video_model:n.defaultVideoModel,default_image_to_video_model:n.defaultImageToVideoModel,default_reference_to_video_model:n.defaultReferenceToVideoModel,default_image_model:n.defaultImageModel,default_speech_model:n.defaultSpeechModel,default_speech_recognition_model:n.defaultSpeechRecognitionModel,api_key_capabilities:n.apiKeyCapabilities?[...n.apiKeyCapabilities]:void 0})}function Ac(e,t=0){return new Promise((n,r)=>{let i=e=>r(e);e.once(`error`,i),e.listen({port:t,host:`127.0.0.1`,exclusive:!0},()=>{e.off(`error`,i);let t=e.address();if(!t||typeof t==`string`){r(/* @__PURE__ */ Error(`Expected TCP socket address`));return}n(t.port)})})}function jc(e){return`"${e.replaceAll(`"`,`""`)}"`}function Mc(e,t=process.platform){return t===`win32`?{command:`cmd`,args:[`/d`,`/v:off`,`/s`,`/c`,`"${`start "" ${jc(e)}`}"`],windowsVerbatimArguments:!0}:t===`darwin`?{command:`open`,args:[e]}:{command:`xdg-open`,args:[e]}}function Nc(e){let t=Mc(e);return new Promise((e,n)=>{$i(t.command,t.args,{windowsHide:!0,windowsVerbatimArguments:t.windowsVerbatimArguments},t=>{t?n(t):e()})})}function Pc(e){return Nc(e)}function Fc(e,t){return typeof t==`string`?t:e.localize?e.localize(t):t[`en-US`]}const Ic=65536,Lc=/* @__PURE__ */ RegExp(`\r
1
+ import{createRequire as e}from"node:module";import{AIGC_MCP_SERVER as t,AIGC_MCP_TOOL as n,ASYNC_FLAG as r,BATCH_STATUSES as i,BATCH_TERMINAL as a,BailianError as o,CONCURRENT_FLAG as s,CONSOLE_AUTH_FLAGS as c,CONSOLE_DATASET_BY_ID_API as l,CONSOLE_DATASET_GROUPS_API as u,CONSOLE_DATASET_VERSIONS_API as d,CONSOLE_DEPLOY_INSTANCES_API as f,CONSOLE_FILE_URL_API as p,DECISION_REGIONS as m,DEFAULT_DECISION_MODEL as h,DEFAULT_DECISION_REGION as g,DEFAULT_INSTALL_PS1_URL as _,DEFAULT_INSTALL_SCRIPT_URL as v,DEFAULT_LANGUAGE as y,DEFAULT_LLM_MODEL as b,DEFAULT_TRAINING_TYPE as x,DOCS_HOSTS as S,ExitCode as C,LLMError as ee,MAX_CPT_BYTES as te,MAX_DATASET_BYTES as ne,MAX_DECISION_DATASET_BYTES as re,MAX_MEDIA_ZIP_BYTES as ie,MCP_CALL_SERVICE as ae,MCP_TTS_VOICES as oe,MODEL_LIST_API as se,Modalities as ce,RAG_PATHS as w,REGIONS as le,SANDBOX_PATHS as ue,STRATEGIES as de,SUPPORTED_LANGUAGES as fe,TRAINING_TYPES_CLI as pe,TRAINING_TYPE_MAP as me,UsageError as T,agentLoop as he,agentStudioFilesPath as ge,agentStudioHost as _e,anonymousConsoleCall as ve,appCompletionPath as ye,bailianMcpPath as be,bailianMcpSsePath as xe,batchDataNotes as Se,batchUsage as Ce,buildAcsCanonicalQuery as we,buildAsrContextMessages as Te,buildAsrFlashRequest as Ee,buildAsyncAsrLanguageFields as De,buildCommandInvocation as Oe,buildConsoleDatasetGroupsRequest as ke,buildConsoleDatasetVersionsRequest as Ae,buildConsoleDeploymentInstancesRequest as je,buildImageEditArgs as Me,buildImageGenArgs as Ne,buildImageToVideoArgs as Pe,buildPrepaidInfo as Fe,buildReservationCapacity as Ie,buildSpeechToTextArgs as Le,buildTextToVideoArgs as Re,buildTtsArgs as ze,buildVideoFetchArgs as Be,buildVocabularyRequest as Ve,callConsoleGateway as He,cancelBatch as Ue,cancelCompressJob as We,cancelFineTune as Ge,chatPath as Ke,collectAsrTranscriptionItems as qe,commandRef as E,computeSkillStatuses as Je,consoleDatasetStatusAvailability as Ye,createBailianControlUser as Xe,createBatch as Ze,createCapacityInstance as Qe,createCompressJob as $e,createCustomModelImport as et,createDeployment as tt,createFineTune as nt,createInstrumentedFetch as rt,createLLMClient as it,createReadlineInteraction as at,createVocabulary as ot,decisionPath as st,defaultDeployPlan as ct,defineCommand as D,deleteCapacityInstance as lt,deleteCompressJob as ut,deleteConfigProfile as dt,deleteCustomModelImport as ft,deleteDataset as pt,deleteDeployment as mt,deleteFineTune as ht,deleteVocabulary as gt,detectInstalledAgents as _t,detectModality as vt,detectOutputFormat as yt,effectiveConsoleGatewayConfig as bt,estimateCptTokens as xt,estimateSftDpoTokens as St,exportBatchCsv as Ct,exportCheckpoint as wt,extractAsrFlashText as Tt,fanOutSkillToAgents as Et,fetchModelCapability as Dt,fetchModelDetail as Ot,fetchModelGroups as kt,fetchModelGroupsAll as At,fetchModelListAll as jt,fetchPredictConfig as Mt,fetchSkillsIndex as Nt,fetchTrainingModelPrice as Pt,findDeploymentEntry as Ft,findModelByName as It,findSupportImportModel as Lt,followParsexResult as Rt,formatCommand as O,formatIssue as zt,formatOutput as Bt,generateCLIAccessToken as Vt,generateFilename as Ht,getApiKeyLoginKind as Ut,getBatch as Wt,getBatchFileContent as Gt,getCapacityInstance as Kt,getCapacityOperation as qt,getCompressJob as Jt,getCompressJobLogs as Yt,getConfigDir as Xt,getConsoleDatasetById as Zt,getConsoleFileUrl as Qt,getCustomModelImport as $t,getDataset as en,getDeployment as tn,getFineTune as nn,getFineTuneHyperParameterDefaultNumber as rn,getFineTuneLogs as an,getFineTuneParams as on,getHermesHome as sn,getModelProfilePreset as cn,getParsexResult as ln,getProfile as un,getSkillRegistryBaseUrl as dn,getSkillsDir as fn,getUpdateInstallMethod as pn,hasPrepaidFlags as mn,httpTransport as hn,image2videoPath as gn,imageFileToDataUri as _n,inspectDecisionQuestions as vn,inspectDecisionState as yn,installSkillWithFanout as bn,isApiKeyCapability as xn,isDashScopeGateway as Sn,isDecisionObject as Cn,isLocalFile as wn,isMcpTtsVoice as Tn,isStreamableHttpUnsupported as En,isTrainingTypeCli as Dn,knowledgeChatEndpoint as On,knowledgeSearchEndpoint as kn,listBailianControlWorkspaces as An,listBasicMetrics as jn,listBatches as Mn,listCapacityInstances as Nn,listCheckpoints as Pn,listCompressJobs as Fn,listCompressTemplates as In,listConsoleDatasetGroups as Ln,listConsoleDatasetVersions as Rn,listConsoleDeploymentInstances as zn,listCustomModelImports as Bn,listDatasets as Vn,listDeployableModels as Hn,listDeployments as Un,listFineTunes as Wn,listIndependentDeployedModels as Gn,listSkillDirsOnDisk as Kn,listSupportImportModels as qn,listSupportedTrainingTypes as Jn,listVocabularies as Yn,loadCatalog as Xn,loadFamilies as Zn,mapApiError as Qn,maskToken as $n,maybeSyncWikiData as er,mcpWebSearchPath as tr,memoryAddAsyncPath as nr,memoryEndpoint as rr,memoryEventPath as ir,memoryListPath as ar,memoryNodePath as or,memorySearchPath as sr,memorySkillExportPath as cr,modelSupportsTrainingType as lr,modelsLimitsPath as ur,modelsPermissionsPath as dr,normalizeConfigName as fr,normalizeModelBaseUrl as pr,parseAigcAsrTexts as mr,parseAigcImageResults as hr,parseAigcToolResult as gr,parseAigcTtsResult as _r,parseAigcVideoTaskId as vr,parseAigcVideoTaskResult as yr,parseBooleanValue as br,parseDatasetSchemaFlag as xr,parseInstantVocabulary as Sr,parseSSE as Cr,parseSkillNames as wr,parseVocabularyEntries as Tr,parsexBaseUrl as Er,parsexEndpoint as Dr,pickPlanStrategy as Or,planUnlinkSkillFromAgents as kr,preflightBatchSizeGate as Ar,prepareBatch as jr,profileSchemaItemPath as Mr,profileSchemaPath as Nr,queryConsoleDatasetVersion as Pr,queryVocabulary as Fr,ragEndpoint as k,readBatchBlob as Ir,readConfigFile as Lr,readSkillLock as Rr,readTextFromPathOrStdin as zr,recommendEngine as Br,redactDataUri as Vr,removeSkillDir as Hr,renderCommandText as Ur,renewCapacityInstance as Wr,requestJson as Gr,requiredTrainTypeForWeightType as Kr,resetBailianControlPolicies4Agent as qr,resolveAsrApi as Jr,resolveBatchChatEndpoint as Yr,resolveBooleanFlag as Xr,resolveCLIAccessTokenTarget as Zr,resolveImageEditApi as Qr,resolveImageGenerateApi as $r,resolveMcpImageSize as ei,resolveModelConnectionProvenance as ti,resolveOutputDir as ni,resolveWatermark as ri,responsesPath as ii,runWithConcurrency as ai,sandboxApiPath as oi,sandboxBaseUrl as si,sandboxInstanceActionPath as ci,sandboxInstancePath as li,sandboxTemplateBuildStatusPath as ui,sandboxTemplatePath as di,scaleCapacityInstance as fi,scaleDeployment as pi,securityAgentLogsEndpoint as mi,securityGet as hi,securityOverviewEndpoint as gi,speechRecognizePath as _i,speechSynthesizePath as vi,speechVocabularyPath as yi,startModelService as bi,stopModelService as xi,stripDecisionTrainingFields as Si,stripUndefined as Ci,submitParsexTask as wi,taskPath as Ti,trackingHeaders as Ei,trainingTypeMethodVariant as Di,unlinkSkillFromAgents as Oi,unwrapConsoleResponse as ki,unwrapDecisionQuestions as Ai,unwrapResponse as ji,updateDeployment as Mi,updateDeploymentOverflow as Ni,updateVocabulary as Pi,uploadDataset as Fi,userProfilePath as Ii,validateBatch as Li,validateConsoleAccessToken as Ri,validateDataset as zi,validateFineTuneHyperParameterOverrides as Bi,validatePrepaidFlags as Vi,validateReservationCapacity as Hi,videoGeneratePath as Ui,workspaceMaaSBaseUrl as Wi,writeBatchFile as Gi,writeConfigFile as Ki,writeSkillLock as qi}from"bailian-cli-core";import{createHash as Ji,randomBytes as Yi,randomUUID as Xi,timingSafeEqual as Zi}from"node:crypto";import Qi from"node:http";import{execFile as $i,spawn as ea}from"node:child_process";import{API_KEY_PAGE as ta,BOOL_FLAG_PROMPT_EXTEND_API_DEFAULT as na,BOOL_FLAG_PROMPT_EXTEND_CLI_TRUE as ra,BOOL_FLAG_PROMPT_EXTEND_IMAGE_GENERATE as ia,BOOL_FLAG_WATERMARK as aa,KNOWLEDGE_BILLING_PAGE as oa,VOICE_TTS_PAGE as sa,ansi as A,collectPipelineHints as ca,collectPipelineIssues as la,displayWidth as ua,downloadFile as da,downloadParallel as fa,executePipeline as pa,fetchBinaryChannelVersion as ma,fetchLatestVersion as ha,formatBytes as ga,formatTable as _a,getConcurrency as va,initPipelineSteps as ya,isValidUpdateTargetVersion as ba,mcpMarketplaceDetailPage as xa,normalizeBinaryVersion as Sa,normalizeError as Ca,padEnd as j,performBinaryUpdate as wa,poll as Ta,refundConsolePage as Ea,registerInterruptHandler as Da,renderBoxTable as Oa,renderGauge as ka,resolveImageSize as Aa,runConcurrent as ja,streamPipelineEvents as Ma}from"bailian-cli-runtime";import{copyFileSync as Na,createWriteStream as Pa,existsSync as Fa,mkdirSync as Ia,readFileSync as La,renameSync as Ra,statSync as za,writeFileSync as Ba}from"fs";import{setTimeout as Va}from"node:timers/promises";import{basename as M,dirname as Ha,extname as Ua,join as N,relative as Wa,resolve as P,sep as Ga}from"node:path";import{basename as Ka,dirname as qa,extname as Ja,join as Ya}from"path";import*as Xa from"node:fs/promises";import{link as Za,lstat as Qa,mkdir as $a,mkdtemp as eo,open as to,readFile as no,realpath as ro,rename as io,rm as ao,stat as oo,unlink as so,writeFile as co}from"node:fs/promises";import{constants as lo,createReadStream as uo,existsSync as F,lstatSync as fo,mkdirSync as po,readFileSync as mo,readdirSync as ho,statSync as go,unlinkSync as _o,writeFileSync as vo}from"node:fs";import{homedir as yo,hostname as bo,tmpdir as xo}from"node:os";import{inflateRawSync as So}from"node:zlib";import Co,{parseDocument as wo}from"yaml";import{parse as To,stringify as Eo}from"smol-toml";import{homedir as Do,platform as Oo}from"os";import{execSync as ko,spawnSync as Ao}from"child_process";import*as jo from"@openagentpack/sdk";import{AGENTS_PROVIDER_FIELDS as Mo,LocalFileStateBackend as No,SessionEventSchema as Po,StateManager as Fo,UserError as Io,archiveRemoteSession as Lo,bootstrapRuntimeCredentialsSync as Ro,buildAgentDecl as zo,createManagedApiContext as Bo,createMemory as Vo,createProjectRuntime as Ho,createRemoteWebhookEndpoint as Uo,createSessionForAgent as Wo,createVaultCredentialWithStateBackend as Go,deleteFile as Ko,deleteMemory as qo,deleteRemoteWebhookEndpoint as Jo,deleteSession as Yo,destroyPlannedProjectResources as Xo,disableRemoteWebhookEndpoint as Zo,downloadRemoteFile as Qo,downloadRemoteSkill as $o,enableRemoteWebhookEndpoint as es,executePlannedProject as ts,getFileInfo as ns,getManagedAgentProviderCapabilities as rs,getMemory as is,getMemoryStore as as,getMemoryVersion as os,getRemoteAgent as ss,getRemoteDeployment as cs,getRemoteDeploymentRun as ls,getRemoteEnvironment as us,getRemoteSkill as ds,getRemoteVault as fs,getRemoteWebhookEndpoint as ps,getSession as ms,importResource as hs,inspectSkillSource as gs,isTerminalSessionStatus as _s,listMemories as vs,listMemoryStores as ys,listMemoryVersions as bs,listRemoteAgentVersions as xs,listRemoteAgents as Ss,listRemoteDeploymentRuns as Cs,listRemoteDeployments as ws,listRemoteEnvironments as Ts,listRemoteFiles as Es,listRemoteSkillVersions as Ds,listRemoteSkills as Os,listRemoteVaults as ks,listRemoteWebhookEndpoints as As,listRemoteWebhookEvents as js,listSessionEvents as Ms,listSessionSummaries as Ns,parseSessionResources as Ps,parseStateAddress as Fs,planDestroyProjectContext as Is,planProjectContext as Ls,planProjectWithStateBackend as Rs,planVaultCredentialCreateWithStateBackend as zs,redactMemoryVersion as Bs,resetRemoteWebhookSecret as Vs,resolveBailianApiBaseUrl as Hs,resolveProjectConfig as Us,resolveProjectConfigFromObject as Ws,runRemoteDeployment as Gs,sendRemoteSessionEvents as Ks,sendSessionMessagePolling as qs,sendSessionMessageStreaming as Js,setRemoteDeploymentPaused as Ys,startSessionRun as Xs,startSessionRunPolling as Zs,streamSessionEvents as Qs,syncProjectResourcesWithStateBackend as $s,testRemoteWebhookEndpoint as ec,updateMemory as tc,updateRemoteSession as nc,updateRemoteWebhookEndpoint as rc,uploadFile as ic,validateProjectConfig as ac}from"@openagentpack/sdk";import{AsyncLocalStorage as oc}from"node:async_hooks";import{promisify as sc}from"node:util";import{commitProjectBuild as cc,createDirectoryWorkspaceVersionService as lc,executeProjectPublish as uc,initializeDirectoryProject as dc,planProjectPublish as fc,previewProjectBuild as pc,resolveDirectoryProjectRoot as mc,validateDirectoryProject as hc}from"@openagentpack/sdk/project-workspace";import{sanitizeSessionEvents as gc}from"@openagentpack/sdk/session-events";const _c=[`cn-beijing`,`ap-southeast-1`,`cn-hongkong`,`ap-northeast-1`,`eu-central-1`,`us-east-1`],vc={ordinary:[`https://dashscope.aliyuncs.com`,`https://dashscope-intl.aliyuncs.com`,`https://dashscope-us.aliyuncs.com`,`https://cn-hongkong.dashscope.aliyuncs.com`],"token-plan":[`https://token-plan.cn-beijing.maas.aliyuncs.com`,`https://token-plan.ap-southeast-1.maas.aliyuncs.com`]};function yc(e,t){let n=new URL(pr(e)).hostname;return t===`token-plan`||n.endsWith(`.maas.aliyuncs.com`)}function bc(e,t){let n=yc(e,t),r=new URL(n?`/compatible-mode/v1/models`:`/api/v1/models`,`${e}/`);return n||(r.searchParams.set(`page_no`,`1`),r.searchParams.set(`page_size`,`1`)),r.toString()}function xc(e){return e===`unknown`?[`ordinary`,`token-plan`]:[e]}function Sc(e){return new URL(pr(e)).hostname.startsWith(`token-plan.`)}function Cc(e,t){return!Sc(t)||!e.includes(`token-plan`)?[...e]:[`token-plan`,...e.filter(e=>e!==`token-plan`)]}function wc(e,t,n,r){let i=pr(n),a=bc(i,r);t.has(a)||(t.add(a),e.push({baseUrl:i,kind:r,modelsUrl:a}))}function Tc(e,t){let n=Ut(e),r=xc(n),i=[],a=/* @__PURE__ */ new Set;if(t.explicitBaseUrl){for(let e of Cc(r,t.explicitBaseUrl))wc(i,a,t.explicitBaseUrl,e);return i}if(t.storedBaseUrl){let e=Sc(t.storedBaseUrl);for(let o of Cc(r,t.storedBaseUrl))(n===`unknown`||e===(o===`token-plan`))&&wc(i,a,t.storedBaseUrl,o)}if(t.workspaceId&&r.includes(`ordinary`))for(let e of _c)wc(i,a,`https://${t.workspaceId}.${e}.maas.aliyuncs.com`,`ordinary`);for(let e of r)for(let t of vc[e])wc(i,a,t,e);return i}function Ec(e){if(!(e instanceof o)||e.api?.httpStatus===void 0)return 0;let t=e.api.httpStatus;return t===429||t>=500?1:2}function Dc(e){let t,n=1/0;for(let r of e){if(r.error===void 0)continue;let e=Ec(r.error);e<n&&(t=r.error,n=e)}return t}async function Oc(e,t,n){let r=Tc(t,n),i=await Promise.all(r.map(async n=>{try{return await Gr(e,{url:n.modelsUrl,headers:{Authorization:`Bearer ${t}`},timeout:e.settings.timeout}),{candidate:n}}catch(e){return{candidate:n,error:e}}})),a=i.find(e=>e.error===void 0);if(a)return{baseUrl:a.candidate.baseUrl,kind:a.candidate.kind};let o=Dc(i);throw o===void 0?TypeError(`API key validation completed without a success or failure result.`):o}async function kc(e,t,n){let r=n.persistBaseUrl?pr(n.persistBaseUrl):void 0;await e.authStore.login({...n.persistPatch,api_key:t,base_url:r,default_text_model:n.defaultTextModel,default_video_model:n.defaultVideoModel,default_image_to_video_model:n.defaultImageToVideoModel,default_reference_to_video_model:n.defaultReferenceToVideoModel,default_image_model:n.defaultImageModel,default_speech_model:n.defaultSpeechModel,default_speech_recognition_model:n.defaultSpeechRecognitionModel,api_key_capabilities:n.apiKeyCapabilities?[...n.apiKeyCapabilities]:void 0})}function Ac(e,t=0){return new Promise((n,r)=>{let i=e=>r(e);e.once(`error`,i),e.listen({port:t,host:`127.0.0.1`,exclusive:!0},()=>{e.off(`error`,i);let t=e.address();if(!t||typeof t==`string`){r(/* @__PURE__ */ Error(`Expected TCP socket address`));return}n(t.port)})})}function jc(e){return`"${e.replaceAll(`"`,`""`)}"`}function Mc(e,t=process.platform){return t===`win32`?{command:`cmd`,args:[`/d`,`/v:off`,`/s`,`/c`,`"${`start "" ${jc(e)}`}"`],windowsVerbatimArguments:!0}:t===`darwin`?{command:`open`,args:[e]}:{command:`xdg-open`,args:[e]}}function Nc(e){let t=Mc(e);return new Promise((e,n)=>{$i(t.command,t.args,{windowsHide:!0,windowsVerbatimArguments:t.windowsVerbatimArguments},t=>{t?n(t):e()})})}function Pc(e){return Nc(e)}function Fc(e,t){return typeof t==`string`?t:e.localize?e.localize(t):t[`en-US`]}const Ic=65536,Lc=/* @__PURE__ */ RegExp(`\r
2
2
  \r
3
3
  |
4
4
 
@@ -2795,7 +2795,7 @@ Hint: Add --diarization flag to enable speaker separation.`,C.USAGE);let c=i||`f
2795
2795
  `)})}});function W(e){return e.toLocaleString(`en-US`)}function yx(e){let t=new Date(e),n=String(t.getMonth()+1).padStart(2,`0`),r=String(t.getDate()).padStart(2,`0`);return`${t.getFullYear()}-${n}-${r}`}function G(e){let t=e=>String(e).padStart(2,`0`),n=new Date(e);return`${yx(e)} ${t(n.getHours())}:${t(n.getMinutes())}:${t(n.getSeconds())}`}function K(e){return{...e,defaultOutput:`json`,defaultOutputOverridesProfile:!0,notes:[...e.notes??[],{"en-US":`Defaults to JSON, including when the Profile default is text. Use --output text or DASHSCOPE_OUTPUT=text to select text explicitly.`,"zh-CN":`默认输出 JSON,即使 Profile 默认格式为 text。可用 --output text 或 DASHSCOPE_OUTPUT=text 显式选择文本。`},{"en-US":`When a workspace is selected, its tenantId is resolved as switchAgent before any business request, overriding --console-switch-agent for this invocation only. Preflight, polling and follow-up requests share this identity; saved configuration is unchanged.`,"zh-CN":`选定工作空间时,在业务请求前将该空间的 tenantId 解析为 switchAgent,仅对本次执行覆盖 --console-switch-agent。预检、轮询和后续请求共享此身份,不修改已保存配置。`}],async run(t){let n=t.settings,r=t.client;if(!n.dryRun){wx(n);let e=await nd(t);e!==void 0&&(r=r.withConsoleSwitchAgent(e))}await e.run({...t,settings:n,client:r})}}}function q(e){let t=bt(e);if(!e.workspaceId)return t;let{consoleSwitchAgent:n,...r}=t;return{...r,...rd(e)}}async function bx(e,t,n,r=30){let i;for(let a=0;a<r;a++){let r=await e.console(t,n(i)),a=ji(r);if(a.taskId&&Object.keys(a).length===1){i=a.taskId,await new Promise(e=>setTimeout(e,500));continue}return r}return null}async function xx(e,t,n){return bx(e,t,e=>({reqDTO:e?{...n,asyncTaskId:e}:n}))}async function Sx(e,t,n){let r=await xx(e,t,n);if(!r)throw new o(`Request timed out.`,C.TIMEOUT);return ji(r)}const Cx=[`cn-beijing`,`ap-southeast-1`];function wx(e){let t=bt(e).consoleRegion;if(!Cx.includes(t))throw new T(`Model monitor/log/alert commands are not available in console region "${t}". Supported regions: ${Cx.join(`, `)} (set --console-region).`)}const Tx={days:{type:`number`,valueHint:`<days>`,description:{"en-US":`Number of days to look back (default: 7)`,"zh-CN":`向前查询的天数(默认:7)`}},startTime:{type:`string`,valueHint:`<time>`,description:{"en-US":`Range start (ISO date or ms epoch); overrides --days`,"zh-CN":`开始时间(ISO 日期或毫秒时间戳),设置后覆盖 --days`}},endTime:{type:`string`,valueHint:`<time>`,description:{"en-US":`Range end (ISO date or ms epoch); default: now`,"zh-CN":`结束时间(ISO 日期或毫秒时间戳),默认当前时间`}}};function Ex(e,t){let n=e.trim();if(/^\d+$/.test(n))return Number(n);let r=Date.parse(n);if(Number.isNaN(r))throw new T(`${t} must be an ISO date or a millisecond timestamp.`);return r}function Dx(e,t=7){let n=e.endTime?Ex(e.endTime,`--end-time`):Date.now(),r=e.startTime?Ex(e.startTime,`--start-time`):e.hours==null?n-(e.days||t)*864e5:n-e.hours*36e5;if(r>=n)throw new T(`--start-time must be earlier than --end-time.`);return{startTime:r,endTime:n}}const Ox={hours:{type:`number`,valueHint:`<hours>`,description:{"en-US":`Hours to look back (default: 1)`,"zh-CN":`向前查询的小时数(默认:1)`}},startTime:Tx.startTime,endTime:Tx.endTime};function kx(e){let t=ji(e);return typeof t==`object`&&t&&`result`in t?t.result:t}const Ax=[60,3600,86400];function jx(e,t){let n=(t-e)/36e5;return n<=12?60:n<=168?3600:86400}async function Mx(e){let{originData:t,dataDownloadUrl:n}=e;if(t!=null)return t;if(n){let e=await hn.fetch(n.replace(/^http:\/\//,`https://`));if(!e.ok)throw new o(`Failed to download telemetry data (HTTP ${e.status}).`,C.NETWORK);return await e.json()}}const Nx=`zeldaEasy.bailian-telemetry.activate.getTelemetryServiceStatus`;async function Px(e,t,n){return await Sx(e,Nx,{...n?{workspaceId:n}:{},serviceType:t})}async function Fx(e,t){let n=await Px(e,t.serviceType,t.workspaceId);if(!(t.requireInstance===!1?n.openStatus:n.openStatus&&n.instanceStatus===`Ready`))throw new o(`The monitoring service is not activated yet.`,C.AUTH,`Run \`${t.enableCommand}\` to activate it, or enable it in the Bailian console.`)}async function Ix(e,t,n){return kx(await e.console(`zeldaEasy.bailian-telemetry.activate.getTelemetrySlrStatus`,{reqDTO:{...n?{workspaceId:n}:{},slrType:t}}))===!0}async function Lx(e,t,n,r={}){if(await Ix(e,t,n))return!0;r.onProgress?.(`Authorizing the service-linked role...`),await e.console(`zeldaEasy.bailian-telemetry.activate.createTelemetrySlr`,{reqDTO:{...n?{workspaceId:n}:{},slrType:t}});let i=r.pollRetries??10,a=r.pollIntervalMs??2e3;for(let r=0;r<i;r+=1){if(await Ix(e,t,n))return!0;await new Promise(e=>setTimeout(e,a))}return!1}const Rx=`zeldaEasy.bailian-telemetry.telemetryGroup.enableTelemetryGroup`,zx=`zeldaEasy.bailian-telemetry.telemetryGroup.disableTelemetryGroup`;function Bx(e){for(let t of[`result`,`list`,`data`]){let n=e[t];if(Array.isArray(n))return n}return[]}async function Vx(e,t,n){let r=await e.console(`zeldaEasy.bailian-telemetry.telemetryGroup.getTelemetryGroupStatus`,{reqDTO:{...n?{workspaceId:n}:{},resourceType:`model`,resourceIds:[`all`],telemetryType:t}}),i=ji(r),a=(Array.isArray(i)?i:Bx(i)).filter(e=>!n||String(e.workspaceId)===String(n));return a.length===0?null:a[0].telemetryStatus===`enable`}function Hx(e,t){return{...e.workspaceId?{workspaceId:e.workspaceId,filterWorkspaceId:e.workspaceId}:{},resourceId:`all`,resourceType:`model`,telemetryType:t}}const Ux={model:{type:`string`,valueHint:`<model>`,description:{"en-US":`Model name(s), comma-separated`,"zh-CN":`模型名称,多个名称以逗号分隔`}},apiKeyId:{type:`string`,valueHint:`<id>`,description:{"en-US":`API key ID(s), comma-separated`,"zh-CN":`API Key ID,多个以逗号分隔`}},channel:{type:`string`,valueHint:`<channel>`,description:{"en-US":`Call channel(s), comma-separated`,"zh-CN":`调用渠道,多个以逗号分隔`}},source:{type:`string`,valueHint:`<source>`,description:{"en-US":`Call source(s), comma-separated`,"zh-CN":`调用来源,多个以逗号分隔`}},callSource:{type:`string`,valueHint:`<type>`,choices:[`Online`,`Offline`],description:{"en-US":`Inference type: Online, Offline`,"zh-CN":`推理类型:Online、Offline`}}},Wx={model:Ux.model,apiKeyId:Ux.apiKeyId,channel:Ux.channel,source:Ux.source};function Gx(e){if(!e)return;let t=U(e);return t.length?t:void 0}function Kx(e,t){return{...t?{workspaceId:t}:{},models:Gx(e.model),apikeyIds:Gx(e.apiKeyId),channels:Gx(e.channel),sources:Gx(e.source),modelCallSource:e.callSource}}function qx(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Jx(e){let t=new Date(e),n=String(t.getHours()).padStart(2,`0`),r=String(t.getMinutes()).padStart(2,`0`),i=String(t.getSeconds()).padStart(2,`0`);return`${qx(e)} ${n}:${r}:${i}`}function Yx(e,t){if(e.workspaceId)return e.workspaceId;throw new o(`workspace-id is required. Set via --workspace-id, BAILIAN_WORKSPACE_ID, or \`${O(t,`config set workspace_id <id>`)}\`.`,C.GENERAL,`Run \`${O(t,`workspace list`)}\` to view available workspaces.`)}function Xx(e){return ji(e)}const Zx={Reasoning:`Text`,TG:`Text`,VU:`Text`,IG:`Vision`,VG:`Vision`,"Realtime-Omni":`Multimodal`,"Multimodal-Omni":`Multimodal`,ASR:`Audio`,TTS:`Audio`,"Voice-Replication":`Audio`,"Realtime-Text-to-Speech":`Audio`,"Realtime-Voice-Replication":`Audio`,"Realtime-ASR":`Audio`,"Realtime-Audio-Translate":`Audio`,ME:`Embedding`,TR:`Embedding`};function Qx(e){for(let t of e){let e=Zx[t];if(e)return e}return`-`}async function $x(e){return(await jt((t,n)=>e.console(t,n))).filter(e=>typeof e.model==`string`&&e.model).map(e=>({name:e.model,type:Qx(e.capabilities||[])}))}const eS=`zeldaEasy.bailian-commerce.freeTrial.queryFreeTierQuota`,tS=`zeldaEasy.bailian-commerce.freeTrial.queryFreeTierOnlyStatus`;function nS(e,t){let n=e.data;if(!n)return[];let r=n.DataV2;return r?r.data?.data?.[t]||[]:n.data?.[t]||[]}function rS(e){return nS(e,`freeTierQuotas`)}function iS(e){return nS(e,`freeTierOnlyStatuses`)}function aS(e){return oS(e)||e.quotaInitTotal==null||e.quotaInitTotal<=0?null:Math.round(e.quotaTotal/e.quotaInitTotal*1e3)/10}function oS(e){return e.quotaValidityPeriod>0&&e.quotaValidityPeriod<Date.now()}function sS(e){let t=[],{quotas:n,stopMap:r,typeMap:i}=e,a=A(process.stdout);e.title&&t.push(a.purple(e.title)+`
2796
2796
  `);let o=[`Model`,`Type`,`Remaining`,`Total`,`Quota Left`,`Auto-Stop`],s=[],c=[],l=o.length-1,u=n.map(e=>{let t=e.quotaInitTotal!=null&&e.quotaTotal!=null,n=oS(e),a=t?`${W(e.quotaTotal)}${n?` (expired)`:``}`:`-`,o=t?W(e.quotaInitTotal):`-`,l=aS(e);s.push(l),c.push(n?`expired`:l==null?`-`:null);let u=r.get(e.model),d=u===!0?`ON`:u===!1?`OFF`:e.quotaStatus===`UNKNOWN`?`Unsupported`:`-`;return[e.model,i.get(e.model)||`-`,a,o,``,d]}),d=Oa({headers:o,rows:u,align:[`left`,`left`,`right`,`right`,`left`,`left`],barColumns:[{index:4,percents:s,labels:c}],cellColor:(e,t,n)=>{if(t===l){if(n===`ON`)return a.green(n);if(n===`OFF`)return a.yellow(n)}}});for(let e of d)t.push(e+`
2797
2797
  `);return e.moreHint&&t.push(a.dim(e.moreHint)+`
2798
- `),t.join(``).replace(/\n$/,``)}const cS=`zeldaEasy.bailian-telemetry.model.getModelUsageStatistic`,lS=`zeldaEasy.bailian-telemetry.model.listModelUsageStatisticData`;async function uS(e,t,n,r){return bx(e,t,e=>({[n]:e?{taskId:e}:{models:r}}),20)}function dS(e){let t=Xx(e);if(t.callSuccessCount!==void 0||t.usages!==void 0)return t}function fS(e){let t=Xx(e);return{list:t.list??[],totalCount:t.totalCount??0,maxResults:t.maxResults??0}}function pS(e){let t={};if(e.usages&&Array.isArray(e.usages))for(let n of e.usages)n.key&&n.value!=null&&(t[n.key]=n.value);if(e.usage&&typeof e.usage==`object`)for(let[n,r]of Object.entries(e.usage))r!=null&&(t[n]=r);return t}const mS={total_token:{en:`Total Tokens`,unit:`tokens`},input_token:{en:`Input Tokens`,unit:`tokens`},output_token:{en:`Output Tokens`,unit:`tokens`},input_token_cache:{en:`Cached Tokens`,unit:`tokens`},input_token_cache_read:{en:`Cache Read`,unit:`tokens`},input_token_cache_creation:{en:`Cache Creation`,unit:`tokens`},thinking_input_token:{en:`Thinking Input`,unit:`tokens`},thinking_output_token:{en:`Thinking Output`,unit:`tokens`},text_input_token:{en:`Text Input`,unit:`tokens`},purein_text_output_token:{en:`Text Output`,unit:`tokens`},embedding_token:{en:`Embedding`,unit:`tokens`},image_number:{en:`Images`,unit:`images`},video_duration:{en:`Video Duration`,unit:`sec`},content_duration:{en:`Audio Duration`,unit:`sec`},tts_text_number:{en:`TTS Chars`,unit:`chars`},total_token_avg:{en:`Avg Tokens/Req`}};function hS(e){let t=mS[e];if(!t)return e;let n=t.unit?` [${t.unit}]`:``;return`${t.en}${n}`}function gS(e,t,n,r,i=`Usage Overview`){let a=[],o=A(process.stdout);a.push(`${o.purple(i)} ${o.dim(`·`)} ${qx(t)} ~ ${qx(n)} ${o.dim(`(${r} days)`)}\n`);let s=[[`Models Called`,W(e.modelCount??0)],[`Successful Calls`,W(e.callSuccessCount??0)]];for(let t of e.usages??[])s.push([hS(t.key),W(t.value)]);let c=Math.max(...s.map(([e])=>ua(e)));for(let[e,t]of s)a.push(`${o.bold(j(e,c+2))}${t}\n`);return a.join(``).replace(/\n$/,``)}var _S=D({description:{"en-US":`Query free-tier quota for models (all models if --model is omitted)`,"zh-CN":`查询模型免费额度(省略 --model 时查询全部模型)`},auth:`console`,usageArgs:`[--model <model>[,model2,...]] [flags]`,flags:{model:{type:`string`,valueHint:`<model>`,description:{"en-US":`Model name(s) to query, comma-separated for multiple; omit for all models`,"zh-CN":`要查询的模型名称;多个名称以逗号分隔,省略时查询全部模型`}},expiring:{type:`string`,valueHint:`<days>`,description:{"en-US":`Only show quotas expiring within N days`,"zh-CN":`仅显示将在 N 天内到期的额度`}},sort:{type:`string`,valueHint:`<field>`,description:{"en-US":`Sort by: remaining (ascending), expires (ascending)`,"zh-CN":`排序方式:remaining(剩余额度升序)、expires(到期时间升序)`},choices:[`remaining`,`expires`]},all:{type:`switch`,description:{"en-US":`Show all models instead of the top rows`,"zh-CN":`显示全部模型,而不只显示前几行`}}},exampleArgs:[``,`--model qwen3-max`,`--model qwen3-max,qwen-turbo`,`--expiring 30`,`--sort remaining`,`--all`,`--model qwen-turbo --output json`,`--model qwen3-max --console-region cn-beijing`],async run(e){let{identity:t,settings:n,flags:r}=e,i=r.model||void 0,a=Number(r.expiring)||0,o=r.sort||void 0,s=!!r.all,c=n.output,l,u=/* @__PURE__ */ new Map;l=i?[...new Set(i.split(`,`).map(e=>e.trim()).filter(Boolean))]:[];let d={queryFreeTierQuotaRequest:{models:l}};if(n.dryRun){e.output.result({api:eS,data:d});return}if(i){let t=await Promise.all(l.map(t=>It((t,n)=>e.client.console(t,n),t)));for(let e=0;e<l.length;e++){let n=t[e];n&&u.set(l[e],Qx(n.capabilities||[]))}}else{let t=await $x(e.client);l=t.map(e=>e.name);for(let e of t)u.set(e.name,e.type);d.queryFreeTierQuotaRequest.models=l}let f=rS(await e.client.console(eS,d)),p=i?f:f.filter(e=>e.quotaStatus===`VALID`&&e.quotaInitTotal>0);if(a>0){let e=Date.now()+a*24*60*60*1e3;p=p.filter(t=>t.quotaValidityPeriod>0&&t.quotaValidityPeriod<=e)}let m=o??(i?void 0:`remaining`);m===`remaining`?p.sort((e,t)=>(e.quotaInitTotal?e.quotaTotal/e.quotaInitTotal:0)-(t.quotaInitTotal?t.quotaTotal/t.quotaInitTotal:0)):m===`expires`&&p.sort((e,t)=>(e.quotaValidityPeriod??0)-(t.quotaValidityPeriod??0));let h=p.map(e=>e.model),g=h.length?await e.client.console(tS,{queryFreeTierOnlyStatusRequest:{models:h}}):null,_=g?iS(g):[],v=new Map(_.map(e=>[e.model,e.freeTierOnly])),y=p.map(e=>{let t=e.quotaInitTotal!=null&&e.quotaTotal!=null,n=t?e.quotaInitTotal-e.quotaTotal:0,r=v.get(e.model),i=r===!0?!0:r===!1?!1:e.quotaStatus===`UNKNOWN`?`unsupported`:null;return{model:e.model,type:u.get(e.model)||null,remaining:t?e.quotaTotal:null,total:t?e.quotaInitTotal:null,usagePercent:t&&e.quotaInitTotal>0?Math.round(n/e.quotaInitTotal*1e3)/10:null,remainingPercent:aS(e),expires:e.quotaValidityPeriod?qx(e.quotaValidityPeriod):null,autoStop:i}}),b=!i&&!s?p.slice(0,15):p,x=p.length-b.length,S=m===`remaining`?` · sorted by urgency`:``;e.output.result(y,c===`text`?{text:p.length?sS({quotas:b,stopMap:v,typeMap:u,title:`Free Tier Quota · ${p.length} models${S}`,moreHint:x>0?`+ ${x} more · ${O(t,`usage free --all`)} to browse all`:void 0}):e.localize({"en-US":`No free-tier quota found.`,"zh-CN":`未找到免费额度。`})}:void 0)}});function vS(e,t){if((e.failureModels??[]).length>0)return!1;let n=e.successModels;return Array.isArray(n)?n.includes(t):typeof e.successCount==`number`?e.successCount>0:e.success===!0}var yS=D({description:{"en-US":`Enable or disable auto-stop for free-tier models. Enables by default; use --off to disable`,"zh-CN":`启用或停用免费额度模型自动停止。默认启用,使用 --off 停用`},auth:`console`,risk:{level:`high`,reason:`billing`,message:{"en-US":`This changes free-tier auto-stop. Enabling it makes calls fail once free quota is exhausted; disabling it allows pay-as-you-go charges after free quota is exhausted.`,"zh-CN":`此操作会变更免费额度自动停止。启用后,免费额度用尽时调用将失败;停用后,免费额度用尽将继续按量计费调用。`}},usageArgs:`<--model <model>[,model2,...] | --all> [--off] [flags]`,flags:{model:{type:`string`,valueHint:`<model>`,description:{"en-US":`Model name(s), comma-separated for multiple`,"zh-CN":`模型名称,多个名称以逗号分隔`}},all:{type:`switch`,description:{"en-US":`Apply to all free-tier models`,"zh-CN":`应用于全部免费额度模型`}},on:{type:`switch`,description:{"en-US":`Enable auto-stop (default behavior)`,"zh-CN":`启用自动停止(默认行为)`}},off:{type:`switch`,description:{"en-US":`Disable auto-stop`,"zh-CN":`停用自动停止`}}},exampleArgs:[`--model qwen3-max --yes`,`--model qwen3-max,qwen-turbo --yes`,`--all --yes`,`--on --model qwen3-max --yes`,`--off --model qwen3-max --yes`,`--off --all --yes`],notes:[{"en-US":"Requires `--yes` (exit code 7 / requires_confirmation without it). Applies to both enabling and disabling auto-stop.","zh-CN":"需要 `--yes`(缺少时退出码 7 / requires_confirmation)。启用与停用自动停止均适用。"}],validate:e=>!e.model&&!e.all?`Provide --model <model>[,model2,...] or --all.`:void 0,async run(e){let{settings:t,flags:n}=e,r=n.model||void 0,i=!!n.off,a=t.output,s=i?`disable`:`enable`,c=i?`停用`:`启用`,l;l=r?[...new Set(r.split(`,`).map(e=>e.trim()).filter(Boolean))]:[];let u=i?`zeldaEasy.bailian-commerce.freeTrial.batchDeactivateFreeTierOnly`:`zeldaEasy.bailian-commerce.freeTrial.batchActivateFreeTierOnly`,d=i?`BatchDeactivateFreeTierOnlyRequest`:`BatchActivateFreeTierOnlyRequest`;if(t.dryRun){e.output.result({api:u,data:{[d]:{models:l}}});return}r||(l=(await $x(e.client)).map(e=>e.name));let f=[],p=[],m=[],h=[],g=[],_=[],v=/* @__PURE__ */ new Map;if(i){let t=iS(await e.client.console(tS,{queryFreeTierOnlyStatusRequest:{models:l}}));v=new Map(t.map(e=>[e.model,e.freeTierOnly]))}let y=!1,b=t=>{y||(a!==`text`||_.length!==0)&&(t?.requireProgress&&p.length===0&&f.length===0&&_.length===0||(e.output.result(i?{processed:p,skipped:f}:p.map(e=>e.result),a===`text`?{text:_.join(`
2798
+ `),t.join(``).replace(/\n$/,``)}const cS=`zeldaEasy.bailian-telemetry.model.getModelUsageStatistic`,lS=`zeldaEasy.bailian-telemetry.model.listModelUsageStatisticData`;async function uS(e,t,n,r){return bx(e,t,e=>({[n]:e?{taskId:e}:{models:r}}),20)}function dS(e){let t=Xx(e);if(t.callSuccessCount!==void 0||t.usages!==void 0)return t}function fS(e){let t=Xx(e);return{list:t.list??[],totalCount:t.totalCount??0,maxResults:t.maxResults??0}}function pS(e){let t={};if(e.usages&&Array.isArray(e.usages))for(let n of e.usages)n.key&&n.value!=null&&(t[n.key]=n.value);if(e.usage&&typeof e.usage==`object`)for(let[n,r]of Object.entries(e.usage))r!=null&&(t[n]=r);return t}const mS={total_token:{en:`Total Tokens`,unit:`tokens`},input_token:{en:`Input Tokens`,unit:`tokens`},output_token:{en:`Output Tokens`,unit:`tokens`},input_token_cache:{en:`Cached Tokens`,unit:`tokens`},input_token_cache_read:{en:`Cache Read`,unit:`tokens`},input_token_cache_creation:{en:`Cache Creation`,unit:`tokens`},thinking_input_token:{en:`Thinking Input`,unit:`tokens`},thinking_output_token:{en:`Thinking Output`,unit:`tokens`},text_input_token:{en:`Text Input`,unit:`tokens`},purein_text_output_token:{en:`Text Output`,unit:`tokens`},embedding_token:{en:`Embedding`,unit:`tokens`},image_number:{en:`Images`,unit:`images`},video_duration:{en:`Video Duration`,unit:`sec`},content_duration:{en:`Audio Duration`,unit:`sec`},tts_text_number:{en:`TTS Chars`,unit:`chars`},total_token_avg:{en:`Avg Tokens/Req`}};function hS(e){let t=mS[e];if(!t)return e;let n=t.unit?` [${t.unit}]`:``;return`${t.en}${n}`}function gS(e,t,n,r,i=`Usage Overview`){let a=[],o=A(process.stdout);a.push(`${o.purple(i)} ${o.dim(`·`)} ${qx(t)} ~ ${qx(n)} ${o.dim(`(${r} days)`)}\n`);let s=[[`Models Called`,W(e.modelCount??0)],[`Successful Calls`,W(e.callSuccessCount??0)]];for(let t of e.usages??[])s.push([hS(t.key),W(t.value)]);let c=Math.max(...s.map(([e])=>ua(e)));for(let[e,t]of s)a.push(`${o.bold(j(e,c+2))}${t}\n`);return a.join(``).replace(/\n$/,``)}var _S=D({description:{"en-US":`Query free-tier quota for models (all models if --model is omitted)`,"zh-CN":`查询模型免费额度(省略 --model 时查询全部模型)`},auth:`console`,usageArgs:`[--model <model>[,model2,...]] [flags]`,flags:{model:{type:`string`,valueHint:`<model>`,description:{"en-US":`Model name(s) to query, comma-separated for multiple; omit for all models`,"zh-CN":`要查询的模型名称;多个名称以逗号分隔,省略时查询全部模型`}},expiring:{type:`string`,valueHint:`<days>`,description:{"en-US":`Only show quotas expiring within N days`,"zh-CN":`仅显示将在 N 天内到期的额度`}},sort:{type:`string`,valueHint:`<field>`,description:{"en-US":`Sort by: remaining (ascending), expires (ascending)`,"zh-CN":`排序方式:remaining(剩余额度升序)、expires(到期时间升序)`},choices:[`remaining`,`expires`]},all:{type:`switch`,description:{"en-US":`Show all models instead of the top rows`,"zh-CN":`显示全部模型,而不只显示前几行`}}},exampleArgs:[``,`--model qwen3-max`,`--model qwen3-max,qwen-turbo`,`--expiring 30`,`--sort remaining`,`--all`,`--model qwen-turbo --output json`,`--model qwen3-max --console-region cn-beijing`],async run(e){let{identity:t,settings:n,flags:r}=e,i=r.model||void 0,a=Number(r.expiring)||0,o=r.sort||void 0,s=!!r.all,c=n.output,l,u=/* @__PURE__ */ new Map;l=i?[...new Set(i.split(`,`).map(e=>e.trim()).filter(Boolean))]:[];let d={queryFreeTierQuotaRequest:{models:l}};if(n.dryRun){e.output.result({api:eS,data:d,...i?{}:{scope:`all`,models_resolved:!1}});return}if(i){let t=await Promise.all(l.map(t=>It((t,n)=>e.client.console(t,n),t)));for(let e=0;e<l.length;e++){let n=t[e];n&&u.set(l[e],Qx(n.capabilities||[]))}}else{let t=await $x(e.client);l=t.map(e=>e.name);for(let e of t)u.set(e.name,e.type);d.queryFreeTierQuotaRequest.models=l}let f=rS(await e.client.console(eS,d)),p=i?f:f.filter(e=>e.quotaStatus===`VALID`&&e.quotaInitTotal>0);if(a>0){let e=Date.now()+a*24*60*60*1e3;p=p.filter(t=>t.quotaValidityPeriod>0&&t.quotaValidityPeriod<=e)}let m=o??(i?void 0:`remaining`);m===`remaining`?p.sort((e,t)=>(e.quotaInitTotal?e.quotaTotal/e.quotaInitTotal:0)-(t.quotaInitTotal?t.quotaTotal/t.quotaInitTotal:0)):m===`expires`&&p.sort((e,t)=>(e.quotaValidityPeriod??0)-(t.quotaValidityPeriod??0));let h=p.map(e=>e.model),g=h.length?await e.client.console(tS,{queryFreeTierOnlyStatusRequest:{models:h}}):null,_=g?iS(g):[],v=new Map(_.map(e=>[e.model,e.freeTierOnly])),y=p.map(e=>{let t=e.quotaInitTotal!=null&&e.quotaTotal!=null,n=t?e.quotaInitTotal-e.quotaTotal:0,r=v.get(e.model),i=r===!0?!0:r===!1?!1:e.quotaStatus===`UNKNOWN`?`unsupported`:null;return{model:e.model,type:u.get(e.model)||null,remaining:t?e.quotaTotal:null,total:t?e.quotaInitTotal:null,usagePercent:t&&e.quotaInitTotal>0?Math.round(n/e.quotaInitTotal*1e3)/10:null,remainingPercent:aS(e),expires:e.quotaValidityPeriod?qx(e.quotaValidityPeriod):null,autoStop:i}}),b=!i&&!s?p.slice(0,15):p,x=p.length-b.length,S=m===`remaining`?` · sorted by urgency`:``;e.output.result(y,c===`text`?{text:p.length?sS({quotas:b,stopMap:v,typeMap:u,title:`Free Tier Quota · ${p.length} models${S}`,moreHint:x>0?`+ ${x} more · ${O(t,`usage free --all`)} to browse all`:void 0}):e.localize({"en-US":`No free-tier quota found.`,"zh-CN":`未找到免费额度。`})}:void 0)}});function vS(e,t){if((e.failureModels??[]).length>0)return!1;let n=e.successModels;return Array.isArray(n)?n.includes(t):typeof e.successCount==`number`?e.successCount>0:e.success===!0}var yS=D({description:{"en-US":`Enable or disable auto-stop for free-tier models. Enables by default; use --off to disable`,"zh-CN":`启用或停用免费额度模型自动停止。默认启用,使用 --off 停用`},auth:`console`,risk:{level:`high`,reason:`billing`,message:{"en-US":`This changes free-tier auto-stop. Enabling it makes calls fail once free quota is exhausted; disabling it allows pay-as-you-go charges after free quota is exhausted.`,"zh-CN":`此操作会变更免费额度自动停止。启用后,免费额度用尽时调用将失败;停用后,免费额度用尽将继续按量计费调用。`}},usageArgs:`<--model <model>[,model2,...] | --all> [--off] [flags]`,flags:{model:{type:`string`,valueHint:`<model>`,description:{"en-US":`Model name(s), comma-separated for multiple`,"zh-CN":`模型名称,多个名称以逗号分隔`}},all:{type:`switch`,description:{"en-US":`Apply to all free-tier models`,"zh-CN":`应用于全部免费额度模型`}},on:{type:`switch`,description:{"en-US":`Enable auto-stop (default behavior)`,"zh-CN":`启用自动停止(默认行为)`}},off:{type:`switch`,description:{"en-US":`Disable auto-stop`,"zh-CN":`停用自动停止`}}},exampleArgs:[`--model qwen3-max --yes`,`--model qwen3-max,qwen-turbo --yes`,`--all --yes`,`--on --model qwen3-max --yes`,`--off --model qwen3-max --yes`,`--off --all --yes`],notes:[{"en-US":"Requires `--yes` (exit code 7 / requires_confirmation without it). Applies to both enabling and disabling auto-stop.","zh-CN":"需要 `--yes`(缺少时退出码 7 / requires_confirmation)。启用与停用自动停止均适用。"}],validate:e=>!e.model&&!e.all?`Provide --model <model>[,model2,...] or --all.`:void 0,async run(e){let{settings:t,flags:n}=e,r=n.model||void 0,i=!!n.off,a=t.output,s=i?`disable`:`enable`,c=i?`停用`:`启用`,l;l=r?[...new Set(r.split(`,`).map(e=>e.trim()).filter(Boolean))]:[];let u=i?`zeldaEasy.bailian-commerce.freeTrial.batchDeactivateFreeTierOnly`:`zeldaEasy.bailian-commerce.freeTrial.batchActivateFreeTierOnly`,d=i?`BatchDeactivateFreeTierOnlyRequest`:`BatchActivateFreeTierOnlyRequest`;if(t.dryRun){let t=!!n.all&&!r;e.output.result({api:u,data:{[d]:{models:l}},...t?{scope:`all`,models_resolved:!1}:{}});return}r||(l=(await $x(e.client)).map(e=>e.name));let f=[],p=[],m=[],h=[],g=[],_=[],v=/* @__PURE__ */ new Map;if(i){let t=iS(await e.client.console(tS,{queryFreeTierOnlyStatusRequest:{models:l}}));v=new Map(t.map(e=>[e.model,e.freeTierOnly]))}let y=!1,b=t=>{y||(a!==`text`||_.length!==0)&&(t?.requireProgress&&p.length===0&&f.length===0&&_.length===0||(e.output.result(i?{processed:p,skipped:f}:p.map(e=>e.result),a===`text`?{text:_.join(`
2799
2799
  `)}:void 0),y=!0))},x=t=>e.localize({"en-US":[`Confirmed ${s} auto-stop for ${m.length} model(s)${m.length>0?`: ${m.join(`, `)}`:``}.`,`Model "${t}" failed; its outcome is unconfirmed. Later models were not executed.`].join(`
2800
2800
  `),"zh-CN":[`已确认${c}自动停止 ${m.length} 个模型${m.length>0?`:${m.join(`、`)}`:``}。`,`模型 "${t}" 失败,结果未确认。后续模型未执行。`].join(`
2801
2801
  `)});for(let t of l){if(i&&v.get(t)===!1){f.push(t),e.output.info({"en-US":`Auto-stop is already disabled for "${t}".`,"zh-CN":`模型 "${t}" 已停用自动停止。`});continue}let n;try{n=await uS(e.client,u,d,[t])}catch(n){throw b({requireProgress:!0}),(m.length>0||p.length>0||f.length>0)&&e.output.warning({code:`FREETIER_PARTIAL_PROGRESS`,message:x(t),details:{confirmed:m,failed_model:t,processed_count:p.length,skipped_count:f.length}}),n}p.push({model:t,result:n});let r=n?ji(n):void 0,a=r?.failureModels??[];if(!n){g.push(t),e.output.warning({code:`FREETIER_OPERATION_TIMEOUT`,message:{"en-US":`Operation timed out for "${t}".`,"zh-CN":`模型 "${t}" 的操作超时。`},details:{model:t}});break}if(a.length>0){h.push(t);let n=a[0].errorCode;e.output.warning({code:`FREETIER_OPERATION_FAILED`,message:i?{"en-US":`Failed to disable auto-stop for "${t}" (${n}).`,"zh-CN":`模型 "${t}" 停用自动停止失败(${n})。`}:{"en-US":`Failed to enable auto-stop for "${t}" (${n}).`,"zh-CN":`模型 "${t}" 启用自动停止失败(${n})。`},details:{model:t,error_code:n}});break}if(!r||!vS(r,t)){h.push(t),e.output.warning({code:`FREETIER_OPERATION_FAILED`,message:{"en-US":`Auto-stop ${s} for "${t}" was not confirmed by the server.`,"zh-CN":`服务端未确认模型 "${t}" 的自动停止${c}。`},details:{model:t}});break}m.push(t),_.push(e.localize(i?{"en-US":`Disabled auto-stop for "${t}".`,"zh-CN":`已为模型 "${t}" 停用自动停止。`}:{"en-US":`Enabled auto-stop for "${t}".`,"zh-CN":`已为模型 "${t}" 启用自动停止。`}))}if(b(),h.length===0&&g.length===0)return;let S=[],ee=[];throw h.length>0&&(S.push(`Failed to ${s} auto-stop for ${h.length} model(s): ${h.join(`, `)}.`),ee.push(`${h.length} 个模型${c}自动停止失败:${h.join(`、`)}。`)),g.length>0&&(S.push(`Timed out waiting to confirm ${s} auto-stop for ${g.length} model(s): ${g.join(`, `)}.`),ee.push(`${g.length} 个模型${c}自动停止超时未确认:${g.join(`、`)}。`)),new o(e.localize({"en-US":S.join(` `),"zh-CN":ee.join(``)}),h.length>0?C.GENERAL:C.TIMEOUT)}});function bS(e){let t=e.unit?` [${e.unit}]`:``;return`${e.en}${t}`}function xS(e,t,n,r){let i=[],a=A(process.stdout);i.push(`${a.dim(`Time Range Period:`)} ${qx(t)} ~ ${qx(n)} ${a.dim(`(${r} days)`)}\n\n`);let o=[[`Models Called`,W(e.modelCount??0)],[`Successful Calls`,W(e.callSuccessCount??0)]];for(let t of e.usages??[]){let e=mS[t.key],n=e?bS(e):t.key;o.push([n,W(t.value)])}let s=Math.max(...o.map(([e])=>ua(e)));for(let[e,t]of o)i.push(`${a.bold(j(e,s+2))}${t}\n`);return i.join(``).replace(/\n$/,``)}function SS(e,t,n,r){let i=[],a=A(process.stdout);if(i.push(`${a.dim(`Time Range Period:`)} ${qx(t)} ~ ${qx(n)} ${a.dim(`(${r} days)`)}\n\n`),e.length===0)return i.push(`No usage data found.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bailian-cli-commands",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "Command library for bailian-cli products (knowledge, memory, media, …). See https://www.npmjs.com/package/bailian-cli for usage.",
5
5
  "homepage": "https://bailian.console.aliyun.com/cli",
6
6
  "bugs": {
@@ -32,8 +32,8 @@
32
32
  "chalk": "^5.6.2",
33
33
  "smol-toml": "^1.4.2",
34
34
  "yaml": "^2.8.3",
35
- "bailian-cli-core": "2.10.0",
36
- "bailian-cli-runtime": "2.10.0"
35
+ "bailian-cli-runtime": "2.10.1",
36
+ "bailian-cli-core": "2.10.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^24",