@certalis/agent-smith 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -335,13 +335,13 @@ class PriceCatalogue {
335
335
  return PriceCatalogue.instance;
336
336
  }
337
337
  getCacheDir() {
338
- return join2(tmpdir(), "ccflare");
338
+ return join2(tmpdir(), "agent-smith");
339
339
  }
340
340
  getCachePath() {
341
341
  return join2(this.getCacheDir(), "models.dev.json");
342
342
  }
343
343
  getCacheDurationMs() {
344
- const hours = Number(process.env.CF_PRICING_REFRESH_HOURS) || 24;
344
+ const hours = Number(process.env.AGENT_SMITH_PRICING_REFRESH_HOURS) || 24;
345
345
  return hours * TIME_CONSTANTS.HOUR;
346
346
  }
347
347
  async ensureCacheDir() {
@@ -1035,7 +1035,7 @@ class LogFileWriter {
1035
1035
  stream = null;
1036
1036
  maxFileSize = BUFFER_SIZES.LOG_FILE_MAX_SIZE;
1037
1037
  constructor() {
1038
- this.logDir = join3(tmpdir2(), "ccflare-logs");
1038
+ this.logDir = join3(tmpdir2(), "agent-smith-logs");
1039
1039
  if (!existsSync(this.logDir)) {
1040
1040
  mkdirSync(this.logDir, { recursive: true });
1041
1041
  }
@@ -1121,11 +1121,11 @@ class Logger {
1121
1121
  constructor(prefix = "", level = 1 /* INFO */, options = {}) {
1122
1122
  this.prefix = prefix;
1123
1123
  this.level = this.getLogLevelFromEnv() || level;
1124
- this.format = process.env.LOG_FORMAT || "pretty";
1125
- this.silentConsole = options.silentConsole ?? !(process.env.ccflare_DEBUG === "1" || this.level === 0 /* DEBUG */);
1124
+ this.format = process.env.AGENT_SMITH_LOG_FORMAT || "pretty";
1125
+ this.silentConsole = options.silentConsole ?? !(process.env.AGENT_SMITH_DEBUG === "1" || this.level === 0 /* DEBUG */);
1126
1126
  }
1127
1127
  getLogLevelFromEnv() {
1128
- const envLevel = process.env.LOG_LEVEL?.toUpperCase();
1128
+ const envLevel = process.env.AGENT_SMITH_LOG_LEVEL?.toUpperCase();
1129
1129
  if (envLevel && envLevel in LogLevel) {
1130
1130
  return LogLevel[envLevel];
1131
1131
  }
@@ -1202,7 +1202,7 @@ class Logger {
1202
1202
  }
1203
1203
  setLevel(level) {
1204
1204
  this.level = level;
1205
- this.silentConsole = !(process.env.ccflare_DEBUG === "1" || this.level === 0 /* DEBUG */);
1205
+ this.silentConsole = !(process.env.AGENT_SMITH_DEBUG === "1" || this.level === 0 /* DEBUG */);
1206
1206
  }
1207
1207
  getLevel() {
1208
1208
  return this.level;
@@ -1237,11 +1237,11 @@ import { platform } from "process";
1237
1237
  function getPlatformConfigDir() {
1238
1238
  if (platform === "win32") {
1239
1239
  const baseDir = process.env.LOCALAPPDATA ?? process.env.APPDATA ?? join4(homedir(), "AppData", "Local");
1240
- return join4(baseDir, "ccflare");
1240
+ return join4(baseDir, "agent-smith");
1241
1241
  } else {
1242
1242
  const xdgConfig = process.env.XDG_CONFIG_HOME;
1243
1243
  const baseDir = xdgConfig ?? join4(homedir(), ".config");
1244
- return join4(baseDir, "ccflare");
1244
+ return join4(baseDir, "agent-smith");
1245
1245
  }
1246
1246
  }
1247
1247
  var init_paths_common = () => {};
@@ -1249,12 +1249,12 @@ var init_paths_common = () => {};
1249
1249
  // ../../packages/config/src/paths.ts
1250
1250
  import { join as join5 } from "path";
1251
1251
  function resolveConfigPath() {
1252
- const explicitPath = process.env.ccflare_CONFIG_PATH;
1252
+ const explicitPath = process.env.AGENT_SMITH_CONFIG_PATH;
1253
1253
  if (explicitPath) {
1254
1254
  return explicitPath;
1255
1255
  }
1256
1256
  const configDir = getPlatformConfigDir();
1257
- return join5(configDir, "ccflare.json");
1257
+ return join5(configDir, "agent-smith.json");
1258
1258
  }
1259
1259
  var init_paths = __esm(() => {
1260
1260
  init_paths_common();
@@ -1638,7 +1638,7 @@ var init_src4 = __esm(() => {
1638
1638
  this.emit("change", { key, oldValue, newValue: value });
1639
1639
  }
1640
1640
  getStrategy() {
1641
- const envStrategy = process.env.LB_STRATEGY;
1641
+ const envStrategy = process.env.AGENT_SMITH_LB_STRATEGY;
1642
1642
  if (envStrategy && isValidStrategy(envStrategy)) {
1643
1643
  return envStrategy;
1644
1644
  }
@@ -1658,7 +1658,7 @@ var init_src4 = __esm(() => {
1658
1658
  return Math.max(min, Math.min(max, n));
1659
1659
  }
1660
1660
  getDataRetentionDays() {
1661
- const fromEnv = process.env.DATA_RETENTION_DAYS;
1661
+ const fromEnv = process.env.AGENT_SMITH_DATA_RETENTION_DAYS;
1662
1662
  if (fromEnv) {
1663
1663
  const n = parseInt(fromEnv, 10);
1664
1664
  if (!Number.isNaN(n))
@@ -1674,7 +1674,7 @@ var init_src4 = __esm(() => {
1674
1674
  this.set("data_retention_days", clamped);
1675
1675
  }
1676
1676
  getRequestRetentionDays() {
1677
- const fromEnv = process.env.REQUEST_RETENTION_DAYS;
1677
+ const fromEnv = process.env.AGENT_SMITH_REQUEST_RETENTION_DAYS;
1678
1678
  if (fromEnv) {
1679
1679
  const n = parseInt(fromEnv, 10);
1680
1680
  if (!Number.isNaN(n))
@@ -1859,34 +1859,34 @@ var init_src4 = __esm(() => {
1859
1859
  port: NETWORK.DEFAULT_PORT,
1860
1860
  teamRouting: this.getTeamRouting()
1861
1861
  };
1862
- if (process.env.CLIENT_ID) {
1863
- defaults.clientId = process.env.CLIENT_ID;
1862
+ if (process.env.AGENT_SMITH_CLIENT_ID) {
1863
+ defaults.clientId = process.env.AGENT_SMITH_CLIENT_ID;
1864
1864
  }
1865
- const retryAttempts = parseNumber(process.env.RETRY_ATTEMPTS);
1865
+ const retryAttempts = parseNumber(process.env.AGENT_SMITH_RETRY_ATTEMPTS);
1866
1866
  if (retryAttempts !== undefined) {
1867
1867
  defaults.retry.attempts = retryAttempts;
1868
1868
  }
1869
- const maxBodyBytes = parseNumber(process.env.MAX_BODY_BYTES);
1869
+ const maxBodyBytes = parseNumber(process.env.AGENT_SMITH_MAX_BODY_BYTES);
1870
1870
  if (maxBodyBytes !== undefined) {
1871
1871
  defaults.maxBodyBytes = maxBodyBytes;
1872
1872
  }
1873
- const quotaThreshold = parseNumber(process.env.QUOTA_THRESHOLD);
1873
+ const quotaThreshold = parseNumber(process.env.AGENT_SMITH_QUOTA_THRESHOLD);
1874
1874
  if (quotaThreshold !== undefined && quotaThreshold > 0 && quotaThreshold <= 1) {
1875
1875
  defaults.quotaThreshold = quotaThreshold;
1876
1876
  }
1877
- const retryDelayMs = parseNumber(process.env.RETRY_DELAY_MS);
1877
+ const retryDelayMs = parseNumber(process.env.AGENT_SMITH_RETRY_DELAY_MS);
1878
1878
  if (retryDelayMs !== undefined) {
1879
1879
  defaults.retry.delayMs = retryDelayMs;
1880
1880
  }
1881
- const retryBackoff = parseNumber(process.env.RETRY_BACKOFF);
1881
+ const retryBackoff = parseNumber(process.env.AGENT_SMITH_RETRY_BACKOFF);
1882
1882
  if (retryBackoff !== undefined) {
1883
1883
  defaults.retry.backoff = retryBackoff;
1884
1884
  }
1885
- const requestScopedRetryDelayMs = parseNumber(process.env.REQUEST_SCOPED_429_RETRY_DELAY_MS);
1885
+ const requestScopedRetryDelayMs = parseNumber(process.env.AGENT_SMITH_REQUEST_SCOPED_429_RETRY_DELAY_MS);
1886
1886
  if (requestScopedRetryDelayMs !== undefined) {
1887
1887
  defaults.requestScopedRetryDelayMs = requestScopedRetryDelayMs;
1888
1888
  }
1889
- const sessionDurationMs = parseNumber(process.env.SESSION_DURATION_MS);
1889
+ const sessionDurationMs = parseNumber(process.env.AGENT_SMITH_SESSION_DURATION_MS);
1890
1890
  if (sessionDurationMs !== undefined) {
1891
1891
  defaults.sessionDurationMs = sessionDurationMs;
1892
1892
  }
@@ -1982,12 +1982,12 @@ var init_analytics_query = __esm(() => {
1982
1982
  // ../../packages/database/src/paths.ts
1983
1983
  import { join as join6 } from "path";
1984
1984
  function resolveDbPath() {
1985
- const explicitPath = process.env.ccflare_DB_PATH;
1985
+ const explicitPath = process.env.AGENT_SMITH_DB_PATH;
1986
1986
  if (explicitPath) {
1987
1987
  return explicitPath;
1988
1988
  }
1989
1989
  const configDir = getPlatformConfigDir();
1990
- return join6(configDir, "ccflare.db");
1990
+ return join6(configDir, "agent-smith.db");
1991
1991
  }
1992
1992
  var init_paths2 = __esm(() => {
1993
1993
  init_src4();
@@ -6477,7 +6477,7 @@ function createAuthCallbackHandler(dbOps, config, providerRegistry) {
6477
6477
  sessionId: authSession.id,
6478
6478
  code
6479
6479
  });
6480
- return htmlPage(200, "Account connected", "Your OAuth account has been connected successfully. You can close this window and return to ccflare.");
6480
+ return htmlPage(200, "Account connected", "Your OAuth account has been connected successfully. You can close this window and return to agent-smith.");
6481
6481
  } catch (error) {
6482
6482
  dbOps.deleteAuthSession(authSession.id);
6483
6483
  return htmlPage(400, "Authorization failed", escapeHtml(error instanceof Error ? error.message : "Failed to complete OAuth flow."));
@@ -8649,11 +8649,12 @@ async function prepareRequestBody(req, maxBodyBytes = DEFAULT_MAX_BODY_BYTES) {
8649
8649
  }
8650
8650
  };
8651
8651
  }
8652
- async function makeProxyRequest(targetUrl, method, headers3, createBodyStream, hasBody) {
8652
+ async function makeProxyRequest(targetUrl, method, headers3, createBodyStream, hasBody, signal) {
8653
8653
  return fetch(targetUrl, {
8654
8654
  method,
8655
8655
  headers: headers3,
8656
8656
  body: createBodyStream(),
8657
+ signal,
8657
8658
  ...hasBody ? { duplex: "half" } : {}
8658
8659
  });
8659
8660
  }
@@ -9677,7 +9678,7 @@ function createUpstreamSender(input) {
9677
9678
  const requestAccount = token === input.account.access_token ? input.account : { ...input.account, access_token: token };
9678
9679
  const headers3 = input.ctx.provider.prepareHeaders(input.req.headers, requestAccount);
9679
9680
  const upstreamRequestStartedAt = Date.now();
9680
- const response = await makeProxyRequest(targetUrl, input.req.method, headers3, () => input.createBodyStream(input.requestBody), !!input.req.body);
9681
+ const response = await makeProxyRequest(targetUrl, input.req.method, headers3, () => input.createBodyStream(input.requestBody), !!input.req.body, input.req.signal);
9681
9682
  return {
9682
9683
  response,
9683
9684
  responseHeadersReceivedAt: Date.now(),
@@ -9801,6 +9802,7 @@ async function proxyWithAccount(req, url, account2, requestMeta, requestBodyBuff
9801
9802
  const upstream = await sendAuthorizedRequest(input, createUpstreamSender(input));
9802
9803
  return isProxyAttempt(upstream) ? upstream : await classifyUpstreamResponse(input, upstream);
9803
9804
  } catch (err) {
9805
+ req.signal.throwIfAborted();
9804
9806
  handleProxyError(err, account2, log20);
9805
9807
  return err instanceof TokenRefreshError ? { kind: "failed" } : { kind: "transport-failure" };
9806
9808
  }
@@ -9873,6 +9875,7 @@ function quotaExhaustionResponse(resetAt2) {
9873
9875
  });
9874
9876
  }
9875
9877
  async function attemptAccount(request2, account2, failoverAttempts) {
9878
+ request2.req.signal.throwIfAborted();
9876
9879
  const admission = request2.ctx.teamAdmission;
9877
9880
  let permit;
9878
9881
  try {
@@ -10428,7 +10431,7 @@ function createDefaultLogger() {
10428
10431
  };
10429
10432
  }
10430
10433
  function resolveUsageWorkerEntrypoint() {
10431
- const configuredPath = process.env.CF_USAGE_WORKER_PATH?.trim();
10434
+ const configuredPath = process.env.AGENT_SMITH_USAGE_WORKER_PATH?.trim();
10432
10435
  if (!configuredPath) {
10433
10436
  return new URL("./post-processor.worker.ts", import.meta.url).href;
10434
10437
  }
@@ -10766,8 +10769,8 @@ var DEFAULT_READY_TIMEOUT_MS, DEFAULT_ACK_TIMEOUT_MS, DEFAULT_SHUTDOWN_DELAY_MS
10766
10769
  var init_usage_worker = __esm(() => {
10767
10770
  init_src2();
10768
10771
  init_src();
10769
- DEFAULT_READY_TIMEOUT_MS = Number(process.env.CF_USAGE_WORKER_READY_TIMEOUT_MS || TIME_CONSTANTS.RETRY_DELAY_DEFAULT * 5);
10770
- DEFAULT_ACK_TIMEOUT_MS = Number(process.env.CF_USAGE_WORKER_ACK_TIMEOUT_MS || TIME_CONSTANTS.RETRY_DELAY_DEFAULT * 5);
10772
+ DEFAULT_READY_TIMEOUT_MS = Number(process.env.AGENT_SMITH_USAGE_WORKER_READY_TIMEOUT_MS || TIME_CONSTANTS.RETRY_DELAY_DEFAULT * 5);
10773
+ DEFAULT_ACK_TIMEOUT_MS = Number(process.env.AGENT_SMITH_USAGE_WORKER_ACK_TIMEOUT_MS || TIME_CONSTANTS.RETRY_DELAY_DEFAULT * 5);
10771
10774
  });
10772
10775
 
10773
10776
  // ../../packages/proxy/src/proxy.ts
@@ -11752,13 +11755,13 @@ function configuredKey(value) {
11752
11755
  return typeof value === "string" && value.length > 0 ? value : undefined;
11753
11756
  }
11754
11757
  function createExposureConfig(config) {
11755
- const configuredHost = configuredKey(process.env.CF_HOST) ?? configuredKey(config.get("host"));
11756
- const configuredTrustLoopback = process.env.CF_TRUST_LOOPBACK;
11758
+ const configuredHost = configuredKey(process.env.AGENT_SMITH_HOST) ?? configuredKey(config.get("host"));
11759
+ const configuredTrustLoopback = process.env.AGENT_SMITH_TRUST_LOOPBACK;
11757
11760
  return {
11758
- adminKey: configuredKey(process.env.CF_ADMIN_KEY),
11761
+ adminKey: configuredKey(process.env.AGENT_SMITH_ADMIN_KEY),
11759
11762
  bindHost: configuredHost ?? "127.0.0.1",
11760
- proxyKey: configuredKey(process.env.CF_PROXY_KEY),
11761
- clientKeysFile: configuredKey(process.env.CF_CLIENT_KEYS_FILE),
11763
+ proxyKey: configuredKey(process.env.AGENT_SMITH_PROXY_KEY),
11764
+ clientKeysFile: configuredKey(process.env.AGENT_SMITH_CLIENT_KEYS_FILE),
11762
11765
  trustLoopback: configuredTrustLoopback === undefined ? config.get("trust_loopback") !== false : configuredTrustLoopback !== "false"
11763
11766
  };
11764
11767
  }
@@ -11926,7 +11929,7 @@ function bootstrapRuntime(port, serverLog) {
11926
11929
  container.registerInstance(SERVICE_KEYS.PricingLogger, pricingLogger);
11927
11930
  setPricingLogger(pricingLogger);
11928
11931
  const apiRouter = new APIRouter({
11929
- enrollmentOrigin: process.env.CF_ENROLLMENT_ORIGIN,
11932
+ enrollmentOrigin: process.env.AGENT_SMITH_ENROLLMENT_ORIGIN,
11930
11933
  config,
11931
11934
  dbOps,
11932
11935
  providerRegistry,
@@ -12081,7 +12084,7 @@ function serveDashboardRoute(url) {
12081
12084
  }
12082
12085
  return null;
12083
12086
  }
12084
- var DASHBOARD_MANIFEST_EXPORT = "@ccflare/web/manifest.json", DASHBOARD_DIST_DIR_ENV = "CF_DASHBOARD_DIST_DIR", DASHBOARD_MANIFEST_PATH_ENV = "CF_DASHBOARD_MANIFEST_PATH", dashboardAssets = null;
12087
+ var DASHBOARD_MANIFEST_EXPORT = "@agent-smith/web/manifest.json", DASHBOARD_DIST_DIR_ENV = "AGENT_SMITH_DASHBOARD_DIST_DIR", DASHBOARD_MANIFEST_PATH_ENV = "AGENT_SMITH_DASHBOARD_MANIFEST_PATH", dashboardAssets = null;
12085
12088
  var init_dashboard_assets = __esm(() => {
12086
12089
  init_src2();
12087
12090
  });
@@ -12106,7 +12109,7 @@ var init_oauth_token = __esm(() => {
12106
12109
  "host",
12107
12110
  "content-length",
12108
12111
  "x-api-key",
12109
- "x-ccflare-scenario-client-id"
12112
+ "x-agent-smith-scenario-client-id"
12110
12113
  ];
12111
12114
  });
12112
12115
 
@@ -12201,7 +12204,7 @@ function createStartupBanner(options) {
12201
12204
  const dashboardUrl = withDashboard ? `http://localhost:${port}` : "disabled";
12202
12205
  const supportedProviders = providers2.join(", ");
12203
12206
  return `
12204
- \uD83C\uDFAF ccflare Server v${version}
12207
+ \uD83C\uDFAF Agent Smith Server v${version}
12205
12208
  \uD83C\uDF10 Port: ${port}
12206
12209
  \uD83D\uDCCA Dashboard: ${dashboardUrl}
12207
12210
  \uD83D\uDD17 Management API: http://localhost:${port}/api
@@ -12355,6 +12358,7 @@ function startServer(options) {
12355
12358
  if (options?.additionalUnixSocket) {
12356
12359
  unixServerInstance = serve({
12357
12360
  unix: options.additionalUnixSocket,
12361
+ idleTimeout: NETWORK.IDLE_TIMEOUT_MAX,
12358
12362
  fetch: fetchHandler,
12359
12363
  websocket: websocketProxyHandler
12360
12364
  });
@@ -12808,6 +12812,79 @@ var init_request_presenters = __esm(() => {
12808
12812
  };
12809
12813
  });
12810
12814
 
12815
+ // ../../packages/ui/src/themes/agent-smith.ts
12816
+ var agentSmithLight, agentSmithDark;
12817
+ var init_agent_smith = __esm(() => {
12818
+ agentSmithLight = {
12819
+ id: "agent-smith-light",
12820
+ name: "Agent Smith Light",
12821
+ family: "agent-smith",
12822
+ appearance: "light",
12823
+ background: "#ffffff",
12824
+ foreground: "#0a0a0f",
12825
+ card: "#ffffff",
12826
+ cardForeground: "#0a0a0f",
12827
+ popover: "#ffffff",
12828
+ popoverForeground: "#0a0a0f",
12829
+ primary: "#f38020",
12830
+ primaryForeground: "#ffffff",
12831
+ secondary: "#f0f0f3",
12832
+ secondaryForeground: "#191920",
12833
+ muted: "#f0f0f3",
12834
+ mutedForeground: "#6e6e7a",
12835
+ accent: "#f38020",
12836
+ accentForeground: "#ffffff",
12837
+ destructive: "#e5484d",
12838
+ destructiveForeground: "#fafafa",
12839
+ border: "#e4e4e9",
12840
+ input: "#e4e4e9",
12841
+ ring: "#f38020",
12842
+ success: "#16a34a",
12843
+ warning: "#ca8a04",
12844
+ error: "#dc2626",
12845
+ info: "#2563eb",
12846
+ chart1: "#f38020",
12847
+ chart2: "#3b82f6",
12848
+ chart3: "#8b5cf6",
12849
+ chart4: "#ec4899",
12850
+ chart5: "#10b981"
12851
+ };
12852
+ agentSmithDark = {
12853
+ id: "agent-smith-dark",
12854
+ name: "Agent Smith Dark",
12855
+ family: "agent-smith",
12856
+ appearance: "dark",
12857
+ background: "#111318",
12858
+ foreground: "#f2f2f2",
12859
+ card: "#181b22",
12860
+ cardForeground: "#f2f2f2",
12861
+ popover: "#181b22",
12862
+ popoverForeground: "#f2f2f2",
12863
+ primary: "#f38020",
12864
+ primaryForeground: "#ffffff",
12865
+ secondary: "#262b33",
12866
+ secondaryForeground: "#f2f2f2",
12867
+ muted: "#262b33",
12868
+ mutedForeground: "#838996",
12869
+ accent: "#f38020",
12870
+ accentForeground: "#ffffff",
12871
+ destructive: "#e5484d",
12872
+ destructiveForeground: "#fafafa",
12873
+ border: "#2a303a",
12874
+ input: "#262b33",
12875
+ ring: "#f38020",
12876
+ success: "#3fb950",
12877
+ warning: "#d29922",
12878
+ error: "#f85149",
12879
+ info: "#58a6ff",
12880
+ chart1: "#f38020",
12881
+ chart2: "#58a6ff",
12882
+ chart3: "#bc8cff",
12883
+ chart4: "#f778ba",
12884
+ chart5: "#3fb950"
12885
+ };
12886
+ });
12887
+
12811
12888
  // ../../packages/ui/src/themes/catppuccin.ts
12812
12889
  var catppuccinMocha, catppuccinMacchiato, catppuccinFrappe, catppuccinLatte;
12813
12890
  var init_catppuccin = __esm(() => {
@@ -12949,79 +13026,6 @@ var init_catppuccin = __esm(() => {
12949
13026
  };
12950
13027
  });
12951
13028
 
12952
- // ../../packages/ui/src/themes/ccflare.ts
12953
- var ccflareLight, ccflareDark;
12954
- var init_ccflare = __esm(() => {
12955
- ccflareLight = {
12956
- id: "ccflare-light",
12957
- name: "ccflare Light",
12958
- family: "ccflare",
12959
- appearance: "light",
12960
- background: "#ffffff",
12961
- foreground: "#0a0a0f",
12962
- card: "#ffffff",
12963
- cardForeground: "#0a0a0f",
12964
- popover: "#ffffff",
12965
- popoverForeground: "#0a0a0f",
12966
- primary: "#f38020",
12967
- primaryForeground: "#ffffff",
12968
- secondary: "#f0f0f3",
12969
- secondaryForeground: "#191920",
12970
- muted: "#f0f0f3",
12971
- mutedForeground: "#6e6e7a",
12972
- accent: "#f38020",
12973
- accentForeground: "#ffffff",
12974
- destructive: "#e5484d",
12975
- destructiveForeground: "#fafafa",
12976
- border: "#e4e4e9",
12977
- input: "#e4e4e9",
12978
- ring: "#f38020",
12979
- success: "#16a34a",
12980
- warning: "#ca8a04",
12981
- error: "#dc2626",
12982
- info: "#2563eb",
12983
- chart1: "#f38020",
12984
- chart2: "#3b82f6",
12985
- chart3: "#8b5cf6",
12986
- chart4: "#ec4899",
12987
- chart5: "#10b981"
12988
- };
12989
- ccflareDark = {
12990
- id: "ccflare-dark",
12991
- name: "ccflare Dark",
12992
- family: "ccflare",
12993
- appearance: "dark",
12994
- background: "#111318",
12995
- foreground: "#f2f2f2",
12996
- card: "#181b22",
12997
- cardForeground: "#f2f2f2",
12998
- popover: "#181b22",
12999
- popoverForeground: "#f2f2f2",
13000
- primary: "#f38020",
13001
- primaryForeground: "#ffffff",
13002
- secondary: "#262b33",
13003
- secondaryForeground: "#f2f2f2",
13004
- muted: "#262b33",
13005
- mutedForeground: "#838996",
13006
- accent: "#f38020",
13007
- accentForeground: "#ffffff",
13008
- destructive: "#e5484d",
13009
- destructiveForeground: "#fafafa",
13010
- border: "#2a303a",
13011
- input: "#262b33",
13012
- ring: "#f38020",
13013
- success: "#3fb950",
13014
- warning: "#d29922",
13015
- error: "#f85149",
13016
- info: "#58a6ff",
13017
- chart1: "#f38020",
13018
- chart2: "#58a6ff",
13019
- chart3: "#bc8cff",
13020
- chart4: "#f778ba",
13021
- chart5: "#3fb950"
13022
- };
13023
- });
13024
-
13025
13029
  // ../../packages/ui/src/themes/dracula.ts
13026
13030
  var dracula;
13027
13031
  var init_dracula = __esm(() => {
@@ -13499,12 +13503,12 @@ function getThemeById(id) {
13499
13503
  return THEME_REGISTRY.find((t) => t.id === id);
13500
13504
  }
13501
13505
  function getDefaultTheme(appearance) {
13502
- return appearance === "dark" ? ccflareDark : ccflareLight;
13506
+ return appearance === "dark" ? agentSmithDark : agentSmithLight;
13503
13507
  }
13504
13508
  var THEME_REGISTRY, THEME_FAMILIES;
13505
13509
  var init_themes = __esm(() => {
13510
+ init_agent_smith();
13506
13511
  init_catppuccin();
13507
- init_ccflare();
13508
13512
  init_dracula();
13509
13513
  init_gruvbox();
13510
13514
  init_nord();
@@ -13513,8 +13517,8 @@ var init_themes = __esm(() => {
13513
13517
  init_solarized();
13514
13518
  init_tokyo_night();
13515
13519
  THEME_REGISTRY = [
13516
- ccflareLight,
13517
- ccflareDark,
13520
+ agentSmithLight,
13521
+ agentSmithDark,
13518
13522
  tokyoNight,
13519
13523
  catppuccinMocha,
13520
13524
  catppuccinMacchiato,
@@ -14059,17 +14063,17 @@ function validateProxyKeyFile(proxyKeyFile) {
14059
14063
  try {
14060
14064
  metadata = statSync3(resolvedPath);
14061
14065
  } catch {
14062
- throw new Error("Agent-smith forwarding-key file is not readable");
14066
+ throw new Error("Agent Smith forwarding-key file is not readable");
14063
14067
  }
14064
14068
  if (!metadata.isFile()) {
14065
- throw new Error("Agent-smith forwarding-key path must be a file");
14069
+ throw new Error("Agent Smith forwarding-key path must be a file");
14066
14070
  }
14067
14071
  if ((metadata.mode & 63) !== 0) {
14068
- throw new Error("Agent-smith forwarding-key file must be owner-only");
14072
+ throw new Error("Agent Smith forwarding-key file must be owner-only");
14069
14073
  }
14070
14074
  const key = readFileSync4(resolvedPath, "utf8").trim();
14071
14075
  if (!/^[\x21-\x7e]{1,512}$/.test(key)) {
14072
- throw new Error("Agent-smith forwarding-key file is invalid");
14076
+ throw new Error("Agent Smith forwarding-key file is invalid");
14073
14077
  }
14074
14078
  return resolvedPath;
14075
14079
  }
@@ -14078,7 +14082,7 @@ function proxyKeySetup(proxyKeyFile) {
14078
14082
  return `export AGENT_SMITH_PROXY_KEY=${shellQuote(LOCAL_CLIENT_KEY)}`;
14079
14083
  }
14080
14084
  return `if [ ! -r ${shellQuote(proxyKeyFile)} ]; then
14081
- echo "Agent-smith forwarding-key file is not readable" >&2
14085
+ echo "Agent Smith forwarding-key file is not readable" >&2
14082
14086
  exit 1
14083
14087
  fi
14084
14088
  export AGENT_SMITH_PROXY_KEY=$(cat ${shellQuote(proxyKeyFile)})`;
@@ -14086,11 +14090,12 @@ export AGENT_SMITH_PROXY_KEY=$(cat ${shellQuote(proxyKeyFile)})`;
14086
14090
  function claudeWrapper(claudePath, baseUrl, proxyKeyFile) {
14087
14091
  return `#!/bin/sh
14088
14092
  # Generated by agent-smith. This file delegates to the real Claude Code binary.
14089
- unset CF_ADMIN_KEY
14090
- unset CF_PROXY_KEY
14093
+ unset AGENT_SMITH_ADMIN_KEY
14094
+ unset AGENT_SMITH_PROXY_KEY
14095
+ unset ANTHROPIC_AUTH_TOKEN
14091
14096
  ${proxyKeySetup(proxyKeyFile)}
14092
14097
  export ANTHROPIC_API_KEY="$AGENT_SMITH_PROXY_KEY"
14093
- export ANTHROPIC_AUTH_TOKEN="$AGENT_SMITH_PROXY_KEY"
14098
+ unset AGENT_SMITH_PROXY_KEY
14094
14099
  export ANTHROPIC_BASE_URL=${shellQuote(baseUrl)}
14095
14100
  exec ${shellQuote(claudePath)} "$@"
14096
14101
  `;
@@ -14098,7 +14103,7 @@ exec ${shellQuote(claudePath)} "$@"
14098
14103
  function codexWrapper(codexPath, baseUrl, proxyKeyFile) {
14099
14104
  const config = [
14100
14105
  'model_provider="agent_smith"',
14101
- 'model_providers.agent_smith.name="Agent-smith"',
14106
+ 'model_providers.agent_smith.name="Agent Smith"',
14102
14107
  `model_providers.agent_smith.base_url="${baseUrl}"`,
14103
14108
  'model_providers.agent_smith.env_key="AGENT_SMITH_PROXY_KEY"',
14104
14109
  'model_providers.agent_smith.wire_api="responses"',
@@ -14108,8 +14113,8 @@ function codexWrapper(codexPath, baseUrl, proxyKeyFile) {
14108
14113
  const overrides = config.map((entry) => ` -c ${shellQuote(entry)}`).join(" \\\n");
14109
14114
  return `#!/bin/sh
14110
14115
  # Generated by agent-smith. This file delegates to the real Codex binary.
14111
- unset CF_ADMIN_KEY
14112
- unset CF_PROXY_KEY
14116
+ unset AGENT_SMITH_ADMIN_KEY
14117
+ unset AGENT_SMITH_PROXY_KEY
14113
14118
  ${proxyKeySetup(proxyKeyFile)}
14114
14119
  exec ${shellQuote(codexPath)} \\
14115
14120
  ${overrides} \\
@@ -14118,7 +14123,7 @@ ${overrides} \\
14118
14123
  }
14119
14124
  async function installClientWrappers(options) {
14120
14125
  if (options.baseUrl && !options.proxyKeyFile) {
14121
- throw new Error("A configured Agent-smith server requires a forwarding key file");
14126
+ throw new Error("A configured Agent Smith server requires a forwarding key file");
14122
14127
  }
14123
14128
  mkdirSync4(options.binDir, { recursive: true, mode: 448 });
14124
14129
  const proxyKeyFile = options.proxyKeyFile ? validateProxyKeyFile(options.proxyKeyFile) : undefined;
@@ -14373,18 +14378,18 @@ function claudeProxyBaseUrl(port, usePool = false) {
14373
14378
  }
14374
14379
  function claudeRunEnvironment(port, proxyKey, environment = process.env, usePool = false) {
14375
14380
  const childEnvironment = { ...environment };
14376
- delete childEnvironment.CF_ADMIN_KEY;
14377
- delete childEnvironment.CF_PROXY_KEY;
14381
+ delete childEnvironment.AGENT_SMITH_ADMIN_KEY;
14382
+ delete childEnvironment.AGENT_SMITH_PROXY_KEY;
14383
+ delete childEnvironment.ANTHROPIC_AUTH_TOKEN;
14378
14384
  return {
14379
14385
  ...childEnvironment,
14380
14386
  ANTHROPIC_API_KEY: proxyKey,
14381
- ANTHROPIC_AUTH_TOKEN: proxyKey,
14382
14387
  ANTHROPIC_BASE_URL: claudeProxyBaseUrl(port, usePool)
14383
14388
  };
14384
14389
  }
14385
14390
  function requireProxyKey(proxyKey) {
14386
14391
  if (!proxyKey) {
14387
- throw new Error("ccflare run requires CF_PROXY_KEY to authenticate its local proxy");
14392
+ throw new Error("agent-smith run requires AGENT_SMITH_PROXY_KEY to authenticate its local proxy");
14388
14393
  }
14389
14394
  return proxyKey;
14390
14395
  }
@@ -14515,7 +14520,7 @@ function loadPersistedThemeId() {
14515
14520
  }
14516
14521
  }
14517
14522
  } catch {}
14518
- return "ccflare-dark";
14523
+ return "agent-smith-dark";
14519
14524
  }
14520
14525
  function persistThemeId(themeId) {
14521
14526
  try {
@@ -14547,7 +14552,7 @@ function getAvailableThemes() {
14547
14552
  var CONFIG_DIR, CONFIG_FILE, currentThemeId, currentColors, C, NAV_ITEMS, SCREEN_TITLES;
14548
14553
  var init_theme = __esm(() => {
14549
14554
  init_src12();
14550
- CONFIG_DIR = join9(homedir3(), ".config", "ccflare");
14555
+ CONFIG_DIR = join9(homedir3(), ".config", "agent-smith");
14551
14556
  CONFIG_FILE = join9(CONFIG_DIR, "theme.json");
14552
14557
  currentThemeId = loadPersistedThemeId();
14553
14558
  currentColors = themeToTuiColors(getThemeById(currentThemeId) ?? getDefaultTheme("dark"));
@@ -15137,7 +15142,7 @@ function AccountsScreen({ refreshKey, port }) {
15137
15142
  /* @__PURE__ */ jsxs("text", {
15138
15143
  fg: C.dim,
15139
15144
  children: [
15140
- "The real clients are not overwritten. Agent-smith adds only its marked PATH block to ",
15145
+ "The real clients are not overwritten. Agent Smith adds only its marked PATH block to ",
15141
15146
  paths2.shellProfile,
15142
15147
  "."
15143
15148
  ]
@@ -15145,7 +15150,7 @@ function AccountsScreen({ refreshKey, port }) {
15145
15150
  ]
15146
15151
  }) : /* @__PURE__ */ jsx("text", {
15147
15152
  fg: C.dim,
15148
- children: "Remove Agent-smith's wrappers and its marked PATH block. The real clients remain unchanged."
15153
+ children: "Remove Agent Smith's wrappers and its marked PATH block. The real clients remain unchanged."
15149
15154
  }),
15150
15155
  /* @__PURE__ */ jsx("text", {
15151
15156
  fg: C.muted,
@@ -17647,7 +17652,7 @@ function ThemePicker({ onClose }) {
17647
17652
  }),
17648
17653
  /* @__PURE__ */ jsx12("text", {
17649
17654
  fg: C.muted,
17650
- children: "Persists to ~/.config/ccflare/theme.json"
17655
+ children: "Persists to ~/.config/agent-smith/theme.json"
17651
17656
  })
17652
17657
  ]
17653
17658
  }) : /* @__PURE__ */ jsx12("text", {
@@ -17993,7 +17998,7 @@ Examples:
17993
17998
  agent-smith --pause work # Pause account
17994
17999
  agent-smith --analyze # Run performance analysis
17995
18000
  agent-smith --stats # View stats
17996
- agent-smith install-client # Configure Claude Code and Codex for this Agent-smith server
18001
+ agent-smith install-client # Configure Claude Code and Codex for this Agent Smith server
17997
18002
  `);
17998
18003
  process.exit(0);
17999
18004
  }
@@ -18022,14 +18027,15 @@ Examples:
18022
18027
  baseUrl: client2.baseUrl,
18023
18028
  proxyKeyFile: client2.proxyKeyFile
18024
18029
  });
18025
- console.log(`Claude Code and Codex now route through ${client2.baseUrl}`);
18030
+ console.log(`Client wrappers configured for ${client2.baseUrl}.`);
18031
+ console.log("Open a new shell and launch Claude Code or Codex through these wrappers. Already-running sessions are unchanged; restart or resume them through the wrapper.");
18026
18032
  return;
18027
18033
  }
18028
18034
  if (parsed.run) {
18029
18035
  printPocNotice();
18030
18036
  const config2 = new Config;
18031
18037
  const port2 = parsed.port || config2.getRuntime().port || NETWORK.DEFAULT_PORT;
18032
- const proxyKey = requireProxyKey(process.env.CF_PROXY_KEY ?? "");
18038
+ const proxyKey = requireProxyKey(process.env.AGENT_SMITH_PROXY_KEY ?? "");
18033
18039
  const proxyServer = startServer({ port: port2, withDashboard: false });
18034
18040
  let exitCode;
18035
18041
  try {
@@ -18180,8 +18186,8 @@ var init_main = __esm(() => {
18180
18186
 
18181
18187
  // src/bundled-assets.ts
18182
18188
  import { join } from "path";
18183
- process.env.CF_DASHBOARD_DIST_DIR ??= join(import.meta.dir, "dashboard");
18184
- process.env.CF_USAGE_WORKER_PATH ??= join(import.meta.dir, "post-processor.worker.js");
18189
+ process.env.AGENT_SMITH_DASHBOARD_DIST_DIR ??= join(import.meta.dir, "dashboard");
18190
+ process.env.AGENT_SMITH_USAGE_WORKER_PATH ??= join(import.meta.dir, "post-processor.worker.js");
18185
18191
 
18186
18192
  // src/bin.ts
18187
18193
  await Promise.resolve().then(() => (init_main(), exports_main));