@mcpjam/cli 6.2.1 → 6.3.0
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 +1589 -148
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { Command, CommanderError, Option } from 'commander';
|
|
3
3
|
import { realpathSync, readFileSync, existsSync, mkdirSync, writeFileSync, statSync, chmodSync, unlinkSync, closeSync, renameSync, lstatSync, openSync } from 'fs';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
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';
|
|
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, DIRECTORY_SNAPSHOT_LABELS, DIRECTORY_TOOL_TEST_STATUSES, 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, 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, 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, startDirectorySubmissionRunOperation, getDirectorySubmissionResultsOperation, updateDirectorySubmissionOperation, getDirectorySubmissionFindingOperation, listDirectorySubmissionEventsOperation, getDirectorySubmissionTestPlanOperation, draftDirectorySubmissionTestPlanOperation, saveDirectorySubmissionTestPlanOperation, getDirectorySubmissionToolTestsOperation, getDirectorySubmissionEvalsOperation, setDirectorySubmissionEvalsOperation, importDirectorySubmissionTestCasesOperation, exportDirectorySubmissionTestCasesOperation, 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, getDirectorySubmissionOperation, directorySubmissionConflict, getDirectorySubmissionHandoffOperation, listDirectorySubmissionFindingsOperation, exportDirectorySubmissionOperation, directoryTestPlanSchema, 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, recordDirectorySubmissionStatusOperation, recordDirectorySubmissionSnapshotOperation, importDirectoryFindingOperation, getDirectoryFlowOperation, listDirectoryFlowsOperation, createDirectorySubmissionOperation, listDirectorySubmissionsOperation, deleteDirectorySubmissionOperation, createReviewerAttemptOperation, getReviewerAttemptOperation, listReviewerAttemptsOperation, resumeReviewerAttemptOperation, createReviewerHandoffOperation, cancelReviewerAttemptOperation, startClaudeReadinessRunOperation, startOpenAIReadinessRunOperation, startMuseReadinessRunOperation, getReadinessRunOperation, listReadinessRunsOperation, cancelReadinessRunOperation, resumeReadinessRunOperation, 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.
|
|
37
|
+
version: "6.3.0"};
|
|
38
38
|
var DEFAULT_OUTPUT_FORMAT = "json";
|
|
39
39
|
var CliError = class extends Error {
|
|
40
40
|
code;
|
|
@@ -454,7 +454,7 @@ function isAccessTokenUsable(contents, now) {
|
|
|
454
454
|
}
|
|
455
455
|
return Date.parse(contents.expiresAt) - now.getTime() > ACCESS_TOKEN_EXPIRY_SKEW_MS;
|
|
456
456
|
}
|
|
457
|
-
var readTextFile = (
|
|
457
|
+
var readTextFile = (path14, encoding) => readFileSync(path14, encoding);
|
|
458
458
|
var JsonInputContext = class {
|
|
459
459
|
constructor(readFile4 = readTextFile) {
|
|
460
460
|
this.readFile = readFile4;
|
|
@@ -1409,7 +1409,7 @@ function toCliError(error, context = {}) {
|
|
|
1409
1409
|
function requestsUpload(options) {
|
|
1410
1410
|
return options.upload === true || options.requireUpload === true;
|
|
1411
1411
|
}
|
|
1412
|
-
async function uploadConformanceReport(
|
|
1412
|
+
async function uploadConformanceReport(report2, args) {
|
|
1413
1413
|
const env = process.env;
|
|
1414
1414
|
const { baseUrl } = resolveCliDeployment({ credential: "api-key" }, { env });
|
|
1415
1415
|
const headers = resolvePlatformExtraHeaders({}, env);
|
|
@@ -1422,7 +1422,7 @@ async function uploadConformanceReport(report, args) {
|
|
|
1422
1422
|
...headers ? { headers } : {}
|
|
1423
1423
|
};
|
|
1424
1424
|
try {
|
|
1425
|
-
const uploaded = args.requireUpload ? await reportConformanceRun(
|
|
1425
|
+
const uploaded = args.requireUpload ? await reportConformanceRun(report2, options) : await reportConformanceRunSafely(report2, options);
|
|
1426
1426
|
if (uploaded?.runUrl && !args.command.optsWithGlobals().quiet) {
|
|
1427
1427
|
process.stderr.write(`Uploaded: ${uploaded.runUrl}
|
|
1428
1428
|
`);
|
|
@@ -1440,12 +1440,12 @@ async function uploadConformanceReport(report, args) {
|
|
|
1440
1440
|
async function maybeUploadSingleSuite(args) {
|
|
1441
1441
|
if (!requestsUpload(args)) return;
|
|
1442
1442
|
const suiteReport = args.report ?? toConformanceReport(args.result);
|
|
1443
|
-
const
|
|
1443
|
+
const report2 = buildConformanceRunReport({
|
|
1444
1444
|
requestedSuites: [args.suiteKind],
|
|
1445
1445
|
reports: { [args.suiteKind]: suiteReport },
|
|
1446
1446
|
startedAt: Date.now() - (suiteReport.durationMs ?? 0)
|
|
1447
1447
|
});
|
|
1448
|
-
await uploadConformanceReport(
|
|
1448
|
+
await uploadConformanceReport(report2, args);
|
|
1449
1449
|
}
|
|
1450
1450
|
async function writeFileAtomic(destinationPath, body, options = {}) {
|
|
1451
1451
|
const resolved = path3.resolve(process.cwd(), destinationPath);
|
|
@@ -2619,12 +2619,12 @@ function renderConformanceResult(result, format) {
|
|
|
2619
2619
|
}
|
|
2620
2620
|
}
|
|
2621
2621
|
function renderConformanceReporterResult(result, reporter) {
|
|
2622
|
-
const
|
|
2622
|
+
const report2 = toConformanceReport(result);
|
|
2623
2623
|
switch (reporter) {
|
|
2624
2624
|
case "json-summary":
|
|
2625
|
-
return JSON.stringify(renderConformanceReportJson(
|
|
2625
|
+
return JSON.stringify(renderConformanceReportJson(report2));
|
|
2626
2626
|
case "junit-xml":
|
|
2627
|
-
return renderConformanceReportJUnitXml(
|
|
2627
|
+
return renderConformanceReportJUnitXml(report2);
|
|
2628
2628
|
case "html":
|
|
2629
2629
|
throw usageError(
|
|
2630
2630
|
'The "html" reporter is not available for this command yet. Use "json-summary" or "junit-xml".'
|
|
@@ -3342,16 +3342,16 @@ function parseReporterFormat(value) {
|
|
|
3342
3342
|
`Invalid reporter "${value}". Use "json-summary", "junit-xml", or "html".`
|
|
3343
3343
|
);
|
|
3344
3344
|
}
|
|
3345
|
-
function writeReporterResult(reporter,
|
|
3345
|
+
function writeReporterResult(reporter, report2) {
|
|
3346
3346
|
if (reporter === "junit-xml") {
|
|
3347
|
-
process.stdout.write(renderStructuredRunJUnitXml(
|
|
3347
|
+
process.stdout.write(renderStructuredRunJUnitXml(report2));
|
|
3348
3348
|
return;
|
|
3349
3349
|
}
|
|
3350
3350
|
if (reporter === "html") {
|
|
3351
|
-
process.stdout.write(renderStructuredRunHtml(
|
|
3351
|
+
process.stdout.write(renderStructuredRunHtml(report2));
|
|
3352
3352
|
return;
|
|
3353
3353
|
}
|
|
3354
|
-
writeResult(renderStructuredRunJson(
|
|
3354
|
+
writeResult(renderStructuredRunJson(report2), "json");
|
|
3355
3355
|
}
|
|
3356
3356
|
function writeEvalDecisionSummary(format, summary, destination = process.stdout, options = {}) {
|
|
3357
3357
|
if (format !== "human" || !summary) return;
|
|
@@ -3376,9 +3376,9 @@ async function writeJsonArtifact(outputPath, payload) {
|
|
|
3376
3376
|
);
|
|
3377
3377
|
}
|
|
3378
3378
|
}
|
|
3379
|
-
async function writeReporterArtifact(outputPath, reporter,
|
|
3379
|
+
async function writeReporterArtifact(outputPath, reporter, report2) {
|
|
3380
3380
|
const resolvedPath = path3.resolve(process.cwd(), outputPath);
|
|
3381
|
-
const body = reporter === "junit-xml" ? renderStructuredRunJUnitXml(
|
|
3381
|
+
const body = reporter === "junit-xml" ? renderStructuredRunJUnitXml(report2) : reporter === "html" ? renderStructuredRunHtml(report2) : `${JSON.stringify(renderStructuredRunJson(report2), null, 2)}
|
|
3382
3382
|
`;
|
|
3383
3383
|
try {
|
|
3384
3384
|
return await writeFileAtomic(resolvedPath, body, { createParents: true });
|
|
@@ -3860,7 +3860,7 @@ var InspectorApiClient = class {
|
|
|
3860
3860
|
}
|
|
3861
3861
|
throw operationalError("Inspector command response was invalid.", payload);
|
|
3862
3862
|
}
|
|
3863
|
-
async request(
|
|
3863
|
+
async request(path14, init = {}) {
|
|
3864
3864
|
const fetchRequest = async () => {
|
|
3865
3865
|
const token = await fetchInspectorSessionToken(this.baseUrl);
|
|
3866
3866
|
const { body: initBody, timeoutMs, retrySessionAuth: _retrySessionAuth, ...fetchInit } = init;
|
|
@@ -3871,7 +3871,7 @@ var InspectorApiClient = class {
|
|
|
3871
3871
|
headers.set("Content-Type", "application/json");
|
|
3872
3872
|
body = JSON.stringify(initBody);
|
|
3873
3873
|
}
|
|
3874
|
-
return await fetch(`${this.baseUrl}${
|
|
3874
|
+
return await fetch(`${this.baseUrl}${path14}`, {
|
|
3875
3875
|
...fetchInit,
|
|
3876
3876
|
signal: fetchInit.signal ?? AbortSignal.timeout(timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS),
|
|
3877
3877
|
headers,
|
|
@@ -3894,7 +3894,7 @@ var InspectorApiClient = class {
|
|
|
3894
3894
|
const payload = await readResponsePayload(response);
|
|
3895
3895
|
if (!response.ok && !init.treatAsSuccess?.(response.status, payload)) {
|
|
3896
3896
|
throw operationalError(
|
|
3897
|
-
getErrorMessage(payload) ?? `Inspector request ${
|
|
3897
|
+
getErrorMessage(payload) ?? `Inspector request ${path14} failed with ${response.status}.`,
|
|
3898
3898
|
payload
|
|
3899
3899
|
);
|
|
3900
3900
|
}
|
|
@@ -5816,7 +5816,7 @@ function registerCloudLinkCommands(cloud) {
|
|
|
5816
5816
|
`Project link apiUrl (${link.apiUrl}) does not match the active deployment (${deployment.apiUrl}). The active deployment's API URL is used; the link's project selector remains active.`
|
|
5817
5817
|
);
|
|
5818
5818
|
}
|
|
5819
|
-
const
|
|
5819
|
+
const report2 = {
|
|
5820
5820
|
ok,
|
|
5821
5821
|
credential: {
|
|
5822
5822
|
source: credential.source,
|
|
@@ -5842,7 +5842,7 @@ function registerCloudLinkCommands(cloud) {
|
|
|
5842
5842
|
link,
|
|
5843
5843
|
warnings
|
|
5844
5844
|
};
|
|
5845
|
-
writeResult(
|
|
5845
|
+
writeResult(report2, globalOptions.format);
|
|
5846
5846
|
if (!ok) {
|
|
5847
5847
|
setProcessExitCode(1);
|
|
5848
5848
|
}
|
|
@@ -6691,7 +6691,7 @@ async function validateImportToolReferences(client, params) {
|
|
|
6691
6691
|
return { targets, findings };
|
|
6692
6692
|
}
|
|
6693
6693
|
function finding(reference, parts) {
|
|
6694
|
-
const
|
|
6694
|
+
const path14 = [
|
|
6695
6695
|
"cases",
|
|
6696
6696
|
reference.caseIndex,
|
|
6697
6697
|
"steps",
|
|
@@ -6700,8 +6700,8 @@ function finding(reference, parts) {
|
|
|
6700
6700
|
];
|
|
6701
6701
|
return {
|
|
6702
6702
|
code: parts.code,
|
|
6703
|
-
path:
|
|
6704
|
-
pointer: suiteFilePointer(
|
|
6703
|
+
path: path14,
|
|
6704
|
+
pointer: suiteFilePointer(path14),
|
|
6705
6705
|
caseId: reference.testCase.id,
|
|
6706
6706
|
caseTitle: reference.testCase.title,
|
|
6707
6707
|
toolName: reference.step.toolName,
|
|
@@ -6832,11 +6832,11 @@ function screenshotFilename(shot, index) {
|
|
|
6832
6832
|
return `${tool}-${suffix}.png`;
|
|
6833
6833
|
}
|
|
6834
6834
|
var UNSUPPORTED_SUITE_EXPORT = "UNSUPPORTED_SUITE_EXPORT";
|
|
6835
|
-
function unsupported(
|
|
6835
|
+
function unsupported(path14, message) {
|
|
6836
6836
|
return {
|
|
6837
6837
|
code: UNSUPPORTED_SUITE_EXPORT,
|
|
6838
|
-
path:
|
|
6839
|
-
pointer: suiteFilePointer(
|
|
6838
|
+
path: path14,
|
|
6839
|
+
pointer: suiteFilePointer(path14),
|
|
6840
6840
|
message
|
|
6841
6841
|
};
|
|
6842
6842
|
}
|
|
@@ -7114,15 +7114,15 @@ function hoistProvider(cases) {
|
|
|
7114
7114
|
)
|
|
7115
7115
|
};
|
|
7116
7116
|
}
|
|
7117
|
-
function differences(expected, actual,
|
|
7117
|
+
function differences(expected, actual, path14 = [], out = []) {
|
|
7118
7118
|
if (isDeepStrictEqual(expected, actual)) return out;
|
|
7119
7119
|
const before = out.length;
|
|
7120
7120
|
if (Array.isArray(expected) && Array.isArray(actual)) {
|
|
7121
7121
|
const length = Math.max(expected.length, actual.length);
|
|
7122
7122
|
for (let index = 0; index < length; index += 1) {
|
|
7123
|
-
differences(expected[index], actual[index], [...
|
|
7123
|
+
differences(expected[index], actual[index], [...path14, index], out);
|
|
7124
7124
|
}
|
|
7125
|
-
if (out.length === before) out.push(
|
|
7125
|
+
if (out.length === before) out.push(path14);
|
|
7126
7126
|
return out;
|
|
7127
7127
|
}
|
|
7128
7128
|
const bothObjects = expected !== null && actual !== null && typeof expected === "object" && typeof actual === "object" && !Array.isArray(expected) && !Array.isArray(actual);
|
|
@@ -7137,14 +7137,14 @@ function differences(expected, actual, path12 = [], out = []) {
|
|
|
7137
7137
|
differences(
|
|
7138
7138
|
expected[key],
|
|
7139
7139
|
actual[key],
|
|
7140
|
-
[...
|
|
7140
|
+
[...path14, key],
|
|
7141
7141
|
out
|
|
7142
7142
|
);
|
|
7143
7143
|
}
|
|
7144
|
-
if (out.length === before) out.push(
|
|
7144
|
+
if (out.length === before) out.push(path14);
|
|
7145
7145
|
return out;
|
|
7146
7146
|
}
|
|
7147
|
-
out.push(
|
|
7147
|
+
out.push(path14);
|
|
7148
7148
|
return out;
|
|
7149
7149
|
}
|
|
7150
7150
|
function buildSuiteFileFromPlatform(input, options = {}) {
|
|
@@ -7279,8 +7279,8 @@ function buildSuiteFileFromPlatform(input, options = {}) {
|
|
|
7279
7279
|
return {
|
|
7280
7280
|
ok: false,
|
|
7281
7281
|
findings: lost.map(
|
|
7282
|
-
(
|
|
7283
|
-
|
|
7282
|
+
(path14) => unsupported(
|
|
7283
|
+
path14,
|
|
7284
7284
|
`the suite file contract does not carry this value, so exporting would drop it. Nothing was written.`
|
|
7285
7285
|
)
|
|
7286
7286
|
)
|
|
@@ -8253,8 +8253,8 @@ function renderCorpusDrift(drift) {
|
|
|
8253
8253
|
}
|
|
8254
8254
|
|
|
8255
8255
|
// src/lib/eval-gate-exit-code.ts
|
|
8256
|
-
function evalGateExitCode(
|
|
8257
|
-
switch (
|
|
8256
|
+
function evalGateExitCode(report2) {
|
|
8257
|
+
switch (report2.outcome) {
|
|
8258
8258
|
case "passed":
|
|
8259
8259
|
return 0;
|
|
8260
8260
|
// An authorized, recorded, time-boxed override of a real failure. Exit 0,
|
|
@@ -8842,11 +8842,11 @@ async function evaluateBaselineComparison(input) {
|
|
|
8842
8842
|
};
|
|
8843
8843
|
}
|
|
8844
8844
|
if (importEvidenceBlocksGate(baseRun)) {
|
|
8845
|
-
const
|
|
8845
|
+
const report2 = importIneligibleReport(baseRun);
|
|
8846
8846
|
return {
|
|
8847
8847
|
report: {
|
|
8848
|
-
...
|
|
8849
|
-
verdicts:
|
|
8848
|
+
...report2,
|
|
8849
|
+
verdicts: report2.verdicts.map((verdict) => ({
|
|
8850
8850
|
...verdict,
|
|
8851
8851
|
gate: "baseline",
|
|
8852
8852
|
message: `baseline run ${compare.baseRun.runNumber}: ${verdict.message}`
|
|
@@ -9750,9 +9750,9 @@ function launchFailureCases(result) {
|
|
|
9750
9750
|
];
|
|
9751
9751
|
});
|
|
9752
9752
|
}
|
|
9753
|
-
function gateReportCase(
|
|
9754
|
-
const waived =
|
|
9755
|
-
const passed =
|
|
9753
|
+
function gateReportCase(report2, baselineProvenance) {
|
|
9754
|
+
const waived = report2.outcome === "waived";
|
|
9755
|
+
const passed = report2.outcome === "passed" || waived;
|
|
9756
9756
|
return {
|
|
9757
9757
|
id: "gate",
|
|
9758
9758
|
title: waived ? "Eval gate (WAIVED)" : "Eval gate",
|
|
@@ -9763,7 +9763,7 @@ function gateReportCase(report, baselineProvenance) {
|
|
|
9763
9763
|
// way), but reporting them as `breaking` — the same class a genuine
|
|
9764
9764
|
// failure gets — would claim a defect the run never observed. Mirrors
|
|
9765
9765
|
// `gateCase` in sdk/src/run-compare.ts.
|
|
9766
|
-
classification:
|
|
9766
|
+
classification: report2.outcome === "failed" ? "breaking" : (
|
|
9767
9767
|
// A waived gate is `informational`, NOT `non_breaking`. It really did
|
|
9768
9768
|
// fail; `non_breaking` would claim the run observed no breaking change,
|
|
9769
9769
|
// which is the opposite of what happened.
|
|
@@ -9773,26 +9773,26 @@ function gateReportCase(report, baselineProvenance) {
|
|
|
9773
9773
|
// explains why the build was not blocked; it is not a reason to stop
|
|
9774
9774
|
// saying what failed.
|
|
9775
9775
|
...passed && !waived ? {} : {
|
|
9776
|
-
error:
|
|
9776
|
+
error: report2.verdicts.filter(
|
|
9777
9777
|
(verdict) => verdict.status !== "passed" && verdict.status !== "waived"
|
|
9778
9778
|
).map((verdict) => verdict.message).join("; ")
|
|
9779
9779
|
},
|
|
9780
|
-
...
|
|
9780
|
+
...report2.waiver ? {
|
|
9781
9781
|
waiver: {
|
|
9782
|
-
id:
|
|
9783
|
-
reason:
|
|
9784
|
-
expiresAt:
|
|
9785
|
-
createdAt:
|
|
9786
|
-
createdBy:
|
|
9787
|
-
createdByEmail:
|
|
9788
|
-
policySnapshot:
|
|
9782
|
+
id: report2.waiver.id,
|
|
9783
|
+
reason: report2.waiver.reason,
|
|
9784
|
+
expiresAt: report2.waiver.expiresAt,
|
|
9785
|
+
createdAt: report2.waiver.createdAt,
|
|
9786
|
+
createdBy: report2.waiver.createdBy,
|
|
9787
|
+
createdByEmail: report2.waiver.createdByEmail,
|
|
9788
|
+
policySnapshot: report2.waiver.policySnapshot
|
|
9789
9789
|
}
|
|
9790
9790
|
} : {},
|
|
9791
9791
|
// The baseline provenance rides along on the case row too, not only in
|
|
9792
9792
|
// the report's top-level metadata: `--reporter junit-xml` has no other
|
|
9793
9793
|
// place to carry it, and a regression visible in the exit code but
|
|
9794
9794
|
// absent from the artifact is a reporting bug.
|
|
9795
|
-
details: baselineProvenance ? { ...
|
|
9795
|
+
details: baselineProvenance ? { ...report2, baseline: baselineProvenance } : report2
|
|
9796
9796
|
};
|
|
9797
9797
|
}
|
|
9798
9798
|
var DEFAULT_GATE_WAIT_TIMEOUT_MS = 35 * 6e4;
|
|
@@ -10026,7 +10026,7 @@ async function runEvalGate(options, command) {
|
|
|
10026
10026
|
throw error;
|
|
10027
10027
|
}
|
|
10028
10028
|
const detail = error instanceof Error ? error.message : String(error);
|
|
10029
|
-
const
|
|
10029
|
+
const report3 = {
|
|
10030
10030
|
outcome: "incomplete",
|
|
10031
10031
|
scoreIntegrity: "unknown",
|
|
10032
10032
|
verdicts: [
|
|
@@ -10038,8 +10038,8 @@ async function runEvalGate(options, command) {
|
|
|
10038
10038
|
]
|
|
10039
10039
|
};
|
|
10040
10040
|
const structured2 = needsReport ? buildEvalRunReport([], {
|
|
10041
|
-
cases: [gateReportCase(
|
|
10042
|
-
verdict: gateOutcomeVerdict(
|
|
10041
|
+
cases: [gateReportCase(report3)],
|
|
10042
|
+
verdict: gateOutcomeVerdict(report3.outcome)
|
|
10043
10043
|
}) : void 0;
|
|
10044
10044
|
if (options.out && structured2) {
|
|
10045
10045
|
await writeReporterArtifact(
|
|
@@ -10052,20 +10052,20 @@ async function runEvalGate(options, command) {
|
|
|
10052
10052
|
writeReporterResult(reporter, structured2);
|
|
10053
10053
|
} else {
|
|
10054
10054
|
writeResult(
|
|
10055
|
-
{ gate:
|
|
10055
|
+
{ gate: report3, exitCode: EVAL_GATE_INCOMPLETE_EXIT_CODE },
|
|
10056
10056
|
globalOptions.format
|
|
10057
10057
|
);
|
|
10058
10058
|
}
|
|
10059
10059
|
setProcessExitCode(EVAL_GATE_INCOMPLETE_EXIT_CODE);
|
|
10060
10060
|
return;
|
|
10061
10061
|
}
|
|
10062
|
-
const
|
|
10062
|
+
const report2 = applyGateWaiver(
|
|
10063
10063
|
outcome.report,
|
|
10064
10064
|
activeWaiverForRun(outcome.run)
|
|
10065
10065
|
);
|
|
10066
10066
|
let suiteGate;
|
|
10067
10067
|
let suiteGateSkip;
|
|
10068
|
-
let composedOutcome =
|
|
10068
|
+
let composedOutcome = report2.outcome;
|
|
10069
10069
|
if (options.suitePolicy !== false && resolvedProjectId) {
|
|
10070
10070
|
const fetched = await runPlatformOperation(
|
|
10071
10071
|
platformOptionsOf(command),
|
|
@@ -10102,27 +10102,27 @@ async function runEvalGate(options, command) {
|
|
|
10102
10102
|
if (fetched.kind === "report") {
|
|
10103
10103
|
suiteGate = fetched.report;
|
|
10104
10104
|
composedOutcome = composeSuiteGateWithBaseReport({
|
|
10105
|
-
base: { outcome:
|
|
10105
|
+
base: { outcome: report2.outcome },
|
|
10106
10106
|
suite: fetched.report
|
|
10107
10107
|
}).outcome;
|
|
10108
10108
|
} else if (fetched.kind === "skip") {
|
|
10109
10109
|
suiteGateSkip = fetched.message;
|
|
10110
10110
|
} else {
|
|
10111
10111
|
suiteGateSkip = fetched.message;
|
|
10112
|
-
if (
|
|
10112
|
+
if (report2.outcome === "passed" || report2.outcome === "waived") {
|
|
10113
10113
|
composedOutcome = "incomplete";
|
|
10114
10114
|
}
|
|
10115
10115
|
}
|
|
10116
10116
|
}
|
|
10117
10117
|
const composedReport = {
|
|
10118
|
-
...
|
|
10118
|
+
...report2,
|
|
10119
10119
|
outcome: composedOutcome === "unavailable" ? "incomplete" : composedOutcome,
|
|
10120
10120
|
// The suite gate's own conditions ride into the report's verdict list, so
|
|
10121
10121
|
// every renderer — human, JUnit, HTML — names the condition that turned
|
|
10122
10122
|
// CI red. Without them a suite-gate failure prints "Gate: FAILED" over
|
|
10123
10123
|
// nothing but PASS rows, and the JUnit failure message is empty.
|
|
10124
10124
|
verdicts: suiteGate ? [
|
|
10125
|
-
...
|
|
10125
|
+
...report2.verdicts,
|
|
10126
10126
|
...suiteGate.conditions.filter((condition) => condition.status !== "passed").map((condition) => ({
|
|
10127
10127
|
gate: `suiteGate:${condition.condition}`,
|
|
10128
10128
|
status: condition.status === "failed" ? "failed" : "non_gateable",
|
|
@@ -10130,7 +10130,7 @@ async function runEvalGate(options, command) {
|
|
|
10130
10130
|
...typeof condition.observed === "number" ? { observed: condition.observed } : {},
|
|
10131
10131
|
...typeof condition.threshold === "number" ? { threshold: condition.threshold } : {}
|
|
10132
10132
|
}))
|
|
10133
|
-
] :
|
|
10133
|
+
] : report2.verdicts
|
|
10134
10134
|
};
|
|
10135
10135
|
const exitCode = evalGateExitCode(composedReport);
|
|
10136
10136
|
const structured = needsReport ? buildEvalRunReport(
|
|
@@ -10384,7 +10384,7 @@ async function runEvalCompare(options, command) {
|
|
|
10384
10384
|
}
|
|
10385
10385
|
const reason = baselineNotFoundReason(error);
|
|
10386
10386
|
const detail = error instanceof Error ? error.message : String(error);
|
|
10387
|
-
const
|
|
10387
|
+
const report2 = {
|
|
10388
10388
|
outcome: "incomplete",
|
|
10389
10389
|
scoreIntegrity: "unknown",
|
|
10390
10390
|
verdicts: [
|
|
@@ -10396,11 +10396,11 @@ async function runEvalCompare(options, command) {
|
|
|
10396
10396
|
]
|
|
10397
10397
|
};
|
|
10398
10398
|
await writeCompareResult(
|
|
10399
|
-
{ report, reporter, out: options.out, format: globalOptions.format },
|
|
10399
|
+
{ report: report2, reporter, out: options.out, format: globalOptions.format },
|
|
10400
10400
|
// Built whenever EITHER output channel was requested. `--reporter` needs
|
|
10401
10401
|
// it to emit JUnit rather than JSON; `--out` needs it so a CI step
|
|
10402
10402
|
// reading the artifact finds the verdict instead of a missing file.
|
|
10403
|
-
reporter || options.out ? emptyCompareReport(
|
|
10403
|
+
reporter || options.out ? emptyCompareReport(report2) : void 0
|
|
10404
10404
|
);
|
|
10405
10405
|
setProcessExitCode(EVAL_GATE_INCOMPLETE_EXIT_CODE);
|
|
10406
10406
|
return;
|
|
@@ -10526,7 +10526,7 @@ async function runEvalPull(options, command) {
|
|
|
10526
10526
|
globalOptions.format
|
|
10527
10527
|
);
|
|
10528
10528
|
}
|
|
10529
|
-
function emptyCompareReport(
|
|
10529
|
+
function emptyCompareReport(report2) {
|
|
10530
10530
|
return buildRunCompareReport(
|
|
10531
10531
|
{
|
|
10532
10532
|
suite: { id: "", name: "" },
|
|
@@ -10576,7 +10576,7 @@ function emptyCompareReport(report) {
|
|
|
10576
10576
|
},
|
|
10577
10577
|
cases: []
|
|
10578
10578
|
},
|
|
10579
|
-
|
|
10579
|
+
report2
|
|
10580
10580
|
);
|
|
10581
10581
|
}
|
|
10582
10582
|
var EMPTY_DIFF = {
|
|
@@ -11368,7 +11368,7 @@ function registerEvalCommands(program) {
|
|
|
11368
11368
|
quiet: true
|
|
11369
11369
|
}
|
|
11370
11370
|
);
|
|
11371
|
-
const
|
|
11371
|
+
const report2 = needsReport ? buildEvalRunReport(completion.reportInputs, {
|
|
11372
11372
|
cases: [
|
|
11373
11373
|
...launchFailureCases(result),
|
|
11374
11374
|
...completion.waitErrors.map((entry) => ({
|
|
@@ -11408,19 +11408,19 @@ function registerEvalCommands(program) {
|
|
|
11408
11408
|
waitErrors: completion.waitErrors
|
|
11409
11409
|
});
|
|
11410
11410
|
let outWriteError;
|
|
11411
|
-
if (options.out &&
|
|
11411
|
+
if (options.out && report2) {
|
|
11412
11412
|
try {
|
|
11413
11413
|
await writeReporterArtifact(
|
|
11414
11414
|
options.out,
|
|
11415
11415
|
reporter ?? "json-summary",
|
|
11416
|
-
|
|
11416
|
+
report2
|
|
11417
11417
|
);
|
|
11418
11418
|
} catch (error) {
|
|
11419
11419
|
outWriteError = error instanceof Error ? error.message : String(error);
|
|
11420
11420
|
}
|
|
11421
11421
|
}
|
|
11422
|
-
if (reporter &&
|
|
11423
|
-
writeReporterResult(reporter,
|
|
11422
|
+
if (reporter && report2) {
|
|
11423
|
+
writeReporterResult(reporter, report2);
|
|
11424
11424
|
} else {
|
|
11425
11425
|
writeResult(
|
|
11426
11426
|
{
|
|
@@ -12318,15 +12318,15 @@ function registerEvalCommands(program) {
|
|
|
12318
12318
|
shot.screenshotUrl,
|
|
12319
12319
|
globalOptions.timeout
|
|
12320
12320
|
);
|
|
12321
|
-
const
|
|
12321
|
+
const path14 = resolveScreenshotPath(
|
|
12322
12322
|
options.out,
|
|
12323
12323
|
shot,
|
|
12324
12324
|
i,
|
|
12325
12325
|
shots.length
|
|
12326
12326
|
);
|
|
12327
|
-
mkdirSync(dirname(
|
|
12328
|
-
writeFileSync(
|
|
12329
|
-
saved.push({ ...shot, savedTo:
|
|
12327
|
+
mkdirSync(dirname(path14), { recursive: true });
|
|
12328
|
+
writeFileSync(path14, bytes);
|
|
12329
|
+
saved.push({ ...shot, savedTo: path14 });
|
|
12330
12330
|
}
|
|
12331
12331
|
let video;
|
|
12332
12332
|
if (options.video) {
|
|
@@ -12891,12 +12891,12 @@ ${summary}
|
|
|
12891
12891
|
}
|
|
12892
12892
|
);
|
|
12893
12893
|
}
|
|
12894
|
-
function readDetails(
|
|
12894
|
+
function readDetails(path14) {
|
|
12895
12895
|
try {
|
|
12896
|
-
return
|
|
12896
|
+
return path14 === "-" ? readFileSync(0, "utf8") : readFileSync(path14, "utf8");
|
|
12897
12897
|
} catch (error) {
|
|
12898
12898
|
throw usageError(
|
|
12899
|
-
|
|
12899
|
+
path14 === "-" ? "Failed to read --details from stdin." : `Failed to read --details from "${path14}".`,
|
|
12900
12900
|
{ source: error instanceof Error ? error.message : String(error) }
|
|
12901
12901
|
);
|
|
12902
12902
|
}
|
|
@@ -13382,11 +13382,11 @@ function registerCloudConformanceCommands(cloud) {
|
|
|
13382
13382
|
getConformanceRunOperation,
|
|
13383
13383
|
(options) => ({ project: options.project, run: options.run })
|
|
13384
13384
|
);
|
|
13385
|
-
const
|
|
13385
|
+
const report2 = addProjectOption(
|
|
13386
13386
|
conformance.command("report").description("Page through a run's failing checks, 50 at a time").requiredOption("--run <id>", "Conformance run id").option("--cursor <cursor>", "The nextCursor of the previous page")
|
|
13387
13387
|
);
|
|
13388
13388
|
bindOperation(
|
|
13389
|
-
|
|
13389
|
+
report2,
|
|
13390
13390
|
getConformanceReportOperation,
|
|
13391
13391
|
(options) => ({
|
|
13392
13392
|
project: options.project,
|
|
@@ -14916,12 +14916,12 @@ function resolveSecretValue(options, { required }) {
|
|
|
14916
14916
|
}
|
|
14917
14917
|
return value;
|
|
14918
14918
|
}
|
|
14919
|
-
const readStdinOrFile = (
|
|
14919
|
+
const readStdinOrFile = (path14) => {
|
|
14920
14920
|
try {
|
|
14921
|
-
return
|
|
14921
|
+
return path14 === "-" ? readFileSync(0, "utf8") : readFileSync(path14, "utf8");
|
|
14922
14922
|
} catch (error) {
|
|
14923
14923
|
throw usageError(
|
|
14924
|
-
|
|
14924
|
+
path14 === "-" ? "Failed to read the secret value from stdin." : `Failed to read the secret value from "${path14}".`,
|
|
14925
14925
|
{ source: error instanceof Error ? error.message : String(error) }
|
|
14926
14926
|
);
|
|
14927
14927
|
}
|
|
@@ -15125,6 +15125,184 @@ function registerSecretsCommands(program) {
|
|
|
15125
15125
|
}
|
|
15126
15126
|
);
|
|
15127
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(path14, what) {
|
|
15138
|
+
let text;
|
|
15139
|
+
try {
|
|
15140
|
+
text = path14 === "-" ? readFileSync(0, "utf8") : readFileSync(path14, "utf8");
|
|
15141
|
+
} catch (error) {
|
|
15142
|
+
throw usageError(
|
|
15143
|
+
path14 === "-" ? `Could not read the ${what} from stdin. Pipe it in, or read it from a file.` : `Could not read the ${what} from "${path14}". 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. 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 a shared or uploaded account whose token is never revealed"
|
|
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. The token is never revealed. Hosted runs use it. On a shared server, members' local apps use it once a project admin allows local runs; on your own server, only your local app does"
|
|
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
|
+
}
|
|
15128
15306
|
async function waitForSessionTurn(run, signal, wait = async (ms, signal2) => {
|
|
15129
15307
|
await setTimeout$1(ms, void 0, { signal: signal2 });
|
|
15130
15308
|
}) {
|
|
@@ -15307,15 +15485,15 @@ function registerSessionsBrowserCommands(sessions) {
|
|
|
15307
15485
|
const extension = bytes[0] === 255 && bytes[1] === 216 ? "jpg" : "png";
|
|
15308
15486
|
const dir = resolve(download);
|
|
15309
15487
|
await mkdir(dir, { recursive: true });
|
|
15310
|
-
const
|
|
15488
|
+
const path14 = resolve(
|
|
15311
15489
|
dir,
|
|
15312
15490
|
`${(wire.commandId ?? "screenshot").replace(
|
|
15313
15491
|
/[^A-Za-z0-9_.-]/g,
|
|
15314
15492
|
"_"
|
|
15315
15493
|
)}.${extension}`
|
|
15316
15494
|
);
|
|
15317
|
-
await writeFile(
|
|
15318
|
-
return { ...result, savedTo:
|
|
15495
|
+
await writeFile(path14, bytes);
|
|
15496
|
+
return { ...result, savedTo: path14 };
|
|
15319
15497
|
}
|
|
15320
15498
|
},
|
|
15321
15499
|
(o) => {
|
|
@@ -16152,8 +16330,8 @@ function resolveHeaders(options) {
|
|
|
16152
16330
|
put(name, value, "--header-env");
|
|
16153
16331
|
}
|
|
16154
16332
|
for (const raw of options.headerFile ?? []) {
|
|
16155
|
-
const [name,
|
|
16156
|
-
const target =
|
|
16333
|
+
const [name, path14] = splitOnFirst(raw, "=", "--header-file");
|
|
16334
|
+
const target = path14.trim();
|
|
16157
16335
|
let contents;
|
|
16158
16336
|
try {
|
|
16159
16337
|
contents = target === "-" ? readFileSync(0, "utf8") : readFileSync(target, "utf8");
|
|
@@ -17554,6 +17732,7 @@ function registerCloudCommands(program) {
|
|
|
17554
17732
|
registerClientsCommands(cloud);
|
|
17555
17733
|
registerEnvironmentsCommands(cloud);
|
|
17556
17734
|
registerSecretsCommands(cloud);
|
|
17735
|
+
registerServerAccountsCommands(cloud);
|
|
17557
17736
|
registerImagesCommands(cloud);
|
|
17558
17737
|
registerSkillsCommands(cloud);
|
|
17559
17738
|
cloud.commandsGroup("Conformance:");
|
|
@@ -19556,13 +19735,13 @@ function resolveLogProbes(options) {
|
|
|
19556
19735
|
}
|
|
19557
19736
|
return { logProbe, logLevelFilteringProbe };
|
|
19558
19737
|
}
|
|
19559
|
-
function readFixturesFile(
|
|
19738
|
+
function readFixturesFile(path14) {
|
|
19560
19739
|
let raw;
|
|
19561
19740
|
try {
|
|
19562
|
-
raw = readFileSync(
|
|
19741
|
+
raw = readFileSync(path14, "utf8");
|
|
19563
19742
|
} catch (error) {
|
|
19564
19743
|
throw usageError(
|
|
19565
|
-
`Could not read fixtures file ${
|
|
19744
|
+
`Could not read fixtures file ${path14}: ${error instanceof Error ? error.message : String(error)}`
|
|
19566
19745
|
);
|
|
19567
19746
|
}
|
|
19568
19747
|
let parsed;
|
|
@@ -19570,15 +19749,15 @@ function readFixturesFile(path12) {
|
|
|
19570
19749
|
parsed = JSON.parse(raw);
|
|
19571
19750
|
} catch (error) {
|
|
19572
19751
|
throw usageError(
|
|
19573
|
-
`Fixtures file ${
|
|
19752
|
+
`Fixtures file ${path14} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`
|
|
19574
19753
|
);
|
|
19575
19754
|
}
|
|
19576
19755
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
19577
19756
|
throw usageError(
|
|
19578
|
-
`Fixtures file ${
|
|
19757
|
+
`Fixtures file ${path14} must contain a JSON object with toolCalls and/or promptGets`
|
|
19579
19758
|
);
|
|
19580
19759
|
}
|
|
19581
|
-
validateFixtures(parsed, `Fixtures file ${
|
|
19760
|
+
validateFixtures(parsed, `Fixtures file ${path14}`);
|
|
19582
19761
|
const document = parsed;
|
|
19583
19762
|
return {
|
|
19584
19763
|
toolCalls: document.toolCalls ?? [],
|
|
@@ -20889,7 +21068,7 @@ async function runTaskVerb(options, command, fn, verbOptions = {}) {
|
|
|
20889
21068
|
const globalOptions = getGlobalOptions(command);
|
|
20890
21069
|
const taskId = verbOptions.requiresTaskId === false ? "" : requireTaskId(options);
|
|
20891
21070
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: describeTarget(options) }) : void 0;
|
|
20892
|
-
const
|
|
21071
|
+
const note2 = (message) => {
|
|
20893
21072
|
if (!globalOptions.quiet) process.stderr.write(`${message}
|
|
20894
21073
|
`);
|
|
20895
21074
|
};
|
|
@@ -20898,7 +21077,7 @@ async function runTaskVerb(options, command, fn, verbOptions = {}) {
|
|
|
20898
21077
|
config,
|
|
20899
21078
|
async (manager, serverId) => {
|
|
20900
21079
|
const support = resolveTasksSupportOrThrow(manager, serverId, options.wire);
|
|
20901
|
-
return fn({ manager, serverId, support, taskId, globalOptions, note });
|
|
21080
|
+
return fn({ manager, serverId, support, taskId, globalOptions, note: note2 });
|
|
20902
21081
|
},
|
|
20903
21082
|
{ timeout: globalOptions.timeout, rpcLogger: collector?.rpcLogger }
|
|
20904
21083
|
);
|
|
@@ -20947,9 +21126,9 @@ function registerTaskVerbs(tasks) {
|
|
|
20947
21126
|
(options, command) => runTaskVerb(
|
|
20948
21127
|
options,
|
|
20949
21128
|
command,
|
|
20950
|
-
async ({ manager, serverId, support, note }) => {
|
|
21129
|
+
async ({ manager, serverId, support, note: note2 }) => {
|
|
20951
21130
|
if (support.wire === "extension") {
|
|
20952
|
-
|
|
21131
|
+
note2(
|
|
20953
21132
|
"Note: SEP-2663 removed tasks/list \u2014 a server cannot enumerate tasks for you on the extension wire, so this is always empty. Track task ids from `tools call --task` instead."
|
|
20954
21133
|
);
|
|
20955
21134
|
} else {
|
|
@@ -21019,7 +21198,7 @@ function registerTaskVerbs(tasks) {
|
|
|
21019
21198
|
(options, command) => runTaskVerb(
|
|
21020
21199
|
options,
|
|
21021
21200
|
command,
|
|
21022
|
-
async ({ manager, serverId, support, taskId, note }) => {
|
|
21201
|
+
async ({ manager, serverId, support, taskId, note: note2 }) => {
|
|
21023
21202
|
assertWireCapability(
|
|
21024
21203
|
support,
|
|
21025
21204
|
"cancel",
|
|
@@ -21028,7 +21207,7 @@ function registerTaskVerbs(tasks) {
|
|
|
21028
21207
|
try {
|
|
21029
21208
|
if (support.wire === "extension") {
|
|
21030
21209
|
await manager.cancelTaskExt(serverId, taskId);
|
|
21031
|
-
|
|
21210
|
+
note2(
|
|
21032
21211
|
"Cancellation requested. SEP-2663 cancellation is cooperative and the ack is empty: the task may still be running, and may still reach `completed`. Re-poll with `mcpjam tasks get`."
|
|
21033
21212
|
);
|
|
21034
21213
|
return { wire: support.wire, task: null, cooperative: true };
|
|
@@ -21057,7 +21236,7 @@ function registerTaskVerbs(tasks) {
|
|
|
21057
21236
|
(options, command) => runTaskVerb(
|
|
21058
21237
|
options,
|
|
21059
21238
|
command,
|
|
21060
|
-
async ({ manager, serverId, support, taskId, note }) => {
|
|
21239
|
+
async ({ manager, serverId, support, taskId, note: note2 }) => {
|
|
21061
21240
|
assertWireCapability(
|
|
21062
21241
|
support,
|
|
21063
21242
|
"update",
|
|
@@ -21079,7 +21258,7 @@ function registerTaskVerbs(tasks) {
|
|
|
21079
21258
|
taskId,
|
|
21080
21259
|
responses
|
|
21081
21260
|
);
|
|
21082
|
-
|
|
21261
|
+
note2(
|
|
21083
21262
|
"Responses accepted. The ack is empty by design \u2014 the task's status does not move until a later `mcpjam tasks get`."
|
|
21084
21263
|
);
|
|
21085
21264
|
return { wire: support.wire, ack };
|
|
@@ -21436,7 +21615,7 @@ function registerConformanceRunCommand(program) {
|
|
|
21436
21615
|
};
|
|
21437
21616
|
}
|
|
21438
21617
|
captureConformanceRunEvent();
|
|
21439
|
-
const
|
|
21618
|
+
const report2 = await runConformance({
|
|
21440
21619
|
server,
|
|
21441
21620
|
suites,
|
|
21442
21621
|
oauth,
|
|
@@ -21459,11 +21638,11 @@ function registerConformanceRunCommand(program) {
|
|
|
21459
21638
|
});
|
|
21460
21639
|
if (reporter === "junit-xml") {
|
|
21461
21640
|
const { renderConformanceRunJUnitXml } = await import('@mcpjam/sdk');
|
|
21462
|
-
writeConformanceOutput3(renderConformanceRunJUnitXml(
|
|
21641
|
+
writeConformanceOutput3(renderConformanceRunJUnitXml(report2));
|
|
21463
21642
|
} else if (reporter === "json-summary" || format === "json") {
|
|
21464
|
-
writeConformanceOutput3(JSON.stringify(
|
|
21643
|
+
writeConformanceOutput3(JSON.stringify(report2, null, 2));
|
|
21465
21644
|
} else {
|
|
21466
|
-
for (const [kind, suiteReport] of Object.entries(
|
|
21645
|
+
for (const [kind, suiteReport] of Object.entries(report2.reports)) {
|
|
21467
21646
|
process.stderr.write(`
|
|
21468
21647
|
== ${kind} ==
|
|
21469
21648
|
`);
|
|
@@ -21472,20 +21651,20 @@ function registerConformanceRunCommand(program) {
|
|
|
21472
21651
|
);
|
|
21473
21652
|
}
|
|
21474
21653
|
}
|
|
21475
|
-
reportScore(
|
|
21476
|
-
for (const suiteReport of Object.values(
|
|
21654
|
+
reportScore(report2.score, command);
|
|
21655
|
+
for (const suiteReport of Object.values(report2.reports)) {
|
|
21477
21656
|
reportIncomplete(suiteReport, command);
|
|
21478
21657
|
}
|
|
21479
21658
|
if (uploads(options)) {
|
|
21480
|
-
await uploadConformanceReport(
|
|
21659
|
+
await uploadConformanceReport(report2, {
|
|
21481
21660
|
serverUrl: String(server.url),
|
|
21482
21661
|
requireUpload: options.requireUpload === true,
|
|
21483
21662
|
command
|
|
21484
21663
|
});
|
|
21485
21664
|
}
|
|
21486
21665
|
const exitCode = conformanceExitCode({
|
|
21487
|
-
passed:
|
|
21488
|
-
outcome:
|
|
21666
|
+
passed: report2.outcome === "passed",
|
|
21667
|
+
outcome: report2.outcome
|
|
21489
21668
|
});
|
|
21490
21669
|
if (exitCode !== 0) {
|
|
21491
21670
|
setProcessExitCode(exitCode);
|
|
@@ -21776,6 +21955,1256 @@ function hostedLazyAuthFields(options) {
|
|
|
21776
21955
|
...claims ? { claimedFeatures: claims } : {}
|
|
21777
21956
|
};
|
|
21778
21957
|
}
|
|
21958
|
+
function parseGateChange(options, submission) {
|
|
21959
|
+
const failOn = options.failOn.map((check) => check.trim());
|
|
21960
|
+
const warnOnly = options.warnOnly.map((check) => check.trim());
|
|
21961
|
+
if (failOn.length === 0 && warnOnly.length === 0 && !options.clear) {
|
|
21962
|
+
throw usageError("Nothing to change. Pass --fail-on, --warn-only or --clear.");
|
|
21963
|
+
}
|
|
21964
|
+
const both = failOn.find((check) => warnOnly.includes(check));
|
|
21965
|
+
if (both !== void 0) {
|
|
21966
|
+
throw usageError(`${both} is given to both --fail-on and --warn-only. Pass it to one of them.`);
|
|
21967
|
+
}
|
|
21968
|
+
const probe = { submission, checkGate: { failOn, warnOnly } };
|
|
21969
|
+
const parsed = updateDirectorySubmissionOperation.inputSchema.safeParse(probe);
|
|
21970
|
+
if (!parsed.success) {
|
|
21971
|
+
const issues = parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`);
|
|
21972
|
+
throw usageError(issues.join("; "));
|
|
21973
|
+
}
|
|
21974
|
+
return { failOn, warnOnly, clear: options.clear === true };
|
|
21975
|
+
}
|
|
21976
|
+
function nextGate(current, change) {
|
|
21977
|
+
const failOn = new Set(change.clear ? [] : current?.failOn);
|
|
21978
|
+
const warnOnly = new Set(change.clear ? [] : current?.warnOnly);
|
|
21979
|
+
for (const check of change.failOn) {
|
|
21980
|
+
failOn.add(check);
|
|
21981
|
+
warnOnly.delete(check);
|
|
21982
|
+
}
|
|
21983
|
+
for (const check of change.warnOnly) {
|
|
21984
|
+
warnOnly.add(check);
|
|
21985
|
+
failOn.delete(check);
|
|
21986
|
+
}
|
|
21987
|
+
if (failOn.size === 0 && warnOnly.size === 0) return null;
|
|
21988
|
+
return {
|
|
21989
|
+
...failOn.size > 0 ? { failOn: [...failOn] } : {},
|
|
21990
|
+
...warnOnly.size > 0 ? { warnOnly: [...warnOnly] } : {}
|
|
21991
|
+
};
|
|
21992
|
+
}
|
|
21993
|
+
async function saveGate(scope, change, context) {
|
|
21994
|
+
const { submission } = await getDirectorySubmissionOperation.execute(scope, context);
|
|
21995
|
+
const checkGate = nextGate(submission.checkGate, change);
|
|
21996
|
+
const input = { ...scope, checkGate, expectedRevision: submission.revision };
|
|
21997
|
+
try {
|
|
21998
|
+
return await updateDirectorySubmissionOperation.execute(input, context);
|
|
21999
|
+
} catch (error) {
|
|
22000
|
+
const conflict = directorySubmissionConflict(error);
|
|
22001
|
+
if (!conflict) throw error;
|
|
22002
|
+
throw new CliError(
|
|
22003
|
+
"CONFLICT",
|
|
22004
|
+
"This submission's check gate changed while yours was saving. Run the command again to apply your change to the new gate.",
|
|
22005
|
+
1,
|
|
22006
|
+
{
|
|
22007
|
+
currentRevision: conflict.currentRevision,
|
|
22008
|
+
conflictingKeys: conflict.conflictingKeys,
|
|
22009
|
+
checkGate: conflict.current?.checkGate ?? null
|
|
22010
|
+
}
|
|
22011
|
+
);
|
|
22012
|
+
}
|
|
22013
|
+
}
|
|
22014
|
+
function report(command, lines) {
|
|
22015
|
+
if (command.optsWithGlobals().quiet) return;
|
|
22016
|
+
process.stderr.write(`${lines.join("\n")}
|
|
22017
|
+
`);
|
|
22018
|
+
}
|
|
22019
|
+
function gateLines(gate) {
|
|
22020
|
+
const lines = ["Gate: the directory's blocking checks"];
|
|
22021
|
+
if (gate?.failOn?.length) lines.push(` Also fail on: ${gate.failOn.join(", ")}`);
|
|
22022
|
+
if (gate?.warnOnly?.length) lines.push(` Warn only: ${gate.warnOnly.join(", ")}`);
|
|
22023
|
+
return lines;
|
|
22024
|
+
}
|
|
22025
|
+
function reportGate(gate, command) {
|
|
22026
|
+
report(command, gateLines(gate));
|
|
22027
|
+
}
|
|
22028
|
+
function verdictSummary(results) {
|
|
22029
|
+
const { verdict, failing, undetermined } = results.verdict;
|
|
22030
|
+
if (verdict === "ready") return void 0;
|
|
22031
|
+
if (verdict === "not-ready") return `checks in the gate failed: ${failing.join(", ")}`;
|
|
22032
|
+
if (results.run === null) {
|
|
22033
|
+
return `no run has completed. Start one with \`mcpjam readiness submission run ${results.submissionId} --wait\`.`;
|
|
22034
|
+
}
|
|
22035
|
+
return undetermined.length > 0 ? `checks in the gate have no current result: ${undetermined.join(", ")}` : "the run reported no check in the gate";
|
|
22036
|
+
}
|
|
22037
|
+
function judgeResults(results, command) {
|
|
22038
|
+
const { verdict } = results;
|
|
22039
|
+
reportReadinessVerdict({ status: verdict.verdict, summary: verdictSummary(results) }, command);
|
|
22040
|
+
const skipped = verdict.notCheckedOnPath.map(
|
|
22041
|
+
(check) => ` ${check}: ${verdict.notCheckedReasons[check]}`
|
|
22042
|
+
);
|
|
22043
|
+
report(command, [
|
|
22044
|
+
...gateLines(verdict.gate),
|
|
22045
|
+
...skipped.length > 0 ? [`Not checked on hosted runs (${skipped.length}):`, ...skipped] : []
|
|
22046
|
+
]);
|
|
22047
|
+
setProcessExitCode(directoryReadinessExitCode({ status: verdict.verdict }));
|
|
22048
|
+
}
|
|
22049
|
+
async function withVerdictExit(action) {
|
|
22050
|
+
try {
|
|
22051
|
+
await action();
|
|
22052
|
+
} catch (error) {
|
|
22053
|
+
if (!(error instanceof CliError) || error.exitCode === 2) throw error;
|
|
22054
|
+
throw new CliError(error.code, error.message, 3, error.details);
|
|
22055
|
+
}
|
|
22056
|
+
}
|
|
22057
|
+
|
|
22058
|
+
// src/lib/op-bindings.ts
|
|
22059
|
+
var CLI_BINDINGS = {
|
|
22060
|
+
// ── Organizations ───────────────────────────────────────────────────────
|
|
22061
|
+
// Read-only, and the only organization command there is. Member, role,
|
|
22062
|
+
// invite and billing writes are account administration and stay in the app.
|
|
22063
|
+
list_organizations: { command: "cloud organizations list" },
|
|
22064
|
+
// ── Projects and servers ────────────────────────────────────────────────
|
|
22065
|
+
list_projects: { command: "cloud projects list" },
|
|
22066
|
+
create_project: { command: "cloud projects create" },
|
|
22067
|
+
update_project: { command: "cloud projects update" },
|
|
22068
|
+
delete_project: { command: "cloud projects delete" },
|
|
22069
|
+
list_project_servers: { command: "cloud projects servers" },
|
|
22070
|
+
create_project_server: { command: "cloud projects servers add" },
|
|
22071
|
+
connect_project_server: { command: "cloud projects servers connect" },
|
|
22072
|
+
// Its OWN command, not `servers connect`. `connect` does poll this operation
|
|
22073
|
+
// while it waits, but `--no-wait` and Ctrl-C both hand back a request id, and
|
|
22074
|
+
// pointing the binding at `connect` claimed a command that could not follow
|
|
22075
|
+
// one — re-running `connect` starts a second request rather than reading the
|
|
22076
|
+
// first.
|
|
22077
|
+
get_project_server_connection_status: {
|
|
22078
|
+
command: "cloud projects servers connect-status"
|
|
22079
|
+
},
|
|
22080
|
+
cancel_project_server_connection: {
|
|
22081
|
+
command: "cloud projects servers connect-cancel"
|
|
22082
|
+
},
|
|
22083
|
+
get_project_server: { command: "cloud projects servers get" },
|
|
22084
|
+
list_server_revisions: { command: "cloud projects servers revisions" },
|
|
22085
|
+
get_server_revision: { command: "cloud projects servers revision" },
|
|
22086
|
+
diff_server_revisions: { command: "cloud projects servers revision-diff" },
|
|
22087
|
+
// `default` runs the same operation as `rename`, with `isDefault` in place
|
|
22088
|
+
// of a name.
|
|
22089
|
+
list_server_accounts: { command: "cloud server-accounts list" },
|
|
22090
|
+
get_server_account: { command: "cloud server-accounts show" },
|
|
22091
|
+
upload_server_account_tokens: { command: "cloud server-accounts set" },
|
|
22092
|
+
update_server_account: { command: "cloud server-accounts rename" },
|
|
22093
|
+
delete_server_account: { command: "cloud server-accounts delete" },
|
|
22094
|
+
update_project_server: { command: "cloud projects servers update" },
|
|
22095
|
+
delete_project_server: { command: "cloud projects servers remove" },
|
|
22096
|
+
show_servers: { command: "cloud projects status" },
|
|
22097
|
+
// ── Journeys (the Swarms product) ───────────────────────────────────────
|
|
22098
|
+
// Flag-gated beta. Bound normally rather than excluded: the server returns a
|
|
22099
|
+
// clean "not currently available for your organization" when the flag is off,
|
|
22100
|
+
// which is a better answer than a command that does not exist. Same shape as
|
|
22101
|
+
// `environments` and `images` for an org that lacks those.
|
|
22102
|
+
list_goals: { command: "cloud goals list" },
|
|
22103
|
+
list_goal_runs: { command: "cloud goals runs" },
|
|
22104
|
+
get_goal_run: { command: "cloud goals status" },
|
|
22105
|
+
list_goal_run_sessions: { command: "cloud goals sessions" },
|
|
22106
|
+
launch_goal_run: { command: "cloud goals run" },
|
|
22107
|
+
cancel_goal_run: { command: "cloud goals cancel" },
|
|
22108
|
+
// Authoring + insights, in `commands/swarms.ts` but hung off the same
|
|
22109
|
+
// `journeys` group so `journeys run` and `journeys create` are one surface
|
|
22110
|
+
// to the person typing them.
|
|
22111
|
+
get_goal: { command: "cloud goals get" },
|
|
22112
|
+
create_goal: { command: "cloud goals create" },
|
|
22113
|
+
update_goal: { command: "cloud goals update" },
|
|
22114
|
+
archive_goal: { command: "cloud goals archive" },
|
|
22115
|
+
generate_goals: { command: "cloud goals generate" },
|
|
22116
|
+
get_swarms_overview: { command: "cloud goals overview" },
|
|
22117
|
+
get_goal_run_scorecard: { command: "cloud goals scorecard" },
|
|
22118
|
+
list_swarm_findings: { command: "cloud goals findings" },
|
|
22119
|
+
dismiss_swarm_finding: { command: "cloud goals dismiss-finding" },
|
|
22120
|
+
undismiss_swarm_finding: { command: "cloud goals undismiss-finding" },
|
|
22121
|
+
get_swarm_run_insights: { command: "cloud goals insights" },
|
|
22122
|
+
request_swarm_run_insights: { command: "cloud goals request-insights" },
|
|
22123
|
+
cancel_swarm_run_insights: { command: "cloud goals cancel-insights" },
|
|
22124
|
+
// ── Personas and swarm containers (Swarms authoring) ────────────────────
|
|
22125
|
+
list_personas: { command: "cloud personas list" },
|
|
22126
|
+
get_persona: { command: "cloud personas get" },
|
|
22127
|
+
create_persona: { command: "cloud personas create" },
|
|
22128
|
+
update_persona: { command: "cloud personas update" },
|
|
22129
|
+
delete_persona: { command: "cloud personas delete" },
|
|
22130
|
+
generate_personas: { command: "cloud personas generate" },
|
|
22131
|
+
// ── Project secrets ─────────────────────────────────────────────────────
|
|
22132
|
+
// `set`/`update` take the value from --value-file, --value-env, or stdin.
|
|
22133
|
+
// A positional value would be written to shell history and visible in `ps`
|
|
22134
|
+
// for the life of the command, which is why the CLI does not offer one.
|
|
22135
|
+
list_secrets: { command: "cloud secrets list" },
|
|
22136
|
+
get_secret: { command: "cloud secrets show" },
|
|
22137
|
+
create_secret: { command: "cloud secrets set" },
|
|
22138
|
+
update_secret: { command: "cloud secrets update" },
|
|
22139
|
+
delete_secret: { command: "cloud secrets rm" },
|
|
22140
|
+
// ── Trace destinations ──────────────────────────────────────────────────
|
|
22141
|
+
// The full surface, bound rather than excluded. Availability is decided per
|
|
22142
|
+
// organization and the server answers a de-flagged org with a clean refusal,
|
|
22143
|
+
// which is a better answer than a command that does not exist — the same
|
|
22144
|
+
// reasoning `journeys` states above. A CLI binding is what makes this
|
|
22145
|
+
// scriptable from CI, which is where an observability integration is
|
|
22146
|
+
// configured in the first place.
|
|
22147
|
+
list_trace_destinations: { command: "cloud trace-destinations list" },
|
|
22148
|
+
get_trace_destination: { command: "cloud trace-destinations show" },
|
|
22149
|
+
create_trace_destination: { command: "cloud trace-destinations create" },
|
|
22150
|
+
update_trace_destination: { command: "cloud trace-destinations update" },
|
|
22151
|
+
delete_trace_destination: { command: "cloud trace-destinations rm" },
|
|
22152
|
+
test_trace_destination: { command: "cloud trace-destinations test" },
|
|
22153
|
+
pause_trace_destination: { command: "cloud trace-destinations pause" },
|
|
22154
|
+
resume_trace_destination: { command: "cloud trace-destinations resume" },
|
|
22155
|
+
backfill_trace_destination: { command: "cloud trace-destinations backfill" },
|
|
22156
|
+
list_trace_destination_backfills: {
|
|
22157
|
+
command: "cloud trace-destinations backfills"
|
|
22158
|
+
},
|
|
22159
|
+
list_swarms: { command: "cloud swarms list" },
|
|
22160
|
+
get_swarm: { command: "cloud swarms get" },
|
|
22161
|
+
create_swarm: { command: "cloud swarms create" },
|
|
22162
|
+
update_swarm: { command: "cloud swarms update" },
|
|
22163
|
+
archive_swarm: { command: "cloud swarms archive" },
|
|
22164
|
+
// ── Capabilities ────────────────────────────────────────────────────────
|
|
22165
|
+
// Nested under projects: the answer is project-scoped (role, org betas,
|
|
22166
|
+
// plan limits) even though it spans Swarms, user testing, and the plan.
|
|
22167
|
+
get_capabilities: { command: "cloud projects capabilities" },
|
|
22168
|
+
// ── Scenarios (user testing) ────────────────────────────────────────────
|
|
22169
|
+
// Publishing and taking down. The reads (`scenarios list` / `scenarios get`)
|
|
22170
|
+
// are bound under "Chat surfaces" below — they used to be a separate group
|
|
22171
|
+
// under the product's older name, and now share this one command.
|
|
22172
|
+
publish_study: { command: "cloud studies publish" },
|
|
22173
|
+
unpublish_study: { command: "cloud studies unpublish" },
|
|
22174
|
+
// ── User testing: everything you do with a scenario once it exists ──────
|
|
22175
|
+
get_study: { command: "cloud studies get" },
|
|
22176
|
+
update_study: { command: "cloud studies update" },
|
|
22177
|
+
list_study_sessions: { command: "cloud studies sessions" },
|
|
22178
|
+
get_study_session: { command: "cloud studies session" },
|
|
22179
|
+
get_study_metrics: { command: "cloud studies metrics" },
|
|
22180
|
+
get_study_usage: { command: "cloud studies usage" },
|
|
22181
|
+
list_study_findings: { command: "cloud studies findings" },
|
|
22182
|
+
get_study_signals: { command: "cloud studies signals" },
|
|
22183
|
+
get_study_insights: { command: "cloud studies insights" },
|
|
22184
|
+
request_study_insights: {
|
|
22185
|
+
command: "cloud studies request-insights"
|
|
22186
|
+
},
|
|
22187
|
+
cancel_study_insights: {
|
|
22188
|
+
command: "cloud studies cancel-insights"
|
|
22189
|
+
},
|
|
22190
|
+
dismiss_study_finding: {
|
|
22191
|
+
command: "cloud studies dismiss-finding"
|
|
22192
|
+
},
|
|
22193
|
+
undismiss_study_finding: {
|
|
22194
|
+
command: "cloud studies undismiss-finding"
|
|
22195
|
+
},
|
|
22196
|
+
set_study_guest_execution: {
|
|
22197
|
+
command: "cloud studies guest-execution"
|
|
22198
|
+
},
|
|
22199
|
+
rotate_study_link: { command: "cloud studies rotate-link" },
|
|
22200
|
+
upsert_study_member: { command: "cloud studies invite" },
|
|
22201
|
+
remove_study_member: { command: "cloud studies remove-member" },
|
|
22202
|
+
rebind_study: { command: "cloud studies rebind" },
|
|
22203
|
+
// Unified share. I5 shipped SDK/MCP/agent; there is no `cloud share`
|
|
22204
|
+
// command yet. Exclude until one exists — a binding with no Commander path
|
|
22205
|
+
// fails the tree test.
|
|
22206
|
+
get_share_settings: {
|
|
22207
|
+
excluded: "Share settings are read from the Share dialog; no `cloud share` command exists yet."
|
|
22208
|
+
},
|
|
22209
|
+
set_share_mode: {
|
|
22210
|
+
excluded: "Changing who can open a shared resource is confirmed in the Share dialog; no CLI write exists yet."
|
|
22211
|
+
},
|
|
22212
|
+
rotate_share_link: {
|
|
22213
|
+
excluded: "Rotating a unified share URL is irreversible and confirmed in the UI; no CLI command exists yet."
|
|
22214
|
+
},
|
|
22215
|
+
// ── Evals ───────────────────────────────────────────────────────────────
|
|
22216
|
+
list_eval_suites: { command: "cloud eval list" },
|
|
22217
|
+
create_eval_suite: { command: "cloud eval create" },
|
|
22218
|
+
get_eval_suite: { command: "cloud eval get" },
|
|
22219
|
+
get_eval_run_disclosure: {
|
|
22220
|
+
excluded: "Not a standalone command: `cloud eval run` already fetches this for its frozen launch plan and prints it (writeRunDisclosure) before the run link in human mode \u2014 on stderr instead of stdout when a --reporter is configured, so the structured report stays the sole document on stdout without losing the disclosure entirely \u2014 and carries it on the JSON receipt's `disclosure` field. A separate command would only invite checking by hand what the launch already discloses."
|
|
22221
|
+
},
|
|
22222
|
+
update_eval_suite: { command: "cloud eval update" },
|
|
22223
|
+
delete_eval_suite: { command: "cloud eval delete" },
|
|
22224
|
+
set_eval_suite_schedule: { command: "cloud eval schedule" },
|
|
22225
|
+
set_eval_suite_environments: { command: "cloud eval environments set" },
|
|
22226
|
+
list_eval_suite_runs: { command: "cloud eval runs" },
|
|
22227
|
+
list_eval_suite_revisions: { command: "cloud eval revisions" },
|
|
22228
|
+
run_eval_suite: { command: "cloud eval run" },
|
|
22229
|
+
cancel_eval_run: { command: "cloud eval cancel" },
|
|
22230
|
+
backtest_eval_run: { command: "cloud eval backtest" },
|
|
22231
|
+
backtest_eval_run_judge: { command: "cloud eval judge-backtest" },
|
|
22232
|
+
request_eval_run_judge: { command: "cloud eval judge" },
|
|
22233
|
+
list_eval_github_repos: { command: "cloud eval github list" },
|
|
22234
|
+
connect_eval_github_repo: { command: "cloud eval github connect" },
|
|
22235
|
+
// The pre-rename spellings, still advertised and still bound — to the
|
|
22236
|
+
// `checks` subgroup they shipped under, which stays registered as a
|
|
22237
|
+
// deprecated alias of `github`.
|
|
22238
|
+
list_eval_check_repos: { command: "cloud eval checks list" },
|
|
22239
|
+
connect_eval_check_repo: { command: "cloud eval checks connect" },
|
|
22240
|
+
get_eval_run: { command: "cloud eval status" },
|
|
22241
|
+
// BOTH bound to one command, addressed by `--run` XOR `--suite`. They are
|
|
22242
|
+
// the same document read two ways — one run, or a suite's runs as a trend
|
|
22243
|
+
// series — and two commands would leave a reader guessing which one
|
|
22244
|
+
// answers "has this stage got worse".
|
|
22245
|
+
//
|
|
22246
|
+
// FLAG-QUALIFIED, following the `registry install --card` precedent above:
|
|
22247
|
+
// the binding test resolves the flag against the real Commander tree, so
|
|
22248
|
+
// these entries prove each shelf exists. Unqualified, both would resolve to
|
|
22249
|
+
// the bare command and the test would still pass with `--run` deleted.
|
|
22250
|
+
get_eval_run_stage_analytics: {
|
|
22251
|
+
command: "cloud eval stage-analytics --run"
|
|
22252
|
+
},
|
|
22253
|
+
get_eval_run_gate: {
|
|
22254
|
+
command: "cloud eval gate --run"
|
|
22255
|
+
},
|
|
22256
|
+
get_eval_run_route_facts: { command: "cloud eval route-facts --run" },
|
|
22257
|
+
get_eval_run_server_facts: { command: "cloud eval server-facts --run" },
|
|
22258
|
+
propose_eval_description_rewrite: {
|
|
22259
|
+
command: "cloud eval description-experiment propose --run --tool"
|
|
22260
|
+
},
|
|
22261
|
+
start_eval_description_experiment: {
|
|
22262
|
+
command: "cloud eval description-experiment start --experiment"
|
|
22263
|
+
},
|
|
22264
|
+
get_eval_description_experiment: {
|
|
22265
|
+
command: "cloud eval description-experiment get --experiment"
|
|
22266
|
+
},
|
|
22267
|
+
list_eval_suite_stage_analytics: {
|
|
22268
|
+
command: "cloud eval stage-analytics --suite"
|
|
22269
|
+
},
|
|
22270
|
+
compare_eval_run: { command: "cloud eval compare" },
|
|
22271
|
+
waive_eval_gate: { command: "cloud eval gate waive" },
|
|
22272
|
+
revoke_eval_gate_waiver: { command: "cloud eval gate unwaive" },
|
|
22273
|
+
get_eval_gate_waiver: {
|
|
22274
|
+
excluded: "Not a standalone command: `cloud eval gate` already reads the waiver off the run projection and names it in every artifact it writes, and `gate unwaive` resolves the waiver in force when `--waiver` is omitted. A separate read command would only invite checking by hand what the gate already reports."
|
|
22275
|
+
},
|
|
22276
|
+
list_eval_run_iterations: { command: "cloud eval iterations" },
|
|
22277
|
+
get_eval_iteration_trace: { command: "cloud eval trace" },
|
|
22278
|
+
get_eval_run_steps: { command: "cloud eval steps" },
|
|
22279
|
+
list_eval_cases: { command: "cloud eval cases list" },
|
|
22280
|
+
get_eval_case: { command: "cloud eval cases get" },
|
|
22281
|
+
create_eval_case: { command: "cloud eval cases create" },
|
|
22282
|
+
create_eval_cases: { command: "cloud eval run --file" },
|
|
22283
|
+
update_eval_case: { command: "cloud eval cases update" },
|
|
22284
|
+
delete_eval_case: { command: "cloud eval cases delete" },
|
|
22285
|
+
generate_eval_cases: { command: "cloud eval cases generate" },
|
|
22286
|
+
import_eval_cases: { command: "cloud eval cases import" },
|
|
22287
|
+
run_eval_case: { command: "cloud eval cases run" },
|
|
22288
|
+
// ── Hosts, environments, images ─────────────────────────────────────────
|
|
22289
|
+
// `cloud clients …`, with `cloud hosts …` kept as a command alias so existing
|
|
22290
|
+
// scripts keep working. The binding names the CANONICAL path — the alias is
|
|
22291
|
+
// resolvable by the same Commander tree, and pointing the binding at it would
|
|
22292
|
+
// document the spelling we are moving away from.
|
|
22293
|
+
list_clients: { command: "cloud clients list" },
|
|
22294
|
+
get_client: { command: "cloud clients get" },
|
|
22295
|
+
create_client: { command: "cloud clients create" },
|
|
22296
|
+
update_client: { command: "cloud clients update" },
|
|
22297
|
+
delete_client: { command: "cloud clients delete" },
|
|
22298
|
+
set_client_servers: { command: "cloud clients servers" },
|
|
22299
|
+
duplicate_client: { command: "cloud clients duplicate" },
|
|
22300
|
+
list_project_environments: { command: "cloud environments list" },
|
|
22301
|
+
get_project_environment_capabilities: {
|
|
22302
|
+
excluded: "Not a user-facing command: it answers 'does this deployment accept a model override?', which `environments create --model` / `environments update --model|--clear-model` already ask on the caller's behalf before writing. A standalone command would only invite people to check by hand what the write already checks."
|
|
22303
|
+
},
|
|
22304
|
+
get_project_environment: { command: "cloud environments get" },
|
|
22305
|
+
resolve_project_environment: { command: "cloud environments resolve" },
|
|
22306
|
+
create_project_environment: { command: "cloud environments create" },
|
|
22307
|
+
ensure_adhoc_environment: { command: "cloud environments ensure-adhoc" },
|
|
22308
|
+
name_environment: { command: "cloud environments name" },
|
|
22309
|
+
update_project_environment: { command: "cloud environments update" },
|
|
22310
|
+
archive_project_environment: { command: "cloud environments archive" },
|
|
22311
|
+
restore_project_environment: { command: "cloud environments restore" },
|
|
22312
|
+
list_project_plugins: {
|
|
22313
|
+
excluded: "No `plugins` command group yet \u2014 the read surface shipped for the MCP catalog and API first. Bind both plugin reads together when the CLI grows one."
|
|
22314
|
+
},
|
|
22315
|
+
get_plugin_version: {
|
|
22316
|
+
excluded: "No `plugins` command group yet \u2014 the read surface shipped for the MCP catalog and API first. Bind both plugin reads together when the CLI grows one."
|
|
22317
|
+
},
|
|
22318
|
+
list_project_skills: { command: "cloud skills list" },
|
|
22319
|
+
get_project_skill: { command: "cloud skills get" },
|
|
22320
|
+
list_sandbox_images: { command: "cloud images list" },
|
|
22321
|
+
get_sandbox_image: { command: "cloud images get" },
|
|
22322
|
+
create_sandbox_image: { command: "cloud images create" },
|
|
22323
|
+
update_sandbox_image: { command: "cloud images edit" },
|
|
22324
|
+
validate_sandbox_image_blueprint: { command: "cloud images validate" },
|
|
22325
|
+
build_sandbox_image: { command: "cloud images build" },
|
|
22326
|
+
list_sandbox_image_builds: { command: "cloud images logs" },
|
|
22327
|
+
promote_sandbox_image: { command: "cloud images promote" },
|
|
22328
|
+
use_sandbox_image: { command: "cloud images use" },
|
|
22329
|
+
delete_sandbox_image: { command: "cloud images delete" },
|
|
22330
|
+
reset_computer: { command: "cloud images reset" },
|
|
22331
|
+
// ── Chat surfaces ───────────────────────────────────────────────────────
|
|
22332
|
+
list_studies: { command: "cloud studies list" },
|
|
22333
|
+
list_chat_sessions: { command: "cloud sessions list" },
|
|
22334
|
+
search_sessions: { command: "cloud sessions search" },
|
|
22335
|
+
send_chat_message: { command: "cloud sessions send" },
|
|
22336
|
+
drive_chat_session_browser: { command: "cloud sessions browser open" },
|
|
22337
|
+
observe_chat_session_browser: { command: "cloud sessions browser observe" },
|
|
22338
|
+
get_chat_session: { command: "cloud sessions show" },
|
|
22339
|
+
get_chat_session_trace: { command: "cloud sessions trace" },
|
|
22340
|
+
// ── Tunnels ─────────────────────────────────────────────────────────────
|
|
22341
|
+
create_tunnel: { command: "cloud tunnel" },
|
|
22342
|
+
close_tunnel: {
|
|
22343
|
+
excluded: "The tunnel closes when `mcpjam cloud tunnel` exits; a separate close command would only strand a session nobody is holding."
|
|
22344
|
+
},
|
|
22345
|
+
// ── Deliberately local-first ────────────────────────────────────────────
|
|
22346
|
+
// The CLI talks to MCP servers DIRECTLY (--url / config file) rather than
|
|
22347
|
+
// through the platform, so a developer can inspect a server that is not
|
|
22348
|
+
// saved in any project and without an API key. Routing these through the
|
|
22349
|
+
// hosted operations would make the platform a prerequisite for the CLI's
|
|
22350
|
+
// most common use. A hosted variant is a real feature request, not an
|
|
22351
|
+
// oversight — it would need its own `--project` mode.
|
|
22352
|
+
list_server_tools: {
|
|
22353
|
+
excluded: "`tools list` connects to the server directly, so it works without a project or an API key."
|
|
22354
|
+
},
|
|
22355
|
+
call_server_tool: {
|
|
22356
|
+
excluded: "`tools call` connects to the server directly, so it works without a project or an API key."
|
|
22357
|
+
},
|
|
22358
|
+
render_server_widget: {
|
|
22359
|
+
excluded: "`apps render` connects to the server directly and mounts the widget in the developer's OWN Chromium, so it works without a project or an API key \u2014 and spends no hosted browser to answer a question the local command already answers."
|
|
22360
|
+
},
|
|
22361
|
+
list_server_prompts: {
|
|
22362
|
+
excluded: "`prompts list` connects to the server directly, so it works without a project or an API key."
|
|
22363
|
+
},
|
|
22364
|
+
get_server_prompt: {
|
|
22365
|
+
excluded: "`prompts get` connects to the server directly, so it works without a project or an API key."
|
|
22366
|
+
},
|
|
22367
|
+
list_server_resources: {
|
|
22368
|
+
excluded: "`resources list` connects to the server directly, so it works without a project or an API key."
|
|
22369
|
+
},
|
|
22370
|
+
read_server_resource: {
|
|
22371
|
+
excluded: "`resources read` connects to the server directly, so it works without a project or an API key."
|
|
22372
|
+
},
|
|
22373
|
+
list_server_skills: {
|
|
22374
|
+
excluded: "`skills list` connects to the server directly, so it works without a project or an API key."
|
|
22375
|
+
},
|
|
22376
|
+
get_server_skill: {
|
|
22377
|
+
excluded: "`skills get` connects to the server directly, so it works without a project or an API key."
|
|
22378
|
+
},
|
|
22379
|
+
read_server_skill_file: {
|
|
22380
|
+
excluded: "`skills read` connects to the server directly, so it works without a project or an API key."
|
|
22381
|
+
},
|
|
22382
|
+
diagnose_server: {
|
|
22383
|
+
excluded: "`server doctor` runs the same sweep locally; the hosted variant is reachable through `projects status`."
|
|
22384
|
+
},
|
|
22385
|
+
validate_server: {
|
|
22386
|
+
excluded: "`server validate` runs locally against any reachable server, saved or not."
|
|
22387
|
+
},
|
|
22388
|
+
export_server: {
|
|
22389
|
+
excluded: "`server export` writes a snapshot of any reachable server without needing it saved first."
|
|
22390
|
+
},
|
|
22391
|
+
check_host_compatibility: {
|
|
22392
|
+
excluded: "`compat` evaluates the bundled catalog locally, so it stays fast and works offline."
|
|
22393
|
+
},
|
|
22394
|
+
// Directory readiness, hosted half. NOT excluded-citing-local like its
|
|
22395
|
+
// neighbours above: `readiness check` grades what THIS machine can reach,
|
|
22396
|
+
// and a hosted run grades the server as the platform reaches it, through the
|
|
22397
|
+
// saved row and the authorize exchange. Different questions, and only the
|
|
22398
|
+
// hosted one can spend for model observations or leave a record.
|
|
22399
|
+
start_claude_readiness_run: { command: "readiness start claude" },
|
|
22400
|
+
start_openai_readiness_run: { command: "readiness start openai" },
|
|
22401
|
+
start_muse_readiness_run: { command: "readiness start muse" },
|
|
22402
|
+
get_readiness_run: { command: "readiness status" },
|
|
22403
|
+
list_readiness_runs: { command: "readiness list" },
|
|
22404
|
+
cancel_readiness_run: { command: "readiness cancel" },
|
|
22405
|
+
resume_readiness_run: { command: "readiness resume" },
|
|
22406
|
+
get_readiness_report: { command: "readiness report" },
|
|
22407
|
+
// `readiness flows` lists the flows, or shows the one it is given.
|
|
22408
|
+
list_directory_flows: { command: "readiness flows" },
|
|
22409
|
+
get_directory_flow: { command: "readiness flows" },
|
|
22410
|
+
create_directory_submission: { command: "readiness submission create" },
|
|
22411
|
+
list_directory_submissions: { command: "readiness submission list" },
|
|
22412
|
+
get_directory_submission: { command: "readiness submission get" },
|
|
22413
|
+
// `readiness submission gate` runs it too, with only `checkGate`.
|
|
22414
|
+
update_directory_submission: { command: "readiness submission set" },
|
|
22415
|
+
delete_directory_submission: { command: "readiness submission delete" },
|
|
22416
|
+
start_directory_submission_run: { command: "readiness submission run" },
|
|
22417
|
+
get_directory_submission_results: {
|
|
22418
|
+
command: "readiness submission results"
|
|
22419
|
+
},
|
|
22420
|
+
// A submission's test plan; `readiness submission run --test-plan-revision`
|
|
22421
|
+
// starts a run that makes its calls.
|
|
22422
|
+
get_directory_submission_test_plan: { command: "readiness submission plan show" },
|
|
22423
|
+
draft_directory_submission_test_plan: { command: "readiness submission plan draft" },
|
|
22424
|
+
save_directory_submission_test_plan: { command: "readiness submission plan save" },
|
|
22425
|
+
get_directory_submission_tool_tests: { command: "readiness submission plan results" },
|
|
22426
|
+
// The eval suite holding a submission's test cases; `evals unlink` runs the
|
|
22427
|
+
// link too, with `null` for what it clears.
|
|
22428
|
+
get_directory_submission_evals: { command: "readiness submission evals show" },
|
|
22429
|
+
set_directory_submission_evals: { command: "readiness submission evals link" },
|
|
22430
|
+
import_directory_submission_test_cases: { command: "readiness submission evals import" },
|
|
22431
|
+
export_directory_submission_test_cases: { command: "readiness submission evals export" },
|
|
22432
|
+
// `readiness reviewer status` lists the attempts, or shows the one it is given.
|
|
22433
|
+
create_reviewer_attempt: { command: "readiness reviewer start" },
|
|
22434
|
+
list_reviewer_attempts: { command: "readiness reviewer status" },
|
|
22435
|
+
get_reviewer_attempt: { command: "readiness reviewer status" },
|
|
22436
|
+
create_reviewer_handoff: { command: "readiness reviewer handoff" },
|
|
22437
|
+
resume_reviewer_attempt: { command: "readiness reviewer resume" },
|
|
22438
|
+
cancel_reviewer_attempt: { command: "readiness reviewer cancel" },
|
|
22439
|
+
// Resuming a submission from its id, and recording what happened in the
|
|
22440
|
+
// directory itself.
|
|
22441
|
+
get_directory_submission_handoff: { command: "readiness submission handoff" },
|
|
22442
|
+
list_directory_submission_findings: {
|
|
22443
|
+
command: "readiness submission findings"
|
|
22444
|
+
},
|
|
22445
|
+
get_directory_submission_finding: { command: "readiness submission finding" },
|
|
22446
|
+
export_directory_submission: { command: "readiness submission export" },
|
|
22447
|
+
list_directory_submission_events: { command: "readiness submission events" },
|
|
22448
|
+
record_directory_submission_status: { command: "readiness submission status" },
|
|
22449
|
+
record_directory_submission_snapshot: {
|
|
22450
|
+
command: "readiness submission snapshot"
|
|
22451
|
+
},
|
|
22452
|
+
import_directory_finding: { command: "readiness submission import-finding" },
|
|
22453
|
+
// Hosted conformance, beside the local `mcpjam conformance` commands: those
|
|
22454
|
+
// grade what this machine reaches and record nothing in a project, these
|
|
22455
|
+
// run on the platform against a saved server and leave a run to poll.
|
|
22456
|
+
start_conformance_run: { command: "cloud conformance run" },
|
|
22457
|
+
get_conformance_run: { command: "cloud conformance status" },
|
|
22458
|
+
list_conformance_runs: { command: "cloud conformance runs" },
|
|
22459
|
+
get_conformance_report: { command: "cloud conformance report" },
|
|
22460
|
+
get_conformance_check: { command: "cloud conformance check" },
|
|
22461
|
+
// ── Covered by the surrounding session, not a command ────────────────────
|
|
22462
|
+
get_me: {
|
|
22463
|
+
excluded: "`cloud whoami` already reports the signed-in identity for the stored credentials."
|
|
22464
|
+
},
|
|
22465
|
+
list_models: {
|
|
22466
|
+
excluded: "Model choice belongs to whatever runs an eval; the CLI never picks one on the user's behalf."
|
|
22467
|
+
},
|
|
22468
|
+
search_registry_directory: { command: "registry search" },
|
|
22469
|
+
get_registry_directory_server: { command: "registry show" },
|
|
22470
|
+
list_registry_directory_sources: { command: "registry sources" },
|
|
22471
|
+
list_registry_servers: { command: "registry servers" },
|
|
22472
|
+
list_registry_connections: { command: "registry connections" },
|
|
22473
|
+
// One Commander path, two ops. `--card` is the shelf disambiguator;
|
|
22474
|
+
// the op-bindings test accepts a flag-qualified command string.
|
|
22475
|
+
install_registry_directory_server: { command: "registry install" },
|
|
22476
|
+
install_registry_server: { command: "registry install --card" },
|
|
22477
|
+
uninstall_registry_server: { command: "registry uninstall" },
|
|
22478
|
+
send_feedback: { command: "cloud feedback" }
|
|
22479
|
+
};
|
|
22480
|
+
|
|
22481
|
+
// src/commands/readiness-submission-handoff.ts
|
|
22482
|
+
var PAGE = 100;
|
|
22483
|
+
var EVIDENCE = "What shows it: url=<https link>, text=<quoted words> or run=<run id>";
|
|
22484
|
+
var scoped = (options, submission = "") => ({ project: options.project, submission });
|
|
22485
|
+
function checked(operation, input) {
|
|
22486
|
+
const parsed = operation.inputSchema.safeParse(input);
|
|
22487
|
+
if (parsed.success) return parsed.data;
|
|
22488
|
+
throw usageError(parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; "));
|
|
22489
|
+
}
|
|
22490
|
+
function note(command, lines) {
|
|
22491
|
+
if (lines.length > 0 && !command.optsWithGlobals().quiet) process.stderr.write(`${lines.join("\n")}
|
|
22492
|
+
`);
|
|
22493
|
+
}
|
|
22494
|
+
function verb(submission, name, description) {
|
|
22495
|
+
return addProjectOption(submission.command(name).description(description).argument("<submission>", "Submission id"));
|
|
22496
|
+
}
|
|
22497
|
+
function withJson(command) {
|
|
22498
|
+
return command.option("--json", "Print JSON (same as --format json)").hook("preAction", (self) => {
|
|
22499
|
+
if (self.opts().json) self.setOptionValue("format", "json");
|
|
22500
|
+
});
|
|
22501
|
+
}
|
|
22502
|
+
function runFor(command, execute) {
|
|
22503
|
+
const { timeout, quiet } = getGlobalOptions(command);
|
|
22504
|
+
const extras = { announce: false, quiet, command: `readiness submission ${command.name()}` };
|
|
22505
|
+
return runPlatformOperation(platformOptionsOf(command), timeout, execute, extras);
|
|
22506
|
+
}
|
|
22507
|
+
function nextSteps(actions) {
|
|
22508
|
+
const steps = actions.map(({ operation, why }) => {
|
|
22509
|
+
const binding = CLI_BINDINGS[operation];
|
|
22510
|
+
return ` ${binding && "command" in binding ? `mcpjam ${binding.command}` : operation}: ${why}`;
|
|
22511
|
+
});
|
|
22512
|
+
return steps.length > 0 ? ["Next:", ...steps] : [];
|
|
22513
|
+
}
|
|
22514
|
+
async function everyFinding(input, context, command) {
|
|
22515
|
+
const list = listDirectorySubmissionFindingsOperation;
|
|
22516
|
+
const first = await list.execute(input, context);
|
|
22517
|
+
const findings = [...first.findings];
|
|
22518
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22519
|
+
let cursor = first.nextCursor;
|
|
22520
|
+
while (cursor) {
|
|
22521
|
+
if (seen.has(cursor)) {
|
|
22522
|
+
const read = `${findings.length} findings`;
|
|
22523
|
+
throw operationalError(`The API sent the same findings page twice after ${read}. Run the command again.`);
|
|
22524
|
+
}
|
|
22525
|
+
seen.add(cursor);
|
|
22526
|
+
note(command, [`Read ${findings.length} findings. Reading the next page.`]);
|
|
22527
|
+
const page = await list.execute({ ...input, project: first.project.id, cursor }, context);
|
|
22528
|
+
findings.push(...page.findings);
|
|
22529
|
+
cursor = page.nextCursor;
|
|
22530
|
+
}
|
|
22531
|
+
return { project: first.project, submissionId: first.submissionId, findings };
|
|
22532
|
+
}
|
|
22533
|
+
async function savePack(out, filename, content) {
|
|
22534
|
+
const folder = statSync(out, { throwIfNoEntry: false })?.isDirectory();
|
|
22535
|
+
const target = folder ? path3.join(out, path3.basename(filename)) : out;
|
|
22536
|
+
try {
|
|
22537
|
+
return await writeFileAtomic(target, content, { createParents: true });
|
|
22538
|
+
} catch (error) {
|
|
22539
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22540
|
+
throw operationalError(`Could not save the pack to ${target} (${reason}). Pass another --out path.`);
|
|
22541
|
+
}
|
|
22542
|
+
}
|
|
22543
|
+
function evidenceOf(value) {
|
|
22544
|
+
if (value === void 0) return void 0;
|
|
22545
|
+
const split = value.indexOf("=");
|
|
22546
|
+
if (split <= 0) throw usageError("--evidence takes kind=value, such as url=https://example.com/status.");
|
|
22547
|
+
return { kind: value.slice(0, split), value: value.slice(split + 1) };
|
|
22548
|
+
}
|
|
22549
|
+
function epochOf(flag, value) {
|
|
22550
|
+
if (value === void 0) return void 0;
|
|
22551
|
+
const time = Date.parse(value);
|
|
22552
|
+
if (Number.isNaN(time)) throw usageError(`${flag} takes a date and time, such as 2026-11-13T09:30:00Z.`);
|
|
22553
|
+
return time;
|
|
22554
|
+
}
|
|
22555
|
+
function directoryWords({ textFile, text }) {
|
|
22556
|
+
if (textFile === void 0 === (text === void 0)) {
|
|
22557
|
+
throw usageError("Pass the directory's words with --text-file <path>, or pipe them in with --text -.");
|
|
22558
|
+
}
|
|
22559
|
+
if (text !== void 0 && text !== "-") {
|
|
22560
|
+
throw usageError("--text reads stdin only, as --text -. Put the words in a file and pass --text-file <path>.");
|
|
22561
|
+
}
|
|
22562
|
+
if (textFile === void 0 && process.stdin.isTTY) {
|
|
22563
|
+
throw usageError("--text - reads stdin, and nothing is piped in. Pipe the words in, or pass --text-file <path>.");
|
|
22564
|
+
}
|
|
22565
|
+
const source = textFile ?? "stdin";
|
|
22566
|
+
let words;
|
|
22567
|
+
try {
|
|
22568
|
+
words = readFileSync(textFile ?? 0, "utf8").replace(/\r?\n$/, "");
|
|
22569
|
+
} catch (error) {
|
|
22570
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22571
|
+
throw usageError(`Could not read ${source} (${reason}). Pass a file you can read.`);
|
|
22572
|
+
}
|
|
22573
|
+
if (words.trim() === "") throw usageError(`${source} holds no text. Pass the directory's words.`);
|
|
22574
|
+
return words;
|
|
22575
|
+
}
|
|
22576
|
+
function recordVerb(submission, name, description) {
|
|
22577
|
+
return withJson(verb(submission, name, description)).option("--observed", "You saw it yourself. Without it, it is recorded as reported: someone told you.").option("--idempotency-key <key>", "Replay guard: a retry returns the event already recorded");
|
|
22578
|
+
}
|
|
22579
|
+
function bindRecord(command, operation, fields) {
|
|
22580
|
+
bindOperation(
|
|
22581
|
+
command,
|
|
22582
|
+
{
|
|
22583
|
+
execute: async (input, context) => {
|
|
22584
|
+
const result = await operation.execute(input, context);
|
|
22585
|
+
if (result.event.replayed) {
|
|
22586
|
+
note(command, [`This idempotency key already recorded event ${result.event.id}. Nothing new was recorded.`]);
|
|
22587
|
+
}
|
|
22588
|
+
return result;
|
|
22589
|
+
}
|
|
22590
|
+
},
|
|
22591
|
+
(options, id) => checked(operation, {
|
|
22592
|
+
...scoped(options, id),
|
|
22593
|
+
...fields(options),
|
|
22594
|
+
reportedOrObserved: options.observed ? "observed" : void 0,
|
|
22595
|
+
idempotencyKey: options.idempotencyKey
|
|
22596
|
+
})
|
|
22597
|
+
);
|
|
22598
|
+
}
|
|
22599
|
+
function registerSubmissionHandoffCommands(submission) {
|
|
22600
|
+
const handoff = addPlatformOptions(
|
|
22601
|
+
withJson(verb(submission, "handoff", "Where the submission stands and what to do next, from its id alone"))
|
|
22602
|
+
);
|
|
22603
|
+
handoff.action(async (id, _options, command) => {
|
|
22604
|
+
const read = getDirectorySubmissionHandoffOperation;
|
|
22605
|
+
const input = checked(read, scoped(platformOptionsOf(command), id));
|
|
22606
|
+
const result = await runFor(command, (context) => read.execute(input, context));
|
|
22607
|
+
writeResult(result, getGlobalOptions(command).format);
|
|
22608
|
+
note(command, nextSteps(result.nextActions));
|
|
22609
|
+
});
|
|
22610
|
+
const findings = addPlatformOptions(
|
|
22611
|
+
withJson(verb(submission, "findings", "List the submission's stored findings, newest first, a page at a time")).option("--status <status>", "Only findings with this status, such as violated").option("--step <id>", "Only findings shown at this portal step").option("--lane <lane>", "Only findings from this lane, such as directory-policy").option("--all", "Read every page, not only the first")
|
|
22612
|
+
);
|
|
22613
|
+
findings.action(async (id, _options, command) => {
|
|
22614
|
+
const options = platformOptionsOf(command);
|
|
22615
|
+
const { status: status2, step, lane, all } = options;
|
|
22616
|
+
const list = listDirectorySubmissionFindingsOperation;
|
|
22617
|
+
const input = checked(list, { ...scoped(options, id), status: status2, step, lane, limit: all ? PAGE : void 0 });
|
|
22618
|
+
const result = await runFor(
|
|
22619
|
+
command,
|
|
22620
|
+
(context) => all ? everyFinding(input, context, command) : list.execute(input, context)
|
|
22621
|
+
);
|
|
22622
|
+
writeResult(result, getGlobalOptions(command).format);
|
|
22623
|
+
if (result.nextCursor) {
|
|
22624
|
+
note(command, [`Showing the first ${result.findings.length} findings. Pass --all to read every page.`]);
|
|
22625
|
+
}
|
|
22626
|
+
});
|
|
22627
|
+
const finding2 = withJson(
|
|
22628
|
+
verb(submission, "finding", "Read one check's stored result, with the observation behind it")
|
|
22629
|
+
).argument("<checkId>", "The check's id, such as claude.endpoint.https");
|
|
22630
|
+
bindOperation(
|
|
22631
|
+
finding2,
|
|
22632
|
+
getDirectorySubmissionFindingOperation,
|
|
22633
|
+
(options, id, check) => checked(getDirectorySubmissionFindingOperation, { ...scoped(options, id), check })
|
|
22634
|
+
);
|
|
22635
|
+
const pack = addPlatformOptions(
|
|
22636
|
+
verb(submission, "export", "Export the pack the team receives, byte for byte as the API serves it").option("--markdown", "The Markdown pack, for a person or a ticket, in place of JSON").option("--out <path>", "Save the pack to this file, or in this folder under its own name")
|
|
22637
|
+
);
|
|
22638
|
+
pack.action(async (id, _options, command) => {
|
|
22639
|
+
if (command.optsWithGlobals().format === "markdown") {
|
|
22640
|
+
throw usageError("For the Markdown pack, pass --markdown. --format chooses json or human output.");
|
|
22641
|
+
}
|
|
22642
|
+
const options = platformOptionsOf(command);
|
|
22643
|
+
const read = exportDirectorySubmissionOperation;
|
|
22644
|
+
const input = checked(read, { ...scoped(options, id), format: options.markdown ? "markdown" : void 0 });
|
|
22645
|
+
const { content, ...file2 } = await runFor(command, (context) => read.execute(input, context));
|
|
22646
|
+
if (options.out === void 0) {
|
|
22647
|
+
process.stdout.write(content);
|
|
22648
|
+
return;
|
|
22649
|
+
}
|
|
22650
|
+
const saved = await savePack(options.out, file2.filename, content);
|
|
22651
|
+
writeResult({ ...file2, path: saved, bytes: Buffer.byteLength(content) }, getGlobalOptions(command).format);
|
|
22652
|
+
});
|
|
22653
|
+
const events = withJson(
|
|
22654
|
+
verb(submission, "events", "List what was recorded about the submission outside MCPJam, newest first")
|
|
22655
|
+
).option("--kind <kind>", "Only events of this kind, such as status or directory-finding");
|
|
22656
|
+
bindOperation(
|
|
22657
|
+
events,
|
|
22658
|
+
listDirectorySubmissionEventsOperation,
|
|
22659
|
+
(options, id) => checked(listDirectorySubmissionEventsOperation, { ...scoped(options, id), kind: options.kind })
|
|
22660
|
+
);
|
|
22661
|
+
const status = recordVerb(submission, "status", "Record where the directory has the submission, as seen or as told").requiredOption("--state <state>", "The stage, such as submitted, in-review or approved").option("--directory-label <words>", "The directory's own words for the state, verbatim").option("--uncertain", "The portal's outcome was unclear, such as a submit dialog that stayed busy").option("--link <url>", "An https link to the submission in the directory").option("--reference <text>", "A confirmation reference the directory gave").option("--detail <text>", "Anything else the next person should know").option("--evidence <kind=value>", EVIDENCE);
|
|
22662
|
+
bindRecord(status, recordDirectorySubmissionStatusOperation, (options) => ({
|
|
22663
|
+
state: options.state,
|
|
22664
|
+
directoryLabel: options.directoryLabel,
|
|
22665
|
+
uncertain: options.uncertain,
|
|
22666
|
+
link: options.link,
|
|
22667
|
+
reference: options.reference,
|
|
22668
|
+
detail: options.detail,
|
|
22669
|
+
evidence: evidenceOf(options.evidence)
|
|
22670
|
+
}));
|
|
22671
|
+
const snapshot = recordVerb(submission, "snapshot", "Record which server revision one copy of the catalog holds").addOption(new Option("--label <label>", "Which copy").choices(DIRECTORY_SNAPSHOT_LABELS).makeOptionMandatory()).option(
|
|
22672
|
+
"--revision <n>",
|
|
22673
|
+
"The server revision it holds. Without one, what it holds stays unknown.",
|
|
22674
|
+
(value) => parsePositiveInteger(value, "--revision")
|
|
22675
|
+
).option("--server <id-or-name>", "The saved server the copy is of. Defaults to the submission's own.").option("--captured-at <time>", "When the copy was seen, such as 2026-11-13T09:30:00Z").option("--note <text>", "How you know, such as what the portal's tool list showed").option("--evidence <kind=value>", EVIDENCE);
|
|
22676
|
+
bindRecord(snapshot, recordDirectorySubmissionSnapshotOperation, (options) => ({
|
|
22677
|
+
label: options.label,
|
|
22678
|
+
revisionNumber: options.revision,
|
|
22679
|
+
server: options.server,
|
|
22680
|
+
capturedAt: epochOf("--captured-at", options.capturedAt),
|
|
22681
|
+
note: options.note,
|
|
22682
|
+
evidence: evidenceOf(options.evidence)
|
|
22683
|
+
}));
|
|
22684
|
+
const said = recordVerb(submission, "import-finding", "Keep what the directory said about the submission, verbatim").option("--text-file <path>", "Read the directory's words from this file").option("--text <source>", "Pass - to read the directory's words from stdin").requiredOption("--via <channel>", "How it arrived: email, portal or other").option("--severity <text>", "The directory's own severity, as given").option("--code <text>", "The directory's code for it, as given").option("--submission-version <text>", "The version of the submission it is about").option("--received-at <time>", "When it arrived, such as 2026-11-13T09:30:00Z").option("--link <url>", "An https link to the message, if it has one").hook("preAction", (self) => {
|
|
22685
|
+
self.setOptionValue("words", directoryWords(self.opts()));
|
|
22686
|
+
});
|
|
22687
|
+
bindRecord(said, importDirectoryFindingOperation, (options) => ({
|
|
22688
|
+
text: options.words,
|
|
22689
|
+
via: options.via,
|
|
22690
|
+
severity: options.severity,
|
|
22691
|
+
code: options.code,
|
|
22692
|
+
version: options.submissionVersion,
|
|
22693
|
+
receivedAt: epochOf("--received-at", options.receivedAt),
|
|
22694
|
+
link: options.link
|
|
22695
|
+
}));
|
|
22696
|
+
}
|
|
22697
|
+
var scoped2 = (options, submission = "") => ({ project: options.project, submission });
|
|
22698
|
+
function guarded(command) {
|
|
22699
|
+
return command.option(
|
|
22700
|
+
"--expected-revision <n>",
|
|
22701
|
+
"The revision you read. Without it, the current revision is read first.",
|
|
22702
|
+
(value) => parsePositiveInteger(value, "--expected-revision")
|
|
22703
|
+
).option("--idempotency-key <key>", "Replay guard: a retry is answered from the first write");
|
|
22704
|
+
}
|
|
22705
|
+
function linkInput(options, submission, change) {
|
|
22706
|
+
const { expectedRevision, idempotencyKey } = options;
|
|
22707
|
+
return { ...scoped2(options, submission), ...change, expectedRevision, idempotencyKey };
|
|
22708
|
+
}
|
|
22709
|
+
async function saveFile(out, filename, content) {
|
|
22710
|
+
const folder = statSync(out, { throwIfNoEntry: false })?.isDirectory();
|
|
22711
|
+
const target = folder ? path3.join(out, path3.basename(filename)) : out;
|
|
22712
|
+
try {
|
|
22713
|
+
return await writeFileAtomic(target, content, { createParents: true });
|
|
22714
|
+
} catch (error) {
|
|
22715
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22716
|
+
throw operationalError(`Could not save the test cases to ${target} (${reason}). Pass another --out path.`);
|
|
22717
|
+
}
|
|
22718
|
+
}
|
|
22719
|
+
function shortfall({ counts, required, omitted }) {
|
|
22720
|
+
const lines = omitted.map(
|
|
22721
|
+
({ title, reason }) => `Left out "${title}": it has no ${reason === "no_prompt" ? "prompt" : "expectation"}. Add one to the case, then export again.`
|
|
22722
|
+
);
|
|
22723
|
+
if (counts.successful !== required.successful || counts.gracefulFailure !== required.gracefulFailure) {
|
|
22724
|
+
lines.push(
|
|
22725
|
+
`The form asks for ${required.successful} successful and ${required.gracefulFailure} graceful-failure cases; this file has ${counts.successful} and ${counts.gracefulFailure}.`
|
|
22726
|
+
);
|
|
22727
|
+
}
|
|
22728
|
+
return lines;
|
|
22729
|
+
}
|
|
22730
|
+
function registerSubmissionEvalCommands(submission) {
|
|
22731
|
+
const evals = submission.command("evals").description("Link, import, read and export the eval suite that holds a submission's test cases");
|
|
22732
|
+
const verb2 = (name, description) => addProjectOption(evals.command(name).description(description).argument("<submission>", "Submission id"));
|
|
22733
|
+
const show = verb2("show", "Read the linked suite and run, and each case's result in that run");
|
|
22734
|
+
bindOperation(show, getDirectorySubmissionEvalsOperation, scoped2);
|
|
22735
|
+
const link = guarded(
|
|
22736
|
+
verb2("link", "Link the eval suite that holds the submission's test cases, or the run that last ran them").option("--suite <id>", "An eval suite in the submission's project").option("--run <id>", "A run of the linked suite, or of --suite")
|
|
22737
|
+
);
|
|
22738
|
+
bindOperation(link, setDirectorySubmissionEvalsOperation, (options, id = "") => {
|
|
22739
|
+
if (options.suite === void 0 && options.run === void 0) {
|
|
22740
|
+
throw usageError("Pass --suite, --run or both.");
|
|
22741
|
+
}
|
|
22742
|
+
return linkInput(options, id, { suite: options.suite, run: options.run });
|
|
22743
|
+
});
|
|
22744
|
+
const unlink3 = guarded(
|
|
22745
|
+
verb2("unlink", "Unlink the submission's eval suite and its run").option(
|
|
22746
|
+
"--run-only",
|
|
22747
|
+
"Keep the suite and clear only the run"
|
|
22748
|
+
)
|
|
22749
|
+
);
|
|
22750
|
+
bindOperation(
|
|
22751
|
+
unlink3,
|
|
22752
|
+
setDirectorySubmissionEvalsOperation,
|
|
22753
|
+
(options, id = "") => linkInput(options, id, options.runOnly ? { run: null } : { suite: null })
|
|
22754
|
+
);
|
|
22755
|
+
const add = verb2("import", "Import the test cases of the submission's ChatGPT plugin version into its linked suite").option("--plugin-version <id>", "The version you expect the submission to name; refused if it names another");
|
|
22756
|
+
bindOperation(add, importDirectorySubmissionTestCasesOperation, (options, id) => ({
|
|
22757
|
+
...scoped2(options, id),
|
|
22758
|
+
pluginVersionId: options.pluginVersion
|
|
22759
|
+
}));
|
|
22760
|
+
const pack = addPlatformOptions(
|
|
22761
|
+
verb2("export", "Export the linked suite's cases in the shape ChatGPT's form takes, byte for byte").option(
|
|
22762
|
+
"--out <path>",
|
|
22763
|
+
"Save the file to this path, or in this folder under its own name"
|
|
22764
|
+
)
|
|
22765
|
+
);
|
|
22766
|
+
pack.action(async (id, _options, command) => {
|
|
22767
|
+
const options = platformOptionsOf(command);
|
|
22768
|
+
const { timeout, quiet, format } = getGlobalOptions(command);
|
|
22769
|
+
const extras = { announce: false, quiet, command: "readiness submission evals export" };
|
|
22770
|
+
const read = exportDirectorySubmissionTestCasesOperation;
|
|
22771
|
+
const result = await runPlatformOperation(options, timeout, (context) => read.execute(scoped2(options, id), context), extras);
|
|
22772
|
+
const { content, ...file2 } = result;
|
|
22773
|
+
if (options.out === void 0) {
|
|
22774
|
+
process.stdout.write(content);
|
|
22775
|
+
} else {
|
|
22776
|
+
const saved = await saveFile(options.out, file2.filename, content);
|
|
22777
|
+
writeResult({ ...file2, path: saved, bytes: Buffer.byteLength(content) }, format);
|
|
22778
|
+
}
|
|
22779
|
+
const notes = shortfall(result);
|
|
22780
|
+
if (notes.length > 0 && !quiet) process.stderr.write(`${notes.join("\n")}
|
|
22781
|
+
`);
|
|
22782
|
+
});
|
|
22783
|
+
}
|
|
22784
|
+
var scoped3 = (options, submission = "") => ({ project: options.project, submission });
|
|
22785
|
+
function readJson(file2) {
|
|
22786
|
+
let text;
|
|
22787
|
+
try {
|
|
22788
|
+
text = file2 === "-" ? readFileSync(0, "utf8") : readFileSync(file2, "utf8");
|
|
22789
|
+
} catch (error) {
|
|
22790
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22791
|
+
throw usageError(`Could not read ${file2} (${reason}). Pass the path of a plan file, or - for stdin.`);
|
|
22792
|
+
}
|
|
22793
|
+
try {
|
|
22794
|
+
return JSON.parse(text);
|
|
22795
|
+
} catch {
|
|
22796
|
+
throw usageError(`${file2} is not JSON. Pass a plan, as \`plan draft --output\` writes one.`);
|
|
22797
|
+
}
|
|
22798
|
+
}
|
|
22799
|
+
function readPlanFile(options, submission) {
|
|
22800
|
+
const file2 = options.file ?? "";
|
|
22801
|
+
const value = readJson(file2);
|
|
22802
|
+
const printed = value && typeof value === "object" && "plan" in value ? value : {};
|
|
22803
|
+
const parsed = directoryTestPlanSchema.safeParse("plan" in printed ? printed.plan : value);
|
|
22804
|
+
if (!parsed.success) {
|
|
22805
|
+
const issue = parsed.error.issues[0];
|
|
22806
|
+
const where = issue?.path.length ? `${issue.path.join(".")}: ` : "";
|
|
22807
|
+
throw usageError(`${file2} is not a test plan. ${where}${issue?.message ?? "Unreadable."}`);
|
|
22808
|
+
}
|
|
22809
|
+
const read = [printed.revision, printed.currentRevision].find(
|
|
22810
|
+
(revision) => typeof revision === "number"
|
|
22811
|
+
);
|
|
22812
|
+
const expectedRevision = options.expectedRevision ?? read;
|
|
22813
|
+
if (expectedRevision === void 0) {
|
|
22814
|
+
throw usageError("Pass --expected-revision: the revision you read, or 0 for the submission's first plan.");
|
|
22815
|
+
}
|
|
22816
|
+
return { ...scoped3(options, submission), expectedRevision, plan: parsed.data };
|
|
22817
|
+
}
|
|
22818
|
+
function registerTestPlanCommands(submission) {
|
|
22819
|
+
const plan = submission.command("plan").description("Draft, read and save the test plan whose tool calls a submission's runs make");
|
|
22820
|
+
const verb2 = (name, description) => addProjectOption(plan.command(name).description(description).argument("<submission>", "Submission id"));
|
|
22821
|
+
const show = verb2("show", "Read the saved test plan, and what keeps it from running").option(
|
|
22822
|
+
"--revision <n>",
|
|
22823
|
+
"A kept revision to read. Defaults to the current plan.",
|
|
22824
|
+
(value) => parsePositiveInteger(value, "--revision")
|
|
22825
|
+
);
|
|
22826
|
+
bindOperation(show, getDirectorySubmissionTestPlanOperation, (options, id) => ({
|
|
22827
|
+
...scoped3(options, id),
|
|
22828
|
+
revision: options.revision
|
|
22829
|
+
}));
|
|
22830
|
+
const draft = verb2("draft", "Draft a plan that calls every tool the server lists. Saves nothing.").option(
|
|
22831
|
+
"--output <file>",
|
|
22832
|
+
"Write the drafted plan to this file, to edit and then save with `plan save`"
|
|
22833
|
+
);
|
|
22834
|
+
bindOperation(
|
|
22835
|
+
draft,
|
|
22836
|
+
{
|
|
22837
|
+
execute: async ({ output, ...input }, context) => {
|
|
22838
|
+
const drafted = await draftDirectorySubmissionTestPlanOperation.execute(input, context);
|
|
22839
|
+
if (output === void 0) return drafted;
|
|
22840
|
+
writeFileSync(output, `${JSON.stringify(drafted.plan, null, 2)}
|
|
22841
|
+
`);
|
|
22842
|
+
const { plan: _plan, ...rest } = drafted;
|
|
22843
|
+
return { ...rest, planFile: output };
|
|
22844
|
+
}
|
|
22845
|
+
},
|
|
22846
|
+
(options, id) => ({ ...scoped3(options, id), output: options.output })
|
|
22847
|
+
);
|
|
22848
|
+
const save = verb2("save", "Save a plan file as the submission's next revision").requiredOption("--file <path>", "The plan: a file `plan draft --output` wrote, what `plan show` printed, or - for stdin").option(
|
|
22849
|
+
"--expected-revision <n>",
|
|
22850
|
+
"The revision you read; 0 for the first plan. Defaults to the one in the file, when it names one.",
|
|
22851
|
+
(value) => parseNonNegativeInteger(value, "--expected-revision")
|
|
22852
|
+
);
|
|
22853
|
+
bindOperation(save, saveDirectorySubmissionTestPlanOperation, (options, id = "") => readPlanFile(options, id));
|
|
22854
|
+
const results = verb2("results", "Read what a run's test plan calls showed, tool by tool").option("--run <id>", "A run's id. Defaults to the newest run that named a test plan.").option("--tool <name>", "One tool, with the call behind each of its cases").addOption(new Option("--status <status>", "List the tools with this status").choices(DIRECTORY_TOOL_TEST_STATUSES));
|
|
22855
|
+
bindOperation(results, getDirectorySubmissionToolTestsOperation, (options, id) => ({
|
|
22856
|
+
...scoped3(options, id),
|
|
22857
|
+
run: options.run,
|
|
22858
|
+
tool: options.tool,
|
|
22859
|
+
status: options.status
|
|
22860
|
+
}));
|
|
22861
|
+
}
|
|
22862
|
+
|
|
22863
|
+
// src/commands/readiness-submissions.ts
|
|
22864
|
+
var RUN_WAIT_MS = 20 * 6e4;
|
|
22865
|
+
var RUN_POLL_MS = 5e3;
|
|
22866
|
+
var RUN_ENDED = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
|
|
22867
|
+
var PROJECT_SCOPED = { ambientProject: true };
|
|
22868
|
+
var scoped4 = (options, submission = "") => ({ project: options.project, submission });
|
|
22869
|
+
var extrasOf = (command, name) => ({
|
|
22870
|
+
announce: false,
|
|
22871
|
+
quiet: getGlobalOptions(command).quiet,
|
|
22872
|
+
command: `readiness submission ${name}`
|
|
22873
|
+
});
|
|
22874
|
+
function jsonOrText(text) {
|
|
22875
|
+
try {
|
|
22876
|
+
return JSON.parse(text);
|
|
22877
|
+
} catch {
|
|
22878
|
+
return text;
|
|
22879
|
+
}
|
|
22880
|
+
}
|
|
22881
|
+
function subjectOf(options) {
|
|
22882
|
+
const { plugin: pluginId, pluginVersion: pluginVersionId, attempt } = options;
|
|
22883
|
+
const named = pluginId !== void 0 || pluginVersionId !== void 0;
|
|
22884
|
+
if (options.clearPlugin && named) {
|
|
22885
|
+
throw usageError(
|
|
22886
|
+
"Pass --clear-plugin, or --plugin and --plugin-version, not both."
|
|
22887
|
+
);
|
|
22888
|
+
}
|
|
22889
|
+
if (options.clearAttempt && attempt !== void 0) {
|
|
22890
|
+
throw usageError("Pass --attempt or --clear-attempt, not both.");
|
|
22891
|
+
}
|
|
22892
|
+
const plugin = named ? { pluginId, pluginVersionId } : void 0;
|
|
22893
|
+
return {
|
|
22894
|
+
plugin: options.clearPlugin ? null : plugin,
|
|
22895
|
+
attempt: options.clearAttempt ? null : attempt
|
|
22896
|
+
};
|
|
22897
|
+
}
|
|
22898
|
+
function parseSetInput(options, submission) {
|
|
22899
|
+
const answers = /* @__PURE__ */ new Map();
|
|
22900
|
+
const add = (key, value) => {
|
|
22901
|
+
if (answers.has(key)) throw usageError(`${key} is given twice. Pass one --answer or --unset per field.`);
|
|
22902
|
+
answers.set(key, value);
|
|
22903
|
+
};
|
|
22904
|
+
for (const pair of options.answer) {
|
|
22905
|
+
const split = pair.indexOf("=");
|
|
22906
|
+
if (split <= 0) throw usageError(`--answer takes key=value, not "${pair}".`);
|
|
22907
|
+
add(pair.slice(0, split).trim(), jsonOrText(pair.slice(split + 1)));
|
|
22908
|
+
}
|
|
22909
|
+
for (const key of options.unset) add(key.trim(), null);
|
|
22910
|
+
const subject = subjectOf(options);
|
|
22911
|
+
const unchanged = [options.title, subject.plugin, subject.attempt].every(
|
|
22912
|
+
(value) => value === void 0
|
|
22913
|
+
);
|
|
22914
|
+
if (answers.size === 0 && options.confirm.length === 0 && unchanged) {
|
|
22915
|
+
throw usageError(
|
|
22916
|
+
"Nothing to save. Pass --answer, --unset, --confirm, --title, --plugin-version or --attempt."
|
|
22917
|
+
);
|
|
22918
|
+
}
|
|
22919
|
+
const parsed = updateDirectorySubmissionOperation.inputSchema.safeParse({
|
|
22920
|
+
...scoped4(options, submission),
|
|
22921
|
+
...answers.size > 0 ? { answers: Object.fromEntries(answers) } : {},
|
|
22922
|
+
...options.confirm.length > 0 ? { confirm: options.confirm } : {},
|
|
22923
|
+
title: options.title,
|
|
22924
|
+
...subject,
|
|
22925
|
+
expectedRevision: options.expectedRevision,
|
|
22926
|
+
idempotencyKey: options.idempotencyKey
|
|
22927
|
+
});
|
|
22928
|
+
if (parsed.success) return parsed.data;
|
|
22929
|
+
throw usageError(parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; "));
|
|
22930
|
+
}
|
|
22931
|
+
var RESUME_TRIES = 3;
|
|
22932
|
+
function isDefiniteRefusal(error) {
|
|
22933
|
+
return isPlatformApiError(error) && error.status >= 400 && error.status < 500 && ![408, 425, 429].includes(error.status);
|
|
22934
|
+
}
|
|
22935
|
+
async function resumeRun(options, timeoutMs, run, extras) {
|
|
22936
|
+
const resume = async (context) => {
|
|
22937
|
+
try {
|
|
22938
|
+
await context.client.resumeReadinessRun(run, { signal: context.signal });
|
|
22939
|
+
return void 0;
|
|
22940
|
+
} catch (error) {
|
|
22941
|
+
if (!isDefiniteRefusal(error)) throw error;
|
|
22942
|
+
return error instanceof Error ? error.message : String(error);
|
|
22943
|
+
}
|
|
22944
|
+
};
|
|
22945
|
+
let outcome = "settled";
|
|
22946
|
+
let note2 = `Run ${run.runId} stopped on the server and was resumed.`;
|
|
22947
|
+
try {
|
|
22948
|
+
const refusal = await runPlatformOperation(options, timeoutMs, resume, extras);
|
|
22949
|
+
if (refusal) note2 = `Run ${run.runId} stopped on the server and could not be resumed: ${refusal}`;
|
|
22950
|
+
} catch (error) {
|
|
22951
|
+
outcome = "transient";
|
|
22952
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22953
|
+
note2 = `Run ${run.runId} stopped on the server and could not be resumed yet, so the resume will be tried again: ${reason}`;
|
|
22954
|
+
}
|
|
22955
|
+
if (!extras.quiet) process.stderr.write(`${note2}
|
|
22956
|
+
`);
|
|
22957
|
+
return outcome;
|
|
22958
|
+
}
|
|
22959
|
+
async function waitForRun(options, timeoutMs, run, extras) {
|
|
22960
|
+
const giveUpAt = Date.now() + RUN_WAIT_MS;
|
|
22961
|
+
const settled = /* @__PURE__ */ new Set();
|
|
22962
|
+
const transientTries = /* @__PURE__ */ new Map();
|
|
22963
|
+
for (; ; ) {
|
|
22964
|
+
const read = (context) => context.client.getReadinessRun(run, { signal: context.signal });
|
|
22965
|
+
const current = await runPlatformOperation(options, timeoutMs, read, extras);
|
|
22966
|
+
if (RUN_ENDED.has(current.status)) return current;
|
|
22967
|
+
const attempt = current.attemptCount;
|
|
22968
|
+
const tries = transientTries.get(attempt) ?? 0;
|
|
22969
|
+
if (current.resumable && !settled.has(attempt) && tries < RESUME_TRIES) {
|
|
22970
|
+
if (await resumeRun(options, timeoutMs, run, extras) === "settled") {
|
|
22971
|
+
settled.add(attempt);
|
|
22972
|
+
continue;
|
|
22973
|
+
}
|
|
22974
|
+
transientTries.set(attempt, tries + 1);
|
|
22975
|
+
}
|
|
22976
|
+
if (Date.now() + RUN_POLL_MS > giveUpAt) {
|
|
22977
|
+
const later = `mcpjam readiness status --run ${run.runId} --project ${run.projectId}`;
|
|
22978
|
+
throw new CliError(
|
|
22979
|
+
"RUN_NOT_FINISHED",
|
|
22980
|
+
`Run ${run.runId} is still ${current.status} after 20 minutes. Read it later with \`${later}\`.`,
|
|
22981
|
+
3
|
|
22982
|
+
);
|
|
22983
|
+
}
|
|
22984
|
+
await new Promise((resolve2) => setTimeout(resolve2, RUN_POLL_MS));
|
|
22985
|
+
}
|
|
22986
|
+
}
|
|
22987
|
+
async function runSubmission(submission, command) {
|
|
22988
|
+
const options = platformOptionsOf(command);
|
|
22989
|
+
const globals = getGlobalOptions(command);
|
|
22990
|
+
const { project, projectScope } = resolveCloudProjectArgs(options);
|
|
22991
|
+
const extras = { ...extrasOf(command, "run"), projectScope };
|
|
22992
|
+
const input = {
|
|
22993
|
+
...scoped4({ ...options, project }, submission),
|
|
22994
|
+
includeLlmObservations: options.aiObservations ? true : void 0,
|
|
22995
|
+
idempotencyKey: options.idempotencyKey,
|
|
22996
|
+
pluginVersionId: options.pluginVersion,
|
|
22997
|
+
testPlanRevision: options.testPlanRevision
|
|
22998
|
+
};
|
|
22999
|
+
const start = startDirectorySubmissionRunOperation;
|
|
23000
|
+
const started = await runPlatformOperation(options, globals.timeout, (context) => start.execute(input, context), extras);
|
|
23001
|
+
if (!options.wait) return writeResult(started, globals.format);
|
|
23002
|
+
const ids = { projectId: started.project.id, runId: started.run.runId };
|
|
23003
|
+
const run = await waitForRun(options, globals.timeout, ids, extras);
|
|
23004
|
+
if (run.status !== "completed") {
|
|
23005
|
+
writeResult({ ...started, run }, globals.format);
|
|
23006
|
+
reportReadinessVerdict({ summary: `the run ${run.status}` }, command);
|
|
23007
|
+
return setProcessExitCode(directoryReadinessExitCode({}));
|
|
23008
|
+
}
|
|
23009
|
+
const scope = { project: ids.projectId, submission, run: ids.runId };
|
|
23010
|
+
const read = getDirectorySubmissionResultsOperation;
|
|
23011
|
+
let results;
|
|
23012
|
+
try {
|
|
23013
|
+
results = await runPlatformOperation(options, globals.timeout, (context) => read.execute(scope, context), extras);
|
|
23014
|
+
} catch (error) {
|
|
23015
|
+
if (!(error instanceof CliError)) throw error;
|
|
23016
|
+
const later = `mcpjam readiness submission results ${submission} --run ${ids.runId}`;
|
|
23017
|
+
const message = `${error.message} The run finished. Read its results with \`${later}\`.`;
|
|
23018
|
+
throw new CliError(error.code, message, error.exitCode, error.details);
|
|
23019
|
+
}
|
|
23020
|
+
writeResult({ ...started, run, verdict: results.verdict }, globals.format);
|
|
23021
|
+
judgeResults(results, command);
|
|
23022
|
+
}
|
|
23023
|
+
function registerDirectorySubmissionCommands(readiness) {
|
|
23024
|
+
const flows = readiness.command("flows").description("List the directory forms MCPJam can rehearse, or show one").argument("[flow]", "Flow id, such as claude-connector").option("--step <id>", "Show only this step of the flow");
|
|
23025
|
+
bindOperation(
|
|
23026
|
+
flows,
|
|
23027
|
+
{
|
|
23028
|
+
execute: ({ flow, step }, context) => flow ? getDirectoryFlowOperation.execute({ flow, step }, context) : listDirectoryFlowsOperation.execute({}, context)
|
|
23029
|
+
},
|
|
23030
|
+
(options, flow) => {
|
|
23031
|
+
if (options.step && !flow) {
|
|
23032
|
+
throw usageError("--step needs a flow, as in `mcpjam readiness flows claude-connector --step listing`.");
|
|
23033
|
+
}
|
|
23034
|
+
return { flow, step: options.step };
|
|
23035
|
+
}
|
|
23036
|
+
);
|
|
23037
|
+
const submission = readiness.command("submission").description("Rehearse a directory submission for a saved server");
|
|
23038
|
+
const verb2 = (name, description, argument = true) => {
|
|
23039
|
+
const command = submission.command(name).description(description);
|
|
23040
|
+
return addProjectOption(argument ? command.argument("<submission>", "Submission id") : command);
|
|
23041
|
+
};
|
|
23042
|
+
const create = verb2("create", "Start a rehearsal of a directory's form for a saved server", false).requiredOption("--flow <id>", "Flow id, from `mcpjam readiness flows`").requiredOption("--server <id-or-name>", "Saved server the submission is for").option("--title <title>", "A name for the rehearsal").option("--idempotency-key <key>", "Replay guard: a retry returns the same submission");
|
|
23043
|
+
bindOperation(
|
|
23044
|
+
create,
|
|
23045
|
+
createDirectorySubmissionOperation,
|
|
23046
|
+
({ project, server = "", flow = "", title, idempotencyKey }) => ({
|
|
23047
|
+
project,
|
|
23048
|
+
server,
|
|
23049
|
+
flow,
|
|
23050
|
+
title,
|
|
23051
|
+
idempotencyKey
|
|
23052
|
+
}),
|
|
23053
|
+
PROJECT_SCOPED
|
|
23054
|
+
);
|
|
23055
|
+
const list = verb2("list", "List a project's submissions, newest first", false).option("--server <id-or-name>", "Narrow to one saved server").option("--flow <id>", "Narrow to one flow").option("--limit <n>", "Rows to return (1-100)", (value) => parsePositiveInteger(value, "Limit"));
|
|
23056
|
+
bindOperation(
|
|
23057
|
+
list,
|
|
23058
|
+
listDirectorySubmissionsOperation,
|
|
23059
|
+
({ project, server, flow, limit }) => ({ project, server, flow, limit }),
|
|
23060
|
+
PROJECT_SCOPED
|
|
23061
|
+
);
|
|
23062
|
+
const get = verb2("get", "Read a submission: its answers, who set them, and the portal's checks");
|
|
23063
|
+
bindOperation(get, getDirectorySubmissionOperation, scoped4, PROJECT_SCOPED);
|
|
23064
|
+
const set = verb2("set", "Save answers to a submission").option(
|
|
23065
|
+
"--answer <key=value>",
|
|
23066
|
+
'Set a field. The value is read as JSON when it parses (true, 3, ["a"]), otherwise as text. Repeatable.',
|
|
23067
|
+
collectRepeated,
|
|
23068
|
+
[]
|
|
23069
|
+
).option("--unset <key>", "Remove a field's answer. Repeatable.", collectRepeated, []).option("--confirm <key>", "Confirm a declaration as the portal words it now. Repeatable.", collectRepeated, []).option("--title <title>", "Rename the submission").option("--plugin <id>", "A ChatGPT plugin submission's stored plugin").option("--plugin-version <id>", "The plugin version to submit. It names its plugin, so --plugin can be left out").option("--clear-plugin", "Remove the submission's plugin and version").option(
|
|
23070
|
+
"--attempt <n>",
|
|
23071
|
+
"Which submission this is: 1, then one more per resubmission",
|
|
23072
|
+
(value) => parsePositiveInteger(value, "--attempt")
|
|
23073
|
+
).option("--clear-attempt", "Remove the submission's attempt number").option(
|
|
23074
|
+
"--expected-revision <n>",
|
|
23075
|
+
"The revision you read. Without it, the current revision is read first.",
|
|
23076
|
+
(value) => parsePositiveInteger(value, "--expected-revision")
|
|
23077
|
+
).option(
|
|
23078
|
+
"--retry-on-conflict",
|
|
23079
|
+
"If someone changed a field you set since your revision, write once more over their change"
|
|
23080
|
+
).option("--idempotency-key <key>", "Replay guard: a retry is answered from the first write");
|
|
23081
|
+
bindOperation(
|
|
23082
|
+
set,
|
|
23083
|
+
{
|
|
23084
|
+
// `--retry-on-conflict`: one more write, over the revision the refusal names.
|
|
23085
|
+
execute: async ({ retry, ...input }, context) => {
|
|
23086
|
+
try {
|
|
23087
|
+
return await updateDirectorySubmissionOperation.execute(input, context);
|
|
23088
|
+
} catch (error) {
|
|
23089
|
+
const conflict = retry ? directorySubmissionConflict(error) : void 0;
|
|
23090
|
+
if (!conflict) throw error;
|
|
23091
|
+
const again = { ...input, expectedRevision: conflict.currentRevision };
|
|
23092
|
+
return updateDirectorySubmissionOperation.execute(again, context);
|
|
23093
|
+
}
|
|
23094
|
+
}
|
|
23095
|
+
},
|
|
23096
|
+
(options, id = "") => ({ ...parseSetInput(options, id), retry: options.retryOnConflict === true }),
|
|
23097
|
+
PROJECT_SCOPED
|
|
23098
|
+
);
|
|
23099
|
+
const remove = verb2("delete", "Delete a submission and its answers. This cannot be undone.");
|
|
23100
|
+
bindOperation(remove, deleteDirectorySubmissionOperation, scoped4, PROJECT_SCOPED);
|
|
23101
|
+
const run = addPlatformOptions(
|
|
23102
|
+
verb2("run", "Grade a submission's server and answers on the platform").option("--wait", "Wait for the run to end, then exit 0 ready, 1 not ready or 3 incomplete").option("--ai-observations", "Add optional model observations, included with MCPJam").option("--plugin-version <id>", "The stored plugin version to grade. Required for a ChatGPT plugin submission").option(
|
|
23103
|
+
"--test-plan-revision <n>",
|
|
23104
|
+
"Also make the calls of the saved test plan at this revision, from `plan show`. It must be the current one.",
|
|
23105
|
+
(value) => parsePositiveInteger(value, "--test-plan-revision")
|
|
23106
|
+
).option("--idempotency-key <key>", "Replay guard: a retry returns the run already started")
|
|
23107
|
+
);
|
|
23108
|
+
run.action(
|
|
23109
|
+
(id, _options, command) => (
|
|
23110
|
+
// Under --wait the exit code is the verdict.
|
|
23111
|
+
platformOptionsOf(command).wait ? withVerdictExit(() => runSubmission(id, command)) : runSubmission(id, command)
|
|
23112
|
+
)
|
|
23113
|
+
);
|
|
23114
|
+
const results = addPlatformOptions(
|
|
23115
|
+
verb2("results", "Read a submission's results by the portal's steps, and exit with its verdict").option("--run <id>", "A completed run's id. Defaults to the latest.").option("--json", "Print JSON (same as --format json)").hook("preAction", (command) => {
|
|
23116
|
+
if (command.opts().json) command.setOptionValue("format", "json");
|
|
23117
|
+
})
|
|
23118
|
+
);
|
|
23119
|
+
results.action(
|
|
23120
|
+
(id, _options, command) => withVerdictExit(async () => {
|
|
23121
|
+
const options = platformOptionsOf(command);
|
|
23122
|
+
const { project, projectScope } = resolveCloudProjectArgs(options);
|
|
23123
|
+
const input = { ...scoped4({ ...options, project }, id), run: options.run };
|
|
23124
|
+
const read = getDirectorySubmissionResultsOperation;
|
|
23125
|
+
const { timeout, format } = getGlobalOptions(command);
|
|
23126
|
+
const execute = (context) => read.execute(input, context);
|
|
23127
|
+
const result = await runPlatformOperation(options, timeout, execute, {
|
|
23128
|
+
...extrasOf(command, "results"),
|
|
23129
|
+
projectScope
|
|
23130
|
+
});
|
|
23131
|
+
writeResult(result, format);
|
|
23132
|
+
judgeResults(result, command);
|
|
23133
|
+
})
|
|
23134
|
+
);
|
|
23135
|
+
const gate = addPlatformOptions(
|
|
23136
|
+
verb2("gate", "Choose which checks fail the submission's runs. Check ids are in its results.").option(
|
|
23137
|
+
"--fail-on <id>",
|
|
23138
|
+
"Fail a run when this check fails, even one the directory does not require. Repeatable.",
|
|
23139
|
+
collectRepeated,
|
|
23140
|
+
[]
|
|
23141
|
+
).option("--warn-only <id>", "Show this check's result without failing the run. Repeatable.", collectRepeated, []).option("--clear", "Start from the directory's blocking checks, dropping earlier choices")
|
|
23142
|
+
);
|
|
23143
|
+
gate.action(async (id, _options, command) => {
|
|
23144
|
+
const options = platformOptionsOf(command);
|
|
23145
|
+
const { project, projectScope } = resolveCloudProjectArgs(options);
|
|
23146
|
+
const change = parseGateChange(options, id);
|
|
23147
|
+
const { timeout, format } = getGlobalOptions(command);
|
|
23148
|
+
const save = (context) => saveGate(scoped4({ ...options, project }, id), change, context);
|
|
23149
|
+
const saved = await runPlatformOperation(options, timeout, save, {
|
|
23150
|
+
...extrasOf(command, "gate"),
|
|
23151
|
+
projectScope
|
|
23152
|
+
});
|
|
23153
|
+
writeResult(saved, format);
|
|
23154
|
+
reportGate(saved.submission.checkGate, command);
|
|
23155
|
+
});
|
|
23156
|
+
registerSubmissionHandoffCommands(submission);
|
|
23157
|
+
registerTestPlanCommands(submission);
|
|
23158
|
+
registerSubmissionEvalCommands(submission);
|
|
23159
|
+
}
|
|
23160
|
+
var scoped5 = (options, submission = "") => ({ project: options.project, submission });
|
|
23161
|
+
function registerReviewerAttemptCommands(readiness) {
|
|
23162
|
+
const reviewer = readiness.command("reviewer").description("Rehearse a directory reviewer's sign-in to a submission's server");
|
|
23163
|
+
const verb2 = (name, description) => addProjectOption(reviewer.command(name).description(description).argument("<submission>", "Submission id"));
|
|
23164
|
+
const start = verb2("start", "Sign in as the reviewer with credentials saved as project secrets").requiredOption("--password-secret <name>", "Name of the project secret holding the reviewer's password").option("--username-secret <name>", "Name of the project secret holding the reviewer's username").option("--username <text>", "The reviewer's username, when it is not a secret").option("--login-url <url>", "The https sign-in page the reviewer starts on").option("--tenant <name>", "The organization the reviewer must end up signed in to").option("--idempotency-key <key>", "Replay guard: a retry returns the same attempt and run");
|
|
23165
|
+
bindOperation(start, createReviewerAttemptOperation, (options, submission) => {
|
|
23166
|
+
const parsed = createReviewerAttemptOperation.inputSchema.safeParse({
|
|
23167
|
+
...scoped5(options, submission),
|
|
23168
|
+
passwordSecretName: options.passwordSecret,
|
|
23169
|
+
usernameSecretName: options.usernameSecret,
|
|
23170
|
+
username: options.username,
|
|
23171
|
+
loginUrl: options.loginUrl,
|
|
23172
|
+
tenant: options.tenant,
|
|
23173
|
+
idempotencyKey: options.idempotencyKey
|
|
23174
|
+
});
|
|
23175
|
+
if (parsed.success) return parsed.data;
|
|
23176
|
+
throw usageError(parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; "));
|
|
23177
|
+
});
|
|
23178
|
+
const status = verb2("status", "List a submission's sign-in attempts, newest first, or show one").option("--attempt <id>", "Show only this attempt, with its stages").option("--limit <n>", "Attempts to list (1-50)", (value) => parsePositiveInteger(value, "Limit"));
|
|
23179
|
+
bindOperation(
|
|
23180
|
+
status,
|
|
23181
|
+
{
|
|
23182
|
+
execute: ({ attempt, limit, ...scope }, context) => attempt ? getReviewerAttemptOperation.execute({ ...scope, attempt }, context) : listReviewerAttemptsOperation.execute({ ...scope, limit }, context)
|
|
23183
|
+
},
|
|
23184
|
+
(options, submission) => ({ ...scoped5(options, submission), attempt: options.attempt, limit: options.limit })
|
|
23185
|
+
);
|
|
23186
|
+
const resume = verb2("resume", "Continue an attempt waiting for a person, in a new run").requiredOption(
|
|
23187
|
+
"--attempt <id>",
|
|
23188
|
+
"The attempt's id"
|
|
23189
|
+
);
|
|
23190
|
+
bindOperation(resume, resumeReviewerAttemptOperation, (options, submission) => ({
|
|
23191
|
+
...scoped5(options, submission),
|
|
23192
|
+
attempt: options.attempt ?? ""
|
|
23193
|
+
}));
|
|
23194
|
+
const handoff = verb2("handoff", "Create a single-use link to finish a paused reviewer sign-in").requiredOption("--attempt <id>", "The attempt's id");
|
|
23195
|
+
bindOperation(handoff, createReviewerHandoffOperation, (options, submission) => ({
|
|
23196
|
+
...scoped5(options, submission),
|
|
23197
|
+
attempt: options.attempt ?? ""
|
|
23198
|
+
}));
|
|
23199
|
+
const cancel = verb2("cancel", "Stop an attempt that is running or waiting for a person").requiredOption(
|
|
23200
|
+
"--attempt <id>",
|
|
23201
|
+
"The attempt's id"
|
|
23202
|
+
);
|
|
23203
|
+
bindOperation(cancel, cancelReviewerAttemptOperation, (options, submission) => ({
|
|
23204
|
+
...scoped5(options, submission),
|
|
23205
|
+
attempt: options.attempt ?? ""
|
|
23206
|
+
}));
|
|
23207
|
+
}
|
|
21779
23208
|
|
|
21780
23209
|
// src/commands/readiness.ts
|
|
21781
23210
|
function getFormat2(command, reporter) {
|
|
@@ -21803,17 +23232,17 @@ function mcpRequestHeaders(options, target) {
|
|
|
21803
23232
|
if (token) headers.authorization = `Bearer ${token}`;
|
|
21804
23233
|
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
21805
23234
|
}
|
|
21806
|
-
async function openPackage(
|
|
23235
|
+
async function openPackage(path14) {
|
|
21807
23236
|
let info;
|
|
21808
23237
|
try {
|
|
21809
|
-
info = await stat(
|
|
23238
|
+
info = await stat(path14);
|
|
21810
23239
|
} catch {
|
|
21811
|
-
throw usageError(`Package path "${
|
|
23240
|
+
throw usageError(`Package path "${path14}" does not exist.`);
|
|
21812
23241
|
}
|
|
21813
23242
|
if (info.isDirectory()) {
|
|
21814
|
-
return { source: createDirectoryPluginFileSource(
|
|
23243
|
+
return { source: createDirectoryPluginFileSource(path14) };
|
|
21815
23244
|
}
|
|
21816
|
-
const bytes = new Uint8Array(await readFile(
|
|
23245
|
+
const bytes = new Uint8Array(await readFile(path14));
|
|
21817
23246
|
return {
|
|
21818
23247
|
source: await createZipPluginFileSource(bytes),
|
|
21819
23248
|
// The RAW central directory, read before the zip library normalizes it:
|
|
@@ -21923,17 +23352,17 @@ async function runOpenAICheck(target, options, command) {
|
|
|
21923
23352
|
const exitCode = directoryReadinessExitCode(result);
|
|
21924
23353
|
if (exitCode !== 0) setProcessExitCode(exitCode);
|
|
21925
23354
|
}
|
|
21926
|
-
async function readSubmissionProfile(
|
|
23355
|
+
async function readSubmissionProfile(path14) {
|
|
21927
23356
|
let text;
|
|
21928
23357
|
try {
|
|
21929
|
-
text = await readFile(
|
|
23358
|
+
text = await readFile(path14, "utf8");
|
|
21930
23359
|
} catch {
|
|
21931
|
-
throw usageError(`Cannot read --submission-profile ${
|
|
23360
|
+
throw usageError(`Cannot read --submission-profile ${path14}.`);
|
|
21932
23361
|
}
|
|
21933
23362
|
try {
|
|
21934
23363
|
return JSON.parse(text);
|
|
21935
23364
|
} catch {
|
|
21936
|
-
throw usageError(`--submission-profile ${
|
|
23365
|
+
throw usageError(`--submission-profile ${path14} is not valid JSON.`);
|
|
21937
23366
|
}
|
|
21938
23367
|
}
|
|
21939
23368
|
async function runMuseCheck(target, options, command) {
|
|
@@ -22033,6 +23462,8 @@ function registerReadinessCommands(program) {
|
|
|
22033
23462
|
await runMuseCheck(url, options, command);
|
|
22034
23463
|
});
|
|
22035
23464
|
registerHostedReadinessCommands(readiness);
|
|
23465
|
+
registerDirectorySubmissionCommands(readiness);
|
|
23466
|
+
registerReviewerAttemptCommands(readiness);
|
|
22036
23467
|
}
|
|
22037
23468
|
function registerHostedReadinessCommands(readiness) {
|
|
22038
23469
|
const start = readiness.command("start").description("Start a hosted readiness run against a saved server");
|
|
@@ -22123,11 +23554,21 @@ function registerHostedReadinessCommands(readiness) {
|
|
|
22123
23554
|
cancelReadinessRunOperation,
|
|
22124
23555
|
(options) => ({ project: options.project, run: options.run })
|
|
22125
23556
|
);
|
|
22126
|
-
const
|
|
23557
|
+
const resume = addProjectOption(
|
|
23558
|
+
readiness.command("resume").description(
|
|
23559
|
+
"Run again a hosted run that stopped on the server. Only the person who started it can."
|
|
23560
|
+
).requiredOption("--run <id>", "Readiness run id")
|
|
23561
|
+
);
|
|
23562
|
+
bindOperation(
|
|
23563
|
+
resume,
|
|
23564
|
+
resumeReadinessRunOperation,
|
|
23565
|
+
(options) => ({ project: options.project, run: options.run })
|
|
23566
|
+
);
|
|
23567
|
+
const report2 = addProjectOption(
|
|
22127
23568
|
readiness.command("report").description("Read a finished hosted run's findings").requiredOption("--run <id>", "Readiness run id")
|
|
22128
23569
|
);
|
|
22129
23570
|
bindOperation(
|
|
22130
|
-
|
|
23571
|
+
report2,
|
|
22131
23572
|
getReadinessReportOperation,
|
|
22132
23573
|
(options) => ({ project: options.project, run: options.run })
|
|
22133
23574
|
);
|
|
@@ -24005,11 +25446,11 @@ function parseConformanceCheckIds(values) {
|
|
|
24005
25446
|
}
|
|
24006
25447
|
return [...new Set(ids)];
|
|
24007
25448
|
}
|
|
24008
|
-
function readPem(
|
|
25449
|
+
function readPem(path14, flag) {
|
|
24009
25450
|
try {
|
|
24010
|
-
return readFileSync(
|
|
25451
|
+
return readFileSync(path14, "utf8");
|
|
24011
25452
|
} catch (error) {
|
|
24012
|
-
throw usageError(`Cannot read ${flag} ${
|
|
25453
|
+
throw usageError(`Cannot read ${flag} ${path14}.`, {
|
|
24013
25454
|
source: error.code ?? String(error)
|
|
24014
25455
|
});
|
|
24015
25456
|
}
|
|
@@ -24039,18 +25480,18 @@ function planConformanceReceiver(options) {
|
|
|
24039
25480
|
let publicOrigin;
|
|
24040
25481
|
let insecure = !tls && insecureFlag;
|
|
24041
25482
|
if (options.publicUrl !== void 0) {
|
|
24042
|
-
const
|
|
25483
|
+
const checked2 = checkCallbackUrl(options.publicUrl, {
|
|
24043
25484
|
flag: "--public-url",
|
|
24044
25485
|
insecureFlag: "--insecure-local-receiver",
|
|
24045
25486
|
allowInsecure: insecureFlag
|
|
24046
25487
|
});
|
|
24047
|
-
if (
|
|
25488
|
+
if (checked2.url.pathname !== "/" || checked2.url.search || checked2.url.hash) {
|
|
24048
25489
|
throw usageError(
|
|
24049
25490
|
"--public-url must be a bare origin (the conformance receiver serves /i/<inbox>/s/<slot> at the root)."
|
|
24050
25491
|
);
|
|
24051
25492
|
}
|
|
24052
|
-
publicOrigin =
|
|
24053
|
-
insecure =
|
|
25493
|
+
publicOrigin = checked2.url.origin;
|
|
25494
|
+
insecure = checked2.insecure;
|
|
24054
25495
|
}
|
|
24055
25496
|
const listen = parseListenAddress(options.listen);
|
|
24056
25497
|
return {
|
|
@@ -24104,9 +25545,9 @@ function renderEventsConformanceTable(result) {
|
|
|
24104
25545
|
`MCP Events conformance \u2014 profile ${result.profile}${result.protocolVersion ? `, protocol ${result.protocolVersion}` : ""}`
|
|
24105
25546
|
];
|
|
24106
25547
|
for (const check of result.checks) {
|
|
24107
|
-
const
|
|
25548
|
+
const note2 = check.status === "passed" ? "" : ` \u2014 ${check.skipReason ? `${check.skipReason}: ` : ""}${check.message}`;
|
|
24108
25549
|
lines.push(
|
|
24109
|
-
` ${STATUS_LABEL[check.status]} ${check.strength.padEnd(6)} ${check.id.padEnd(idWidth)} ${check.title}${
|
|
25550
|
+
` ${STATUS_LABEL[check.status]} ${check.strength.padEnd(6)} ${check.id.padEnd(idWidth)} ${check.title}${note2}`
|
|
24110
25551
|
);
|
|
24111
25552
|
}
|
|
24112
25553
|
const { passed, failed, warned, skipped } = result.summary;
|
|
@@ -24220,12 +25661,12 @@ async function startEventsReceiver(args) {
|
|
|
24220
25661
|
res.writeHead(status, { "content-type": "application/json", ...headers });
|
|
24221
25662
|
res.end(body === void 0 ? "" : JSON.stringify(body));
|
|
24222
25663
|
};
|
|
24223
|
-
const
|
|
24224
|
-
if (req.method === "GET" &&
|
|
25664
|
+
const path14 = (req.url ?? "/").split("?")[0] ?? "/";
|
|
25665
|
+
if (req.method === "GET" && path14 === "/.well-known/mcp-webhook-receiver.json") {
|
|
24225
25666
|
respond(200, { receivers: ["/i/"] });
|
|
24226
25667
|
return;
|
|
24227
25668
|
}
|
|
24228
|
-
const match = DELIVERY_PATH.exec(
|
|
25669
|
+
const match = DELIVERY_PATH.exec(path14);
|
|
24229
25670
|
if (req.method !== "POST" || !match) {
|
|
24230
25671
|
respond(404, { error: "not_found" });
|
|
24231
25672
|
return;
|
|
@@ -24630,16 +26071,16 @@ function planWatchReceiver(options) {
|
|
|
24630
26071
|
let publicUrl;
|
|
24631
26072
|
let insecure = options.insecureLocalReceiver === true && options.publicUrl === void 0;
|
|
24632
26073
|
if (options.publicUrl !== void 0) {
|
|
24633
|
-
const
|
|
26074
|
+
const checked2 = checkCallbackUrl(options.publicUrl, {
|
|
24634
26075
|
flag: "--public-url",
|
|
24635
26076
|
insecureFlag: "--insecure-local-receiver",
|
|
24636
26077
|
allowInsecure: options.insecureLocalReceiver === true
|
|
24637
26078
|
});
|
|
24638
|
-
if (
|
|
26079
|
+
if (checked2.url.search || checked2.url.hash) {
|
|
24639
26080
|
throw usageError("--public-url must not carry a query string or fragment.");
|
|
24640
26081
|
}
|
|
24641
|
-
publicUrl =
|
|
24642
|
-
insecure =
|
|
26082
|
+
publicUrl = checked2.url;
|
|
26083
|
+
insecure = checked2.insecure;
|
|
24643
26084
|
}
|
|
24644
26085
|
return {
|
|
24645
26086
|
forcedMode: "webhook",
|
|
@@ -25304,7 +26745,7 @@ async function runTaskAugmentedToolCall(args) {
|
|
|
25304
26745
|
yes: options.yes
|
|
25305
26746
|
});
|
|
25306
26747
|
const onState = options.taskWatch ? watchStateReporter(globalOptions) : void 0;
|
|
25307
|
-
const
|
|
26748
|
+
const note2 = (message) => {
|
|
25308
26749
|
if (!globalOptions.quiet) process.stderr.write(`${message}
|
|
25309
26750
|
`);
|
|
25310
26751
|
};
|
|
@@ -25356,7 +26797,7 @@ async function runTaskAugmentedToolCall(args) {
|
|
|
25356
26797
|
{ wire: support.wire, result }
|
|
25357
26798
|
);
|
|
25358
26799
|
}
|
|
25359
|
-
|
|
26800
|
+
note2(
|
|
25360
26801
|
`No task materialized: the server answered ${toolName} synchronously. Returning the tool result as-is.`
|
|
25361
26802
|
);
|
|
25362
26803
|
return { aborted: null, created: null, result };
|
|
@@ -27307,7 +28748,7 @@ async function requireBrowserConsentCapability(client) {
|
|
|
27307
28748
|
);
|
|
27308
28749
|
}
|
|
27309
28750
|
}
|
|
27310
|
-
async function post(options,
|
|
28751
|
+
async function post(options, path14, body, timeoutMs) {
|
|
27311
28752
|
if (options.cloud) {
|
|
27312
28753
|
if (options.inspectorUrl || options.consent)
|
|
27313
28754
|
throw usageError(
|
|
@@ -27320,14 +28761,14 @@ async function post(options, path12, body, timeoutMs) {
|
|
|
27320
28761
|
timeoutMs: timeoutMs ?? 12e4
|
|
27321
28762
|
});
|
|
27322
28763
|
return client2.browserSession(
|
|
27323
|
-
|
|
28764
|
+
path14.slice(1),
|
|
27324
28765
|
body
|
|
27325
28766
|
);
|
|
27326
28767
|
}
|
|
27327
28768
|
const client = new InspectorApiClient({ baseUrl: browserBaseUrl(options) });
|
|
27328
28769
|
const consentToken = consentOf(options);
|
|
27329
28770
|
await requireBrowserConsentCapability(client);
|
|
27330
|
-
const result = await client.request(`${BROWSER_ROUTE}${
|
|
28771
|
+
const result = await client.request(`${BROWSER_ROUTE}${path14}`, {
|
|
27331
28772
|
method: "POST",
|
|
27332
28773
|
body,
|
|
27333
28774
|
headers: { [BROWSER_CONSENT_HEADER]: consentToken },
|