@64mb/freelens-power 2.21.9 → 2.22.1

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.
@@ -1 +1 @@
1
- export { t as CodexApiError, n as createCodexApiSession } from "./ai-codex-api-CHt-EMIE.js";
1
+ export { t as CodexApiError, n as createCodexApiSession } from "./ai-codex-api-DmYSBZSZ.js";
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as AI_MODELS_CHANNEL, c as CODEX_API_REASONING_EFFORTS, d as piModelEfforts, f as piModelLabel, g as __require, h as __commonJSMin, i as setAiApiKey, l as CODEX_REASONING_EFFORTS, m as Main, n as createCodexApiSession, o as CLAUDE_REASONING_EFFORTS, p as Common, r as aiApiKeyStatus, s as CODEX_API_MODELS, t as CodexApiError, u as PI_REASONING_EFFORTS } from "./ai-codex-api-CHt-EMIE.js";
1
+ import { _ as __require, a as AI_MODELS_CHANNEL, c as CODEX_API_MODELS, d as PI_REASONING_EFFORTS, f as piModelEfforts, g as __commonJSMin, h as Main, i as setAiApiKey, l as CODEX_API_REASONING_EFFORTS, m as Common, n as createCodexApiSession, o as CLAUDE_REASONING_EFFORTS, p as piModelLabel, r as aiApiKeyStatus, s as CODEX_62_MODELS, t as CodexApiError, u as CODEX_REASONING_EFFORTS } from "./ai-codex-api-DmYSBZSZ.js";
2
2
  import { n as normalizePowerLogsLimits, t as applyPowerLogsLimits } from "./power-logs-limits-CdzRcMHg.js";
3
3
  import { i as POWER_LOGS_STORAGE_CHANNEL, r as POWER_LOGS_LIMITS, t as POWER_LOGS_CHANNEL } from "./power-logs-D2eUB0f0.js";
4
4
  import { createRequire } from "node:module";
@@ -7181,7 +7181,7 @@ var AiPreferencesStore = class extends Common.Store.ExtensionStore {
7181
7181
  this.model = typeof data?.model === "string" ? data.model : "";
7182
7182
  const reasoningEffort = data?.reasoningEffort ?? "";
7183
7183
  this.reasoningEffort = CODEX_REASONING_EFFORTS.includes(reasoningEffort) ? reasoningEffort : "";
7184
- this.speed = data?.speed === "fast" ? "fast" : "default";
7184
+ this.speed = data?.speed === "fast" || data?.speed === "ultrafast" ? data.speed : "default";
7185
7185
  this.chatFontSize = typeof data?.chatFontSize === "number" && Number.isInteger(data.chatFontSize) && data.chatFontSize >= 10 && data.chatFontSize <= 24 ? data.chatFontSize : 14;
7186
7186
  this.chatPanelWidth = typeof data?.chatPanelWidth === "number" && Number.isFinite(data.chatPanelWidth) ? Math.min(1e4, Math.max(360, Math.round(data.chatPanelWidth))) : 560;
7187
7187
  this.conversations = {};
@@ -7488,6 +7488,14 @@ var GLYPHS = Object.freeze([
7488
7488
  id: "rocket",
7489
7489
  label: "Rocket",
7490
7490
  body: "<g transform=\"translate(32 11.4) scale(1.497435897) translate(-12.25 -2)\" stroke-width=\"1.869863014\"><path d=\"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2zM9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05\"/></g>"
7491
+ }),
7492
+ ...Array.from({ length: 10 }, (_, index) => {
7493
+ const number = String(index + 1).padStart(2, "0");
7494
+ return Object.freeze({
7495
+ id: `number-${number}`,
7496
+ label: number,
7497
+ body: `<text x="32" y="36" text-anchor="middle" font-family="monospace" font-size="28" font-weight="700" fill="currentColor" stroke="none">${number}</text>`
7498
+ });
7491
7499
  })
7492
7500
  ]);
7493
7501
  var COLOR = /^#[\da-f]{6}$/i;
@@ -7524,7 +7532,7 @@ function escapeXml(text) {
7524
7532
  function clusterIconDataUrl(input) {
7525
7533
  const design = normalizeClusterIconDesign(input);
7526
7534
  const glyph = GLYPHS.find((candidate) => candidate.id === design.glyph);
7527
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="15" fill="#292d38" stroke="${design.outlineColor}" stroke-width="3"/><g fill="none" stroke="${design.iconColor}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round">${glyph.body}</g><rect x="15" y="46" width="34" height="12" rx="6" fill="${design.labelColor}"/><text x="32" y="55.2" text-anchor="middle" font-family="Helvetica,Arial,sans-serif" font-size="9.5" font-weight="800" fill="#292d38">${escapeXml(design.label)}</text></svg>`;
7535
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="15" fill="#292d38" stroke="${design.outlineColor}" stroke-width="3"/><g fill="none" stroke="${design.iconColor}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round">${glyph.body.replace("currentColor", design.iconColor)}</g><rect x="15" y="46" width="34" height="12" rx="6" fill="${design.labelColor}"/><text x="32" y="55.2" text-anchor="middle" font-family="Helvetica,Arial,sans-serif" font-size="9.5" font-weight="800" fill="#292d38">${escapeXml(design.label)}</text></svg>`;
7528
7536
  return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
7529
7537
  }
7530
7538
  function clusterIconDesignFromDataUrl(value) {
@@ -7536,7 +7544,7 @@ function clusterIconDesignFromDataUrl(value) {
7536
7544
  const outlineColor = /<rect x="2"[^>]* stroke="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7537
7545
  const iconColor = /<g\b[^>]*\bstroke="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7538
7546
  const labelColor = /<rect x="15"[^>]* fill="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7539
- const text = /<text\b[^>]*>([^<]*)<\/text>/.exec(svg)?.[1];
7547
+ const text = [...svg.matchAll(/<text\b[^>]*>([^<]*)<\/text>/g)].at(-1)?.[1];
7540
7548
  if (text === void 0 || /\bon[a-z]+\s*=|(?:href|style)\s*=/i.test(svg)) return void 0;
7541
7549
  const label = text.replace(/&(amp|lt|gt|quot|apos);/g, (entity) => ({
7542
7550
  "&amp;": "&",
@@ -9084,9 +9092,9 @@ function codexAiArguments(model, speed, directory, reasoningEffort = "") {
9084
9092
  "approval_policy=\"never\"",
9085
9093
  "shell_environment_policy.inherit=\"none\"",
9086
9094
  "project_doc_max_bytes=0",
9087
- `features.fast_mode=${speed === "fast"}`
9095
+ `features.fast_mode=${speed !== "default"}`
9088
9096
  ]) args.push("-c", setting);
9089
- if (speed === "fast") args.push("-c", "service_tier=\"fast\"");
9097
+ if (speed === "fast" || speed === "ultrafast") args.push("-c", `service_tier="${speed}"`);
9090
9098
  if (model) args.push("--model", model);
9091
9099
  if (reasoningEffort) args.push("-c", `model_reasoning_effort="${reasoningEffort}"`);
9092
9100
  args.push("-");
@@ -9422,7 +9430,7 @@ async function runAiChat(request, resolveCluster, signal, onActivity, onProgress
9422
9430
  "codex-api",
9423
9431
  "claude",
9424
9432
  "pi"
9425
- ].includes(request.provider) || request.requestId !== void 0 && !validAiRequestId(request.requestId) || !Array.isArray(request.messages) || request.messages.length > 100 || request.messages.some((message) => !message || !["user", "assistant"].includes(message.role) || typeof message.text !== "string") || !request.context || !["default", "fast"].includes(request.speed) || typeof request.model !== "string" || request.reasoningEffort !== void 0 && (typeof request.reasoningEffort !== "string" || !(request.provider === "codex-api" ? codexApiReasoningEfforts : request.provider === "claude" ? claudeReasoningEfforts : request.provider === "pi" ? piReasoningEfforts : reasoningEfforts).has(request.reasoningEffort)) || request.systemPrompt !== void 0 && (typeof request.systemPrompt !== "string" || request.systemPrompt.length > 2e4)) throw new Error("Invalid AI request");
9433
+ ].includes(request.provider) || request.requestId !== void 0 && !validAiRequestId(request.requestId) || !Array.isArray(request.messages) || request.messages.length > 100 || request.messages.some((message) => !message || !["user", "assistant"].includes(message.role) || typeof message.text !== "string") || !request.context || !["default", "fast"].includes(request.speed) && !(request.speed === "ultrafast" && (request.provider === void 0 || request.provider === "codex")) || typeof request.model !== "string" || request.reasoningEffort !== void 0 && (typeof request.reasoningEffort !== "string" || !(request.provider === "codex-api" ? codexApiReasoningEfforts : request.provider === "claude" ? claudeReasoningEfforts : request.provider === "pi" ? piReasoningEfforts : reasoningEfforts).has(request.reasoningEffort)) || request.systemPrompt !== void 0 && (typeof request.systemPrompt !== "string" || request.systemPrompt.length > 2e4)) throw new Error("Invalid AI request");
9426
9434
  const started = Date.now();
9427
9435
  const progress = (phase, round, text) => {
9428
9436
  if (signal?.aborted) return;
@@ -10235,9 +10243,7 @@ function startAiModels() {
10235
10243
  if (url.protocol !== "https:" || !(url.hostname === "renderer.freelens.app" || url.hostname.endsWith(".renderer.freelens.app"))) return [];
10236
10244
  if (provider === "codex-api") {
10237
10245
  const models = await readAiModels();
10238
- const catalog = models.length ? [...models] : [...CODEX_API_MODELS];
10239
- if (!catalog.some((model) => model.id === CODEX_API_MODELS[0].id)) catalog.push(CODEX_API_MODELS[0]);
10240
- return catalog.map((model) => ({
10246
+ return [...models, ...CODEX_API_MODELS.filter((fallback) => !models.some((model) => model.id === fallback.id))].map((model) => ({
10241
10247
  ...model,
10242
10248
  reasoningEfforts: model.reasoningEfforts.filter((effort) => CODEX_API_REASONING_EFFORTS.includes(effort)),
10243
10249
  defaultReasoningEffort: CODEX_API_REASONING_EFFORTS.includes(model.defaultReasoningEffort) ? model.defaultReasoningEffort : ""
@@ -10261,7 +10267,8 @@ function startAiModels() {
10261
10267
  return piModels;
10262
10268
  }
10263
10269
  if (provider !== "codex") return [];
10264
- return readAiModels();
10270
+ const models = await readAiModels();
10271
+ return [...models, ...CODEX_62_MODELS.filter((fallback) => !models.some((model) => model.id === fallback.id))];
10265
10272
  } catch {
10266
10273
  return [];
10267
10274
  }
@@ -10299,11 +10306,19 @@ function createClusterIconsService(host, store) {
10299
10306
  if (!payload || typeof payload !== "object" || Array.isArray(payload)) throw new Error("Invalid icon request");
10300
10307
  const input = payload;
10301
10308
  if (input.operation === "list") return list();
10302
- if (input.operation !== "apply") throw new Error("Invalid icon operation");
10309
+ if (input.operation !== "apply" && input.operation !== "clear") throw new Error("Invalid icon operation");
10303
10310
  if (typeof input.id !== "string" || !input.id || input.id.length > 1024) throw new Error("Invalid cluster identifier");
10304
10311
  const cluster = host.clusters().find((entry) => entry.id === input.id);
10305
10312
  if (!cluster) throw new Error("Cluster is no longer available");
10306
10313
  const id = cluster.id;
10314
+ if (input.operation === "clear") {
10315
+ runInAction(() => {
10316
+ const icons = { ...store.icons };
10317
+ delete icons[id];
10318
+ store.icons = icons;
10319
+ });
10320
+ return list();
10321
+ }
10307
10322
  const design = normalizeClusterIconDesign(input.design);
10308
10323
  runInAction(() => {
10309
10324
  store.icons = {
@@ -11962,7 +11977,7 @@ function startDockIconOverride() {
11962
11977
  };
11963
11978
  }
11964
11979
  // package.json
11965
- var version = "2.21.9";
11980
+ var version = "2.22.1";
11966
11981
  // src/common/extension-updates.ts
11967
11982
  var EXTENSION_UPDATES_CHANNEL = "freelens-power:extension-updates";
11968
11983
  var semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;