fix(console): mirror secure agent setup commands
This commit is contained in:
1 parent
78cb95e288
commit
99dc0fe122
9 files changed
+286
-59
No files matched your search
@@ -30,8 +30,16 @@ export default function ConnectStep({
|
||||
const [language, setLanguage] = useState<SdkLanguage>('node');
|
||||
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL ?? 'http://localhost:8787';
|
||||
const instructions = useMemo(
|
||||
() => buildInstallInstructions(language, { integration, credentials, token, baseUrl }),
|
||||
[baseUrl, credentials, integration, language, token],
|
||||
() => buildInstallInstructions(language, {
|
||||
integration,
|
||||
identity: {
|
||||
agentId: credentials.agentId,
|
||||
kid: credentials.kid,
|
||||
orgId: credentials.orgId,
|
||||
},
|
||||
baseUrl,
|
||||
}),
|
||||
[baseUrl, credentials.agentId, credentials.kid, credentials.orgId, integration, language],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -63,18 +71,50 @@ export default function ConnectStep({
|
||||
<h3 id="setup-command-label" className="section-label">
|
||||
{integration.mode === 'adapter' ? t('agentRegistration.install') : t('agentRegistration.configure')}
|
||||
</h3>
|
||||
<CopyControl value={instructions.setup} />
|
||||
<CopyControl
|
||||
value={instructions.setup}
|
||||
ariaLabel={t('agentRegistration.copySetup')}
|
||||
/>
|
||||
</div>
|
||||
<pre className="p-4 bg-ink text-[#EAEAE5] font-mono text-[10px] leading-relaxed whitespace-pre-wrap break-all overflow-x-auto">
|
||||
{instructions.setup}
|
||||
</pre>
|
||||
</section>
|
||||
|
||||
<div>
|
||||
<div
|
||||
className="border-y border-border"
|
||||
role="group"
|
||||
aria-label={t('agentRegistration.steps.credentials')}
|
||||
>
|
||||
<div className="flex items-center justify-between py-2 border-b border-border">
|
||||
<span className="section-label">{t('agentRegistration.privateKey')}</span>
|
||||
<CopyControl
|
||||
value={credentials.privateKey}
|
||||
ariaLabel={t('agentRegistration.copyPrivateKey')}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between py-2">
|
||||
<span className="section-label">{t('agentRegistration.apiToken')}</span>
|
||||
<CopyControl
|
||||
value={token}
|
||||
ariaLabel={t('agentRegistration.copyApiToken')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<p className="mt-2 font-mono text-[10px] text-ink-dim">
|
||||
{t(`agentRegistration.secretDelivery.${instructions.secretDelivery}`)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{instructions.usage && (
|
||||
<section aria-labelledby="record-operation-label">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<h3 id="record-operation-label" className="section-label">{t('agentRegistration.record')}</h3>
|
||||
<CopyControl value={instructions.usage} />
|
||||
<CopyControl
|
||||
value={instructions.usage}
|
||||
ariaLabel={t('agentRegistration.copyUsage')}
|
||||
/>
|
||||
</div>
|
||||
<pre className="p-4 bg-ink text-[#EAEAE5] font-mono text-[10px] leading-relaxed whitespace-pre-wrap break-all overflow-x-auto">
|
||||
{instructions.usage}
|
||||
@@ -86,7 +126,10 @@ export default function ConnectStep({
|
||||
<section aria-labelledby="verify-command-label">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<h3 id="verify-command-label" className="section-label">{t('agentRegistration.verify')}</h3>
|
||||
<CopyControl value={instructions.verify} />
|
||||
<CopyControl
|
||||
value={instructions.verify}
|
||||
ariaLabel={t('agentRegistration.copyVerify')}
|
||||
/>
|
||||
</div>
|
||||
<code className="block px-3 py-2 border-y border-border font-mono text-[11px] text-ink">
|
||||
{instructions.verify}
|
||||
|
||||
@@ -6,9 +6,10 @@ import { useTranslation } from 'react-i18next';
|
||||
interface CopyControlProps {
|
||||
readonly value: string;
|
||||
readonly className?: string;
|
||||
readonly ariaLabel?: string;
|
||||
}
|
||||
|
||||
export default function CopyControl({ value, className = '' }: CopyControlProps) {
|
||||
export default function CopyControl({ value, className = '', ariaLabel }: CopyControlProps) {
|
||||
const { t } = useTranslation();
|
||||
const [status, setStatus] = useState<'idle' | 'copied' | 'failed'>('idle');
|
||||
|
||||
@@ -26,6 +27,7 @@ export default function CopyControl({ value, className = '' }: CopyControlProps)
|
||||
<button
|
||||
type="button"
|
||||
onClick={copy}
|
||||
aria-label={ariaLabel}
|
||||
className="font-mono text-[10px] uppercase tracking-wider text-ink-dim hover:text-ink"
|
||||
>
|
||||
{status === 'copied' ? t('common.copied') : t('common.copy')}
|
||||
|
||||
@@ -83,7 +83,10 @@ export default function CredentialsStep({
|
||||
<h3 id="private-key-label" className="section-label text-red-700">
|
||||
{t('agentRegistration.privateKeySaveNow')}
|
||||
</h3>
|
||||
<CopyControl value={credentials.privateKey} />
|
||||
<CopyControl
|
||||
value={credentials.privateKey}
|
||||
ariaLabel={t('agentRegistration.copyPrivateKey')}
|
||||
/>
|
||||
</div>
|
||||
<code className="block p-3 bg-ink text-[#EAEAE5] font-mono text-[10px] break-all select-all">
|
||||
{credentials.privateKey}
|
||||
@@ -104,7 +107,10 @@ export default function CredentialsStep({
|
||||
<span className="font-mono text-[10px] text-ink-dim">
|
||||
{t('agentRegistration.tokenIssued')}
|
||||
</span>
|
||||
<CopyControl value={token} />
|
||||
<CopyControl
|
||||
value={token}
|
||||
ariaLabel={t('agentRegistration.copyApiToken')}
|
||||
/>
|
||||
</div>
|
||||
<code className="block p-3 bg-ink text-[#EAEAE5] font-mono text-[10px] break-all select-all">
|
||||
{token}
|
||||
|
||||
Reference in new issue
Block a user