@llmnative/runner 1.5.0 → 2.0.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-Da8UbNNk.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-CdEnLJdB.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.5.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.5.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=`2.0.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??`2.0.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.5.0", t = "sherpadvisorylab/llmnative-runner", n = {
2
+ var e = "2.0.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.5.0";
25
+ let t = e.version ?? "2.0.0";
26
26
  return [
27
27
  `curl -fsSLO ${a(t)}`,
28
28
  `curl -fsSL ${o(t)} | sha256sum -c -`,
@@ -25,27 +25,63 @@ export type RunnerModels = {
25
25
  tenant: number;
26
26
  }>;
27
27
  };
28
+ /** A tenant: an organization (2.0), shared by the apps that work for it. `platforms`: the platform keys that see it. */
28
29
  export type RunnerTenant = {
29
30
  id: string;
30
31
  name: string;
31
32
  createdAt: string;
32
33
  usersWithAccounts?: number;
34
+ platforms?: string[];
33
35
  };
34
36
  export type RunnerKey = {
35
37
  id: string;
36
38
  kind: 'platform' | 'project';
37
- tenant?: string; /** Platform keys: the project whose tenants (`<project>`, `<project>-…`) it owns. */
39
+ tenant?: string;
40
+ /** Platform keys (2.0): the app that connected with it; it sees the tenants it made and those granted to it. */
41
+ app?: string;
42
+ /** Platform keys before 2.0: the project whose tenants (`<project>`, `<project>-…`) it owns. */
38
43
  project?: string;
39
44
  name: string;
40
45
  permissions: RunnerPermission[];
41
46
  createdAt: string;
42
47
  expiresAt: string | null;
43
48
  };
49
+ /** An app asked for an organization another app made: the admin grants it in the console, or not. */
50
+ export type RunnerGrantRequest = {
51
+ id: string;
52
+ tenant: string;
53
+ key: string;
54
+ keyName: string;
55
+ app?: string;
56
+ createdAt: string;
57
+ };
58
+ /** The 2.0 migration of the tenants: what moves (`<app>-<org>` → `<org>`), what stays and why. */
59
+ export type RunnerTenantMigration = {
60
+ applied: boolean;
61
+ moves: Array<{
62
+ from: string;
63
+ to: string;
64
+ merge: boolean;
65
+ platforms: string[];
66
+ }>;
67
+ skipped: Array<{
68
+ tenant: string;
69
+ reason: 'needs-name' | 'invalid' | 'same';
70
+ }>;
71
+ keys: string[];
72
+ };
73
+ /** Who a platform key is for: an app (2.0), or, as a string, the project of the keys before 2.0. */
74
+ export type RunnerPlatformScope = string | {
75
+ app?: string;
76
+ project?: string;
77
+ };
44
78
  export type RunnerStatus = {
45
79
  version: string;
46
80
  agentImage: string;
47
81
  url?: string;
48
- /** The project of the platform key asking: the tenants listed are its own only. */
82
+ /** The app of the platform key asking (2.0): the tenants listed are those it sees. */
83
+ app?: string;
84
+ /** The project of the platform key asking, before 2.0. */
49
85
  project?: string;
50
86
  load: {
51
87
  chats: number;
@@ -79,6 +115,7 @@ export type RunnerPairingPoll = {
79
115
  export type RunnerPairingRequestView = {
80
116
  code: string;
81
117
  name: string;
118
+ app?: string;
82
119
  project?: string;
83
120
  from?: string;
84
121
  createdAt: string;
@@ -162,6 +199,9 @@ export type RunnerClientOptions = {
162
199
  tenant?: string;
163
200
  /** The person the requests are for (needs `act-as-user` with a project key). */
164
201
  user?: string;
202
+ /** The app and the project of completions and chats (2.0): a label in the log of the runner, never a scope. */
203
+ app?: string;
204
+ project?: string;
165
205
  fetch?: typeof fetch;
166
206
  /** More headers for each request (the session of the host, for its backend). */
167
207
  headers?: () => Record<string, string> | Promise<Record<string, string>>;
@@ -173,14 +213,19 @@ export declare class RunnerClient {
173
213
  as(scope: {
174
214
  tenant?: string;
175
215
  user?: string;
216
+ app?: string;
217
+ project?: string;
176
218
  }): RunnerClient;
177
219
  private headers;
178
220
  /** One request; its JSON, or a RunnerError. */
179
221
  request<T>(method: string, path: string, body?: unknown): Promise<T>;
180
222
  health(): Promise<RunnerHealth>;
181
223
  /** A pairing code (printed by the installer) → a platform key, seen once. */
182
- /** `project`: the platform key owns only the tenants of that project (`<project>`, `<project>-…`). */
183
- pair(code: string, name?: string, project?: string): Promise<{
224
+ /**
225
+ * `{ app }` (2.0): the platform key sees the organizations it makes and those the admin grants it. A string: the
226
+ * project of the keys before 2.0, owning `<project>` and `<project>-…`.
227
+ */
228
+ pair(code: string, name?: string, scope?: RunnerPlatformScope): Promise<{
184
229
  key: string;
185
230
  record: RunnerKey;
186
231
  version: string;
@@ -189,7 +234,7 @@ export declare class RunnerClient {
189
234
  * Asks to connect (device flow): the admin of the runner approves it in the console at `approveUrl`, where the
190
235
  * same `code` is shown; meanwhile `pollPairing(request)` every `interval` seconds, until it gives the key.
191
236
  */
192
- requestPairing(name: string, project?: string): Promise<RunnerPairingRequest>;
237
+ requestPairing(name: string, scope?: RunnerPlatformScope): Promise<RunnerPairingRequest>;
193
238
  pollPairing(request: string): Promise<RunnerPairingPoll>;
194
239
  info(): Promise<{
195
240
  version: string;
@@ -205,12 +250,25 @@ export declare class RunnerClient {
205
250
  }>;
206
251
  pairingRequests(): Promise<RunnerPairingRequestView[]>;
207
252
  answerPairing(code: string, approve: boolean): Promise<RunnerPairingRequestView>;
208
- /** The project of a platform key (null: every tenant, as keys made before 1.2). */
253
+ /** The apps waiting for an organization another app made. */
254
+ grantRequests(): Promise<RunnerGrantRequest[]>;
255
+ answerGrant(id: string, approve: boolean): Promise<RunnerGrantRequest>;
256
+ /** A platform key sees a tenant, or (`allow: false`) no longer. */
257
+ grantTenant(tenant: string, key: string, allow?: boolean): Promise<RunnerTenant>;
258
+ /** The 2.0 migration of the tenants (`<app>-<org>` → `<org>`): a dry run unless `apply`; `map` names the others. */
259
+ migrateTenants(options?: {
260
+ apply?: boolean;
261
+ map?: Record<string, string>;
262
+ }): Promise<RunnerTenantMigration>;
263
+ /** The project of a platform key before 2.0 (null: every tenant, as keys made before 1.2). */
209
264
  setKeyProject(id: string, project: string | null): Promise<RunnerKey>;
210
265
  readonly platform: {
211
266
  status: () => Promise<RunnerStatus>;
212
267
  tenants: () => Promise<RunnerTenant[]>;
213
- /** A tenant, with its first project key unless `key: false` (seen once: keep it in the backend). */
268
+ /**
269
+ * A tenant, with its first project key unless `key: false` (seen once: keep it in the backend). An organization
270
+ * another app made answers RunnerError `needs-grant` (409): the admin of the runner grants it in the console.
271
+ */
214
272
  createTenant: (id: string, options?: {
215
273
  name?: string;
216
274
  key?: boolean;
@@ -287,6 +345,9 @@ export type RunnerProxyTarget = {
287
345
  tenant?: string;
288
346
  /** The signed-in person, verified by the host. */
289
347
  user: string;
348
+ /** The app and the project the person works in: labels in the log of the runner. */
349
+ app?: string;
350
+ project?: string;
290
351
  };
291
352
  /**
292
353
  * Forwards a request of a signed-in person to their runner: only the routes of a person, with the key, tenant and
@@ -162,6 +162,16 @@ export declare const en: {
162
162
  consolePlatformSave: string;
163
163
  consolePlatformRevokeConfirm: string;
164
164
  consoleRequestMatch: string;
165
+ consoleRequestApp: string;
166
+ consolePlatformApp: string;
167
+ consoleGrants: string;
168
+ consoleGrantsHint: string;
169
+ consoleGrantFrom: string;
170
+ consoleGrantApproved: string;
171
+ consoleGrantDenied: string;
172
+ consoleTenantPlatforms: string;
173
+ consoleTenantPlatformsNone: string;
174
+ consoleUngrant: string;
165
175
  consoleApprove: string;
166
176
  consoleDeny: string;
167
177
  consoleApproved: string;
@@ -337,6 +347,16 @@ export declare const runnerTexts: {
337
347
  consolePlatformSave: string;
338
348
  consolePlatformRevokeConfirm: string;
339
349
  consoleRequestMatch: string;
350
+ consoleRequestApp: string;
351
+ consolePlatformApp: string;
352
+ consoleGrants: string;
353
+ consoleGrantsHint: string;
354
+ consoleGrantFrom: string;
355
+ consoleGrantApproved: string;
356
+ consoleGrantDenied: string;
357
+ consoleTenantPlatforms: string;
358
+ consoleTenantPlatformsNone: string;
359
+ consoleUngrant: string;
340
360
  consoleApprove: string;
341
361
  consoleDeny: string;
342
362
  consoleApproved: string;
@@ -509,6 +529,16 @@ export declare const runnerTexts: {
509
529
  consolePlatformSave: string;
510
530
  consolePlatformRevokeConfirm: string;
511
531
  consoleRequestMatch: string;
532
+ consoleRequestApp: string;
533
+ consolePlatformApp: string;
534
+ consoleGrants: string;
535
+ consoleGrantsHint: string;
536
+ consoleGrantFrom: string;
537
+ consoleGrantApproved: string;
538
+ consoleGrantDenied: string;
539
+ consoleTenantPlatforms: string;
540
+ consoleTenantPlatformsNone: string;
541
+ consoleUngrant: string;
512
542
  consoleApprove: string;
513
543
  consoleDeny: string;
514
544
  consoleApproved: 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.`,accountsSection:`{name} ({count})`,accountsByUse:`API keys of the providers by use ({count})`,boxClaudeCode:`A Claude subscription (Pro, Max, Team): signed in with Anthropic.`,boxOpencodeGo:`The OpenCode Go subscription, with its API key.`,boxByUse:`Paid by use, with an API key of {provider}.`,groupSubscriptions:`Subscriptions`,groupUsage:`Pay as you go`,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})`,boxClaudeCode:`Un abbonamento Claude (Pro, Max, Team): si accede con Anthropic.`,boxOpencodeGo:`L'abbonamento OpenCode Go, con la sua API key.`,boxByUse:`A consumo, con una API key di {provider}.`,groupSubscriptions:`Abbonamenti`,groupUsage:`A consumo`,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,h]=(0,u.useState)(null),[g,y]=(0,u.useState)(null),[S,w]=(0,u.useState)(null),[E,D]=(0,u.useState)(!1),O=e=>{w(e),s?.(e!==null)},k=(0,u.useCallback)(async()=>{try{let{accounts:t}=await e.accounts.list();return h(t),y(null),t}catch(e){return y(e instanceof c.RunnerError?e.code:String(e)),h([]),[]}},[e]);(0,u.useEffect)(()=>{k()},[k]);let A=async e=>{let t=e??await k();e&&h(e),i?.(t)},j=e=>(m??[]).filter(t=>t.provider===e),M=e=>e===`claude-code`?l.boxClaudeCode:e===`opencode-go`?l.boxOpencodeGo:v(l.boxByUse,{provider:x(e)});return(0,f.jsxs)(d.Card,{title:t===`user`?l.accountsTitleUser:l.accountsTitleTenant,loading:m===null,loaderMinHeight:120,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===`user`?l.accountsIntroUser:l.accountsIntroTenant}),g&&(0,f.jsx)(d.Alert,{variant:`danger`,children:v(l.error,{error:g})}),m&&(0,f.jsx)(d.ConnectionBoard,{items:p.map(e=>{let t=j(e),n=t.filter(e=>e.noCreditUntil);return{id:e,label:x(e),description:M(e),icon:e===`claude-code`?`user`:`key-round`,group:b.includes(e)?`subscription`:`usage`,count:t.length,status:t.length>0&&n.length===t.length?(0,f.jsx)(d.Badge,{variant:`warning`,children:v(l.accountsNoCredit,{at:C(n.map(e=>e.noCreditUntil).sort()[0])})}):void 0}}),titles:{subscription:l.groupSubscriptions,usage:l.groupUsage},onOpen:e=>O(e)}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l.termsNote})]}),S&&m&&(0,f.jsx)(d.Modal,{title:x(S),position:`right`,size:`lg`,stackedBehind:E,onClose:()=>O(null),footer:(0,f.jsx)(d.ActionButton,{variant:`link`,label:l.close,onClick:()=>O(null)}),children:(0,f.jsx)(T,{client:e,t:l,provider:S,accounts:j(S),onChanged:A,onStack:D,extra:o?.(S,j(S))})})]})}function T({client:e,t,provider:n,accounts:r,onChanged:i,onStack:a,extra:o}){let[s,l]=(0,u.useState)(null),p=e=>l(v(t.error,{error:e instanceof c.RunnerError?e.code:String(e)})),m=e=>r.find(t=>t.id===e);return(0,f.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n===`claude-code`?t.boxClaudeCode:n===`opencode-go`?t.boxOpencodeGo:v(t.boxByUse,{provider:x(n)})}),s&&(0,f.jsx)(d.Alert,{variant:`danger`,children:s}),(0,f.jsx)(d.ConnectionList,{items:r.map(e=>({id:e.id,label:e.label,icon:e.provider===`claude-code`?`user`:`key-round`,meta:v(t.accountsAddedOn,{date:S(e.at)}),exhaustedUntil:e.noCreditUntil})),title:v(t.accountsSection,{name:x(n),count:String(r.length)}),emptyText:t.accountsEmpty,unnamed:t.accountsUnnamed,orderHint:t.accountsOrderHint,addLabel:n===`claude-code`?t.accountsAdd:t.keyConnect,onStack:a,onReorder:t=>e.accounts.order(n,t).then(e=>i(e),p),onRename:async(t,r)=>{await i(await e.accounts.rename(n,t,r))},onRemove:async t=>{await e.accounts.remove(m(t).provider,t).catch(p),await i()},renderAdd:a=>n===`claude-code`?(0,f.jsx)(E,{client:e,t,others:r.length,onDone:async()=>{a(),await i()},onCancel:a}):(0,f.jsx)(D,{client:e,t,providers:[n],onDone:async()=>{a(),await i()},onCancel:a})}),o]})}function E({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 D({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 O({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 k({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)(O,{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)(O,{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)(O,{title:o.guideAccessTitle,children:(0,f.jsx)(`p`,{className:`text-sm`,children:o.guideAccess})}),(0,f.jsxs)(O,{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(`
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})`,boxClaudeCode:`A Claude subscription (Pro, Max, Team): signed in with Anthropic.`,boxOpencodeGo:`The OpenCode Go subscription, with its API key.`,boxByUse:`Paid by use, with an API key of {provider}.`,groupSubscriptions:`Subscriptions`,groupUsage:`Pay as you go`,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`,consoleRequestApp:`For the app «{app}»: it will see the organizations it makes and those you grant it.`,consolePlatformApp:`app «{app}»`,consoleGrants:`Organizations asked for`,consoleGrantsHint:`An app asked for an organization that another app made on this runner. Granting it, the app uses its accounts too.`,consoleGrantFrom:`{name} ({app}) asks for the organization «{tenant}», at {at}`,consoleGrantApproved:`{name} now sees «{tenant}».`,consoleGrantDenied:`Refused.`,consoleTenantPlatforms:`Apps that see it`,consoleTenantPlatformsNone:`Only the admin and the platforms connected before 2.0.`,consoleUngrant:`Take away`,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})`,boxClaudeCode:`Un abbonamento Claude (Pro, Max, Team): si accede con Anthropic.`,boxOpencodeGo:`L'abbonamento OpenCode Go, con la sua API key.`,boxByUse:`A consumo, con una API key di {provider}.`,groupSubscriptions:`Abbonamenti`,groupUsage:`A consumo`,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`,consoleRequestApp:`Per l'app «{app}»: vedrà le organizzazioni che crea e quelle che le concedi.`,consolePlatformApp:`app «{app}»`,consoleGrants:`Organizzazioni richieste`,consoleGrantsHint:`Un'app ha chiesto un'organizzazione che un'altra app ha creato su questo runner. Concedendola, l'app usa anche i suoi account.`,consoleGrantFrom:`{name} ({app}) chiede l'organizzazione «{tenant}», alle {at}`,consoleGrantApproved:`{name} ora vede «{tenant}».`,consoleGrantDenied:`Rifiutata.`,consoleTenantPlatforms:`App che la vedono`,consoleTenantPlatformsNone:`Solo l'admin e le piattaforme collegate prima della 2.0.`,consoleUngrant:`Togli`,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,h]=(0,u.useState)(null),[g,y]=(0,u.useState)(null),[S,w]=(0,u.useState)(null),[E,D]=(0,u.useState)(!1),O=e=>{w(e),s?.(e!==null)},k=(0,u.useCallback)(async()=>{try{let{accounts:t}=await e.accounts.list();return h(t),y(null),t}catch(e){return y(e instanceof c.RunnerError?e.code:String(e)),h([]),[]}},[e]);(0,u.useEffect)(()=>{k()},[k]);let A=async e=>{let t=e??await k();e&&h(e),i?.(t)},j=e=>(m??[]).filter(t=>t.provider===e),M=e=>e===`claude-code`?l.boxClaudeCode:e===`opencode-go`?l.boxOpencodeGo:v(l.boxByUse,{provider:x(e)});return(0,f.jsxs)(d.Card,{title:t===`user`?l.accountsTitleUser:l.accountsTitleTenant,loading:m===null,loaderMinHeight:120,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===`user`?l.accountsIntroUser:l.accountsIntroTenant}),g&&(0,f.jsx)(d.Alert,{variant:`danger`,children:v(l.error,{error:g})}),m&&(0,f.jsx)(d.ConnectionBoard,{items:p.map(e=>{let t=j(e),n=t.filter(e=>e.noCreditUntil);return{id:e,label:x(e),description:M(e),icon:e===`claude-code`?`user`:`key-round`,group:b.includes(e)?`subscription`:`usage`,count:t.length,status:t.length>0&&n.length===t.length?(0,f.jsx)(d.Badge,{variant:`warning`,children:v(l.accountsNoCredit,{at:C(n.map(e=>e.noCreditUntil).sort()[0])})}):void 0}}),titles:{subscription:l.groupSubscriptions,usage:l.groupUsage},onOpen:e=>O(e)}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l.termsNote})]}),S&&m&&(0,f.jsx)(d.Modal,{title:x(S),position:`right`,size:`lg`,stackedBehind:E,onClose:()=>O(null),footer:(0,f.jsx)(d.ActionButton,{variant:`link`,label:l.close,onClick:()=>O(null)}),children:(0,f.jsx)(T,{client:e,t:l,provider:S,accounts:j(S),onChanged:A,onStack:D,extra:o?.(S,j(S))})})]})}function T({client:e,t,provider:n,accounts:r,onChanged:i,onStack:a,extra:o}){let[s,l]=(0,u.useState)(null),p=e=>l(v(t.error,{error:e instanceof c.RunnerError?e.code:String(e)})),m=e=>r.find(t=>t.id===e);return(0,f.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n===`claude-code`?t.boxClaudeCode:n===`opencode-go`?t.boxOpencodeGo:v(t.boxByUse,{provider:x(n)})}),s&&(0,f.jsx)(d.Alert,{variant:`danger`,children:s}),(0,f.jsx)(d.ConnectionList,{items:r.map(e=>({id:e.id,label:e.label,icon:e.provider===`claude-code`?`user`:`key-round`,meta:v(t.accountsAddedOn,{date:S(e.at)}),exhaustedUntil:e.noCreditUntil})),title:v(t.accountsSection,{name:x(n),count:String(r.length)}),emptyText:t.accountsEmpty,unnamed:t.accountsUnnamed,orderHint:t.accountsOrderHint,addLabel:n===`claude-code`?t.accountsAdd:t.keyConnect,onStack:a,onReorder:t=>e.accounts.order(n,t).then(e=>i(e),p),onRename:async(t,r)=>{await i(await e.accounts.rename(n,t,r))},onRemove:async t=>{await e.accounts.remove(m(t).provider,t).catch(p),await i()},renderAdd:a=>n===`claude-code`?(0,f.jsx)(E,{client:e,t,others:r.length,onDone:async()=>{a(),await i()},onCancel:a}):(0,f.jsx)(D,{client:e,t,providers:[n],onDone:async()=>{a(),await i()},onCancel:a})}),o]})}function E({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 D({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 O({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 k({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)(O,{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)(O,{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)(O,{title:o.guideAccessTitle,children:(0,f.jsx)(`p`,{className:`text-sm`,children:o.guideAccess})}),(0,f.jsxs)(O,{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
2
  `)})]}),(0,f.jsxs)(O,{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)(O,{title:o.guideTroubleTitle,children:(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.guideTrouble})})]})}function A({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)(N,{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 j({target:e,children:t}){return e?(0,p.createPortal)(t,e):null}var M=e=>{try{return new URL(e).hostname}catch{return e}};function N({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)(P,{title:t.addAutomatic,hint:t.addAutomaticHint,onClick:()=>s(`automatic`)}),(0,f.jsx)(P,{title:t.addGuided,hint:t.addGuidedHint,onClick:()=>s(`guided`)}),(0,f.jsx)(P,{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)(B,{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)(k,{locale:n,texts:t,onPair:async({url:t,code:n})=>{await i(await e.add({name:M(t),url:t,code:n}))}}),o===`existing`&&(0,f.jsx)(R,{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:M(t),url:t,code:n}))}catch(e){h(e)}}})]})})}function P({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 F=e=>(/^https?:\/\//.test(e.trim())?e.trim():`https://${e.trim()}`).replace(/\/+$/,``),I=e=>new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}),L=5;function R({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>=L&&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:I(g.expiresAt)})}),(0,f.jsx)(j,{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)(j,{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(F(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=F(s);_(await n.start({name:M(e),url:e}))}catch(e){i(e)}}})]})]})}var z=[`check`,`docker`,`files`,`start`,`agent`,`health`,`pair`,`tls`,`done`];function B({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:z.map(e=>(0,f.jsx)(d.Badge,{variant:p===e?`primary`:z.indexOf(e)<z.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)(j,{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 V=e=>(e/1024**3).toFixed(1),H=e=>new Date(e).toLocaleString(void 0,{dateStyle:`short`,timeStyle:`short`});function U({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)(q,{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:V(o.machine.availableBytes),total:V(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:H(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)(W,{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)(G,{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 W({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:[H(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 G({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 K=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,``);function q({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?K(n):``;a([...t].sort((e,t)=>Number(K(t.code)===r)-Number(K(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&&K(i.code)===K(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:H(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=N,exports.InstallGuide=k,exports.RunnerAccounts=w,exports.RunnerConsole=U,exports.RunnersSettings=A,exports.fill=v,exports.runnerTexts=g,exports.textsFor=_;
3
+ `)}),(0,f.jsx)(j,{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 V=e=>(e/1024**3).toFixed(1),H=e=>new Date(e).toLocaleString(void 0,{dateStyle:`short`,timeStyle:`short`});function U({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)(q,{client:e,t:a,approve:i,onAnswered:S}),(0,f.jsx)(J,{client:e,t:a,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:V(o.machine.availableBytes),total:V(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:H(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)(W,{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)(G,{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 W({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 n.app?(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:`flex flex-1 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:[H(n.createdAt),` · `,v(t.consolePlatformApp,{app:n.app})]})]}),(0,f.jsx)(d.ActionButton,{icon:`trash`,label:t.consoleRevoke,variant:`outline-danger`,onClick:()=>s(n)})]},n.id):(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:[H(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 G({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,g]=(0,u.useState)({}),_=(0,u.useMemo)(()=>e.as({tenant:t.id}),[e,t.id]),y=(0,u.useCallback)(async()=>l(await e.platform.keys(t.id)),[e,t.id]);return(0,u.useEffect)(()=>{o&&(y(),t.platforms?.length&&e.platform.platformKeys().then(e=>g(Object.fromEntries(e.map(e=>[e.id,e.app?`${e.name} (${e.app})`:e.name])))).catch(()=>void 0))},[o,y,e,t.platforms]),(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.consoleTenantPlatforms}),t.platforms?.length?t.platforms.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:h[r]??r}),(0,f.jsx)(d.ActionButton,{label:n.consoleUngrant,variant:`outline-danger`,onClick:async()=>{await e.grantTenant(t.id,r,!1),await a()}})]},r)):(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.consoleTenantPlatformsNone}),(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 y()}})]},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 y()}})}),(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:n.consoleAccounts}),(0,f.jsx)(w,{client:_,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 K=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,``);function q({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?K(n):``;a([...t].sort((e,t)=>Number(K(t.code)===r)-Number(K(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&&K(i.code)===K(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:H(i.createdAt)})}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i.app?v(t.consoleRequestApp,{app:i.app}):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)})]})})}function J({client:e,t,onAnswered:n}){let[r,i]=(0,u.useState)([]),[a,o]=(0,u.useState)(null),s=(0,u.useCallback)(async()=>{try{i(await e.grantRequests())}catch{i([])}},[e]);return(0,u.useEffect)(()=>{s();let e=setInterval(()=>void s(),5e3);return()=>clearInterval(e)},[s]),!r.length&&!a?null:(0,f.jsx)(d.Card,{title:t.consoleGrants,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.consoleGrantsHint}),a&&(0,f.jsx)(d.Alert,{variant:a.variant,children:a.text}),r.map(r=>{let i=async i=>{await e.answerGrant(r.id,i),o(i?{variant:`success`,text:v(t.consoleGrantApproved,{name:r.keyName,tenant:r.tenant})}:{variant:`info`,text:t.consoleGrantDenied}),await s(),await n()};return(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-border p-3`,children:[(0,f.jsx)(`p`,{className:`text-sm`,children:v(t.consoleGrantFrom,{name:r.keyName,app:r.app??`?`,tenant:r.tenant,at:H(r.createdAt)})}),(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,f.jsx)(d.LoadingButton,{label:t.consoleApprove,variant:`primary`,onClick:()=>i(!0)}),(0,f.jsx)(d.LoadingButton,{label:t.consoleDeny,variant:`outline-danger`,onClick:()=>i(!1)})]})]},r.id)})]})})}exports.AddRunner=N,exports.InstallGuide=k,exports.RunnerAccounts=w,exports.RunnerConsole=U,exports.RunnersSettings=A,exports.fill=v,exports.runnerTexts=g,exports.textsFor=_;
4
4
  //# sourceMappingURL=ui.js.map