@llmnative/runner 1.3.0 → 1.4.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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="robots" content="noindex" />
7
7
  <title>Runner setup</title>
8
- <script type="module" crossorigin src="./assets/index-wu52h7ow.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-C8qoeNuR.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-XKyaHtl9.js">
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-CmPc3Q2I.css">
11
11
  </head>
package/dist/steps.js CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`1.3.0`,t=`sherpadvisorylab/llmnative-runner`,n={systems:[`Ubuntu 22.04 or newer`,`Debian 12 or newer`],architectures:[`x86_64`,`arm64`],cpus:2,memoryGb:4,diskGb:20,ports:[22,80,443]},r=/^(?=.{4,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,i=e=>r.test(e.trim().toLowerCase()),a=(n=e)=>`https://github.com/${t}/releases/download/v${n}/install.sh`,o=(t=e)=>`${a(t)}.sha256`;function s({domain:e,maxChats:t}){return[`--domain`,(e=>`'${e.replace(/'/g,`'\\''`)}'`)(e.trim().toLowerCase()),...t?[`--max-chats`,String(t)]:[]]}function c(e){return`curl -fsSL ${a(e.version)} | sudo sh -s -- ${s(e).join(` `)}`}function l(e){let t=e.version??`1.3.0`;return[`curl -fsSLO ${a(t)}`,`curl -fsSL ${o(t)} | sha256sum -c -`,`sudo sh install.sh ${s(e).join(` `)}`]}var u=[{id:`server`},{id:`dns`,check:`dns`},{id:`access`},{id:`install`},{id:`pair`,check:`health`}];function d(e){let t=t=>RegExp(`^${t}=(.+)$`,`m`).exec(e)?.[1]?.trim(),n=t(`RUNNER_URL`),r=t(`PAIRING_CODE`),i=t(`RUNNER_ERROR`);return{...n?{url:n}:{},...r?{pairingCode:r}:{},...i?{error:i}:{}}}var f=[`check`,`docker`,`files`,`start`,`agent`,`health`,`pair`,`tls`,`done`],p=e=>{let t=/^STEP=([a-z]+)$/.exec(e.trim());return t&&f.includes(t[1])?t[1]:void 0};async function m(e,t={}){let n=t.resolver??`https://cloudflare-dns.com/dns-query`,r=async r=>{let i=await(t.fetch??fetch)(`${n}?name=${encodeURIComponent(e)}&type=${r}`,{headers:{accept:`application/dns-json`}});return i.ok?((await i.json()).Answer??[]).filter(e=>e.type===(r===`A`?1:28)).map(e=>e.data):[]},[i,a]=await Promise.all([r(`A`),r(`AAAA`)]);return[...i,...a]}async function h(e,t=fetch){try{let n=await t(`${e.replace(/\/+$/,``)}/health`);if(!n.ok)return{ok:!1,reason:`not-a-runner`};let r=await n.json();return r.ok&&typeof r.version==`string`?{ok:!0,version:r.version}:{ok:!1,reason:`not-a-runner`}}catch{return{ok:!1,reason:`unreachable`}}}exports.DOMAIN_PATTERN=r,exports.GUIDE_STEPS=u,exports.INSTALL_PHASES=f,exports.RUNNER_REPOSITORY=t,exports.RUNNER_REQUIREMENTS=n,exports.RUNNER_VERSION=e,exports.checkRunner=h,exports.checksumUrl=o,exports.installArguments=s,exports.installCommand=c,exports.installScriptUrl=a,exports.isDomain=i,exports.lookupDomain=m,exports.parseInstallOutput=d,exports.phaseOf=p,exports.verifiedInstallCommands=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`1.4.0`,t=`sherpadvisorylab/llmnative-runner`,n={systems:[`Ubuntu 22.04 or newer`,`Debian 12 or newer`],architectures:[`x86_64`,`arm64`],cpus:2,memoryGb:4,diskGb:20,ports:[22,80,443]},r=/^(?=.{4,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,i=e=>r.test(e.trim().toLowerCase()),a=(n=e)=>`https://github.com/${t}/releases/download/v${n}/install.sh`,o=(t=e)=>`${a(t)}.sha256`;function s({domain:e,maxChats:t}){return[`--domain`,(e=>`'${e.replace(/'/g,`'\\''`)}'`)(e.trim().toLowerCase()),...t?[`--max-chats`,String(t)]:[]]}function c(e){return`curl -fsSL ${a(e.version)} | sudo sh -s -- ${s(e).join(` `)}`}function l(e){let t=e.version??`1.4.0`;return[`curl -fsSLO ${a(t)}`,`curl -fsSL ${o(t)} | sha256sum -c -`,`sudo sh install.sh ${s(e).join(` `)}`]}var u=[{id:`server`},{id:`dns`,check:`dns`},{id:`access`},{id:`install`},{id:`pair`,check:`health`}];function d(e){let t=t=>RegExp(`^${t}=(.+)$`,`m`).exec(e)?.[1]?.trim(),n=t(`RUNNER_URL`),r=t(`PAIRING_CODE`),i=t(`RUNNER_ERROR`);return{...n?{url:n}:{},...r?{pairingCode:r}:{},...i?{error:i}:{}}}var f=[`check`,`docker`,`files`,`start`,`agent`,`health`,`pair`,`tls`,`done`],p=e=>{let t=/^STEP=([a-z]+)$/.exec(e.trim());return t&&f.includes(t[1])?t[1]:void 0};async function m(e,t={}){let n=t.resolver??`https://cloudflare-dns.com/dns-query`,r=async r=>{let i=await(t.fetch??fetch)(`${n}?name=${encodeURIComponent(e)}&type=${r}`,{headers:{accept:`application/dns-json`}});return i.ok?((await i.json()).Answer??[]).filter(e=>e.type===(r===`A`?1:28)).map(e=>e.data):[]},[i,a]=await Promise.all([r(`A`),r(`AAAA`)]);return[...i,...a]}async function h(e,t=fetch){try{let n=await t(`${e.replace(/\/+$/,``)}/health`);if(!n.ok)return{ok:!1,reason:`not-a-runner`};let r=await n.json();return r.ok&&typeof r.version==`string`?{ok:!0,version:r.version}:{ok:!1,reason:`not-a-runner`}}catch{return{ok:!1,reason:`unreachable`}}}exports.DOMAIN_PATTERN=r,exports.GUIDE_STEPS=u,exports.INSTALL_PHASES=f,exports.RUNNER_REPOSITORY=t,exports.RUNNER_REQUIREMENTS=n,exports.RUNNER_VERSION=e,exports.checkRunner=h,exports.checksumUrl=o,exports.installArguments=s,exports.installCommand=c,exports.installScriptUrl=a,exports.isDomain=i,exports.lookupDomain=m,exports.parseInstallOutput=d,exports.phaseOf=p,exports.verifiedInstallCommands=l;
2
2
  //# sourceMappingURL=steps.js.map
package/dist/steps.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/setup/steps.ts
2
- var e = "1.3.0", t = "sherpadvisorylab/llmnative-runner", n = {
2
+ var e = "1.4.0", t = "sherpadvisorylab/llmnative-runner", n = {
3
3
  systems: ["Ubuntu 22.04 or newer", "Debian 12 or newer"],
4
4
  architectures: ["x86_64", "arm64"],
5
5
  cpus: 2,
@@ -22,7 +22,7 @@ function c(e) {
22
22
  return `curl -fsSL ${a(e.version)} | sudo sh -s -- ${s(e).join(" ")}`;
23
23
  }
24
24
  function l(e) {
25
- let t = e.version ?? "1.3.0";
25
+ let t = e.version ?? "1.4.0";
26
26
  return [
27
27
  `curl -fsSLO ${a(t)}`,
28
28
  `curl -fsSL ${o(t)} | sha256sum -c -`,
@@ -2,7 +2,7 @@
2
2
  export declare const RUNNER_KEY_PROVIDERS: readonly ['anthropic', 'openai', 'gemini', 'mistral', 'deepseek', 'openrouter'];
3
3
  export type RunnerKeyProvider = (typeof RUNNER_KEY_PROVIDERS)[number];
4
4
  export type RunnerProvider = 'claude-code' | 'opencode-go' | 'opencode' | RunnerKeyProvider;
5
- export type RunnerPermission = 'complete' | 'chat' | 'chat:tools' | 'accounts' | 'accounts:tenant' | 'act-as-user' | 'keys';
5
+ export type RunnerPermission = 'complete' | 'chat' | 'chat:tools' | 'accounts' | 'accounts:tenant' | 'act-as-user' | 'keys' | 'modules';
6
6
  export type RunnerAccount = {
7
7
  provider: RunnerProvider;
8
8
  id: string;
@@ -195,6 +195,7 @@ export declare class RunnerClient {
195
195
  version: string;
196
196
  harnesses: string[];
197
197
  capabilities: Record<string, boolean>;
198
+ modules?: string[];
198
199
  permissions: RunnerPermission[];
199
200
  tenant?: string;
200
201
  }>;
@@ -248,6 +249,8 @@ export declare class RunnerClient {
248
249
  /** A key: OpenCode Go/Zen, or the API key of a provider by use the runner keeps (opencode runs it). */
249
250
  addKey: (provider: Exclude<RunnerProvider, 'claude-code'>, key: string, label?: string) => Promise<RunnerAccount>;
250
251
  remove: (provider: RunnerProvider, id: string) => Promise<boolean>;
252
+ /** The name of an account (its email, say); empty: none. */
253
+ rename: (provider: RunnerProvider, id: string, label: string) => Promise<RunnerAccount[]>;
251
254
  order: (provider: RunnerProvider, ids: string[]) => Promise<RunnerAccount[]>;
252
255
  };
253
256
  models(): Promise<RunnerModels>;
@@ -7,9 +7,13 @@ export type RunnerAccountsProps = {
7
7
  scope: 'user' | 'tenant';
8
8
  locale?: string;
9
9
  texts?: Partial<RunnerUiTexts>;
10
- /** Called after an account was added or removed (the host refreshes its list of models). */
10
+ /** Called after an account was added, removed, renamed or moved (the host refreshes its list of models). */
11
11
  onChange?: (accounts: RunnerAccount[]) => void;
12
12
  /** What can be added here: default the subscriptions and, for a tenant, the API keys of the providers by use too. */
13
13
  providers?: RunnerProvider[];
14
+ /** What the host shows under the accounts of a subscription, e.g. the model its chats start with. */
15
+ renderProvider?: (provider: RunnerProvider, accounts: RunnerAccount[]) => React.ReactNode;
16
+ /** Called when a modal of its own opens over the page (true) and closes: the host dims the one below. */
17
+ onStack?: (open: boolean) => void;
14
18
  };
15
- export declare function RunnerAccounts({ client, scope, locale, texts, onChange, providers }: RunnerAccountsProps): React.JSX.Element;
19
+ export declare function RunnerAccounts({ client, scope, locale, texts, onChange, providers, renderProvider, onStack }: RunnerAccountsProps): React.JSX.Element;
@@ -80,10 +80,11 @@ export type RunnersSettingsProps = {
80
80
  };
81
81
  export declare function RunnersSettings({ fleet, locale, texts }: RunnersSettingsProps): React.JSX.Element;
82
82
  /** Adding a runner: the three ways, in one modal. */
83
- export declare function AddRunner({ fleet, t, locale, onClose, onAdded }: {
83
+ export declare function AddRunner({ fleet, t, locale, onClose, onAdded, position }: {
84
84
  fleet: RunnerFleet;
85
85
  t: RunnerUiTexts;
86
86
  locale?: string;
87
87
  onClose: () => void;
88
- onAdded: (entry: RunnerEntry) => void | Promise<void>;
88
+ onAdded: (entry: RunnerEntry) => void | Promise<void>; /** Where the modal opens: centered (default) or on the right, over another. */
89
+ position?: 'center' | 'right';
89
90
  }): React.JSX.Element;
@@ -25,6 +25,26 @@ export declare const en: {
25
25
  keyProvider: string;
26
26
  keyLabel: string;
27
27
  termsNote: string;
28
+ accountsSection: string;
29
+ accountsByUse: string;
30
+ accountsAdd: string;
31
+ accountsAvailable: string;
32
+ accountsAddedOn: string;
33
+ accountsUnnamed: string;
34
+ accountsOrderHint: string;
35
+ accountsName: string;
36
+ accountsRenameTitle: string;
37
+ accountsRenameAria: string;
38
+ accountsRemoveAria: string;
39
+ accountsSave: string;
40
+ claudeMultiWarning: string;
41
+ claudeCopy: string;
42
+ claudeCopied: string;
43
+ claudeManual: string;
44
+ claudeBackToLogin: string;
45
+ claudeTokenIntro: string;
46
+ claudeToken: string;
47
+ keyAddOf: string;
28
48
  guideTitle: string;
29
49
  guideServerTitle: string;
30
50
  guideServer: string;
@@ -175,6 +195,26 @@ export declare const runnerTexts: {
175
195
  keyProvider: string;
176
196
  keyLabel: string;
177
197
  termsNote: string;
198
+ accountsSection: string;
199
+ accountsByUse: string;
200
+ accountsAdd: string;
201
+ accountsAvailable: string;
202
+ accountsAddedOn: string;
203
+ accountsUnnamed: string;
204
+ accountsOrderHint: string;
205
+ accountsName: string;
206
+ accountsRenameTitle: string;
207
+ accountsRenameAria: string;
208
+ accountsRemoveAria: string;
209
+ accountsSave: string;
210
+ claudeMultiWarning: string;
211
+ claudeCopy: string;
212
+ claudeCopied: string;
213
+ claudeManual: string;
214
+ claudeBackToLogin: string;
215
+ claudeTokenIntro: string;
216
+ claudeToken: string;
217
+ keyAddOf: string;
178
218
  guideTitle: string;
179
219
  guideServerTitle: string;
180
220
  guideServer: string;
@@ -322,6 +362,26 @@ export declare const runnerTexts: {
322
362
  keyProvider: string;
323
363
  keyLabel: string;
324
364
  termsNote: string;
365
+ accountsSection: string;
366
+ accountsByUse: string;
367
+ accountsAdd: string;
368
+ accountsAvailable: string;
369
+ accountsAddedOn: string;
370
+ accountsUnnamed: string;
371
+ accountsOrderHint: string;
372
+ accountsName: string;
373
+ accountsRenameTitle: string;
374
+ accountsRenameAria: string;
375
+ accountsRemoveAria: string;
376
+ accountsSave: string;
377
+ claudeMultiWarning: string;
378
+ claudeCopy: string;
379
+ claudeCopied: string;
380
+ claudeManual: string;
381
+ claudeBackToLogin: string;
382
+ claudeTokenIntro: string;
383
+ claudeToken: string;
384
+ keyAddOf: string;
325
385
  guideTitle: string;
326
386
  guideServerTitle: string;
327
387
  guideServer: string;
package/dist/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./client.js"),l=require("./steps.js");let u=require("react");u=s(u,1);let d=require("@llmnative/react"),f=require("react/jsx-runtime"),p=require("react-dom");var m={accountsTitleUser:`My subscriptions`,accountsTitleTenant:`Subscriptions of the tenant`,accountsIntroUser:`Connect your own subscription: it is used only for your requests. Without one, the API keys of the workspace are used.`,accountsIntroTenant:`Accounts used by everyone of the tenant, after their own.`,accountsEmpty:`No subscription connected.`,accountsNoCredit:`Limit reached, back at {at}`,accountsConnected:`Connected {at}`,accountsRemove:`Disconnect`,accountsRemoveConfirm:`Disconnect {name}? Its token is deleted from the runner.`,claudeConnect:`Connect Claude`,claudeStep1:`Open the page of Anthropic and sign in with your Claude account (Pro or Max).`,claudeOpen:`Open the page of Anthropic`,claudeStep2:`Anthropic shows a code: paste it here.`,claudeCode:`Code`,claudeLabel:`Name (optional)`,claudeLabelPlaceholder:`Personal Max`,claudeFinish:`Connect`,claudeRefused:`Anthropic did not accept the code: start again.`,claudeNoLink:`The runner could not start the sign-in. Try again in a minute.`,opencodeConnect:`Add OpenCode Go`,opencodeKey:`API key of OpenCode Go`,opencodeAdd:`Add`,keyConnect:`Add a key`,keyProvider:`Provider`,keyLabel:`API key of {provider}`,termsNote:`A Pro or Max subscription is personal: connect only your own.`,guideTitle:`Install a runner by hand`,guideServerTitle:`1. A VPS`,guideServer:`Any provider works. It needs {systems}, at least {cpus} cores, {memory} GB of memory and {disk} GB of disk, with ports {ports} open.`,guideDnsTitle:`2. The domain`,guideDns:`In the DNS of your domain, create a record A for the runner (e.g. runner.example.com) with the IP address of the VPS.`,guideDomain:`Domain of the runner`,guideCheckDns:`Check`,guideDnsOk:`The domain points to {ips}.`,guideDnsMissing:`The domain does not point anywhere yet: DNS changes can take some minutes.`,guideAccessTitle:`3. Enter the VPS`,guideAccess:`From a terminal: ssh root@<IP of the VPS>. Or open the web console of your provider.`,guideInstallTitle:`4. Run the installer`,guideInstall:`Paste this command and press Enter. It takes 3–10 minutes.`,guideVerified:`Prefer to check the script first?`,guideCopy:`Copy`,guideCopied:`Copied`,guidePairTitle:`5. Connect it`,guidePair:`At the end the installer prints a pairing code (valid 15 minutes). Paste it here.`,guideCheckHealth:`Check the runner`,guideHealthOk:`The runner {version} answers at {url}.`,guideHealthKo:`No runner answers at {url} yet: check the domain and that ports 80 and 443 are open.`,guideTroubleTitle:`If something goes wrong`,guideTrouble:`"port is used": another web server is running (stop it). "certificate": the domain does not point to the VPS yet. Run the command again at any time: nothing is lost.`,runnersTitle:`Runners`,runnersIntro:`The servers where Claude Code and opencode run. Each tenant uses one of them.`,runnersEmpty:`No runner yet.`,runnersAdd:`Add a runner`,runnersDefault:`Default for new tenants`,runnersDraining:`Draining (no new chats)`,runnersRemove:`Remove`,runnersRemoveConfirm:`Remove {name}? Its tenants must be moved first.`,runnersLoad:`{chats} of {max} chats`,runnersTenants:`{count} tenants`,runnersUnreachable:`Not reachable`,runnersVersion:`Version {version}`,distributionTitle:`Tenants`,distributionIntro:`Which runner each tenant uses. Moving a tenant asks its people to connect their subscriptions again.`,distributionRunner:`Runner`,distributionNone:`None`,addTitle:`Add a runner`,addAutomatic:`Install it for me`,addAutomaticHint:`Give the access to a new VPS: the runner is installed and connected by itself.`,addGuided:`Guide me`,addGuidedHint:`Step by step instructions to install it by hand.`,addExisting:`It is already installed`,addExistingHint:`Its address: you approve on the runner.`,addName:`Name`,addNamePlaceholder:`Runner Europe 1`,addUrl:`Address`,addCode:`Pairing code`,addConnect:`Connect`,addHost:`IP address of the VPS`,addPort:`SSH port`,addUser:`User`,addAuth:`Access`,addKey:`Private SSH key`,addLocalKey:`The SSH key of this computer`,addLocalKeyHint:`The key ~/.ssh/config gives this host (or ~/.ssh/id_ed25519), and its user when it says one: leave the user empty to take it from there.`,addPassword:`Password`,addInstall:`Install`,addInstalling:`Installing…`,addCredentialsNote:`The access is used only for this installation and is not kept.`,addBack:`Back`,addDone:`The runner is connected.`,error:`Something went wrong: {error}`,consoleTitle:`Runner console`,consoleSignIn:`Sign in`,consoleToken:`Admin token`,consoleTokenHint:`On the VPS: docker compose -f /opt/llmnative-runner/compose.yaml exec runner node src/cli.ts admin-token`,consoleSignOut:`Sign out`,consoleStatus:`Status`,consoleMachine:`{memory} GB of memory free of {total}, {cpus} cores`,consolePairing:`Connect a platform`,consolePairingHint:`A code to connect this runner to a CMS or a studio (15 minutes, once).`,consoleNewCode:`New pairing code`,consoleCode:`Code: {code} (until {at})`,consoleTenants:`Tenants`,consoleNewTenant:`New tenant`,consoleTenantId:`Id (lowercase, digits, -)`,consoleTenantName:`Name`,consoleCreate:`Create`,consoleKeys:`Keys`,consoleNewKey:`New key`,consoleKeyShown:`The key, shown this once: {key}`,consoleRevoke:`Revoke`,consoleRemoveTenant:`Remove tenant`,consoleRemoveTenantConfirm:`Remove {name}, its keys and chats?`,consoleAccounts:`Accounts`,pairNext:`Continue`,pairWaitingTitle:`Approve on the runner`,pairWaitingHint:`Open the runner and approve the request: check that it shows this same code.`,pairOpen:`Open the runner to approve`,pairWaiting:`Waiting for the approval… (until {at})`,pairDenied:`The request was refused on the runner.`,pairExpired:`The request expired: ask again.`,pairAgain:`Ask again`,pairWithCode:`I have a pairing code`,pairWithApproval:`Approve on the runner instead`,consoleRequests:`Requests to connect`,consoleRequestsHint:`A platform asked to connect to this runner. Approve only if you asked from there and the code is the one it shows.`,consoleRequestsEmpty:`No requests waiting.`,consoleRequestFrom:`{name}, from {from}, asked at {at}`,consoleRequestProject:`For the project «{project}»: it will see only its tenants ({project}, {project}-…).`,consoleRequestAll:`Without a project: it will see every tenant of this runner.`,consolePlatforms:`Connected platforms`,consolePlatformsHint:`Who connected this runner. A platform of a project sees only the tenants of its project; one without a project (connected before 1.2) sees them all: give it its project.`,consolePlatformsEmpty:`No platform connected.`,consolePlatformAll:`every tenant`,consolePlatformProject:`Project`,consolePlatformSave:`Save`,consolePlatformRevokeConfirm:`Disconnect {name}? It will no longer reach this runner.`,consoleRequestMatch:`The request you opened`,consoleApprove:`Approve`,consoleDeny:`Refuse`,consoleApproved:`Approved: {name} is connected.`,consoleDenied:`Refused.`,consoleRemember:`Remember on this browser`,close:`Close`,cancel:`Cancel`},h={accountsTitleUser:`I miei abbonamenti`,accountsTitleTenant:`Abbonamenti del tenant`,accountsIntroUser:`Collega il tuo abbonamento: lo usano solo le tue richieste. Senza, si usano le API key del workspace.`,accountsIntroTenant:`Account usati da tutti nel tenant, dopo i loro.`,accountsEmpty:`Nessun abbonamento collegato.`,accountsNoCredit:`Limite raggiunto, torna alle {at}`,accountsConnected:`Collegato il {at}`,accountsRemove:`Scollega`,accountsRemoveConfirm:`Scollegare {name}? Il token viene cancellato dal runner.`,claudeConnect:`Collega Claude`,claudeStep1:`Apri la pagina di Anthropic ed entra con il tuo account Claude (Pro o Max).`,claudeOpen:`Apri la pagina di Anthropic`,claudeStep2:`Anthropic mostra un codice: incollalo qui.`,claudeCode:`Codice`,claudeLabel:`Nome (facoltativo)`,claudeLabelPlaceholder:`Max personale`,claudeFinish:`Collega`,claudeRefused:`Anthropic non ha accettato il codice: ricomincia.`,claudeNoLink:`Il runner non è riuscito ad avviare l'accesso. Riprova tra un minuto.`,opencodeConnect:`Aggiungi OpenCode Go`,opencodeKey:`API key di OpenCode Go`,opencodeAdd:`Aggiungi`,keyConnect:`Aggiungi una chiave`,keyProvider:`Provider`,keyLabel:`API key di {provider}`,termsNote:`Un abbonamento Pro o Max è personale: collega solo il tuo.`,guideTitle:`Installa un runner a mano`,guideServerTitle:`1. Una VPS`,guideServer:`Va bene qualunque fornitore. Servono {systems}, almeno {cpus} core, {memory} GB di memoria e {disk} GB di disco, con le porte {ports} aperte.`,guideDnsTitle:`2. Il dominio`,guideDns:`Nel DNS del tuo dominio crea un record A per il runner (es. runner.example.com) con l'indirizzo IP della VPS.`,guideDomain:`Dominio del runner`,guideCheckDns:`Controlla`,guideDnsOk:`Il dominio punta a {ips}.`,guideDnsMissing:`Il dominio non punta ancora da nessuna parte: le modifiche al DNS possono richiedere qualche minuto.`,guideAccessTitle:`3. Entra nella VPS`,guideAccess:`Da un terminale: ssh root@<IP della VPS>. Oppure apri la console web del fornitore.`,guideInstallTitle:`4. Lancia l'installazione`,guideInstall:`Incolla questo comando e premi Invio. Ci vogliono 3–10 minuti.`,guideVerified:`Preferisci controllare lo script prima?`,guideCopy:`Copia`,guideCopied:`Copiato`,guidePairTitle:`5. Collegalo`,guidePair:`Alla fine l'installazione stampa un codice di abbinamento (valido 15 minuti). Incollalo qui.`,guideCheckHealth:`Controlla il runner`,guideHealthOk:`Il runner {version} risponde su {url}.`,guideHealthKo:`Nessun runner risponde ancora su {url}: controlla il dominio e che le porte 80 e 443 siano aperte.`,guideTroubleTitle:`Se qualcosa non va`,guideTrouble:`"port is used": c'è già un altro server web (fermalo). "certificate": il dominio non punta ancora alla VPS. Puoi rilanciare il comando quando vuoi: non si perde niente.`,runnersTitle:`Runner`,runnersIntro:`I server dove girano Claude Code e opencode. Ogni tenant ne usa uno.`,runnersEmpty:`Nessun runner.`,runnersAdd:`Aggiungi un runner`,runnersDefault:`Predefinito per i nuovi tenant`,runnersDraining:`In svuotamento (niente chat nuove)`,runnersRemove:`Rimuovi`,runnersRemoveConfirm:`Rimuovere {name}? Prima vanno spostati i suoi tenant.`,runnersLoad:`{chats} chat su {max}`,runnersTenants:`{count} tenant`,runnersUnreachable:`Non raggiungibile`,runnersVersion:`Versione {version}`,distributionTitle:`Tenant`,distributionIntro:`Quale runner usa ogni tenant. Spostare un tenant chiede alle sue persone di ricollegare gli abbonamenti.`,distributionRunner:`Runner`,distributionNone:`Nessuno`,addTitle:`Aggiungi un runner`,addAutomatic:`Installalo tu`,addAutomaticHint:`Dai l'accesso a una VPS nuova: il runner si installa e si collega da solo.`,addGuided:`Guidami`,addGuidedHint:`Istruzioni passo passo per installarlo a mano.`,addExisting:`È già installato`,addExistingHint:`Il suo indirizzo: approvi sul runner.`,addName:`Nome`,addNamePlaceholder:`Runner Europa 1`,addUrl:`Indirizzo`,addCode:`Codice di abbinamento`,addConnect:`Collega`,addHost:`Indirizzo IP della VPS`,addPort:`Porta SSH`,addUser:`Utente`,addAuth:`Accesso`,addKey:`Chiave SSH privata`,addLocalKey:`La chiave SSH di questo computer`,addLocalKeyHint:`La chiave che ~/.ssh/config indica per questo host (o ~/.ssh/id_ed25519), e il suo utente se lo indica: lascia vuoto l'utente per prenderlo da lì.`,addPassword:`Password`,addInstall:`Installa`,addInstalling:`Installazione in corso…`,addCredentialsNote:`L'accesso serve solo per questa installazione e non viene salvato.`,addBack:`Indietro`,addDone:`Il runner è collegato.`,error:`Qualcosa è andato storto: {error}`,consoleTitle:`Console del runner`,consoleSignIn:`Entra`,consoleToken:`Token di amministrazione`,consoleTokenHint:`Sulla VPS: docker compose -f /opt/llmnative-runner/compose.yaml exec runner node src/cli.ts admin-token`,consoleSignOut:`Esci`,consoleStatus:`Stato`,consoleMachine:`{memory} GB di memoria liberi su {total}, {cpus} core`,consolePairing:`Collega una piattaforma`,consolePairingHint:`Un codice per collegare questo runner a un CMS o a uno studio (15 minuti, una volta).`,consoleNewCode:`Nuovo codice di abbinamento`,consoleCode:`Codice: {code} (fino alle {at})`,consoleTenants:`Tenant`,consoleNewTenant:`Nuovo tenant`,consoleTenantId:`Id (minuscole, cifre, -)`,consoleTenantName:`Nome`,consoleCreate:`Crea`,consoleKeys:`Chiavi`,consoleNewKey:`Nuova chiave`,consoleKeyShown:`La chiave, mostrata solo ora: {key}`,consoleRevoke:`Revoca`,consoleRemoveTenant:`Rimuovi tenant`,consoleRemoveTenantConfirm:`Rimuovere {name}, le sue chiavi e le sue chat?`,consoleAccounts:`Account`,pairNext:`Continua`,pairWaitingTitle:`Approva sul runner`,pairWaitingHint:`Apri il runner e approva la richiesta: controlla che mostri questo stesso codice.`,pairOpen:`Apri il runner per approvare`,pairWaiting:`In attesa dell'approvazione… (fino alle {at})`,pairDenied:`La richiesta è stata rifiutata sul runner.`,pairExpired:`La richiesta è scaduta: chiedi di nuovo.`,pairAgain:`Chiedi di nuovo`,pairWithCode:`Ho un codice di abbinamento`,pairWithApproval:`Approva sul runner invece`,consoleRequests:`Richieste di collegamento`,consoleRequestsHint:`Una piattaforma ha chiesto di collegarsi a questo runner. Approva solo se l'hai chiesto tu da lì e il codice è quello che mostra.`,consoleRequestsEmpty:`Nessuna richiesta in attesa.`,consoleRequestFrom:`{name}, da {from}, alle {at}`,consoleRequestProject:`Per il progetto «{project}»: vedrà solo i suoi tenant ({project}, {project}-…).`,consoleRequestAll:`Senza progetto: vedrà tutti i tenant di questo runner.`,consolePlatforms:`Piattaforme collegate`,consolePlatformsHint:`Chi ha collegato questo runner. Una piattaforma di un progetto vede solo i tenant del suo progetto; una senza progetto (collegata prima della 1.2) li vede tutti: assegnale il suo progetto.`,consolePlatformsEmpty:`Nessuna piattaforma collegata.`,consolePlatformAll:`tutti i tenant`,consolePlatformProject:`Progetto`,consolePlatformSave:`Salva`,consolePlatformRevokeConfirm:`Scollegare {name}? Non raggiungerà più questo runner.`,consoleRequestMatch:`La richiesta che hai aperto`,consoleApprove:`Approva`,consoleDeny:`Rifiuta`,consoleApproved:`Approvata: {name} è collegato.`,consoleDenied:`Rifiutata.`,consoleRemember:`Ricorda su questo browser`,close:`Chiudi`,cancel:`Annulla`},g={en:m,it:h};function _(e,t){let n=e&&e.toLowerCase().startsWith(`it`)?h:m;return t?{...n,...t}:n}var v=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),y={"claude-code":`Claude Code`,"opencode-go":`OpenCode Go`,opencode:`OpenCode Zen`,anthropic:`Anthropic`,openai:`OpenAI`,gemini:`Gemini`,mistral:`Mistral`,deepseek:`DeepSeek`,openrouter:`OpenRouter`},b=[`claude-code`,`opencode-go`],x=e=>new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`});function S({client:e,scope:t,locale:n,texts:r,onChange:i,providers:a}){let o=_(n,r),s=a??(t===`tenant`?[...b,`opencode`,...c.RUNNER_KEY_PROVIDERS]:b),l=s.filter(e=>e!==`claude-code`),[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),[S,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(null),O=(0,u.useCallback)(async()=>{try{let{accounts:t}=await e.accounts.list();return m(t),g(null),t}catch(e){return g(e instanceof c.RunnerError?e.code:String(e)),m([]),[]}},[e]);(0,u.useEffect)(()=>{O()},[O]);let k=async()=>{T(null);let e=await O();i?.(e)};return(0,f.jsxs)(d.Card,{title:t===`user`?o.accountsTitleUser:o.accountsTitleTenant,loading:p===null,loaderMinHeight:120,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===`user`?o.accountsIntroUser:o.accountsIntroTenant}),h&&(0,f.jsx)(d.Alert,{variant:`danger`,children:v(o.error,{error:h})}),p?.length===0&&!h&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.accountsEmpty}),p?.map(e=>(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-border p-3`,children:[(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.label??y[e.provider]??e.provider}),(0,f.jsx)(d.Badge,{variant:`secondary`,children:y[e.provider]??e.provider}),e.noCreditUntil&&(0,f.jsx)(d.Badge,{variant:`warning`,children:v(o.accountsNoCredit,{at:x(e.noCreditUntil)})})]}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v(o.accountsConnected,{at:x(e.at)})})]}),(0,f.jsx)(d.ActionButton,{icon:`unlink`,label:o.accountsRemove,variant:`outline-danger`,onClick:()=>D(e)})]},`${e.provider}/${e.id}`)),S===`claude`&&(0,f.jsx)(C,{client:e,t:o,onDone:k,onCancel:()=>T(null)}),S===`key`&&(0,f.jsx)(w,{client:e,t:o,providers:l,onDone:k,onCancel:()=>T(null)}),!S&&(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[s.includes(`claude-code`)&&(0,f.jsx)(d.ActionButton,{icon:`plus`,label:o.claudeConnect,variant:`primary`,onClick:()=>T(`claude`)}),l.length>0&&(0,f.jsx)(d.ActionButton,{icon:`plus`,label:l.length===1&&l[0]===`opencode-go`?o.opencodeConnect:o.keyConnect,variant:`outline-secondary`,onClick:()=>T(`key`)})]}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o.termsNote})]}),E&&(0,f.jsx)(d.ModalYesNo,{title:o.accountsRemove,danger:!0,onClose:()=>D(null),onYes:async()=>(await e.accounts.remove(E.provider,E.id).catch(()=>!1),D(null),await k(),!0),children:v(o.accountsRemoveConfirm,{name:E.label??y[E.provider]??E.provider})})]})}function C({client:e,t,onDone:n,onCancel:r}){let[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(``),[l,p]=(0,u.useState)(``),[m,h]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let n=!1;return e.accounts.startClaudeLogin().then(({url:e})=>!n&&a(e)).catch(()=>!n&&h(t.claudeNoLink)),()=>{n=!0}},[e,t]),(0,f.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border border-border p-3`,children:[m&&(0,f.jsx)(d.Alert,{variant:`danger`,children:m}),(0,f.jsx)(`p`,{className:`text-sm`,children:t.claudeStep1}),(0,f.jsx)(`div`,{children:(0,f.jsx)(d.ActionButton,{icon:`external-link`,label:t.claudeOpen,variant:`primary`,disabled:!i,onClick:()=>i&&window.open(i,`_blank`,`noopener,noreferrer`)})}),(0,f.jsx)(`p`,{className:`text-sm`,children:t.claudeStep2}),(0,f.jsxs)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:[(0,f.jsx)(d.String,{name:`code`,label:t.claudeCode,autoComplete:`off`,onChange:({value:e})=>s(String(e??``))}),(0,f.jsx)(d.String,{name:`label`,label:t.claudeLabel,placeholder:t.claudeLabelPlaceholder,onChange:({value:e})=>p(String(e??``))})]}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:t.claudeFinish,variant:`primary`,disabled:!i||!o.trim(),onClick:async()=>{try{await e.accounts.finishClaudeLogin(o.trim(),l.trim()||void 0),n()}catch(e){h(e instanceof c.RunnerError&&e.code===`refused`?t.claudeRefused:v(t.error,{error:e instanceof c.RunnerError?e.code:String(e)}))}}}),(0,f.jsx)(d.ActionButton,{label:t.cancel,variant:`outline-secondary`,onClick:r})]})]})}function w({client:e,t,providers:n,onDone:r,onCancel:i}){let[a,o]=(0,u.useState)(n[0]),[s,l]=(0,u.useState)(``),[p,m]=(0,u.useState)(``),[h,g]=(0,u.useState)(null);return(0,f.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border border-border p-3`,children:[h&&(0,f.jsx)(d.Alert,{variant:`danger`,children:h}),(0,f.jsxs)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:[n.length>1&&(0,f.jsx)(d.Select,{name:`provider`,label:t.keyProvider,defaultValue:a,options:n.map(e=>({label:y[e]??e,value:e})),onChange:({value:e})=>o(String(e??n[0]))}),(0,f.jsx)(d.Password,{name:`key`,label:v(t.keyLabel,{provider:y[a]??a}),autoComplete:`off`,onChange:({value:e})=>l(String(e??``))}),(0,f.jsx)(d.String,{name:`label`,label:t.claudeLabel,onChange:({value:e})=>m(String(e??``))})]}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:t.opencodeAdd,variant:`primary`,disabled:!s.trim(),onClick:async()=>{try{await e.accounts.addKey(a,s.trim(),p.trim()||void 0),r()}catch(e){g(v(t.error,{error:e instanceof c.RunnerError?e.code:String(e)}))}}}),(0,f.jsx)(d.ActionButton,{label:t.cancel,variant:`outline-secondary`,onClick:i})]})]})}function T({title:e,children:t,done:n}){return(0,f.jsxs)(`section`,{className:`flex flex-col gap-2 border-l-2 border-border pl-4`,children:[(0,f.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[e,n&&(0,f.jsx)(d.Badge,{variant:`success`,children:`✓`})]}),t]})}function E({locale:e,texts:t,onPair:n,lookup:r=e=>l.lookupDomain(e),check:i=l.checkRunner,version:a}){let o=_(e,t),[s,c]=(0,u.useState)(``),[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),[y,b]=(0,u.useState)(``),[x,S]=(0,u.useState)(!1),[C,w]=(0,u.useState)(null),E=l.isDomain(s),D=`https://${s.trim().toLowerCase()}`,O=l.RUNNER_REQUIREMENTS;return(0,f.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,f.jsx)(T,{title:o.guideServerTitle,children:(0,f.jsx)(`p`,{className:`text-sm`,children:v(o.guideServer,{systems:O.systems.join(`, `),cpus:O.cpus,memory:O.memoryGb,disk:O.diskGb,ports:O.ports.join(`, `)})})}),(0,f.jsxs)(T,{title:o.guideDnsTitle,done:!!p?.ips.length,children:[(0,f.jsx)(`p`,{className:`text-sm`,children:o.guideDns}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:(0,f.jsx)(d.String,{name:`domain`,label:o.guideDomain,placeholder:`runner.example.com`,autoComplete:`off`,onChange:({value:e})=>{c(String(e??``)),m(null),g(null)}})}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:o.guideCheckDns,variant:`outline-secondary`,disabled:!E,onClick:async()=>m({ips:await r(s.trim().toLowerCase()).catch(()=>[])})}),p&&(p.ips.length?(0,f.jsx)(d.Alert,{variant:`success`,appearance:`text`,children:v(o.guideDnsOk,{ips:p.ips.join(`, `)})}):(0,f.jsx)(d.Alert,{variant:`warning`,appearance:`text`,children:o.guideDnsMissing}))]})]}),(0,f.jsx)(T,{title:o.guideAccessTitle,children:(0,f.jsx)(`p`,{className:`text-sm`,children:o.guideAccess})}),(0,f.jsxs)(T,{title:o.guideInstallTitle,children:[(0,f.jsx)(`p`,{className:`text-sm`,children:o.guideInstall}),(0,f.jsx)(d.Code,{language:`bash`,showCopy:!0,children:l.installCommand({domain:E?s:`runner.example.com`,...a?{version:a}:{}})}),(0,f.jsx)(`div`,{children:(0,f.jsx)(d.ActionButton,{label:o.guideVerified,variant:`link`,onClick:()=>S(e=>!e)})}),x&&(0,f.jsx)(d.Code,{language:`bash`,showCopy:!0,children:l.verifiedInstallCommands({domain:E?s:`runner.example.com`,...a?{version:a}:{}}).join(`
2
- `)})]}),(0,f.jsxs)(T,{title:o.guidePairTitle,done:h?.ok,children:[(0,f.jsx)(`p`,{className:`text-sm`,children:o.guidePair}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:(0,f.jsx)(d.String,{name:`code`,label:o.addCode,placeholder:`ABCD-EFGH`,autoComplete:`off`,onChange:({value:e})=>b(String(e??``))})}),h&&(0,f.jsx)(d.Alert,{variant:h.ok?`success`:`warning`,appearance:`text`,children:h.text}),C&&(0,f.jsx)(d.Alert,{variant:`danger`,children:C}),(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:o.guideCheckHealth,variant:`outline-secondary`,disabled:!E,onClick:async()=>{let e=await i(D);g(e.ok?{ok:!0,text:v(o.guideHealthOk,{version:e.version,url:D})}:{ok:!1,text:v(o.guideHealthKo,{url:D})})}}),(0,f.jsx)(d.LoadingButton,{label:o.addConnect,variant:`primary`,disabled:!E||y.trim().length<8,onClick:async()=>{try{w(null),await n({url:D,code:y.trim()})}catch(e){w(v(o.error,{error:e.message}))}}})]})]}),(0,f.jsx)(T,{title:o.guideTroubleTitle,children:(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.guideTrouble})})]})}function D({fleet:e,locale:t,texts:n}){let r=_(t,n),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(null),[c,l]=(0,u.useState)(!1),[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),y=(0,u.useCallback)(async()=>{try{let t=await e.list();a(t);let n=await Promise.all(t.map(t=>e.status(t.id).catch(()=>null)));a(t.map((e,t)=>({...e,status:n[t]}))),e.tenants&&s(await e.tenants.list())}catch(e){g(v(r.error,{error:e.message})),a([])}},[e,r]);(0,u.useEffect)(()=>{y()},[y]);let b=async(t,n)=>{await e.update(t,n),await y()};return(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,f.jsx)(d.Card,{header:(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`h3`,{className:`flex-1 text-base font-semibold`,children:r.runnersTitle}),(0,f.jsx)(d.ActionButton,{icon:`plus`,label:r.runnersAdd,variant:`primary`,onClick:()=>l(!0)})]}),loading:i===null,loaderMinHeight:120,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.runnersIntro}),h&&(0,f.jsx)(d.Alert,{variant:`danger`,children:h}),i?.length===0&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.runnersEmpty}),i?.map(e=>(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-border p-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.url}),e.status===null&&(0,f.jsx)(d.Badge,{variant:`danger`,children:r.runnersUnreachable}),e.status&&(0,f.jsx)(d.Badge,{variant:`secondary`,children:v(r.runnersVersion,{version:e.status.version})}),e.status&&(0,f.jsx)(d.Badge,{variant:`info`,children:v(r.runnersLoad,{chats:e.status.load.chats,max:e.status.load.maxChats})}),e.status&&(0,f.jsx)(d.Badge,{variant:`light`,children:v(r.runnersTenants,{count:e.status.tenants.length})}),(0,f.jsx)(`div`,{className:`ml-auto`,children:(0,f.jsx)(d.ActionButton,{icon:`trash`,label:r.runnersRemove,variant:`outline-danger`,onClick:()=>m(e)})})]}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,defaultValues:{isDefault:e.isDefault?`true`:``,draining:e.draining?`true`:``},children:(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,f.jsx)(d.Switch,{name:`isDefault`,label:r.runnersDefault,valueChecked:`true`,onChange:({value:t})=>void b(e.id,{isDefault:!!t})}),(0,f.jsx)(d.Switch,{name:`draining`,label:r.runnersDraining,valueChecked:`true`,onChange:({value:t})=>void b(e.id,{draining:!!t})})]})})]},e.id))]})}),e.tenants&&i&&i.length>0&&(0,f.jsx)(d.Card,{title:r.distributionTitle,loading:o===null,loaderMinHeight:80,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.distributionIntro}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,defaultValues:Object.fromEntries((o??[]).map(e=>[`runner_${e.id}`,e.runnerId??``])),children:(o??[]).map(t=>(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`min-w-40 flex-1 text-sm`,children:t.name}),(0,f.jsx)(d.Select,{name:`runner_${t.id}`,title:r.distributionRunner,placeholderOption:{label:r.distributionNone,value:``},options:i.map(e=>({label:e.name,value:e.id})),onChange:({value:n})=>{n&&e.tenants.assign(t.id,String(n)).then(y)}})]},t.id))})]})}),c&&(0,f.jsx)(A,{fleet:e,t:r,locale:t,onClose:()=>l(!1),onAdded:async()=>{l(!1),await y()}}),p&&(0,f.jsx)(d.ModalYesNo,{title:r.runnersRemove,danger:!0,onClose:()=>m(null),onYes:async()=>(await e.remove(p.id).catch(e=>g(v(r.error,{error:e.message}))),m(null),await y(),!0),children:v(r.runnersRemoveConfirm,{name:p.name})})]})}function O({target:e,children:t}){return e?(0,p.createPortal)(t,e):null}var k=e=>{try{return new URL(e).hostname}catch{return e}};function A({fleet:e,t,locale:n,onClose:r,onAdded:i}){let[a,o]=(0,u.useState)(`choose`),[s,c]=(0,u.useState)(null),[l,p]=(0,u.useState)(null),m=(0,u.useCallback)(e=>c(v(t.error,{error:e.message})),[t]);return(0,f.jsx)(d.Modal,{title:t.addTitle,size:`lg`,onClose:r,footer:a===`choose`||a===`guided`?!1:(0,f.jsx)(`div`,{ref:p,className:`flex w-full flex-wrap items-center justify-end gap-3`}),children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[s&&(0,f.jsx)(d.Alert,{variant:`danger`,children:s}),a===`choose`&&(0,f.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[e.install&&(0,f.jsx)(j,{title:t.addAutomatic,hint:t.addAutomaticHint,onClick:()=>o(`automatic`)}),(0,f.jsx)(j,{title:t.addGuided,hint:t.addGuidedHint,onClick:()=>o(`guided`)}),(0,f.jsx)(j,{title:t.addExisting,hint:t.addExistingHint,onClick:()=>o(`existing`)})]}),a!==`choose`&&(0,f.jsx)(`div`,{children:(0,f.jsx)(d.ActionButton,{icon:`arrow-left`,label:t.addBack,variant:`link`,onClick:()=>{o(`choose`),c(null)}})}),a===`automatic`&&e.install&&(0,f.jsx)(L,{t,footer:l,localKeys:!!e.localKeys,install:(t,n,r)=>e.install({name:t,domain:t,access:n},r),onDone:i,onError:m}),a===`guided`&&(0,f.jsx)(E,{locale:n,texts:t,onPair:async({url:t,code:n})=>{await i(await e.add({name:k(t),url:t,code:n}))}}),a===`existing`&&(0,f.jsx)(F,{t,footer:l,pairing:e.startPairing&&e.pairingStatus?{start:e.startPairing.bind(e),status:e.pairingStatus.bind(e)}:void 0,onAdded:i,onError:m,onClearError:()=>c(null),onConnect:async(t,n)=>{try{await i(await e.add({name:k(t),url:t,code:n}))}catch(e){m(e)}}})]})})}function j({title:e,hint:t,onClick:n}){return(0,f.jsxs)(`button`,{type:`button`,onClick:n,className:`rounded-lg border border-border p-4 text-left transition-colors hover:border-primary hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,f.jsx)(`span`,{className:`block font-medium`,children:e}),(0,f.jsx)(`span`,{className:`mt-1 block text-sm text-muted-foreground`,children:t})]})}var M=e=>(/^https?:\/\//.test(e.trim())?e.trim():`https://${e.trim()}`).replace(/\/+$/,``),N=e=>new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}),P=5;function F({t:e,footer:t,pairing:n,onAdded:r,onError:i,onClearError:a,onConnect:o}){let[s,c]=(0,u.useState)(``),[l,p]=(0,u.useState)(``),[m,h]=(0,u.useState)(!n),[g,_]=(0,u.useState)(null),[y,b]=(0,u.useState)(null);return(0,u.useEffect)(()=>{if(!g||!n)return;let e=!1,t=0,a,o=async()=>{try{let i=await n.status(g.id);if(t=0,e)return;if(i.status===`approved`){await r(i.runner);return}if(i.status!==`pending`){b(i.status),_(null);return}}catch(n){t+=1,!e&&t>=P&&i(n)}e||(a=setTimeout(()=>void o(),2e3))};return a=setTimeout(()=>void o(),2e3),()=>{e=!0,clearTimeout(a)}},[g,n,r,i]),g?(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`h4`,{className:`font-semibold`,children:e.pairWaitingTitle}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.pairWaitingHint}),(0,f.jsx)(`div`,{className:`rounded-lg border border-border p-4 text-center font-mono text-3xl font-semibold tracking-widest`,children:g.code}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:v(e.pairWaiting,{at:N(g.expiresAt)})}),(0,f.jsx)(O,{target:t,children:(0,f.jsx)(d.ActionButton,{icon:`external-link`,label:e.pairOpen,variant:`primary`,onClick:()=>window.open(g.approveUrl,`_blank`,`noopener`)})})]}):(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[y&&(0,f.jsx)(d.Alert,{variant:y===`denied`?`danger`:`warning`,children:y===`denied`?e.pairDenied:e.pairExpired}),(0,f.jsxs)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,defaultValues:{url:s,code:l},children:[(0,f.jsx)(d.String,{name:`url`,label:e.addUrl,placeholder:`https://runner.example.com`,onChange:({value:e})=>c(String(e??``))}),m&&(0,f.jsx)(d.String,{name:`code`,label:e.addCode,placeholder:`ABCD-EFGH`,autoComplete:`off`,onChange:({value:e})=>p(String(e??``))})]}),(0,f.jsxs)(O,{target:t,children:[n&&(0,f.jsx)(d.ActionButton,{label:m?e.pairWithApproval:e.pairWithCode,variant:`link`,onClick:()=>h(e=>!e)}),m?(0,f.jsx)(d.LoadingButton,{label:e.addConnect,variant:`primary`,disabled:!s.trim()||l.trim().length<8,onClick:()=>o(M(s),l.trim())}):(0,f.jsx)(d.LoadingButton,{label:y?e.pairAgain:e.pairNext,variant:`primary`,disabled:!s.trim(),onClick:async()=>{b(null),a();try{let e=M(s);_(await n.start({name:k(e),url:e}))}catch(e){i(e)}}})]})]})}var I=[`check`,`docker`,`files`,`start`,`agent`,`health`,`pair`,`tls`,`done`];function L({t:e,footer:t,localKeys:n,install:r,onDone:i,onError:a}){let[o,s]=(0,u.useState)({host:``,port:`22`,username:n?``:`root`,auth:n?`local`:`key`,privateKey:``,password:``,domain:``}),[c,l]=(0,u.useState)([]),[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(!1),_=e=>({value:t})=>s(n=>({...n,[e]:String(t??``)})),v=o.host.trim()&&o.domain.trim()&&(o.auth===`local`||o.username.trim())&&(o.auth===`local`||(o.auth===`key`?o.privateKey.trim():o.password));return(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!h&&(0,f.jsxs)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,defaultValues:o,children:[(0,f.jsx)(d.String,{name:`domain`,label:e.guideDomain,placeholder:`runner.example.com`,onChange:_(`domain`)}),(0,f.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,f.jsx)(d.String,{name:`host`,label:e.addHost,placeholder:`203.0.113.10`,onChange:_(`host`)}),(0,f.jsx)(d.String,{name:`port`,label:e.addPort,onChange:_(`port`)}),(0,f.jsx)(d.String,{name:`username`,label:e.addUser,onChange:_(`username`)})]}),(0,f.jsx)(d.Select,{name:`auth`,label:e.addAuth,options:[...n?[{label:e.addLocalKey,value:`local`}]:[],{label:e.addKey,value:`key`},{label:e.addPassword,value:`password`}],onChange:_(`auth`)}),o.auth===`local`&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.addLocalKeyHint}),o.auth===`local`?null:o.auth===`key`?(0,f.jsx)(d.TextArea,{name:`privateKey`,label:e.addKey,placeholder:`-----BEGIN OPENSSH PRIVATE KEY-----`,onChange:_(`privateKey`)}):(0,f.jsx)(d.Password,{name:`password`,label:e.addPassword,autoComplete:`off`,onChange:_(`password`)})]}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.addCredentialsNote}),h&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:I.map(e=>(0,f.jsx)(d.Badge,{variant:p===e?`primary`:I.indexOf(e)<I.indexOf(p??`check`)?`success`:`light`,children:e},e))}),c.length>0&&(0,f.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-md bg-muted p-2 text-xs`,children:c.slice(-200).join(`
3
- `)}),(0,f.jsx)(O,{target:t,children:(0,f.jsx)(d.LoadingButton,{label:h?e.addInstalling:e.addInstall,variant:`primary`,disabled:!v||h,onClick:async()=>{g(!0),l([]);try{await i(await r(o.domain.trim().toLowerCase(),{host:o.host.trim(),port:Number(o.port)||22,username:o.username.trim(),...o.auth===`key`?{privateKey:o.privateKey}:o.auth===`password`?{password:o.password}:{}},({line:e,phase:t})=>{t&&m(t),/^[A-Z_]+=/.test(e)||l(t=>[...t,e])}))}catch(e){a(e)}finally{g(!1)}}})})]})}var R=e=>(e/1024**3).toFixed(1),z=e=>new Date(e).toLocaleString(void 0,{dateStyle:`short`,timeStyle:`short`});function B({client:e,locale:t,texts:n,onSignOut:r,approve:i}){let a=_(t,n),[o,s]=(0,u.useState)(null),[l,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(null),[g,y]=(0,u.useState)({id:``,name:``}),[b,x]=(0,u.useState)(null),S=(0,u.useCallback)(async()=>{try{s(await e.platform.status()),p(null)}catch(e){p(v(a.error,{error:e instanceof c.RunnerError?e.code:String(e)}))}},[e,a]);return(0,u.useEffect)(()=>{S()},[S]),(0,f.jsxs)(`div`,{className:`mx-auto flex max-w-4xl flex-col gap-4 p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h1`,{className:`flex-1 text-xl font-semibold`,children:a.consoleTitle}),r&&(0,f.jsx)(d.ActionButton,{icon:`log-out`,label:a.consoleSignOut,variant:`outline-secondary`,onClick:r})]}),l&&(0,f.jsx)(d.Alert,{variant:`danger`,children:l}),(0,f.jsx)(W,{client:e,t:a,approve:i,onAnswered:S}),(0,f.jsx)(d.Card,{title:a.consoleStatus,loading:!o&&!l,loaderMinHeight:100,children:o&&(0,f.jsx)(d.DescriptionList,{items:[{label:`Version`,value:o.version},{label:`URL`,value:o.url},{label:`Chats`,value:`${o.load.chats} / ${o.load.maxChats}`},{label:`Machine`,value:v(a.consoleMachine,{memory:R(o.machine.availableBytes),total:R(o.machine.totalBytes),cpus:o.machine.cpus})},{label:`Agent`,value:o.agentImage}]})}),(0,f.jsx)(d.Card,{title:a.consolePairing,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.consolePairingHint}),m&&(0,f.jsx)(d.Code,{showCopy:!0,children:m.code}),m&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v(a.consoleCode,{code:m.code,at:z(m.expiresAt)})}),(0,f.jsx)(`div`,{children:(0,f.jsx)(d.LoadingButton,{label:a.consoleNewCode,variant:`outline-primary`,onClick:async()=>h(await e.createPairing())})})]})}),(0,f.jsx)(V,{client:e,t:a}),(0,f.jsx)(d.Card,{title:a.consoleTenants,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[b&&(0,f.jsx)(d.Alert,{variant:`warning`,onClose:()=>x(null),children:(0,f.jsx)(`span`,{className:`break-all`,children:v(a.consoleKeyShown,{key:b})})}),o?.tenants.map(n=>(0,f.jsx)(H,{client:e,tenant:n,t:a,locale:t,onKey:x,onChange:S},n.id)),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:(0,f.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto] sm:items-end`,children:[(0,f.jsx)(d.String,{name:`tenantId`,label:a.consoleTenantId,placeholder:`acme`,onChange:({value:e})=>y(t=>({...t,id:String(e??``)}))}),(0,f.jsx)(d.String,{name:`tenantName`,label:a.consoleTenantName,placeholder:`Acme`,onChange:({value:e})=>y(t=>({...t,name:String(e??``)}))}),(0,f.jsx)(d.LoadingButton,{label:a.consoleCreate,variant:`primary`,disabled:!/^[a-z0-9][a-z0-9-]{0,62}$/.test(g.id),onClick:async()=>{try{let t=await e.platform.createTenant(g.id,{name:g.name||void 0});t.key&&x(t.key),await S()}catch(e){p(v(a.error,{error:e instanceof c.RunnerError?e.code:String(e)}))}}})]})})]})})]})}function V({client:e,t}){let[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)({}),[o,s]=(0,u.useState)(null),c=(0,u.useCallback)(async()=>r(await e.platform.platformKeys()),[e]);return(0,u.useEffect)(()=>{c()},[c]),(0,f.jsxs)(d.Card,{title:t.consolePlatforms,loading:!n,loaderMinHeight:60,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consolePlatformsHint}),n&&!n.length&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consolePlatformsEmpty}),n?.map(n=>{let r=i[n.id]??n.project??``;return(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:(0,f.jsxs)(`div`,{className:`grid gap-2 rounded-md border border-border p-3 sm:grid-cols-[1fr_12rem_auto] sm:items-end`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:n.name}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[z(n.createdAt),` · `,n.project??t.consolePlatformAll]})]}),(0,f.jsx)(d.String,{name:`project-${n.id}`,label:t.consolePlatformProject,value:r,placeholder:`crm`,onChange:({value:e})=>a(t=>({...t,[n.id]:String(e??``).trim()}))}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:t.consolePlatformSave,variant:`outline-primary`,disabled:r===(n.project??``)||r!==``&&!/^[a-z0-9]{1,32}$/.test(r),onClick:async()=>{await e.setKeyProject(n.id,r||null),await c()}}),(0,f.jsx)(d.ActionButton,{icon:`trash`,label:t.consoleRevoke,variant:`outline-danger`,onClick:()=>s(n)})]})]})},n.id)})]}),o&&(0,f.jsx)(d.ModalYesNo,{title:t.consoleRevoke,danger:!0,onClose:()=>s(null),onYes:async()=>(await e.platform.revokePlatformKey(o.id),s(null),await c(),!0),children:v(t.consolePlatformRevokeConfirm,{name:o.name})})]})}function H({client:e,tenant:t,t:n,locale:r,onKey:i,onChange:a}){let[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(null),[p,m]=(0,u.useState)(!1),h=(0,u.useMemo)(()=>e.as({tenant:t.id}),[e,t.id]),g=(0,u.useCallback)(async()=>l(await e.platform.keys(t.id)),[e,t.id]);return(0,u.useEffect)(()=>{o&&g()},[o,g]),(0,f.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`flex-1 text-left font-medium`,onClick:()=>s(e=>!e),children:[t.name,` `,(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.id,`)`]})]}),t.usersWithAccounts!==void 0&&(0,f.jsxs)(d.Badge,{variant:`light`,children:[t.usersWithAccounts,` 👤`]}),(0,f.jsx)(d.ActionButton,{icon:`trash`,label:n.consoleRemoveTenant,variant:`outline-danger`,onClick:()=>m(!0)})]}),o&&(0,f.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:n.consoleKeys}),c?.map(r=>(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,f.jsx)(`span`,{className:`flex-1`,children:r.name}),r.permissions.map(e=>(0,f.jsx)(d.Badge,{variant:`info`,children:e},e)),(0,f.jsx)(d.ActionButton,{label:n.consoleRevoke,variant:`outline-danger`,onClick:async()=>{await e.platform.revokeKey(t.id,r.id),await g()}})]},r.id)),(0,f.jsx)(`div`,{children:(0,f.jsx)(d.LoadingButton,{label:n.consoleNewKey,variant:`outline-secondary`,onClick:async()=>{i((await e.platform.createKey(t.id,{name:`console`,permissions:[`complete`,`chat`,`chat:tools`,`accounts`,`act-as-user`]})).key),await g()}})}),(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:n.consoleAccounts}),(0,f.jsx)(S,{client:h,scope:`tenant`,locale:r,texts:n})]}),p&&(0,f.jsx)(d.ModalYesNo,{title:n.consoleRemoveTenant,danger:!0,onClose:()=>m(!1),onYes:async()=>(await e.platform.removeTenant(t.id),m(!1),await a(),!0),children:v(n.consoleRemoveTenantConfirm,{name:t.name})})]})}var U=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,``);function W({client:e,t,approve:n,onAnswered:r}){let[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(null),c=(0,u.useCallback)(async()=>{try{let t=await e.pairingRequests(),r=n?U(n):``;a([...t].sort((e,t)=>Number(U(t.code)===r)-Number(U(e.code)===r)))}catch{a([])}},[e,n]);return(0,u.useEffect)(()=>{c();let e=setInterval(()=>void c(),5e3);return()=>clearInterval(e)},[c]),!n&&!i?.length&&!o?null:(0,f.jsx)(d.Card,{title:t.consoleRequests,loading:i===null,loaderMinHeight:80,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consoleRequestsHint}),o&&(0,f.jsx)(d.Alert,{variant:o.variant,children:o.text}),i?.length===0&&!o&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consoleRequestsEmpty}),i?.map(i=>{let a=!!n&&U(i.code)===U(n),o=async n=>{let a=await e.answerPairing(i.code,n);s(n?{variant:`success`,text:v(t.consoleApproved,{name:a.name})}:{variant:`info`,text:t.consoleDenied}),await c(),await r()};return(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3 ${a?`border-primary`:`border-border`}`,children:[a&&(0,f.jsx)(d.Badge,{variant:`primary`,children:t.consoleRequestMatch}),(0,f.jsx)(`div`,{className:`font-mono text-2xl font-semibold tracking-widest`,children:i.code}),(0,f.jsx)(`p`,{className:`text-sm`,children:v(t.consoleRequestFrom,{name:i.name,from:i.from??`?`,at:z(i.createdAt)})}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i.project?v(t.consoleRequestProject,{project:i.project}):t.consoleRequestAll}),(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:t.consoleApprove,variant:`primary`,onClick:()=>o(!0)}),(0,f.jsx)(d.LoadingButton,{label:t.consoleDeny,variant:`outline-danger`,onClick:()=>o(!1)})]})]},i.code)})]})})}exports.AddRunner=A,exports.InstallGuide=E,exports.RunnerAccounts=S,exports.RunnerConsole=B,exports.RunnersSettings=D,exports.fill=v,exports.runnerTexts=g,exports.textsFor=_;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./client.js"),l=require("./steps.js");let u=require("react");u=s(u,1);let d=require("@llmnative/react"),f=require("react/jsx-runtime"),p=require("react-dom");var m={accountsTitleUser:`My subscriptions`,accountsTitleTenant:`Subscriptions of the tenant`,accountsIntroUser:`Connect your own subscription: it is used only for your requests. Without one, the API keys of the workspace are used.`,accountsIntroTenant:`Accounts used by everyone of the tenant, after their own.`,accountsEmpty:`No subscription connected.`,accountsNoCredit:`Limit reached, back at {at}`,accountsConnected:`Connected {at}`,accountsRemove:`Disconnect`,accountsRemoveConfirm:`Disconnect {name}? Its token is deleted from the runner.`,claudeConnect:`Connect Claude`,claudeStep1:`Open the page of Anthropic and sign in with your Claude account (Pro or Max).`,claudeOpen:`Open the page of Anthropic`,claudeStep2:`Anthropic shows a code: paste it here.`,claudeCode:`Code`,claudeLabel:`Name (optional)`,claudeLabelPlaceholder:`Personal Max`,claudeFinish:`Connect`,claudeRefused:`Anthropic did not accept the code: start again.`,claudeNoLink:`The runner could not start the sign-in. Try again in a minute.`,opencodeConnect:`Add OpenCode Go`,opencodeKey:`API key of OpenCode Go`,opencodeAdd:`Add`,keyConnect:`Add a key`,keyProvider:`Provider`,keyLabel:`API key of {provider}`,termsNote:`A Pro or Max subscription is personal: connect only your own.`,accountsSection:`{name} ({count})`,accountsByUse:`API keys of the providers by use ({count})`,accountsAdd:`Add subscription`,accountsAvailable:`Available`,accountsAddedOn:`Added on {date}`,accountsUnnamed:`Account {n}`,accountsOrderHint:`They are used in this order: when one runs out of credit, the turn goes to the next. Drag a card, or use the arrows on its handle, to change it.`,accountsName:`Name (the email of the account)`,accountsRenameTitle:`Name of the account`,accountsRenameAria:`Rename {name}`,accountsRemoveAria:`Disconnect {name}`,accountsSave:`Save`,claudeMultiWarning:`Pro and Max are personal subscriptions: Anthropic does not allow several accounts to get around the limits, and doing so risks suspension. Add only the subscription of another person who makes it available, or seats of Claude Team or Enterprise.`,claudeCopy:`Copy the link`,claudeCopied:`Link copied`,claudeManual:`I have a token made with claude setup-token`,claudeBackToLogin:`Sign in with Anthropic instead`,claudeTokenIntro:`Run claude setup-token on a computer signed in to the account, then paste the token it prints.`,claudeToken:`Token (claude setup-token)`,keyAddOf:`Add {provider}`,guideTitle:`Install a runner by hand`,guideServerTitle:`1. A VPS`,guideServer:`Any provider works. It needs {systems}, at least {cpus} cores, {memory} GB of memory and {disk} GB of disk, with ports {ports} open.`,guideDnsTitle:`2. The domain`,guideDns:`In the DNS of your domain, create a record A for the runner (e.g. runner.example.com) with the IP address of the VPS.`,guideDomain:`Domain of the runner`,guideCheckDns:`Check`,guideDnsOk:`The domain points to {ips}.`,guideDnsMissing:`The domain does not point anywhere yet: DNS changes can take some minutes.`,guideAccessTitle:`3. Enter the VPS`,guideAccess:`From a terminal: ssh root@<IP of the VPS>. Or open the web console of your provider.`,guideInstallTitle:`4. Run the installer`,guideInstall:`Paste this command and press Enter. It takes 3–10 minutes.`,guideVerified:`Prefer to check the script first?`,guideCopy:`Copy`,guideCopied:`Copied`,guidePairTitle:`5. Connect it`,guidePair:`At the end the installer prints a pairing code (valid 15 minutes). Paste it here.`,guideCheckHealth:`Check the runner`,guideHealthOk:`The runner {version} answers at {url}.`,guideHealthKo:`No runner answers at {url} yet: check the domain and that ports 80 and 443 are open.`,guideTroubleTitle:`If something goes wrong`,guideTrouble:`"port is used": another web server is running (stop it). "certificate": the domain does not point to the VPS yet. Run the command again at any time: nothing is lost.`,runnersTitle:`Runners`,runnersIntro:`The servers where Claude Code and opencode run. Each tenant uses one of them.`,runnersEmpty:`No runner yet.`,runnersAdd:`Add a runner`,runnersDefault:`Default for new tenants`,runnersDraining:`Draining (no new chats)`,runnersRemove:`Remove`,runnersRemoveConfirm:`Remove {name}? Its tenants must be moved first.`,runnersLoad:`{chats} of {max} chats`,runnersTenants:`{count} tenants`,runnersUnreachable:`Not reachable`,runnersVersion:`Version {version}`,distributionTitle:`Tenants`,distributionIntro:`Which runner each tenant uses. Moving a tenant asks its people to connect their subscriptions again.`,distributionRunner:`Runner`,distributionNone:`None`,addTitle:`Add a runner`,addAutomatic:`Install it for me`,addAutomaticHint:`Give the access to a new VPS: the runner is installed and connected by itself.`,addGuided:`Guide me`,addGuidedHint:`Step by step instructions to install it by hand.`,addExisting:`It is already installed`,addExistingHint:`Its address: you approve on the runner.`,addName:`Name`,addNamePlaceholder:`Runner Europe 1`,addUrl:`Address`,addCode:`Pairing code`,addConnect:`Connect`,addHost:`IP address of the VPS`,addPort:`SSH port`,addUser:`User`,addAuth:`Access`,addKey:`Private SSH key`,addLocalKey:`The SSH key of this computer`,addLocalKeyHint:`The key ~/.ssh/config gives this host (or ~/.ssh/id_ed25519), and its user when it says one: leave the user empty to take it from there.`,addPassword:`Password`,addInstall:`Install`,addInstalling:`Installing…`,addCredentialsNote:`The access is used only for this installation and is not kept.`,addBack:`Back`,addDone:`The runner is connected.`,error:`Something went wrong: {error}`,consoleTitle:`Runner console`,consoleSignIn:`Sign in`,consoleToken:`Admin token`,consoleTokenHint:`On the VPS: docker compose -f /opt/llmnative-runner/compose.yaml exec runner node src/cli.ts admin-token`,consoleSignOut:`Sign out`,consoleStatus:`Status`,consoleMachine:`{memory} GB of memory free of {total}, {cpus} cores`,consolePairing:`Connect a platform`,consolePairingHint:`A code to connect this runner to a CMS or a studio (15 minutes, once).`,consoleNewCode:`New pairing code`,consoleCode:`Code: {code} (until {at})`,consoleTenants:`Tenants`,consoleNewTenant:`New tenant`,consoleTenantId:`Id (lowercase, digits, -)`,consoleTenantName:`Name`,consoleCreate:`Create`,consoleKeys:`Keys`,consoleNewKey:`New key`,consoleKeyShown:`The key, shown this once: {key}`,consoleRevoke:`Revoke`,consoleRemoveTenant:`Remove tenant`,consoleRemoveTenantConfirm:`Remove {name}, its keys and chats?`,consoleAccounts:`Accounts`,pairNext:`Continue`,pairWaitingTitle:`Approve on the runner`,pairWaitingHint:`Open the runner and approve the request: check that it shows this same code.`,pairOpen:`Open the runner to approve`,pairWaiting:`Waiting for the approval… (until {at})`,pairDenied:`The request was refused on the runner.`,pairExpired:`The request expired: ask again.`,pairAgain:`Ask again`,pairWithCode:`I have a pairing code`,pairWithApproval:`Approve on the runner instead`,consoleRequests:`Requests to connect`,consoleRequestsHint:`A platform asked to connect to this runner. Approve only if you asked from there and the code is the one it shows.`,consoleRequestsEmpty:`No requests waiting.`,consoleRequestFrom:`{name}, from {from}, asked at {at}`,consoleRequestProject:`For the project «{project}»: it will see only its tenants ({project}, {project}-…).`,consoleRequestAll:`Without a project: it will see every tenant of this runner.`,consolePlatforms:`Connected platforms`,consolePlatformsHint:`Who connected this runner. A platform of a project sees only the tenants of its project; one without a project (connected before 1.2) sees them all: give it its project.`,consolePlatformsEmpty:`No platform connected.`,consolePlatformAll:`every tenant`,consolePlatformProject:`Project`,consolePlatformSave:`Save`,consolePlatformRevokeConfirm:`Disconnect {name}? It will no longer reach this runner.`,consoleRequestMatch:`The request you opened`,consoleApprove:`Approve`,consoleDeny:`Refuse`,consoleApproved:`Approved: {name} is connected.`,consoleDenied:`Refused.`,consoleRemember:`Remember on this browser`,close:`Close`,cancel:`Cancel`},h={accountsTitleUser:`I miei abbonamenti`,accountsTitleTenant:`Abbonamenti del tenant`,accountsIntroUser:`Collega il tuo abbonamento: lo usano solo le tue richieste. Senza, si usano le API key del workspace.`,accountsIntroTenant:`Account usati da tutti nel tenant, dopo i loro.`,accountsEmpty:`Nessun abbonamento collegato.`,accountsNoCredit:`Limite raggiunto, torna alle {at}`,accountsConnected:`Collegato il {at}`,accountsRemove:`Scollega`,accountsRemoveConfirm:`Scollegare {name}? Il token viene cancellato dal runner.`,claudeConnect:`Collega Claude`,claudeStep1:`Apri la pagina di Anthropic ed entra con il tuo account Claude (Pro o Max).`,claudeOpen:`Apri la pagina di Anthropic`,claudeStep2:`Anthropic mostra un codice: incollalo qui.`,claudeCode:`Codice`,claudeLabel:`Nome (facoltativo)`,claudeLabelPlaceholder:`Max personale`,claudeFinish:`Collega`,claudeRefused:`Anthropic non ha accettato il codice: ricomincia.`,claudeNoLink:`Il runner non è riuscito ad avviare l'accesso. Riprova tra un minuto.`,opencodeConnect:`Aggiungi OpenCode Go`,opencodeKey:`API key di OpenCode Go`,opencodeAdd:`Aggiungi`,keyConnect:`Aggiungi una chiave`,keyProvider:`Provider`,keyLabel:`API key di {provider}`,termsNote:`Un abbonamento Pro o Max è personale: collega solo il tuo.`,accountsSection:`{name} ({count})`,accountsByUse:`API key dei provider a consumo ({count})`,accountsAdd:`Aggiungi abbonamento`,accountsAvailable:`Disponibile`,accountsAddedOn:`Aggiunto il {date}`,accountsUnnamed:`Account {n}`,accountsOrderHint:`Si usano in quest'ordine: quando uno finisce il credito, il turno passa al successivo. Trascina una scheda, o usa le frecce della sua maniglia, per cambiarlo.`,accountsName:`Nome (l'email dell'account)`,accountsRenameTitle:`Nome dell'account`,accountsRenameAria:`Rinomina {name}`,accountsRemoveAria:`Scollega {name}`,accountsSave:`Salva`,claudeMultiWarning:`Pro e Max sono abbonamenti personali: Anthropic non consente più account per aggirare i limiti, e farlo rischia la sospensione. Aggiungi solo l’abbonamento di un’altra persona che lo mette a disposizione, o posti di Claude Team o Enterprise.`,claudeCopy:`Copia il link`,claudeCopied:`Link copiato`,claudeManual:`Ho un token fatto con claude setup-token`,claudeBackToLogin:`Entra invece con la pagina di Anthropic`,claudeTokenIntro:`Esegui claude setup-token su un computer collegato all'account, poi incolla il token che stampa.`,claudeToken:`Token (claude setup-token)`,keyAddOf:`Aggiungi {provider}`,guideTitle:`Installa un runner a mano`,guideServerTitle:`1. Una VPS`,guideServer:`Va bene qualunque fornitore. Servono {systems}, almeno {cpus} core, {memory} GB di memoria e {disk} GB di disco, con le porte {ports} aperte.`,guideDnsTitle:`2. Il dominio`,guideDns:`Nel DNS del tuo dominio crea un record A per il runner (es. runner.example.com) con l'indirizzo IP della VPS.`,guideDomain:`Dominio del runner`,guideCheckDns:`Controlla`,guideDnsOk:`Il dominio punta a {ips}.`,guideDnsMissing:`Il dominio non punta ancora da nessuna parte: le modifiche al DNS possono richiedere qualche minuto.`,guideAccessTitle:`3. Entra nella VPS`,guideAccess:`Da un terminale: ssh root@<IP della VPS>. Oppure apri la console web del fornitore.`,guideInstallTitle:`4. Lancia l'installazione`,guideInstall:`Incolla questo comando e premi Invio. Ci vogliono 3–10 minuti.`,guideVerified:`Preferisci controllare lo script prima?`,guideCopy:`Copia`,guideCopied:`Copiato`,guidePairTitle:`5. Collegalo`,guidePair:`Alla fine l'installazione stampa un codice di abbinamento (valido 15 minuti). Incollalo qui.`,guideCheckHealth:`Controlla il runner`,guideHealthOk:`Il runner {version} risponde su {url}.`,guideHealthKo:`Nessun runner risponde ancora su {url}: controlla il dominio e che le porte 80 e 443 siano aperte.`,guideTroubleTitle:`Se qualcosa non va`,guideTrouble:`"port is used": c'è già un altro server web (fermalo). "certificate": il dominio non punta ancora alla VPS. Puoi rilanciare il comando quando vuoi: non si perde niente.`,runnersTitle:`Runner`,runnersIntro:`I server dove girano Claude Code e opencode. Ogni tenant ne usa uno.`,runnersEmpty:`Nessun runner.`,runnersAdd:`Aggiungi un runner`,runnersDefault:`Predefinito per i nuovi tenant`,runnersDraining:`In svuotamento (niente chat nuove)`,runnersRemove:`Rimuovi`,runnersRemoveConfirm:`Rimuovere {name}? Prima vanno spostati i suoi tenant.`,runnersLoad:`{chats} chat su {max}`,runnersTenants:`{count} tenant`,runnersUnreachable:`Non raggiungibile`,runnersVersion:`Versione {version}`,distributionTitle:`Tenant`,distributionIntro:`Quale runner usa ogni tenant. Spostare un tenant chiede alle sue persone di ricollegare gli abbonamenti.`,distributionRunner:`Runner`,distributionNone:`Nessuno`,addTitle:`Aggiungi un runner`,addAutomatic:`Installalo tu`,addAutomaticHint:`Dai l'accesso a una VPS nuova: il runner si installa e si collega da solo.`,addGuided:`Guidami`,addGuidedHint:`Istruzioni passo passo per installarlo a mano.`,addExisting:`È già installato`,addExistingHint:`Il suo indirizzo: approvi sul runner.`,addName:`Nome`,addNamePlaceholder:`Runner Europa 1`,addUrl:`Indirizzo`,addCode:`Codice di abbinamento`,addConnect:`Collega`,addHost:`Indirizzo IP della VPS`,addPort:`Porta SSH`,addUser:`Utente`,addAuth:`Accesso`,addKey:`Chiave SSH privata`,addLocalKey:`La chiave SSH di questo computer`,addLocalKeyHint:`La chiave che ~/.ssh/config indica per questo host (o ~/.ssh/id_ed25519), e il suo utente se lo indica: lascia vuoto l'utente per prenderlo da lì.`,addPassword:`Password`,addInstall:`Installa`,addInstalling:`Installazione in corso…`,addCredentialsNote:`L'accesso serve solo per questa installazione e non viene salvato.`,addBack:`Indietro`,addDone:`Il runner è collegato.`,error:`Qualcosa è andato storto: {error}`,consoleTitle:`Console del runner`,consoleSignIn:`Entra`,consoleToken:`Token di amministrazione`,consoleTokenHint:`Sulla VPS: docker compose -f /opt/llmnative-runner/compose.yaml exec runner node src/cli.ts admin-token`,consoleSignOut:`Esci`,consoleStatus:`Stato`,consoleMachine:`{memory} GB di memoria liberi su {total}, {cpus} core`,consolePairing:`Collega una piattaforma`,consolePairingHint:`Un codice per collegare questo runner a un CMS o a uno studio (15 minuti, una volta).`,consoleNewCode:`Nuovo codice di abbinamento`,consoleCode:`Codice: {code} (fino alle {at})`,consoleTenants:`Tenant`,consoleNewTenant:`Nuovo tenant`,consoleTenantId:`Id (minuscole, cifre, -)`,consoleTenantName:`Nome`,consoleCreate:`Crea`,consoleKeys:`Chiavi`,consoleNewKey:`Nuova chiave`,consoleKeyShown:`La chiave, mostrata solo ora: {key}`,consoleRevoke:`Revoca`,consoleRemoveTenant:`Rimuovi tenant`,consoleRemoveTenantConfirm:`Rimuovere {name}, le sue chiavi e le sue chat?`,consoleAccounts:`Account`,pairNext:`Continua`,pairWaitingTitle:`Approva sul runner`,pairWaitingHint:`Apri il runner e approva la richiesta: controlla che mostri questo stesso codice.`,pairOpen:`Apri il runner per approvare`,pairWaiting:`In attesa dell'approvazione… (fino alle {at})`,pairDenied:`La richiesta è stata rifiutata sul runner.`,pairExpired:`La richiesta è scaduta: chiedi di nuovo.`,pairAgain:`Chiedi di nuovo`,pairWithCode:`Ho un codice di abbinamento`,pairWithApproval:`Approva sul runner invece`,consoleRequests:`Richieste di collegamento`,consoleRequestsHint:`Una piattaforma ha chiesto di collegarsi a questo runner. Approva solo se l'hai chiesto tu da lì e il codice è quello che mostra.`,consoleRequestsEmpty:`Nessuna richiesta in attesa.`,consoleRequestFrom:`{name}, da {from}, alle {at}`,consoleRequestProject:`Per il progetto «{project}»: vedrà solo i suoi tenant ({project}, {project}-…).`,consoleRequestAll:`Senza progetto: vedrà tutti i tenant di questo runner.`,consolePlatforms:`Piattaforme collegate`,consolePlatformsHint:`Chi ha collegato questo runner. Una piattaforma di un progetto vede solo i tenant del suo progetto; una senza progetto (collegata prima della 1.2) li vede tutti: assegnale il suo progetto.`,consolePlatformsEmpty:`Nessuna piattaforma collegata.`,consolePlatformAll:`tutti i tenant`,consolePlatformProject:`Progetto`,consolePlatformSave:`Salva`,consolePlatformRevokeConfirm:`Scollegare {name}? Non raggiungerà più questo runner.`,consoleRequestMatch:`La richiesta che hai aperto`,consoleApprove:`Approva`,consoleDeny:`Rifiuta`,consoleApproved:`Approvata: {name} è collegato.`,consoleDenied:`Rifiutata.`,consoleRemember:`Ricorda su questo browser`,close:`Chiudi`,cancel:`Annulla`},g={en:m,it:h};function _(e,t){let n=e&&e.toLowerCase().startsWith(`it`)?h:m;return t?{...n,...t}:n}var v=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),y={"claude-code":`Claude Code`,"opencode-go":`OpenCode Go`,opencode:`OpenCode Zen`,anthropic:`Anthropic`,openai:`OpenAI`,gemini:`Gemini`,mistral:`Mistral`,deepseek:`DeepSeek`,openrouter:`OpenRouter`},b=[`claude-code`,`opencode-go`],x=e=>y[e]??e,S=e=>new Date(e).toLocaleDateString(void 0,{dateStyle:`medium`}),C=e=>new Date(e).toLocaleString(void 0,{dateStyle:`short`,timeStyle:`short`});function w({client:e,scope:t,locale:n,texts:r,onChange:i,providers:a,renderProvider:o,onStack:s}){let l=_(n,r),p=a??(t===`tenant`?[...b,`opencode`,...c.RUNNER_KEY_PROVIDERS]:b),m=b.filter(e=>p.includes(e)),h=p.filter(e=>!b.includes(e)),[g,y]=(0,u.useState)(null),[x,S]=(0,u.useState)(null),C=(0,u.useCallback)(async()=>{try{let{accounts:t}=await e.accounts.list();return y(t),S(null),t}catch(e){return S(e instanceof c.RunnerError?e.code:String(e)),y([]),[]}},[e]);(0,u.useEffect)(()=>{C()},[C]);let w=async e=>{let t=e??await C();e&&y(e),i?.(t)};return(0,f.jsx)(d.Card,{title:t===`user`?l.accountsTitleUser:l.accountsTitleTenant,loading:g===null,loaderMinHeight:120,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===`user`?l.accountsIntroUser:l.accountsIntroTenant}),x&&(0,f.jsx)(d.Alert,{variant:`danger`,children:v(l.error,{error:x})}),g&&m.map(t=>(0,f.jsx)(T,{client:e,t:l,provider:t,accounts:g.filter(e=>e.provider===t),onChanged:w,onStack:s,extra:o?.(t,g.filter(e=>e.provider===t))},t)),g&&h.length>0&&(0,f.jsx)(T,{client:e,t:l,provider:h,accounts:g.filter(e=>h.includes(e.provider)),onChanged:w,onStack:s}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l.termsNote})]})})}function T({client:e,t,provider:n,accounts:r,onChanged:i,onStack:a,extra:o}){let s=typeof n==`string`?n:void 0,l=s?v(t.accountsSection,{name:x(s),count:String(r.length)}):v(t.accountsByUse,{count:String(r.length)}),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(null),_=e=>{g(e),a?.(e!==null)},[y,b]=(0,u.useState)(null),[w,T]=(0,u.useState)(null),k=(e,n)=>e.label||v(t.accountsUnnamed,{n:String(n+1)}),A=e=>T(v(t.error,{error:e instanceof c.RunnerError?e.code:String(e)}));return(0,f.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,f.jsx)(`h5`,{className:`text-sm font-semibold`,children:l}),!p&&(0,f.jsx)(d.ActionButton,{icon:`plus`,variant:`outline-primary`,label:s?t.accountsAdd:t.keyConnect,onClick:()=>{T(null),m(!0)}})]}),w&&(0,f.jsx)(d.Alert,{variant:`danger`,children:w}),(0,f.jsx)(d.SortableList,{items:r,getKey:e=>`${e.provider}/${e.id}`,label:l,numbered:!!s&&r.length>1,disabled:!s,emptyState:(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.accountsEmpty}),onReorder:t=>{s&&e.accounts.order(s,t.map(e=>e.id)).then(e=>i(e),A)},renderItem:(e,n)=>({icon:e.provider===`claude-code`?`user`:`key`,title:k(e,n),meta:[s?void 0:x(e.provider),v(t.accountsAddedOn,{date:S(e.at)})].filter(Boolean).join(` · `),badge:e.noCreditUntil?(0,f.jsx)(d.Badge,{variant:`warning`,children:v(t.accountsNoCredit,{at:C(e.noCreditUntil)})}):(0,f.jsx)(d.Badge,{variant:`success`,children:t.accountsAvailable}),trailing:(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(d.ActionButton,{icon:`pencil`,variant:`link`,ariaLabel:v(t.accountsRenameAria,{name:k(e,n)}),onClick:()=>_(e)}),(0,f.jsx)(d.ActionButton,{icon:`trash-2`,variant:`link`,ariaLabel:v(t.accountsRemoveAria,{name:k(e,n)}),onClick:()=>b(e)})]})})}),s&&r.length>1&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.accountsOrderHint}),p&&(s===`claude-code`?(0,f.jsx)(D,{client:e,t,others:r.length,onDone:async()=>{m(!1),await i()},onCancel:()=>m(!1)}):(0,f.jsx)(O,{client:e,t,providers:s?[s]:n,onDone:async()=>{m(!1),await i()},onCancel:()=>m(!1)})),o,h&&(0,f.jsx)(E,{client:e,t,account:h,onClose:()=>_(null),onDone:async e=>{_(null),await i(e)}}),y&&(0,f.jsx)(d.ModalYesNo,{title:t.accountsRemove,danger:!0,onClose:()=>b(null),onYes:async()=>(await e.accounts.remove(y.provider,y.id).catch(()=>!1),b(null),await i(),!0),children:v(t.accountsRemoveConfirm,{name:y.label??x(y.provider)})})]})}function E({client:e,t,account:n,onClose:r,onDone:i}){let[a,o]=(0,u.useState)(n.label??``),[s,l]=(0,u.useState)(null);return(0,f.jsxs)(d.Modal,{title:t.accountsRenameTitle,position:`right`,size:`sm`,onClose:r,footer:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.ActionButton,{variant:`link`,label:t.cancel,onClick:r}),(0,f.jsx)(d.LoadingButton,{variant:`primary`,label:t.accountsSave,onClick:async()=>{try{await i(await e.accounts.rename(n.provider,n.id,a.trim()))}catch(e){l(v(t.error,{error:e instanceof c.RunnerError?e.code:String(e)}))}}})]}),children:[s&&(0,f.jsx)(d.Alert,{variant:`danger`,children:s}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,defaultValues:{label:n.label??``},onSubmit:()=>!1,children:(0,f.jsx)(d.String,{name:`label`,label:t.accountsName,placeholder:t.claudeLabelPlaceholder,onChange:({value:e})=>o(String(e??``))})})]})}function D({client:e,t,others:n,onDone:r,onCancel:i}){let[a,o]=(0,u.useState)(!1),[s,l]=(0,u.useState)(null),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(``),[_,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(null);return(0,u.useEffect)(()=>{if(a)return;let n=!1;return e.accounts.startClaudeLogin().then(({url:e})=>!n&&l(e)).catch(()=>!n&&C(t.claudeNoLink)),()=>{n=!0}},[e,t,a]),(0,f.jsxs)(d.Card,{headerClassName:`px-4 py-3`,bodyClassName:`flex flex-col gap-3`,header:(0,f.jsx)(`span`,{className:`text-sm font-medium`,children:t.claudeConnect}),children:[n>0&&(0,f.jsx)(d.Alert,{variant:`warning`,children:t.claudeMultiWarning}),S&&(0,f.jsx)(d.Alert,{variant:`danger`,children:S}),a?(0,f.jsx)(`p`,{className:`text-sm`,children:t.claudeTokenIntro}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`p`,{className:`text-sm`,children:t.claudeStep1}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,f.jsx)(d.ActionButton,{icon:`external-link`,variant:`outline-primary`,className:`w-full justify-center whitespace-nowrap`,label:t.claudeOpen,disabled:!s,onClick:()=>s&&window.open(s,`_blank`,`noopener,noreferrer`)}),(0,f.jsx)(d.ActionButton,{icon:p?`check`:`copy`,variant:`outline-secondary`,className:`w-full justify-center whitespace-nowrap`,label:p?t.claudeCopied:t.claudeCopy,disabled:!s,onClick:()=>{s&&navigator.clipboard?.writeText(s).then(()=>m(!0),()=>m(!1))}})]}),(0,f.jsx)(`p`,{className:`text-sm`,children:t.claudeStep2})]}),(0,f.jsxs)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:[a?(0,f.jsx)(d.Password,{name:`token`,label:t.claudeToken,placeholder:`sk-ant-oat01-…`,autoComplete:`off`,onChange:({value:e})=>y(String(e??``))}):(0,f.jsx)(d.String,{name:`code`,label:t.claudeCode,autoComplete:`off`,onChange:({value:e})=>g(String(e??``))}),(0,f.jsx)(d.String,{name:`label`,label:t.accountsName,placeholder:t.claudeLabelPlaceholder,onChange:({value:e})=>x(String(e??``))})]}),(0,f.jsx)(d.ActionButton,{variant:`link`,className:`h-auto self-start p-0 text-xs`,label:a?t.claudeBackToLogin:t.claudeManual,onClick:()=>{o(!a),C(null)}}),(0,f.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,f.jsx)(d.ActionButton,{label:t.cancel,variant:`link`,onClick:i}),(0,f.jsx)(d.LoadingButton,{label:t.claudeFinish,variant:`primary`,disabled:a?!_.trim():!s||!h.trim(),onClick:async()=>{C(null);try{a?await e.accounts.addClaudeToken(_.trim(),b.trim()||void 0):await e.accounts.finishClaudeLogin(h.trim(),b.trim()||void 0),r()}catch(n){let r=n instanceof c.RunnerError&&n.code===`refused`;C(r?t.claudeRefused:v(t.error,{error:n instanceof c.RunnerError?n.code:String(n)})),r&&!a&&(l(null),m(!1),e.accounts.startClaudeLogin().then(({url:e})=>l(e)).catch(()=>C(t.claudeNoLink)))}}})]})]})}function O({client:e,t,providers:n,onDone:r,onCancel:i}){let[a,o]=(0,u.useState)(n[0]),[s,l]=(0,u.useState)(``),[p,m]=(0,u.useState)(``),[h,g]=(0,u.useState)(null);return(0,f.jsxs)(d.Card,{headerClassName:`px-4 py-3`,bodyClassName:`flex flex-col gap-3`,header:(0,f.jsx)(`span`,{className:`text-sm font-medium`,children:n.length===1?v(t.keyAddOf,{provider:x(n[0])}):t.keyConnect}),children:[h&&(0,f.jsx)(d.Alert,{variant:`danger`,children:h}),(0,f.jsxs)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:[n.length>1&&(0,f.jsx)(d.Select,{name:`provider`,label:t.keyProvider,defaultValue:a,options:n.map(e=>({label:x(e),value:e})),onChange:({value:e})=>o(String(e??n[0]))}),(0,f.jsx)(d.Password,{name:`key`,label:v(t.keyLabel,{provider:x(a)}),autoComplete:`off`,onChange:({value:e})=>l(String(e??``))}),(0,f.jsx)(d.String,{name:`label`,label:t.accountsName,onChange:({value:e})=>m(String(e??``))})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,f.jsx)(d.ActionButton,{label:t.cancel,variant:`link`,onClick:i}),(0,f.jsx)(d.LoadingButton,{label:t.opencodeAdd,variant:`primary`,disabled:!s.trim(),onClick:async()=>{try{await e.accounts.addKey(a,s.trim(),p.trim()||void 0),r()}catch(e){g(v(t.error,{error:e instanceof c.RunnerError?e.code:String(e)}))}}})]})]})}function k({title:e,children:t,done:n}){return(0,f.jsxs)(`section`,{className:`flex flex-col gap-2 border-l-2 border-border pl-4`,children:[(0,f.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[e,n&&(0,f.jsx)(d.Badge,{variant:`success`,children:`✓`})]}),t]})}function A({locale:e,texts:t,onPair:n,lookup:r=e=>l.lookupDomain(e),check:i=l.checkRunner,version:a}){let o=_(e,t),[s,c]=(0,u.useState)(``),[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),[y,b]=(0,u.useState)(``),[x,S]=(0,u.useState)(!1),[C,w]=(0,u.useState)(null),T=l.isDomain(s),E=`https://${s.trim().toLowerCase()}`,D=l.RUNNER_REQUIREMENTS;return(0,f.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,f.jsx)(k,{title:o.guideServerTitle,children:(0,f.jsx)(`p`,{className:`text-sm`,children:v(o.guideServer,{systems:D.systems.join(`, `),cpus:D.cpus,memory:D.memoryGb,disk:D.diskGb,ports:D.ports.join(`, `)})})}),(0,f.jsxs)(k,{title:o.guideDnsTitle,done:!!p?.ips.length,children:[(0,f.jsx)(`p`,{className:`text-sm`,children:o.guideDns}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:(0,f.jsx)(d.String,{name:`domain`,label:o.guideDomain,placeholder:`runner.example.com`,autoComplete:`off`,onChange:({value:e})=>{c(String(e??``)),m(null),g(null)}})}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:o.guideCheckDns,variant:`outline-secondary`,disabled:!T,onClick:async()=>m({ips:await r(s.trim().toLowerCase()).catch(()=>[])})}),p&&(p.ips.length?(0,f.jsx)(d.Alert,{variant:`success`,appearance:`text`,children:v(o.guideDnsOk,{ips:p.ips.join(`, `)})}):(0,f.jsx)(d.Alert,{variant:`warning`,appearance:`text`,children:o.guideDnsMissing}))]})]}),(0,f.jsx)(k,{title:o.guideAccessTitle,children:(0,f.jsx)(`p`,{className:`text-sm`,children:o.guideAccess})}),(0,f.jsxs)(k,{title:o.guideInstallTitle,children:[(0,f.jsx)(`p`,{className:`text-sm`,children:o.guideInstall}),(0,f.jsx)(d.Code,{language:`bash`,showCopy:!0,children:l.installCommand({domain:T?s:`runner.example.com`,...a?{version:a}:{}})}),(0,f.jsx)(`div`,{children:(0,f.jsx)(d.ActionButton,{label:o.guideVerified,variant:`link`,onClick:()=>S(e=>!e)})}),x&&(0,f.jsx)(d.Code,{language:`bash`,showCopy:!0,children:l.verifiedInstallCommands({domain:T?s:`runner.example.com`,...a?{version:a}:{}}).join(`
2
+ `)})]}),(0,f.jsxs)(k,{title:o.guidePairTitle,done:h?.ok,children:[(0,f.jsx)(`p`,{className:`text-sm`,children:o.guidePair}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:(0,f.jsx)(d.String,{name:`code`,label:o.addCode,placeholder:`ABCD-EFGH`,autoComplete:`off`,onChange:({value:e})=>b(String(e??``))})}),h&&(0,f.jsx)(d.Alert,{variant:h.ok?`success`:`warning`,appearance:`text`,children:h.text}),C&&(0,f.jsx)(d.Alert,{variant:`danger`,children:C}),(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:o.guideCheckHealth,variant:`outline-secondary`,disabled:!T,onClick:async()=>{let e=await i(E);g(e.ok?{ok:!0,text:v(o.guideHealthOk,{version:e.version,url:E})}:{ok:!1,text:v(o.guideHealthKo,{url:E})})}}),(0,f.jsx)(d.LoadingButton,{label:o.addConnect,variant:`primary`,disabled:!T||y.trim().length<8,onClick:async()=>{try{w(null),await n({url:E,code:y.trim()})}catch(e){w(v(o.error,{error:e.message}))}}})]})]}),(0,f.jsx)(k,{title:o.guideTroubleTitle,children:(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.guideTrouble})})]})}function j({fleet:e,locale:t,texts:n}){let r=_(t,n),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(null),[c,l]=(0,u.useState)(!1),[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),y=(0,u.useCallback)(async()=>{try{let t=await e.list();a(t);let n=await Promise.all(t.map(t=>e.status(t.id).catch(()=>null)));a(t.map((e,t)=>({...e,status:n[t]}))),e.tenants&&s(await e.tenants.list())}catch(e){g(v(r.error,{error:e.message})),a([])}},[e,r]);(0,u.useEffect)(()=>{y()},[y]);let b=async(t,n)=>{await e.update(t,n),await y()};return(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,f.jsx)(d.Card,{header:(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`h3`,{className:`flex-1 text-base font-semibold`,children:r.runnersTitle}),(0,f.jsx)(d.ActionButton,{icon:`plus`,label:r.runnersAdd,variant:`primary`,onClick:()=>l(!0)})]}),loading:i===null,loaderMinHeight:120,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.runnersIntro}),h&&(0,f.jsx)(d.Alert,{variant:`danger`,children:h}),i?.length===0&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.runnersEmpty}),i?.map(e=>(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-border p-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.url}),e.status===null&&(0,f.jsx)(d.Badge,{variant:`danger`,children:r.runnersUnreachable}),e.status&&(0,f.jsx)(d.Badge,{variant:`secondary`,children:v(r.runnersVersion,{version:e.status.version})}),e.status&&(0,f.jsx)(d.Badge,{variant:`info`,children:v(r.runnersLoad,{chats:e.status.load.chats,max:e.status.load.maxChats})}),e.status&&(0,f.jsx)(d.Badge,{variant:`light`,children:v(r.runnersTenants,{count:e.status.tenants.length})}),(0,f.jsx)(`div`,{className:`ml-auto`,children:(0,f.jsx)(d.ActionButton,{icon:`trash`,label:r.runnersRemove,variant:`outline-danger`,onClick:()=>m(e)})})]}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,defaultValues:{isDefault:e.isDefault?`true`:``,draining:e.draining?`true`:``},children:(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,f.jsx)(d.Switch,{name:`isDefault`,label:r.runnersDefault,valueChecked:`true`,onChange:({value:t})=>void b(e.id,{isDefault:!!t})}),(0,f.jsx)(d.Switch,{name:`draining`,label:r.runnersDraining,valueChecked:`true`,onChange:({value:t})=>void b(e.id,{draining:!!t})})]})})]},e.id))]})}),e.tenants&&i&&i.length>0&&(0,f.jsx)(d.Card,{title:r.distributionTitle,loading:o===null,loaderMinHeight:80,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.distributionIntro}),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,defaultValues:Object.fromEntries((o??[]).map(e=>[`runner_${e.id}`,e.runnerId??``])),children:(o??[]).map(t=>(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`min-w-40 flex-1 text-sm`,children:t.name}),(0,f.jsx)(d.Select,{name:`runner_${t.id}`,title:r.distributionRunner,placeholderOption:{label:r.distributionNone,value:``},options:i.map(e=>({label:e.name,value:e.id})),onChange:({value:n})=>{n&&e.tenants.assign(t.id,String(n)).then(y)}})]},t.id))})]})}),c&&(0,f.jsx)(P,{fleet:e,t:r,locale:t,onClose:()=>l(!1),onAdded:async()=>{l(!1),await y()}}),p&&(0,f.jsx)(d.ModalYesNo,{title:r.runnersRemove,danger:!0,onClose:()=>m(null),onYes:async()=>(await e.remove(p.id).catch(e=>g(v(r.error,{error:e.message}))),m(null),await y(),!0),children:v(r.runnersRemoveConfirm,{name:p.name})})]})}function M({target:e,children:t}){return e?(0,p.createPortal)(t,e):null}var N=e=>{try{return new URL(e).hostname}catch{return e}};function P({fleet:e,t,locale:n,onClose:r,onAdded:i,position:a}){let[o,s]=(0,u.useState)(`choose`),[c,l]=(0,u.useState)(null),[p,m]=(0,u.useState)(null),h=(0,u.useCallback)(e=>l(v(t.error,{error:e.message})),[t]);return(0,f.jsx)(d.Modal,{title:t.addTitle,...a===`right`?{position:`right`}:{},size:`lg`,onClose:r,footer:o===`choose`||o===`guided`?!1:(0,f.jsx)(`div`,{ref:m,className:`flex w-full flex-wrap items-center justify-end gap-3`}),children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&(0,f.jsx)(d.Alert,{variant:`danger`,children:c}),o===`choose`&&(0,f.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[e.install&&(0,f.jsx)(F,{title:t.addAutomatic,hint:t.addAutomaticHint,onClick:()=>s(`automatic`)}),(0,f.jsx)(F,{title:t.addGuided,hint:t.addGuidedHint,onClick:()=>s(`guided`)}),(0,f.jsx)(F,{title:t.addExisting,hint:t.addExistingHint,onClick:()=>s(`existing`)})]}),o!==`choose`&&(0,f.jsx)(`div`,{children:(0,f.jsx)(d.ActionButton,{icon:`arrow-left`,label:t.addBack,variant:`link`,onClick:()=>{s(`choose`),l(null)}})}),o===`automatic`&&e.install&&(0,f.jsx)(V,{t,footer:p,localKeys:!!e.localKeys,install:(t,n,r)=>e.install({name:t,domain:t,access:n},r),onDone:i,onError:h}),o===`guided`&&(0,f.jsx)(A,{locale:n,texts:t,onPair:async({url:t,code:n})=>{await i(await e.add({name:N(t),url:t,code:n}))}}),o===`existing`&&(0,f.jsx)(z,{t,footer:p,pairing:e.startPairing&&e.pairingStatus?{start:e.startPairing.bind(e),status:e.pairingStatus.bind(e)}:void 0,onAdded:i,onError:h,onClearError:()=>l(null),onConnect:async(t,n)=>{try{await i(await e.add({name:N(t),url:t,code:n}))}catch(e){h(e)}}})]})})}function F({title:e,hint:t,onClick:n}){return(0,f.jsxs)(`button`,{type:`button`,onClick:n,className:`rounded-lg border border-border p-4 text-left transition-colors hover:border-primary hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,f.jsx)(`span`,{className:`block font-medium`,children:e}),(0,f.jsx)(`span`,{className:`mt-1 block text-sm text-muted-foreground`,children:t})]})}var I=e=>(/^https?:\/\//.test(e.trim())?e.trim():`https://${e.trim()}`).replace(/\/+$/,``),L=e=>new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}),R=5;function z({t:e,footer:t,pairing:n,onAdded:r,onError:i,onClearError:a,onConnect:o}){let[s,c]=(0,u.useState)(``),[l,p]=(0,u.useState)(``),[m,h]=(0,u.useState)(!n),[g,_]=(0,u.useState)(null),[y,b]=(0,u.useState)(null);return(0,u.useEffect)(()=>{if(!g||!n)return;let e=!1,t=0,a,o=async()=>{try{let i=await n.status(g.id);if(t=0,e)return;if(i.status===`approved`){await r(i.runner);return}if(i.status!==`pending`){b(i.status),_(null);return}}catch(n){t+=1,!e&&t>=R&&i(n)}e||(a=setTimeout(()=>void o(),2e3))};return a=setTimeout(()=>void o(),2e3),()=>{e=!0,clearTimeout(a)}},[g,n,r,i]),g?(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`h4`,{className:`font-semibold`,children:e.pairWaitingTitle}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.pairWaitingHint}),(0,f.jsx)(`div`,{className:`rounded-lg border border-border p-4 text-center font-mono text-3xl font-semibold tracking-widest`,children:g.code}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:v(e.pairWaiting,{at:L(g.expiresAt)})}),(0,f.jsx)(M,{target:t,children:(0,f.jsx)(d.ActionButton,{icon:`external-link`,label:e.pairOpen,variant:`primary`,onClick:()=>window.open(g.approveUrl,`_blank`,`noopener`)})})]}):(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[y&&(0,f.jsx)(d.Alert,{variant:y===`denied`?`danger`:`warning`,children:y===`denied`?e.pairDenied:e.pairExpired}),(0,f.jsxs)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,defaultValues:{url:s,code:l},children:[(0,f.jsx)(d.String,{name:`url`,label:e.addUrl,placeholder:`https://runner.example.com`,onChange:({value:e})=>c(String(e??``))}),m&&(0,f.jsx)(d.String,{name:`code`,label:e.addCode,placeholder:`ABCD-EFGH`,autoComplete:`off`,onChange:({value:e})=>p(String(e??``))})]}),(0,f.jsxs)(M,{target:t,children:[n&&(0,f.jsx)(d.ActionButton,{label:m?e.pairWithApproval:e.pairWithCode,variant:`link`,onClick:()=>h(e=>!e)}),m?(0,f.jsx)(d.LoadingButton,{label:e.addConnect,variant:`primary`,disabled:!s.trim()||l.trim().length<8,onClick:()=>o(I(s),l.trim())}):(0,f.jsx)(d.LoadingButton,{label:y?e.pairAgain:e.pairNext,variant:`primary`,disabled:!s.trim(),onClick:async()=>{b(null),a();try{let e=I(s);_(await n.start({name:N(e),url:e}))}catch(e){i(e)}}})]})]})}var B=[`check`,`docker`,`files`,`start`,`agent`,`health`,`pair`,`tls`,`done`];function V({t:e,footer:t,localKeys:n,install:r,onDone:i,onError:a}){let[o,s]=(0,u.useState)({host:``,port:`22`,username:n?``:`root`,auth:n?`local`:`key`,privateKey:``,password:``,domain:``}),[c,l]=(0,u.useState)([]),[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(!1),_=e=>({value:t})=>s(n=>({...n,[e]:String(t??``)})),v=o.host.trim()&&o.domain.trim()&&(o.auth===`local`||o.username.trim())&&(o.auth===`local`||(o.auth===`key`?o.privateKey.trim():o.password));return(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!h&&(0,f.jsxs)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,defaultValues:o,children:[(0,f.jsx)(d.String,{name:`domain`,label:e.guideDomain,placeholder:`runner.example.com`,onChange:_(`domain`)}),(0,f.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,f.jsx)(d.String,{name:`host`,label:e.addHost,placeholder:`203.0.113.10`,onChange:_(`host`)}),(0,f.jsx)(d.String,{name:`port`,label:e.addPort,onChange:_(`port`)}),(0,f.jsx)(d.String,{name:`username`,label:e.addUser,onChange:_(`username`)})]}),(0,f.jsx)(d.Select,{name:`auth`,label:e.addAuth,options:[...n?[{label:e.addLocalKey,value:`local`}]:[],{label:e.addKey,value:`key`},{label:e.addPassword,value:`password`}],onChange:_(`auth`)}),o.auth===`local`&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.addLocalKeyHint}),o.auth===`local`?null:o.auth===`key`?(0,f.jsx)(d.TextArea,{name:`privateKey`,label:e.addKey,placeholder:`-----BEGIN OPENSSH PRIVATE KEY-----`,onChange:_(`privateKey`)}):(0,f.jsx)(d.Password,{name:`password`,label:e.addPassword,autoComplete:`off`,onChange:_(`password`)})]}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.addCredentialsNote}),h&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:B.map(e=>(0,f.jsx)(d.Badge,{variant:p===e?`primary`:B.indexOf(e)<B.indexOf(p??`check`)?`success`:`light`,children:e},e))}),c.length>0&&(0,f.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-md bg-muted p-2 text-xs`,children:c.slice(-200).join(`
3
+ `)}),(0,f.jsx)(M,{target:t,children:(0,f.jsx)(d.LoadingButton,{label:h?e.addInstalling:e.addInstall,variant:`primary`,disabled:!v||h,onClick:async()=>{g(!0),l([]);try{await i(await r(o.domain.trim().toLowerCase(),{host:o.host.trim(),port:Number(o.port)||22,username:o.username.trim(),...o.auth===`key`?{privateKey:o.privateKey}:o.auth===`password`?{password:o.password}:{}},({line:e,phase:t})=>{t&&m(t),/^[A-Z_]+=/.test(e)||l(t=>[...t,e])}))}catch(e){a(e)}finally{g(!1)}}})})]})}var H=e=>(e/1024**3).toFixed(1),U=e=>new Date(e).toLocaleString(void 0,{dateStyle:`short`,timeStyle:`short`});function W({client:e,locale:t,texts:n,onSignOut:r,approve:i}){let a=_(t,n),[o,s]=(0,u.useState)(null),[l,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(null),[g,y]=(0,u.useState)({id:``,name:``}),[b,x]=(0,u.useState)(null),S=(0,u.useCallback)(async()=>{try{s(await e.platform.status()),p(null)}catch(e){p(v(a.error,{error:e instanceof c.RunnerError?e.code:String(e)}))}},[e,a]);return(0,u.useEffect)(()=>{S()},[S]),(0,f.jsxs)(`div`,{className:`mx-auto flex max-w-4xl flex-col gap-4 p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h1`,{className:`flex-1 text-xl font-semibold`,children:a.consoleTitle}),r&&(0,f.jsx)(d.ActionButton,{icon:`log-out`,label:a.consoleSignOut,variant:`outline-secondary`,onClick:r})]}),l&&(0,f.jsx)(d.Alert,{variant:`danger`,children:l}),(0,f.jsx)(J,{client:e,t:a,approve:i,onAnswered:S}),(0,f.jsx)(d.Card,{title:a.consoleStatus,loading:!o&&!l,loaderMinHeight:100,children:o&&(0,f.jsx)(d.DescriptionList,{items:[{label:`Version`,value:o.version},{label:`URL`,value:o.url},{label:`Chats`,value:`${o.load.chats} / ${o.load.maxChats}`},{label:`Machine`,value:v(a.consoleMachine,{memory:H(o.machine.availableBytes),total:H(o.machine.totalBytes),cpus:o.machine.cpus})},{label:`Agent`,value:o.agentImage}]})}),(0,f.jsx)(d.Card,{title:a.consolePairing,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.consolePairingHint}),m&&(0,f.jsx)(d.Code,{showCopy:!0,children:m.code}),m&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v(a.consoleCode,{code:m.code,at:U(m.expiresAt)})}),(0,f.jsx)(`div`,{children:(0,f.jsx)(d.LoadingButton,{label:a.consoleNewCode,variant:`outline-primary`,onClick:async()=>h(await e.createPairing())})})]})}),(0,f.jsx)(G,{client:e,t:a}),(0,f.jsx)(d.Card,{title:a.consoleTenants,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[b&&(0,f.jsx)(d.Alert,{variant:`warning`,onClose:()=>x(null),children:(0,f.jsx)(`span`,{className:`break-all`,children:v(a.consoleKeyShown,{key:b})})}),o?.tenants.map(n=>(0,f.jsx)(K,{client:e,tenant:n,t:a,locale:t,onKey:x,onChange:S},n.id)),(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:(0,f.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto] sm:items-end`,children:[(0,f.jsx)(d.String,{name:`tenantId`,label:a.consoleTenantId,placeholder:`acme`,onChange:({value:e})=>y(t=>({...t,id:String(e??``)}))}),(0,f.jsx)(d.String,{name:`tenantName`,label:a.consoleTenantName,placeholder:`Acme`,onChange:({value:e})=>y(t=>({...t,name:String(e??``)}))}),(0,f.jsx)(d.LoadingButton,{label:a.consoleCreate,variant:`primary`,disabled:!/^[a-z0-9][a-z0-9-]{0,62}$/.test(g.id),onClick:async()=>{try{let t=await e.platform.createTenant(g.id,{name:g.name||void 0});t.key&&x(t.key),await S()}catch(e){p(v(a.error,{error:e instanceof c.RunnerError?e.code:String(e)}))}}})]})})]})})]})}function G({client:e,t}){let[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)({}),[o,s]=(0,u.useState)(null),c=(0,u.useCallback)(async()=>r(await e.platform.platformKeys()),[e]);return(0,u.useEffect)(()=>{c()},[c]),(0,f.jsxs)(d.Card,{title:t.consolePlatforms,loading:!n,loaderMinHeight:60,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consolePlatformsHint}),n&&!n.length&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consolePlatformsEmpty}),n?.map(n=>{let r=i[n.id]??n.project??``;return(0,f.jsx)(d.Form,{appearance:`empty`,showNotice:!1,onSubmit:()=>!1,children:(0,f.jsxs)(`div`,{className:`grid gap-2 rounded-md border border-border p-3 sm:grid-cols-[1fr_12rem_auto] sm:items-end`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:n.name}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[U(n.createdAt),` · `,n.project??t.consolePlatformAll]})]}),(0,f.jsx)(d.String,{name:`project-${n.id}`,label:t.consolePlatformProject,value:r,placeholder:`crm`,onChange:({value:e})=>a(t=>({...t,[n.id]:String(e??``).trim()}))}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:t.consolePlatformSave,variant:`outline-primary`,disabled:r===(n.project??``)||r!==``&&!/^[a-z0-9]{1,32}$/.test(r),onClick:async()=>{await e.setKeyProject(n.id,r||null),await c()}}),(0,f.jsx)(d.ActionButton,{icon:`trash`,label:t.consoleRevoke,variant:`outline-danger`,onClick:()=>s(n)})]})]})},n.id)})]}),o&&(0,f.jsx)(d.ModalYesNo,{title:t.consoleRevoke,danger:!0,onClose:()=>s(null),onYes:async()=>(await e.platform.revokePlatformKey(o.id),s(null),await c(),!0),children:v(t.consolePlatformRevokeConfirm,{name:o.name})})]})}function K({client:e,tenant:t,t:n,locale:r,onKey:i,onChange:a}){let[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(null),[p,m]=(0,u.useState)(!1),h=(0,u.useMemo)(()=>e.as({tenant:t.id}),[e,t.id]),g=(0,u.useCallback)(async()=>l(await e.platform.keys(t.id)),[e,t.id]);return(0,u.useEffect)(()=>{o&&g()},[o,g]),(0,f.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`flex-1 text-left font-medium`,onClick:()=>s(e=>!e),children:[t.name,` `,(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.id,`)`]})]}),t.usersWithAccounts!==void 0&&(0,f.jsxs)(d.Badge,{variant:`light`,children:[t.usersWithAccounts,` 👤`]}),(0,f.jsx)(d.ActionButton,{icon:`trash`,label:n.consoleRemoveTenant,variant:`outline-danger`,onClick:()=>m(!0)})]}),o&&(0,f.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:n.consoleKeys}),c?.map(r=>(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,f.jsx)(`span`,{className:`flex-1`,children:r.name}),r.permissions.map(e=>(0,f.jsx)(d.Badge,{variant:`info`,children:e},e)),(0,f.jsx)(d.ActionButton,{label:n.consoleRevoke,variant:`outline-danger`,onClick:async()=>{await e.platform.revokeKey(t.id,r.id),await g()}})]},r.id)),(0,f.jsx)(`div`,{children:(0,f.jsx)(d.LoadingButton,{label:n.consoleNewKey,variant:`outline-secondary`,onClick:async()=>{i((await e.platform.createKey(t.id,{name:`console`,permissions:[`complete`,`chat`,`chat:tools`,`accounts`,`act-as-user`]})).key),await g()}})}),(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:n.consoleAccounts}),(0,f.jsx)(w,{client:h,scope:`tenant`,locale:r,texts:n})]}),p&&(0,f.jsx)(d.ModalYesNo,{title:n.consoleRemoveTenant,danger:!0,onClose:()=>m(!1),onYes:async()=>(await e.platform.removeTenant(t.id),m(!1),await a(),!0),children:v(n.consoleRemoveTenantConfirm,{name:t.name})})]})}var q=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,``);function J({client:e,t,approve:n,onAnswered:r}){let[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(null),c=(0,u.useCallback)(async()=>{try{let t=await e.pairingRequests(),r=n?q(n):``;a([...t].sort((e,t)=>Number(q(t.code)===r)-Number(q(e.code)===r)))}catch{a([])}},[e,n]);return(0,u.useEffect)(()=>{c();let e=setInterval(()=>void c(),5e3);return()=>clearInterval(e)},[c]),!n&&!i?.length&&!o?null:(0,f.jsx)(d.Card,{title:t.consoleRequests,loading:i===null,loaderMinHeight:80,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consoleRequestsHint}),o&&(0,f.jsx)(d.Alert,{variant:o.variant,children:o.text}),i?.length===0&&!o&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consoleRequestsEmpty}),i?.map(i=>{let a=!!n&&q(i.code)===q(n),o=async n=>{let a=await e.answerPairing(i.code,n);s(n?{variant:`success`,text:v(t.consoleApproved,{name:a.name})}:{variant:`info`,text:t.consoleDenied}),await c(),await r()};return(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3 ${a?`border-primary`:`border-border`}`,children:[a&&(0,f.jsx)(d.Badge,{variant:`primary`,children:t.consoleRequestMatch}),(0,f.jsx)(`div`,{className:`font-mono text-2xl font-semibold tracking-widest`,children:i.code}),(0,f.jsx)(`p`,{className:`text-sm`,children:v(t.consoleRequestFrom,{name:i.name,from:i.from??`?`,at:U(i.createdAt)})}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i.project?v(t.consoleRequestProject,{project:i.project}):t.consoleRequestAll}),(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:t.consoleApprove,variant:`primary`,onClick:()=>o(!0)}),(0,f.jsx)(d.LoadingButton,{label:t.consoleDeny,variant:`outline-danger`,onClick:()=>o(!1)})]})]},i.code)})]})})}exports.AddRunner=P,exports.InstallGuide=A,exports.RunnerAccounts=w,exports.RunnerConsole=W,exports.RunnersSettings=j,exports.fill=v,exports.runnerTexts=g,exports.textsFor=_;
4
4
  //# sourceMappingURL=ui.js.map