@mcpjam/cli 6.2.0 → 6.2.2
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 +240 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { realpathSync, readFileSync, existsSync, mkdirSync, writeFileSync, statS
|
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
5
|
import { MODEL_REASONING_EFFORTS, MCP_CHECK_IDS, MCP_APPS_CHECK_IDS, MCP_TASKS_CHECK_IDS, RETIRED_MCP_CHECK_IDS, RENAMED_MCP_TASKS_CHECK_IDS, loadEvalSuiteFile, createSuiteFileRunner, runSuiteFile, SuiteFileRunError, formatLocalEvalRunSummary, renderStructuredRunJson, probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, listServerSkillCatalog, getVerifiedServerSkill, isServerSkillRefusalError, readVerifiedServerSkillFile, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, runConformance, OPENAI_SUBMISSION_MODES, renderStructuredRunJUnitXml, renderStructuredRunHtml, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, parseToolResultAuthChallenge, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, buildConformanceRunReport, MCP_TASKS_READINESS_IDS, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_LOG_LEVELS, MCP_PROTOCOL_VERSIONS, isConformanceReportingConfigured, reportConformanceRun, reportConformanceRunSafely, DIRECTORY_FEATURE_CLAIMS, gatherClaudeReadinessEvidence, gradeClaudeReadiness, gatherOpenAIReadinessEvidence, xmldomParseXml, gradeOpenAIReadiness, gatherMuseReadinessEvidence, gradeMuseReadiness, openUrlInBrowser, buildEvalRunReport, GATE_WAIVER_MAX_REASON_LENGTH, GATE_WAIVER_REASON_NOTICE, MCPClientManager, withSkillsExtensionCapability, extractAuthChallenge, isUnauthorized401, detectCiMetadata, MCP_SKILLS_EXTENSION_ID, decodeMcpHeaderValue, canDeclareTasksExtension, createStrictElicitationContentValidator, MCP_APPS_CHECK_CATEGORIES, MCP_TASKS_CHECK_CATEGORIES, validateTaskOverrides, EVENTS_CHECK_IDS, MCP_OAUTH_READINESS_IDS, OAuthProxyError, isLoopbackHost, MCP_READINESS_IDS, LAZY_AUTH_PROBE_LIMITS, OPENAI_SUBMISSION_MODE_SHAPES, createDirectoryPluginFileSource, collectZipArchiveObservations, createZipPluginFileSource, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, declareEvalSuiteFileValidity, aiRefusalClass, formatEvalRunDecisionSummary, gateOutcomeVerdict, applyGateWaiver, formatGateReport, formatGateWaiverLine, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, startEventsConformanceReceiver, runEventsConformance, MCP_CHECK_CATEGORIES, recognizedAiRefusalCode, readEvalRunDecisionSummary as readEvalRunDecisionSummary$1, buildEvalRunDecisionSummary, evaluateGates, gateInputFromPlatformRun, isGateWaiverInForce, calculateLatencyStats, CORPUS_LOCK_VERSION, suiteFilePointer, passRateFractionFromPercent, DEFAULT_MIN_EFFECT_SIZE, DEFAULT_MIN_SAMPLE_SIZE, planPlatformSuiteGradingUpdate, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES, isMCPEventsWireError, classifyEventsRpcError } from '@mcpjam/sdk';
|
|
6
6
|
import { isMcpjamDeploymentError, deploymentPolicy, resolveDeployment, MCPJAM_CLOUD_API_URL, backendFetch, trimTrailingSlashes } from '@mcpjam/sdk/internal/deployment';
|
|
7
|
-
import { RUN_LAUNCH_HEADERS, getRegistryDirectoryServerOperation, isPlatformApiError, resolveProject, listOrganizationsOperation, listProjectsOperation, createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, cancelProjectServerConnectionOperation, listChatSessionsOperation, sendChatMessageOperation, createTunnelOperation, listEvalSuiteRunsOperation, listEvalSuiteRevisionsOperation, runEvalSuiteOperation, getEvalRunOperation, getEvalRunRouteFactsOperation, getEvalRunServerFactsOperation, proposeEvalDescriptionRewriteOperation, startEvalDescriptionExperimentOperation, getEvalDescriptionExperimentOperation, cancelEvalRunOperation, backtestEvalRunJudgeOperation, backtestEvalRunOperation, requestEvalRunJudgeOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, importEvalCasesOperation, createClientOperation, updateClientOperation, setClientServersOperation, duplicateClientOperation, createEnvironmentOperation, ensureAdhocEnvironmentOperation, nameEnvironmentOperation, updateEnvironmentOperation, createSecretOperation, updateSecretOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, listTraceDestinationsOperation, getTraceDestinationOperation, createTraceDestinationOperation, updateTraceDestinationOperation, deleteTraceDestinationOperation, testTraceDestinationOperation, pauseTraceDestinationOperation, resumeTraceDestinationOperation, backfillTraceDestinationOperation, listTraceDestinationBackfillsOperation, runOperationWithPermalinks, withPermalinkEnvelope, PlatformApiError, installRegistryServerOperation, installRegistryDirectoryServerOperation, getProjectServerOperation, PlatformApiClient, projectResolutionError, listProjectServersOperation, createProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, driveChatSessionBrowserOperation, observeChatSessionBrowserOperation, describePlatformRefusal, platformRefusalHint, createEvalSuiteOperation, listEvalSuitesOperation, buildAppPermalink, listEvalSuiteStageAnalyticsOperation, getEvalRunStageAnalyticsOperation, listEvalGithubReposOperation, connectEvalGithubRepoOperation, resolveEnvironmentOperation, listClientsOperation, getClientOperation, deleteClientOperation, listEnvironmentsOperation, getEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listSecretsOperation, getSecretOperation, deleteSecretOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, listProjectSkillsOperation, getProjectSkillOperation, listGoalsOperation, listGoalRunsOperation, getGoalRunOperation, launchGoalRunOperation, cancelGoalRunOperation, listGoalRunSessionsOperation, platformBrowserToolPolicySchema, listServerToolsOperation, runEvalCaseOperation, sendFeedbackOperation, startConformanceRunOperation, listConformanceRunsOperation, getConformanceRunOperation, getConformanceReportOperation, getConformanceCheckOperation, getCapabilitiesOperation, getStudyOperation, listStudySessionsOperation, getStudySessionOperation, getStudyMetricsOperation, getStudyUsageOperation, listStudyFindingsOperation, getStudySignalsOperation, getStudyInsightsOperation, requestStudyInsightsOperation, cancelStudyInsightsOperation, dismissStudyFindingOperation, undismissStudyFindingOperation, updateStudyOperation, setStudyGuestExecutionOperation, rotateStudyLinkOperation, upsertStudyMemberOperation, removeStudyMemberOperation, rebindStudyOperation, listStudiesOperation, publishStudyOperation, unpublishStudyOperation, searchSessionsOperation, getChatSessionOperation, getChatSessionTraceOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getGoalOperation, createGoalOperation, updateGoalOperation, archiveGoalOperation, generateGoalsOperation, getSwarmOverviewOperation, getGoalRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getSwarmRunInsightsOperation, requestSwarmRunInsightsOperation, cancelSwarmRunInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, startClaudeReadinessRunOperation, startOpenAIReadinessRunOperation, startMuseReadinessRunOperation, getReadinessRunOperation, listReadinessRunsOperation, cancelReadinessRunOperation, getReadinessReportOperation, listRegistryDirectorySourcesOperation, searchRegistryDirectoryOperation, listRegistryServersOperation, listRegistryConnectionsOperation, uninstallRegistryServerOperation } from '@mcpjam/sdk/platform';
|
|
7
|
+
import { RUN_LAUNCH_HEADERS, getRegistryDirectoryServerOperation, isPlatformApiError, resolveProject, listOrganizationsOperation, listProjectsOperation, createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, cancelProjectServerConnectionOperation, listChatSessionsOperation, sendChatMessageOperation, createTunnelOperation, listEvalSuiteRunsOperation, listEvalSuiteRevisionsOperation, runEvalSuiteOperation, getEvalRunOperation, getEvalRunRouteFactsOperation, getEvalRunServerFactsOperation, proposeEvalDescriptionRewriteOperation, startEvalDescriptionExperimentOperation, getEvalDescriptionExperimentOperation, cancelEvalRunOperation, backtestEvalRunJudgeOperation, backtestEvalRunOperation, requestEvalRunJudgeOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, importEvalCasesOperation, createClientOperation, updateClientOperation, setClientServersOperation, duplicateClientOperation, createEnvironmentOperation, ensureAdhocEnvironmentOperation, nameEnvironmentOperation, updateEnvironmentOperation, createSecretOperation, updateSecretOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, listTraceDestinationsOperation, getTraceDestinationOperation, createTraceDestinationOperation, updateTraceDestinationOperation, deleteTraceDestinationOperation, testTraceDestinationOperation, pauseTraceDestinationOperation, resumeTraceDestinationOperation, backfillTraceDestinationOperation, listTraceDestinationBackfillsOperation, runOperationWithPermalinks, withPermalinkEnvelope, PlatformApiError, installRegistryServerOperation, installRegistryDirectoryServerOperation, getProjectServerOperation, PlatformApiClient, projectResolutionError, listProjectServersOperation, createProjectServerOperation, listServerRevisionsOperation, getServerRevisionOperation, diffServerRevisionsOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, driveChatSessionBrowserOperation, observeChatSessionBrowserOperation, describePlatformRefusal, platformRefusalHint, createEvalSuiteOperation, listEvalSuitesOperation, buildAppPermalink, listEvalSuiteStageAnalyticsOperation, getEvalRunStageAnalyticsOperation, listEvalGithubReposOperation, connectEvalGithubRepoOperation, resolveEnvironmentOperation, listClientsOperation, getClientOperation, deleteClientOperation, listEnvironmentsOperation, getEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listSecretsOperation, getSecretOperation, deleteSecretOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, listProjectSkillsOperation, getProjectSkillOperation, listGoalsOperation, listGoalRunsOperation, getGoalRunOperation, launchGoalRunOperation, cancelGoalRunOperation, listGoalRunSessionsOperation, platformBrowserToolPolicySchema, listServerToolsOperation, runEvalCaseOperation, sendFeedbackOperation, startConformanceRunOperation, listConformanceRunsOperation, getConformanceRunOperation, getConformanceReportOperation, getConformanceCheckOperation, getCapabilitiesOperation, getStudyOperation, listStudySessionsOperation, getStudySessionOperation, getStudyMetricsOperation, getStudyUsageOperation, listStudyFindingsOperation, getStudySignalsOperation, getStudyInsightsOperation, requestStudyInsightsOperation, cancelStudyInsightsOperation, dismissStudyFindingOperation, undismissStudyFindingOperation, updateStudyOperation, setStudyGuestExecutionOperation, rotateStudyLinkOperation, upsertStudyMemberOperation, removeStudyMemberOperation, rebindStudyOperation, listStudiesOperation, publishStudyOperation, unpublishStudyOperation, listServerAccountsOperation, getServerAccountOperation, uploadServerAccountTokensOperation, updateServerAccountOperation, deleteServerAccountOperation, searchSessionsOperation, getChatSessionOperation, getChatSessionTraceOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getGoalOperation, createGoalOperation, updateGoalOperation, archiveGoalOperation, generateGoalsOperation, getSwarmOverviewOperation, getGoalRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getSwarmRunInsightsOperation, requestSwarmRunInsightsOperation, cancelSwarmRunInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, startClaudeReadinessRunOperation, startOpenAIReadinessRunOperation, startMuseReadinessRunOperation, getReadinessRunOperation, listReadinessRunsOperation, cancelReadinessRunOperation, getReadinessReportOperation, listRegistryDirectorySourcesOperation, searchRegistryDirectoryOperation, listRegistryServersOperation, listRegistryConnectionsOperation, uninstallRegistryServerOperation } from '@mcpjam/sdk/platform';
|
|
8
8
|
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
9
9
|
import { mkdir, writeFile, readFile, chmod, rename, rm, open, unlink, stat } from 'fs/promises';
|
|
10
10
|
import path3, { join, dirname, basename, resolve } from 'path';
|
|
@@ -34,7 +34,7 @@ import { selectPluginMcpServerMap, detectPluginMcpTransport } from '@mcpjam/sdk/
|
|
|
34
34
|
|
|
35
35
|
// package.json
|
|
36
36
|
var package_default = {
|
|
37
|
-
version: "6.2.
|
|
37
|
+
version: "6.2.2"};
|
|
38
38
|
var DEFAULT_OUTPUT_FORMAT = "json";
|
|
39
39
|
var CliError = class extends Error {
|
|
40
40
|
code;
|
|
@@ -14014,6 +14014,64 @@ function registerOrganizationsCommands(program) {
|
|
|
14014
14014
|
}
|
|
14015
14015
|
});
|
|
14016
14016
|
}
|
|
14017
|
+
function registerServerRevisionCommands(servers) {
|
|
14018
|
+
bindOperation(
|
|
14019
|
+
addProjectOption(
|
|
14020
|
+
servers.command("revisions").description(
|
|
14021
|
+
"List a saved server's stored revisions, newest first: captures of its tools and server info"
|
|
14022
|
+
).requiredOption("--server <id-or-name>", "Server ID or name").option("--limit <n>", "Revisions per page, 1 to 200 (default 50)").option("--cursor <cursor>", "nextCursor from the previous page")
|
|
14023
|
+
),
|
|
14024
|
+
listServerRevisionsOperation,
|
|
14025
|
+
(options) => ({
|
|
14026
|
+
project: options.project,
|
|
14027
|
+
server: options.server,
|
|
14028
|
+
limit: parseIntegerOption(options.limit, "--limit", { min: 1, max: 200 }),
|
|
14029
|
+
cursor: options.cursor
|
|
14030
|
+
})
|
|
14031
|
+
);
|
|
14032
|
+
bindOperation(
|
|
14033
|
+
addProjectOption(
|
|
14034
|
+
servers.command("revision").description(
|
|
14035
|
+
"Read one stored revision of a saved server: its tools and server info"
|
|
14036
|
+
).requiredOption("--server <id-or-name>", "Server ID or name").requiredOption("--revision <number>", "Revision number")
|
|
14037
|
+
),
|
|
14038
|
+
getServerRevisionOperation,
|
|
14039
|
+
(options) => ({
|
|
14040
|
+
project: options.project,
|
|
14041
|
+
server: options.server,
|
|
14042
|
+
revisionNumber: parseRequiredIntegerOption(
|
|
14043
|
+
options.revision,
|
|
14044
|
+
"--revision",
|
|
14045
|
+
{ min: 1 }
|
|
14046
|
+
)
|
|
14047
|
+
})
|
|
14048
|
+
);
|
|
14049
|
+
bindOperation(
|
|
14050
|
+
addProjectOption(
|
|
14051
|
+
servers.command("revision-diff").description(
|
|
14052
|
+
"Compare two stored revisions of a saved server: tools added, removed and changed, and server info changes"
|
|
14053
|
+
).requiredOption("--server <id-or-name>", "Server ID or name").requiredOption("--revision <number>", "The later revision").option(
|
|
14054
|
+
"--from <number>",
|
|
14055
|
+
"The revision to compare against (default: the one before)"
|
|
14056
|
+
)
|
|
14057
|
+
),
|
|
14058
|
+
diffServerRevisionsOperation,
|
|
14059
|
+
(options) => ({
|
|
14060
|
+
project: options.project,
|
|
14061
|
+
server: options.server,
|
|
14062
|
+
revisionNumber: parseRequiredIntegerOption(
|
|
14063
|
+
options.revision,
|
|
14064
|
+
"--revision",
|
|
14065
|
+
{ min: 1 }
|
|
14066
|
+
),
|
|
14067
|
+
fromRevisionNumber: parseIntegerOption(options.from, "--from", {
|
|
14068
|
+
min: 1
|
|
14069
|
+
})
|
|
14070
|
+
})
|
|
14071
|
+
);
|
|
14072
|
+
}
|
|
14073
|
+
|
|
14074
|
+
// src/commands/projects.ts
|
|
14017
14075
|
function requireProject(command, options) {
|
|
14018
14076
|
const resolved = resolveCloudProjectArgs({ project: options.project });
|
|
14019
14077
|
if (resolved.projectScope.source === "automatic" || !resolved.project) {
|
|
@@ -14192,6 +14250,7 @@ function registerProjectsCommands(program) {
|
|
|
14192
14250
|
);
|
|
14193
14251
|
writeResult(result, globalOptions.format);
|
|
14194
14252
|
});
|
|
14253
|
+
registerServerRevisionCommands(servers);
|
|
14195
14254
|
servers.command("update").description("Update one saved MCP server").option("--project <id-or-name>", "Project name or ID").requiredOption("--server <id>", "Server ID").requiredOption("--body <json>", "Patch JSON body").action(
|
|
14196
14255
|
async (options, command) => {
|
|
14197
14256
|
const globalOptions = getGlobalOptions(command);
|
|
@@ -15066,6 +15125,184 @@ function registerSecretsCommands(program) {
|
|
|
15066
15125
|
}
|
|
15067
15126
|
);
|
|
15068
15127
|
}
|
|
15128
|
+
function nonEmptyToken(text, what) {
|
|
15129
|
+
const token = text.trim();
|
|
15130
|
+
if (token === "") {
|
|
15131
|
+
throw usageError(
|
|
15132
|
+
`The ${what} is empty. Check the file, variable or pipe it comes from.`
|
|
15133
|
+
);
|
|
15134
|
+
}
|
|
15135
|
+
return token;
|
|
15136
|
+
}
|
|
15137
|
+
function readTokenFrom(path12, what) {
|
|
15138
|
+
let text;
|
|
15139
|
+
try {
|
|
15140
|
+
text = path12 === "-" ? readFileSync(0, "utf8") : readFileSync(path12, "utf8");
|
|
15141
|
+
} catch (error) {
|
|
15142
|
+
throw usageError(
|
|
15143
|
+
path12 === "-" ? `Could not read the ${what} from stdin. Pipe it in, or read it from a file.` : `Could not read the ${what} from "${path12}". Check the path and that you can read the file.`,
|
|
15144
|
+
{ source: error instanceof Error ? error.message : String(error) }
|
|
15145
|
+
);
|
|
15146
|
+
}
|
|
15147
|
+
return nonEmptyToken(text, what);
|
|
15148
|
+
}
|
|
15149
|
+
function readAccessToken(options) {
|
|
15150
|
+
if (options.accessToken !== void 0 && options.accessToken !== "-") {
|
|
15151
|
+
throw usageError(
|
|
15152
|
+
"Nothing was uploaded: a token typed on the command line is kept in shell history and visible to other processes. Pass it with --access-token-file <path> or --access-token-env <VAR>, or pipe it to --access-token -."
|
|
15153
|
+
);
|
|
15154
|
+
}
|
|
15155
|
+
const given = [
|
|
15156
|
+
options.accessTokenFile !== void 0 ? "--access-token-file" : null,
|
|
15157
|
+
options.accessTokenEnv !== void 0 ? "--access-token-env" : null,
|
|
15158
|
+
options.accessToken !== void 0 ? "--access-token" : null
|
|
15159
|
+
].filter((flag) => flag !== null);
|
|
15160
|
+
if (given.length !== 1) {
|
|
15161
|
+
throw usageError(
|
|
15162
|
+
given.length === 0 ? "An access token is required. Pass --access-token-file <path> or --access-token-env <VAR>, or pipe it to --access-token -." : `Pass only one of ${given.join(" or ")}.`
|
|
15163
|
+
);
|
|
15164
|
+
}
|
|
15165
|
+
if (options.accessTokenEnv !== void 0) {
|
|
15166
|
+
const value = process.env[options.accessTokenEnv];
|
|
15167
|
+
if (value === void 0) {
|
|
15168
|
+
throw usageError(
|
|
15169
|
+
`Environment variable "${options.accessTokenEnv}" is not set. Set it to the access token, or pass --access-token-file <path>.`
|
|
15170
|
+
);
|
|
15171
|
+
}
|
|
15172
|
+
return nonEmptyToken(value, `access token in "${options.accessTokenEnv}"`);
|
|
15173
|
+
}
|
|
15174
|
+
return readTokenFrom(options.accessTokenFile ?? "-", "access token");
|
|
15175
|
+
}
|
|
15176
|
+
function buildUploadInput(options) {
|
|
15177
|
+
const accessTokenFromStdin = options.accessToken === "-" || options.accessTokenFile === "-";
|
|
15178
|
+
if (accessTokenFromStdin && options.refreshTokenFile === "-") {
|
|
15179
|
+
throw usageError(
|
|
15180
|
+
"Only one token can come from stdin. Read the refresh token from a file with --refresh-token-file <path>."
|
|
15181
|
+
);
|
|
15182
|
+
}
|
|
15183
|
+
const expiresIn = parseIntegerOption(options.expiresIn, "--expires-in", {
|
|
15184
|
+
min: 1
|
|
15185
|
+
});
|
|
15186
|
+
const accessToken = readAccessToken(options);
|
|
15187
|
+
const refreshToken = options.refreshTokenFile === void 0 ? void 0 : readTokenFrom(options.refreshTokenFile, "refresh token");
|
|
15188
|
+
const parsed = uploadServerAccountTokensOperation.inputSchema.safeParse({
|
|
15189
|
+
project: options.project,
|
|
15190
|
+
server: options.server,
|
|
15191
|
+
account: options.account,
|
|
15192
|
+
tokens: {
|
|
15193
|
+
access_token: accessToken,
|
|
15194
|
+
...refreshToken !== void 0 ? { refresh_token: refreshToken } : {},
|
|
15195
|
+
...expiresIn !== void 0 ? { expires_in: expiresIn } : {}
|
|
15196
|
+
},
|
|
15197
|
+
clientInformation: { clientId: options.clientId }
|
|
15198
|
+
});
|
|
15199
|
+
if (!parsed.success) {
|
|
15200
|
+
throw usageError(
|
|
15201
|
+
`Invalid input: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ")}`
|
|
15202
|
+
);
|
|
15203
|
+
}
|
|
15204
|
+
return parsed.data;
|
|
15205
|
+
}
|
|
15206
|
+
function accountInput(options) {
|
|
15207
|
+
return {
|
|
15208
|
+
project: options.project,
|
|
15209
|
+
server: options.server,
|
|
15210
|
+
account: options.account
|
|
15211
|
+
};
|
|
15212
|
+
}
|
|
15213
|
+
function serverCommand(accounts, name, description) {
|
|
15214
|
+
return addProjectOption(
|
|
15215
|
+
accounts.command(name).description(description).requiredOption("--server <id-or-name>", "Server ID or name")
|
|
15216
|
+
);
|
|
15217
|
+
}
|
|
15218
|
+
function accountCommand(accounts, name, description) {
|
|
15219
|
+
return serverCommand(accounts, name, description).requiredOption(
|
|
15220
|
+
"--account <id-or-name>",
|
|
15221
|
+
"Account ID or name"
|
|
15222
|
+
);
|
|
15223
|
+
}
|
|
15224
|
+
function registerServerAccountsCommands(cloud) {
|
|
15225
|
+
const accounts = cloud.command("server-accounts").description(
|
|
15226
|
+
"Manage the accounts a saved server signs in with for hosted runs. Write-only: no command prints a token."
|
|
15227
|
+
);
|
|
15228
|
+
bindOperation(
|
|
15229
|
+
serverCommand(
|
|
15230
|
+
accounts,
|
|
15231
|
+
"list",
|
|
15232
|
+
"List a saved server's accounts: id, name, whether runs use it by default, whether it needs reconnecting, and whether it is for hosted runs only"
|
|
15233
|
+
),
|
|
15234
|
+
listServerAccountsOperation,
|
|
15235
|
+
(options) => ({
|
|
15236
|
+
project: options.project,
|
|
15237
|
+
server: options.server
|
|
15238
|
+
})
|
|
15239
|
+
);
|
|
15240
|
+
bindOperation(
|
|
15241
|
+
accountCommand(
|
|
15242
|
+
accounts,
|
|
15243
|
+
"show",
|
|
15244
|
+
"Show one of a saved server's accounts, by ID or name. Never its token"
|
|
15245
|
+
),
|
|
15246
|
+
getServerAccountOperation,
|
|
15247
|
+
accountInput
|
|
15248
|
+
);
|
|
15249
|
+
bindOperation(
|
|
15250
|
+
accountCommand(
|
|
15251
|
+
accounts,
|
|
15252
|
+
"set",
|
|
15253
|
+
"Upload an access token to an account. A name no account has creates the account; otherwise its token is replaced and its ID stays. Accounts uploaded this way are for hosted runs only"
|
|
15254
|
+
).requiredOption(
|
|
15255
|
+
"--client-id <id>",
|
|
15256
|
+
"The OAuth client the token was issued to"
|
|
15257
|
+
).option("--access-token-file <path>", "Read the access token from a file").option(
|
|
15258
|
+
"--access-token-env <VAR>",
|
|
15259
|
+
"Read the access token from an environment variable"
|
|
15260
|
+
).option(
|
|
15261
|
+
"--access-token <->",
|
|
15262
|
+
"`-` reads the access token from stdin. A token typed here is refused"
|
|
15263
|
+
).option(
|
|
15264
|
+
"--refresh-token-file <path>",
|
|
15265
|
+
"Read a refresh token from a file, or `-` for stdin. Leave it out when you upload a fresh token before each run, or when the issuer rejects refreshes: stored, it only adds a long-lived credential"
|
|
15266
|
+
).option(
|
|
15267
|
+
"--expires-in <seconds>",
|
|
15268
|
+
"Seconds until the access token expires"
|
|
15269
|
+
),
|
|
15270
|
+
uploadServerAccountTokensOperation,
|
|
15271
|
+
buildUploadInput
|
|
15272
|
+
);
|
|
15273
|
+
bindOperation(
|
|
15274
|
+
accountCommand(accounts, "rename", "Rename an account").requiredOption(
|
|
15275
|
+
"--name <name>",
|
|
15276
|
+
"The new name: letters, digits, '.', '_' and '-', starting with a letter or digit, at most 64 characters"
|
|
15277
|
+
),
|
|
15278
|
+
updateServerAccountOperation,
|
|
15279
|
+
(options) => ({
|
|
15280
|
+
...accountInput(options),
|
|
15281
|
+
name: options.name
|
|
15282
|
+
})
|
|
15283
|
+
);
|
|
15284
|
+
bindOperation(
|
|
15285
|
+
accountCommand(
|
|
15286
|
+
accounts,
|
|
15287
|
+
"default",
|
|
15288
|
+
"Make an account the default. Runs with no saved account choice sign in as the default, so set it before you start a run"
|
|
15289
|
+
),
|
|
15290
|
+
updateServerAccountOperation,
|
|
15291
|
+
(options) => ({
|
|
15292
|
+
...accountInput(options),
|
|
15293
|
+
isDefault: true
|
|
15294
|
+
})
|
|
15295
|
+
);
|
|
15296
|
+
bindOperation(
|
|
15297
|
+
accountCommand(
|
|
15298
|
+
accounts,
|
|
15299
|
+
"delete",
|
|
15300
|
+
"Delete an account and its stored token, and ask the token's issuer to revoke it where it supports that. The default account can't be deleted while other accounts exist: make another account the default first"
|
|
15301
|
+
),
|
|
15302
|
+
deleteServerAccountOperation,
|
|
15303
|
+
accountInput
|
|
15304
|
+
);
|
|
15305
|
+
}
|
|
15069
15306
|
async function waitForSessionTurn(run, signal, wait = async (ms, signal2) => {
|
|
15070
15307
|
await setTimeout$1(ms, void 0, { signal: signal2 });
|
|
15071
15308
|
}) {
|
|
@@ -17495,6 +17732,7 @@ function registerCloudCommands(program) {
|
|
|
17495
17732
|
registerClientsCommands(cloud);
|
|
17496
17733
|
registerEnvironmentsCommands(cloud);
|
|
17497
17734
|
registerSecretsCommands(cloud);
|
|
17735
|
+
registerServerAccountsCommands(cloud);
|
|
17498
17736
|
registerImagesCommands(cloud);
|
|
17499
17737
|
registerSkillsCommands(cloud);
|
|
17500
17738
|
cloud.commandsGroup("Conformance:");
|