@hashimkarim/usagestat-darwin-arm64 2.0.0-alpha.4 → 2.3.2

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.
Files changed (189) hide show
  1. package/native-manifest.json +873 -141
  2. package/package.json +124 -2
  3. package/plugins/abliteration/LICENSE +21 -0
  4. package/plugins/abliteration/icon.svg +5 -0
  5. package/plugins/abliteration/plugin.js +89 -0
  6. package/plugins/abliteration/plugin.json +24 -0
  7. package/plugins/aerostack/LICENSE +21 -0
  8. package/plugins/aerostack/icon.svg +1 -0
  9. package/plugins/aerostack/plugin.js +94 -0
  10. package/plugins/aerostack/plugin.json +24 -0
  11. package/plugins/aixy/icon.svg +1 -0
  12. package/plugins/aixy/plugin.js +5 -0
  13. package/plugins/aixy/plugin.json +9 -1
  14. package/plugins/antigravity/plugin.js +60 -26
  15. package/plugins/antigravity-cli/plugin.js +21 -5
  16. package/plugins/antigravity-ide/plugin.js +19 -7
  17. package/plugins/atlascloud/plugin.js +5 -0
  18. package/plugins/atlascloud/plugin.json +2 -1
  19. package/plugins/bifrost/icon.svg +3 -0
  20. package/plugins/bifrost/plugin.js +5 -0
  21. package/plugins/bifrost/plugin.json +9 -1
  22. package/plugins/chatbox/LICENSE +21 -0
  23. package/plugins/chatbox/icon.svg +4 -0
  24. package/plugins/chatbox/plugin.js +208 -0
  25. package/plugins/chatbox/plugin.json +24 -0
  26. package/plugins/claude/plugin.js +39 -2
  27. package/plugins/claudeplatform/LICENSE +21 -0
  28. package/plugins/claudeplatform/icon.svg +3 -0
  29. package/plugins/claudeplatform/plugin.js +244 -0
  30. package/plugins/claudeplatform/plugin.json +25 -0
  31. package/plugins/codex/plugin.js +14 -8
  32. package/plugins/codex/plugin.json +11 -2
  33. package/plugins/copilot/plugin.json +1 -0
  34. package/plugins/cosmic/LICENSE +21 -0
  35. package/plugins/cosmic/icon.svg +1 -0
  36. package/plugins/cosmic/plugin.js +134 -0
  37. package/plugins/cosmic/plugin.json +32 -0
  38. package/plugins/cursor/plugin.js +51 -14
  39. package/plugins/cursor-nightly/plugin.json +1 -1
  40. package/plugins/devpass/icon.svg +3 -0
  41. package/plugins/devpass/plugin.js +5 -0
  42. package/plugins/devpass/plugin.json +2 -1
  43. package/plugins/exa/LICENSE +21 -0
  44. package/plugins/exa/icon-color.svg +1 -0
  45. package/plugins/exa/icon.svg +1 -0
  46. package/plugins/exa/plugin.js +75 -0
  47. package/plugins/exa/plugin.json +32 -0
  48. package/plugins/fal/LICENSE +21 -0
  49. package/plugins/fal/icon-color.svg +1 -0
  50. package/plugins/fal/icon.svg +1 -0
  51. package/plugins/fal/plugin.js +74 -0
  52. package/plugins/fal/plugin.json +24 -0
  53. package/plugins/flora/LICENSE +21 -0
  54. package/plugins/flora/icon.svg +4 -0
  55. package/plugins/flora/plugin.js +93 -0
  56. package/plugins/flora/plugin.json +32 -0
  57. package/plugins/futureagi/LICENSE +21 -0
  58. package/plugins/futureagi/icon.svg +24 -0
  59. package/plugins/futureagi/plugin.js +139 -0
  60. package/plugins/futureagi/plugin.json +32 -0
  61. package/plugins/gemini-apps/LICENSE +1 -2
  62. package/plugins/gemini-apps/plugin.js +136 -465
  63. package/plugins/gemini-apps/plugin.json +13 -7
  64. package/plugins/gitkraken/icon.svg +2 -0
  65. package/plugins/gitkraken/plugin.js +5 -0
  66. package/plugins/gitkraken/plugin.json +9 -1
  67. package/plugins/googledeveloper/LICENSE +21 -0
  68. package/plugins/googledeveloper/icon.svg +3 -0
  69. package/plugins/googledeveloper/plugin.js +204 -0
  70. package/plugins/googledeveloper/plugin.json +25 -0
  71. package/plugins/helmcode/icon.svg +5 -0
  72. package/plugins/helmcode/plugin.js +121 -56
  73. package/plugins/helmcode/plugin.json +10 -2
  74. package/plugins/huggingface/plugin.js +6 -1
  75. package/plugins/huggingface/plugin.json +4 -3
  76. package/plugins/hyper/plugin.js +53 -47
  77. package/plugins/hyper/plugin.json +3 -2
  78. package/plugins/jetbrains-ai-assistant/LICENSE +22 -0
  79. package/plugins/jetbrains-ai-assistant/plugin.js +502 -16
  80. package/plugins/jetbrains-ai-assistant/plugin.json +27 -4
  81. package/plugins/kimi/plugin.js +54 -14
  82. package/plugins/kimi/plugin.json +46 -6
  83. package/plugins/langdock/LICENSE +21 -0
  84. package/plugins/langdock/icon.svg +4 -0
  85. package/plugins/langdock/plugin.js +106 -0
  86. package/plugins/langdock/plugin.json +25 -0
  87. package/plugins/linkup/LICENSE +21 -0
  88. package/plugins/linkup/icon.svg +10 -0
  89. package/plugins/linkup/plugin.js +46 -0
  90. package/plugins/linkup/plugin.json +24 -0
  91. package/plugins/lithosai/LICENSE +21 -0
  92. package/plugins/lithosai/icon.svg +1 -0
  93. package/plugins/lithosai/plugin.js +130 -0
  94. package/plugins/lithosai/plugin.json +26 -0
  95. package/plugins/llmman/icon.svg +4 -0
  96. package/plugins/llmman/plugin.js +5 -0
  97. package/plugins/llmman/plugin.json +9 -1
  98. package/plugins/mistral/plugin.js +54 -22
  99. package/plugins/munito/LICENSE +21 -0
  100. package/plugins/munito/icon.svg +7 -0
  101. package/plugins/munito/plugin.js +171 -0
  102. package/plugins/munito/plugin.json +24 -0
  103. package/plugins/muse/icon.svg +3 -0
  104. package/plugins/muse/plugin.js +98 -129
  105. package/plugins/muse/plugin.json +10 -2
  106. package/plugins/museai/LICENSE +21 -0
  107. package/plugins/museai/icon.svg +3 -0
  108. package/plugins/museai/plugin.js +161 -0
  109. package/plugins/museai/plugin.json +26 -0
  110. package/plugins/nous/plugin.js +5 -0
  111. package/plugins/nous/plugin.json +9 -1
  112. package/plugins/ollama/plugin.js +58 -0
  113. package/plugins/opencode-go/plugin.js +74 -25
  114. package/plugins/opendesign/LICENSE +21 -0
  115. package/plugins/opendesign/icon.svg +4 -0
  116. package/plugins/opendesign/plugin.js +108 -0
  117. package/plugins/opendesign/plugin.json +25 -0
  118. package/plugins/parallel/LICENSE +21 -0
  119. package/plugins/parallel/icon.svg +11 -0
  120. package/plugins/parallel/plugin.js +97 -0
  121. package/plugins/parallel/plugin.json +25 -0
  122. package/plugins/perplexity/LICENSE +22 -0
  123. package/plugins/perplexity/plugin.js +122 -0
  124. package/plugins/perplexity/plugin.json +36 -7
  125. package/plugins/qwencloud/LICENSE +21 -0
  126. package/plugins/qwencloud/plugin.js +197 -0
  127. package/plugins/qwencloud/plugin.json +17 -0
  128. package/plugins/raycast/icon.svg +4 -0
  129. package/plugins/raycast/plugin.js +6 -1
  130. package/plugins/raycast/plugin.json +10 -2
  131. package/plugins/replicate/plugin.js +5 -0
  132. package/plugins/replicate/plugin.json +2 -1
  133. package/plugins/sailresearch/LICENSE +21 -0
  134. package/plugins/sailresearch/icon.svg +4 -0
  135. package/plugins/sailresearch/plugin.js +104 -0
  136. package/plugins/sailresearch/plugin.json +24 -0
  137. package/plugins/siliconflow/LICENSE +21 -0
  138. package/plugins/siliconflow/icon.svg +3 -0
  139. package/plugins/siliconflow/plugin.js +87 -0
  140. package/plugins/siliconflow/plugin.json +32 -0
  141. package/plugins/sofya/LICENSE +21 -0
  142. package/plugins/sofya/icon.svg +3 -0
  143. package/plugins/sofya/plugin.js +86 -0
  144. package/plugins/sofya/plugin.json +24 -0
  145. package/plugins/soniox/LICENSE +21 -0
  146. package/plugins/soniox/icon.svg +3 -0
  147. package/plugins/soniox/plugin.js +103 -0
  148. package/plugins/soniox/plugin.json +24 -0
  149. package/plugins/synthetic/plugin.js +12 -0
  150. package/plugins/synthetic/plugin.json +51 -9
  151. package/plugins/tavily/LICENSE +21 -0
  152. package/plugins/tavily/icon.svg +3 -0
  153. package/plugins/tavily/plugin.js +61 -0
  154. package/plugins/tavily/plugin.json +24 -0
  155. package/plugins/tinyapi/LICENSE +21 -0
  156. package/plugins/tinyapi/icon.svg +4 -0
  157. package/plugins/tinyapi/plugin.js +73 -0
  158. package/plugins/tinyapi/plugin.json +25 -0
  159. package/plugins/traecn/LICENSE +21 -0
  160. package/plugins/traecn/icon.svg +3 -0
  161. package/plugins/traecn/plugin.js +103 -0
  162. package/plugins/traecn/plugin.json +25 -0
  163. package/plugins/tripo/LICENSE +21 -0
  164. package/plugins/tripo/icon.svg +4 -0
  165. package/plugins/tripo/plugin.js +60 -0
  166. package/plugins/tripo/plugin.json +24 -0
  167. package/plugins/typesafe/icon.svg +4 -0
  168. package/plugins/typesafe/plugin.js +85 -129
  169. package/plugins/typesafe/plugin.json +3 -2
  170. package/plugins/v0/plugin.js +5 -0
  171. package/plugins/v0/plugin.json +9 -1
  172. package/plugins/vercel/plugin.js +147 -0
  173. package/plugins/vercel/plugin.json +34 -3
  174. package/plugins/workbuddy/LICENSE +21 -0
  175. package/plugins/workbuddy/icon.svg +1 -0
  176. package/plugins/workbuddy/plugin.js +318 -0
  177. package/plugins/workbuddy/plugin.json +63 -0
  178. package/plugins/xai/plugin.js +9 -0
  179. package/plugins/xapi/LICENSE +21 -0
  180. package/plugins/xapi/icon.svg +1 -0
  181. package/plugins/xapi/plugin.js +90 -0
  182. package/plugins/xapi/plugin.json +25 -0
  183. package/plugins/xkiro/icon.svg +1 -0
  184. package/plugins/xkiro/plugin.js +5 -0
  185. package/plugins/xkiro/plugin.json +2 -1
  186. package/plugins/zai/plugin.js +5 -1
  187. package/usagestat +0 -0
  188. package/usagestatd +0 -0
  189. package/plugins/cursor-nightly/plugin.js +0 -1416
@@ -12,17 +12,22 @@
12
12
  monthly: 60,
13
13
  };
14
14
 
15
- const HISTORY_EXISTS_SQL = `
16
- SELECT 1 AS present
17
- FROM message
18
- WHERE json_valid(data)
19
- AND json_extract(data, '$.providerID') = 'opencode-go'
20
- AND json_extract(data, '$.role') = 'assistant'
21
- LIMIT 1
22
- `;
23
-
24
- const HISTORY_ROWS_SQL = `
15
+ const TABLES_SQL = "SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('message','session_message','credential','migration')";
16
+ const CREDENTIALS_IMPORTED_SQL = "SELECT 1 AS imported FROM migration WHERE id = '20260805200742_import_legacy_credentials' LIMIT 1";
17
+ const CREDENTIAL_SQL = `SELECT value FROM credential
18
+ WHERE (integration_id = 'opencode-go' AND (active IS NULL OR active = 1))
19
+ OR (integration_id = 'opencode' AND active = 1)
20
+ ORDER BY CASE integration_id WHEN 'opencode-go' THEN 0 ELSE 1 END, active DESC, time_updated DESC, id DESC LIMIT 1`;
21
+ function historySQL(tables) {
22
+ const sources = [];
23
+ if (tables.includes('session_message')) sources.push(`SELECT id, time_created, data FROM session_message
24
+ WHERE json_valid(data) AND (type = 'assistant' OR (type = 'compaction' AND json_extract(data,'$.status') = 'completed'))`);
25
+ if (tables.includes('message')) sources.push(`SELECT id, time_created, data FROM message
26
+ WHERE json_valid(data) AND json_extract(data,'$.role') = 'assistant'`);
27
+ if (!sources.length) return null;
28
+ return `
25
29
  SELECT
30
+ id,
26
31
  CAST(COALESCE(json_extract(data, '$.time.created'), time_created) AS INTEGER) AS createdMs,
27
32
  json_extract(data, '$.cost') AS cost,
28
33
  json_extract(data, '$.tokens.input') AS inputTokens,
@@ -30,11 +35,10 @@
30
35
  json_extract(data, '$.tokens.cache.read') AS cacheReadTokens,
31
36
  json_extract(data, '$.tokens.cache.write') AS cacheCreationTokens,
32
37
  json_extract(data, '$.tokens.reasoning') AS reasoningOutputTokens
33
- FROM message
34
- WHERE json_valid(data)
35
- AND json_extract(data, '$.providerID') = 'opencode-go'
36
- AND json_extract(data, '$.role') = 'assistant'
38
+ FROM (${sources.join(' UNION ALL ')})
39
+ WHERE COALESCE(json_extract(data, '$.model.providerID'), json_extract(data, '$.providerID')) = 'opencode-go'
37
40
  `;
41
+ }
38
42
 
39
43
  function readNumber(value) {
40
44
  if (typeof value !== "number" && typeof value !== "string") return null;
@@ -317,7 +321,7 @@
317
321
  }
318
322
  return { ok: true, rows };
319
323
  } catch (e) {
320
- ctx.host.log.warn("sqlite query failed: " + String(e));
324
+ ctx.host.log.warn("OpenCode history could not be read");
321
325
  return { ok: false, rows: [] };
322
326
  }
323
327
  }
@@ -326,6 +330,34 @@
326
330
  const configured = trim(ctx.provider && ctx.provider.apiKey) || env(ctx, "OPENCODE_GO_API_KEY");
327
331
  if (configured) return configured;
328
332
  const inline = ctx.host.env.get("OPENCODE_AUTH_CONTENT");
333
+ // OpenCode 1 also creates credential tables, but still signs in through
334
+ // auth.json. Only the completed v2 import makes database logout authoritative.
335
+ if (!inline) {
336
+ const database = databasePath(ctx);
337
+ if (ctx.host.fs.exists(database)) {
338
+ try {
339
+ const tables = ctx.util.tryParseJson(ctx.host.sqlite.query(database, TABLES_SQL));
340
+ if (!Array.isArray(tables)) throw new Error('Invalid schema');
341
+ const imported = tables.some(table => table.name === 'migration')
342
+ ? ctx.util.tryParseJson(ctx.host.sqlite.query(database, CREDENTIALS_IMPORTED_SQL)) : [];
343
+ if (!Array.isArray(imported)) throw new Error('Invalid migration result');
344
+ if (imported.length) {
345
+ if (!tables.some(table => table.name === 'credential')) throw new Error('Imported credential storage is missing');
346
+ const rows = ctx.util.tryParseJson(ctx.host.sqlite.query(database, CREDENTIAL_SQL));
347
+ if (!Array.isArray(rows)) throw new Error('Invalid credential result');
348
+ if (!rows.length) return null;
349
+ const entry = ctx.util.tryParseJson(rows[0].value);
350
+ if (!entry || typeof entry !== 'object' || Array.isArray(entry) ||
351
+ (entry.key !== undefined && typeof entry.key !== 'string'))
352
+ throw {code:'credential-malformed', message:'OpenCode credential row is malformed.'};
353
+ return trim(entry.key);
354
+ }
355
+ } catch (error) {
356
+ if (error && error.code) throw error;
357
+ throw {code:'credential-unavailable',message:'OpenCode credential database cannot be read. Its imported auth file was not used.'};
358
+ }
359
+ }
360
+ }
329
361
  const path = inline ? null : dataPath(ctx, "auth.json");
330
362
  if (!inline && !ctx.host.fs.exists(path)) return null;
331
363
 
@@ -334,34 +366,45 @@
334
366
  const parsed = ctx.util.tryParseJson(text);
335
367
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
336
368
  if (inline) throw {code: "credential-malformed", message: "OPENCODE_AUTH_CONTENT must contain an auth JSON object."};
337
- ctx.host.log.warn("opencode auth file is not valid json");
338
- return null;
369
+ throw {code:'credential-malformed',message:'OpenCode auth file is not valid JSON.'};
339
370
  }
340
- const entry = parsed[PROVIDER_ID];
371
+ const entry = parsed[PROVIDER_ID] || parsed.opencode;
341
372
  if (!entry || typeof entry !== "object") return null;
342
373
  const key = typeof entry.key === "string" ? entry.key.trim() : "";
343
374
  return key || null;
344
375
  } catch (e) {
345
376
  if (e && e.code) throw e;
346
- ctx.host.log.warn("opencode auth read failed: " + String(e));
347
- return null;
377
+ throw {code:'credential-unavailable',message:'OpenCode auth file cannot be read.'};
348
378
  }
349
379
  }
350
380
 
351
381
  function hasHistory(ctx) {
352
- const result = queryRows(ctx, HISTORY_EXISTS_SQL);
382
+ const result = queryHistory(ctx, true);
353
383
  if (!result.ok) return { ok: false, present: false };
354
384
  return { ok: true, present: result.rows.length > 0 };
355
385
  }
356
386
 
387
+ function queryHistory(ctx, probeOnly) {
388
+ const schema = queryRows(ctx, TABLES_SQL);
389
+ if (!schema.ok) return schema;
390
+ const sql = historySQL(schema.rows.map(table => table.name));
391
+ if (!sql) return {ok:true,rows:[]};
392
+ return queryRows(ctx, probeOnly ? 'SELECT 1 AS present FROM (' + sql + ') LIMIT 1' : sql);
393
+ }
394
+
357
395
  function loadHistory(ctx) {
358
- const result = queryRows(ctx, HISTORY_ROWS_SQL);
396
+ const result = queryHistory(ctx, false);
359
397
  if (!result.ok) return result;
360
398
 
361
399
  const rows = [];
400
+ const seen = new Set();
362
401
  for (let i = 0; i < result.rows.length; i += 1) {
363
402
  const row = result.rows[i];
364
403
  if (!row || typeof row !== "object") continue;
404
+ if (trim(row.id)) {
405
+ if (seen.has(row.id)) continue;
406
+ seen.add(row.id);
407
+ }
365
408
  const createdMs = readNumber(row.createdMs);
366
409
  const cost = readNumber(row.cost);
367
410
  if (createdMs === null || createdMs <= 0 || createdMs > Date.parse(ctx.nowIso)) continue;
@@ -585,6 +628,9 @@
585
628
  if (ctx.util.isAuthStatus(result.resp.status)) throw "OpenCode Go key was rejected. Sign into OpenCode Go again.";
586
629
  if (result.resp.status < 200 || result.resp.status >= 300) throw "OpenCode Go usage API returned HTTP " + result.resp.status + ".";
587
630
  const usage = result.json && result.json.usage;
631
+ const dateHeader = Object.entries(result.resp.headers || {}).find(([key]) => key.toLowerCase() === 'date');
632
+ const serverTime = dateHeader && Date.parse(dateHeader[1]);
633
+ const referenceTime = Number.isFinite(serverTime) ? serverTime : Date.parse(ctx.nowIso);
588
634
  const specs = [["rolling", "Session", FIVE_HOURS_MS], ["weekly", "Weekly", WEEK_MS], ["monthly", "Monthly", null]];
589
635
  const lines = [];
590
636
  for (const spec of specs) {
@@ -593,8 +639,11 @@
593
639
  const percent = window && readNumber(window.percent);
594
640
  if (!Number.isFinite(percent)) throw "OpenCode Go usage API returned an invalid quota.";
595
641
  const resetInSec = readNumber(window.resetInSec);
596
- const resetsAt = ctx.util.toIso(window.resetsAt) || (resetInSec !== null && resetInSec >= 0
597
- ? ctx.util.toIso(Date.parse(ctx.nowIso) + resetInSec * 1000) : null);
642
+ let resetsAt = ctx.util.toIso(window.resetsAt) || (resetInSec !== null && resetInSec >= 0
643
+ ? ctx.util.toIso(referenceTime + resetInSec * 1000) : null);
644
+ if (window.resetsAt != null && !ctx.util.toIso(window.resetsAt)) throw 'OpenCode Go usage API returned an invalid reset.';
645
+ if (spec[0] === 'rolling' && percent === 0 && resetsAt && Math.abs(Date.parse(resetsAt)-referenceTime-FIVE_HOURS_MS)<=2000)
646
+ resetsAt = null;
598
647
  lines.push(ctx.line.progress({ label: spec[1], used: Math.max(0, Math.min(100, percent)), limit: 100,
599
648
  format: { kind: "percent" }, resetsAt, periodDurationMs: spec[2] }));
600
649
  }
@@ -608,7 +657,7 @@
608
657
  if (!cookie) throw "OpenCode Go session cookie is missing.";
609
658
  return fetchWebResult(ctx, cookie);
610
659
  }
611
- const authKey = loadAuthKey(ctx);
660
+ const authKey = source === 'local' && !ctx.host.env.get('OPENCODE_AUTH_CONTENT') ? null : loadAuthKey(ctx);
612
661
  if (source === "api" && !authKey) throw "OpenCode Go API key missing. Set OPENCODE_GO_API_KEY.";
613
662
  if (authKey && source !== "local") {
614
663
  const result = fetchApiResult(ctx, authKey);
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Peter Steinberger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="100 100 385 385" fill="currentColor">
2
+ <path fill-rule="evenodd" d="M292.716 112.374C392.751 112.374 473.845 193.468 473.845 293.503C473.845 393.538 392.751 474.632 292.716 474.632H135.685C122.347 474.632 111.587 463.874 111.587 450.536C111.587 410.139 111.587 329.633 111.587 293.503C111.587 193.468 192.681 112.374 292.716 112.374ZM292.716 148.6C212.689 148.6 147.813 213.476 147.813 293.504C147.813 373.532 212.689 438.407 292.716 438.407C372.744 438.407 437.619 373.532 437.619 293.504C437.619 213.476 372.744 148.6 292.716 148.6Z"/>
3
+ <path d="M281.618 378.232L226.395 232.908C224.608 228.205 229.201 223.594 233.873 225.402L379.265 281.651C385.249 283.966 383.6 292.898 377.189 292.898H292.803V376.155C292.803 382.61 283.91 384.262 281.618 378.232Z"/>
4
+ </svg>
@@ -0,0 +1,108 @@
1
+ // Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
2
+ globalThis.__usagestat_bundled_options = {"labels":["Session","Weekly","Additional"],"defaults":{},"autoMode":"web"};
3
+ (function(defineProvider) {
4
+ // BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/opendesign.js
5
+ defineProvider({
6
+ id: "opendesign",
7
+ name: "OpenDesign",
8
+ settings: [{ key: "MESSAGES", title: "OpenDesign", type: "plain" }],
9
+ endpoints: ["https://amr-api.open-design.ai"],
10
+ capabilities: ["browser-cookies", "http-status"],
11
+ cookieDomains: ["amr-api.open-design.ai"],
12
+ cookiePolicy: {
13
+ selection: "request-url",
14
+ cache: "nonpersistent",
15
+ imports: "access-gated",
16
+ // The host's optional name filter excludes dots; validate the opaque session at the endpoint.
17
+ },
18
+ async fetchUsage(ctx) {
19
+ const domain = "amr-api.open-design.ai";
20
+ const messages = JSON.parse(ctx.settings.get("MESSAGES") || "{}");
21
+ const message = (key) => messages[key] || key;
22
+ const signIn = message("Sign in to OpenDesign, then refresh CodexBar.");
23
+ const expired = ctx.fail.authenticationExpired(signIn);
24
+ const malformed = () => {
25
+ throw ctx.fail.parseFailure(message("OpenDesign usage response format changed."));
26
+ };
27
+ const text = (value) => (typeof value === "string" && value.trim() ? value.trim() : undefined);
28
+ const credits = (value) => {
29
+ if (typeof value === "string" && /^\d+(\.\d+)?$/.test(value)) value = Number(value);
30
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= Number.MAX_SAFE_INTEGER
31
+ ? value
32
+ : malformed();
33
+ };
34
+ if (ctx.browser.availability(domain) === "off") throw ctx.fail.missingCredential(signIn);
35
+ let rejected = false;
36
+ for await (const session of ctx.browser.sessions(domain)) {
37
+ const get = async (path, workspace) => {
38
+ const response = await ctx.http.get(`https://${domain}/api/v1/workspaces/${path}`, {
39
+ cookieSession: session.id,
40
+ headers: { Accept: "application/json", ...(workspace ? { "X-Vela-Workspace-Id": workspace } : {}) },
41
+ });
42
+ if (response.status === 401) throw expired;
43
+ if (response.status === 403) throw ctx.fail.permissionDenied(message("OpenDesign billing access was denied."));
44
+ const failed = message("OpenDesign request failed. Try again later.");
45
+ if (response.status === 429) throw ctx.fail.rateLimited(failed);
46
+ if (response.status >= 500 || response.status === 408) throw ctx.fail.providerUnavailable(failed);
47
+ if (response.status !== 200) throw ctx.fail.apiFailure(failed);
48
+ try {
49
+ return JSON.parse(response.bodyText);
50
+ } catch {
51
+ return malformed();
52
+ }
53
+ };
54
+ try {
55
+ const workspace = await get("current");
56
+ const id = text(workspace?.workspaceId);
57
+ if (!id || !/^[A-Za-z0-9_-]{1,128}$/.test(id)) return malformed();
58
+ const usage = await get(`${id}/billing/coding-plan-usage`, id);
59
+ if (usage?.workspaceId !== id || typeof usage.eligible !== "boolean" || !Array.isArray(usage.windows))
60
+ return malformed();
61
+ const unavailable = () => {
62
+ throw ctx.fail.providerUnavailable(
63
+ message("OpenDesign subscription usage is unavailable for this workspace."),
64
+ );
65
+ };
66
+ if (!usage.eligible) return unavailable();
67
+ const window = (seconds) => {
68
+ const matches = usage.windows.filter((item) => item?.durationSeconds === seconds);
69
+ if (matches.length === 0) return undefined;
70
+ if (matches.length !== 1) return malformed();
71
+ const item = matches[0];
72
+ const used = credits(item.usedCredits);
73
+ const limit = credits(item.limitCredits);
74
+ if (limit <= 0) return malformed();
75
+ const reset = text(item.resetsAt);
76
+ return {
77
+ usedPercent: ctx.pct(used, limit),
78
+ windowMinutes: seconds / 60,
79
+ quotaLimit: limit,
80
+ quotaUnit: "credits",
81
+ resetsAt:
82
+ reset && /^\d{4}-\d{2}-\d{2}T/.test(reset) && Number.isFinite(Date.parse(reset)) ? reset : undefined,
83
+ };
84
+ };
85
+ const primary = window(18000);
86
+ const secondary = window(604800);
87
+ if (!primary && !secondary) return unavailable();
88
+ return {
89
+ primary,
90
+ secondary,
91
+ identity: {
92
+ accountID: id,
93
+ organization: text(workspace.workspaceName),
94
+ loginMethod: text(usage.tier) ?? text(workspace.personalMembershipTier),
95
+ },
96
+ };
97
+ } catch (error) {
98
+ if (error !== expired) throw error;
99
+ ctx.browser.rejectCookie(domain, session);
100
+ rejected = true;
101
+ }
102
+ }
103
+ throw rejected ? expired : ctx.fail.missingCredential(signIn);
104
+ },
105
+ });
106
+
107
+ // END UPSTREAM
108
+ })(globalThis.defineProvider);
@@ -0,0 +1,25 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "id": "opendesign",
4
+ "name": "OpenDesign",
5
+ "version": "0.1.0",
6
+ "entry": "plugin.js",
7
+ "enabledByDefault": false,
8
+ "supportedModes": [
9
+ "web"
10
+ ],
11
+ "autoMode": "web",
12
+ "usageDashboardUrl": "https://open-design.ai",
13
+ "webUrl": "https://amr-api.open-design.ai",
14
+ "envVars": [
15
+ "OPENDESIGN_COOKIE"
16
+ ],
17
+ "setupFields": [],
18
+ "upstream": {
19
+ "repository": "https://github.com/steipete/CodexBar",
20
+ "revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
21
+ "path": "Sources/CodexBarCore/Resources/Plugins/opendesign.js",
22
+ "sha256": "9eb64161b779de122e6343eb166ee6ebca6d3e828dc7e40df7a1af695f6a79d4",
23
+ "license": "MIT"
24
+ }
25
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Peter Steinberger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ <svg fill="currentColor" viewBox="-10 -10.5 291 291" xmlns="http://www.w3.org/2000/svg">
2
+ <title>Parallel</title>
3
+ <path d="M267.804 105.65H193.828C194.026 106.814 194.187 107.996 194.349 109.178H76.6703C76.4546 110.736 76.2388 112.312 76.0591 113.87H1.63342C1.27387 116.198 0.950289 118.543 0.698608 120.925H75.3759C75.2501 122.483 75.1602 124.059 75.0703 125.617H195.949C196.003 126.781 196.057 127.962 196.093 129.144H270.68V125.384C270.195 118.651 269.242 112.061 267.804 105.65Z"/>
4
+ <path d="M195.949 144.401H75.0703C75.1422 145.977 75.2501 147.535 75.3759 149.093H0.698608C0.950289 151.457 1.2559 153.802 1.63342 156.148H76.0591C76.2388 157.724 76.4366 159.282 76.6703 160.84H194.349C194.187 162.022 194.008 163.186 193.828 164.367H267.804C269.242 157.957 270.195 151.367 270.68 144.634V140.874H196.093C196.057 142.055 196.003 143.219 195.949 144.401Z"/>
5
+ <path d="M190.628 179.642H80.3559C80.7514 181.218 81.1828 182.776 81.6143 184.334H9.30994C10.2448 186.715 11.2515 189.061 12.3121 191.389H83.7536C84.2749 192.965 84.7962 194.523 85.3535 196.08H185.594C185.163 197.262 184.732 198.426 184.282 199.608H254.519C258.6 192.177 261.98 184.316 264.604 176.114H191.455C191.185 177.296 190.898 178.46 190.61 179.642H190.628Z"/>
6
+ <path d="M177.666 214.883H93.3352C94.1082 216.458 94.9172 218.034 95.7441 219.574H29.8756C31.8351 221.992 33.8666 224.337 35.9699 226.63H99.6632C100.598 228.205 101.551 229.781 102.522 231.321H168.498C167.761 232.503 167.006 233.685 166.233 234.849H226.762C234.474 227.847 241.36 219.95 247.292 211.355H179.356C178.799 212.537 178.26 213.719 177.684 214.883H177.666Z"/>
7
+ <path d="M154.943 250.106H116.058C117.371 251.699 118.701 253.257 120.067 254.797H73.021C91.6094 264.431 112.715 269.946 135.096 270C135.24 270 135.366 270 135.492 270C135.618 270 135.761 270 135.887 270C164.04 269.911 190.178 261.28 211.805 246.56H157.748C156.813 247.742 155.878 248.924 154.925 250.088L154.943 250.106Z"/>
8
+ <path d="M116.059 19.9124H154.943C155.896 21.0764 156.831 22.2582 157.766 23.4401H211.823C190.179 8.72065 164.058 0.0895344 135.906 0C135.762 0 135.636 0 135.51 0C135.384 0 135.24 0 135.115 0C112.715 0.0716275 91.6277 5.56904 73.0393 15.2029H120.086C118.719 16.7429 117.389 18.3187 116.077 19.8945L116.059 19.9124Z"/>
9
+ <path d="M93.3356 55.1532H177.667C178.242 56.3171 178.799 57.499 179.339 58.6808H247.274C241.342 50.0855 234.457 42.1886 226.744 35.187H166.215C166.988 36.351 167.743 37.5328 168.48 38.7147H102.504C101.533 40.2726 100.58 41.8305 99.6456 43.4063H35.9523C33.831 45.6804 31.7996 48.0262 29.858 50.4616H95.7265C94.8996 52.0195 94.1086 53.5774 93.3176 55.1532H93.3356Z"/>
10
+ <path d="M80.3736 90.3758H190.646C190.933 91.5398 191.221 92.7216 191.491 93.9035H264.64C262.015 85.7021 258.636 77.841 254.555 70.4097H184.318C184.767 71.5736 185.199 72.7555 185.63 73.9373H85.3893C84.832 75.4952 84.2927 77.0531 83.7893 78.6289H12.3479C11.2872 80.9389 10.2805 83.2847 9.3457 85.6842H81.65C81.2186 87.2421 80.7871 88.8 80.3916 90.3758H80.3736Z"/>
11
+ </svg>
@@ -0,0 +1,97 @@
1
+ // Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
2
+ globalThis.__usagestat_bundled_options = {"labels":["Balance","Additional","Additional"],"defaults":{},"autoMode":"web","balanceOnly":true};
3
+ (function(defineProvider) {
4
+ // BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/parallel.js
5
+ function _nullishCoalesce(lhs, rhsFn) {
6
+ if (lhs != null) {
7
+ return lhs;
8
+ } else {
9
+ return rhsFn();
10
+ }
11
+ }
12
+ defineProvider({
13
+ id: "parallel",
14
+ name: "Parallel",
15
+ endpoints: ["https://platform.parallel.ai"],
16
+ settings: [],
17
+ capabilities: ["browser-cookies", "http-status"],
18
+ cookieDomains: ["platform.parallel.ai"],
19
+ async fetchUsage(ctx) {
20
+ const domain = "platform.parallel.ai";
21
+ const policy = ctx.browser.availability(domain);
22
+ if (policy === "off") throw ctx.fail.missingCredential("Parallel cookies are disabled.");
23
+ // Internal dashboard RPC with no public contract; every shape check below fails closed.
24
+ const request = (cookie) =>
25
+ ctx.http.post(`https://${domain}/api/rpc/billing/payments/refresh-balance`, {
26
+ body: {},
27
+ headers: { Cookie: cookie, Origin: `https://${domain}` },
28
+ });
29
+ const signedOut = (response) =>
30
+ response.status === 401 ||
31
+ response.status === 403 ||
32
+ (response.status >= 300 && response.status < 400) ||
33
+ (response.status === 200 &&
34
+ _nullishCoalesce(response.headers["content-type"], () => "")
35
+ .toLowerCase()
36
+ .includes("text/html"));
37
+
38
+ let response;
39
+ let rejected = false;
40
+ for await (const session of ctx.browser.sessions(domain)) {
41
+ const candidate = await request(_nullishCoalesce(session.header, () => ""));
42
+ if (signedOut(candidate)) {
43
+ rejected = true;
44
+ ctx.browser.rejectCookie(domain, session);
45
+ if (policy === "manual") break;
46
+ continue;
47
+ }
48
+ response = candidate;
49
+ break;
50
+ }
51
+ if (!response) {
52
+ throw rejected
53
+ ? ctx.fail.authenticationExpired(
54
+ "Parallel session expired. Sign in to platform.parallel.ai again or paste a fresh Cookie header.",
55
+ )
56
+ : ctx.fail.missingCredential(
57
+ `No Parallel session found. Sign in to platform.parallel.ai. Supported browsers: ${ctx.browser.supportedBrowsers}. Or paste a Cookie header.`,
58
+ );
59
+ }
60
+
61
+ const message = `Parallel returned HTTP ${response.status}.`;
62
+ if (response.status === 429) {
63
+ const delay = Number(_nullishCoalesce(response.headers["retry-after"], () => 1));
64
+ throw ctx.fail.rateLimited(message, {
65
+ retryAfterSeconds: Number.isFinite(delay) && delay >= 0 ? Math.min(delay, 10) : 1,
66
+ });
67
+ }
68
+ if (response.status === 408 || response.status >= 500) throw ctx.fail.providerUnavailable(message);
69
+ if (response.status !== 200) throw ctx.fail.apiFailure(message);
70
+
71
+ const formatChanged = () => {
72
+ throw ctx.fail.parseFailure("Parallel billing response format changed.");
73
+ };
74
+ const finite = (value) => typeof value === "number" && Number.isFinite(value);
75
+ let payload;
76
+ try {
77
+ payload = JSON.parse(response.bodyText);
78
+ } catch (error) {
79
+ void error;
80
+ return formatChanged();
81
+ }
82
+ const data = payload && typeof payload === "object" && payload.kind === "ok" ? payload.data : undefined;
83
+ if (!data || typeof data !== "object" || !finite(data.balance)) return formatChanged();
84
+ const rows = [{ label: "Balance", value: ctx.format.currency(data.balance / 100, "USD") }];
85
+ if (finite(data.pendingDebitBalanceCents) && data.pendingDebitBalanceCents !== 0) {
86
+ rows.push({ label: "Pending debit", value: ctx.format.currency(data.pendingDebitBalanceCents / 100, "USD") });
87
+ }
88
+ return {
89
+ details: [{ title: "Account balance", rows }],
90
+ identity: { loginMethod: "Browser session" },
91
+ dataConfidence: "exact",
92
+ };
93
+ },
94
+ });
95
+
96
+ // END UPSTREAM
97
+ })(globalThis.defineProvider);
@@ -0,0 +1,25 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "id": "parallel",
4
+ "name": "Parallel",
5
+ "version": "0.1.0",
6
+ "entry": "plugin.js",
7
+ "enabledByDefault": false,
8
+ "supportedModes": [
9
+ "web"
10
+ ],
11
+ "autoMode": "web",
12
+ "usageDashboardUrl": "https://platform.parallel.ai",
13
+ "webUrl": "https://platform.parallel.ai",
14
+ "envVars": [
15
+ "PARALLEL_COOKIE"
16
+ ],
17
+ "setupFields": [],
18
+ "upstream": {
19
+ "repository": "https://github.com/steipete/CodexBar",
20
+ "revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
21
+ "path": "Sources/CodexBarCore/Resources/Plugins/parallel.js",
22
+ "sha256": "854d5faa2b6c01b96cf009295fabe85cbdc28d07911d7c7e1da970c8cc77e5e8",
23
+ "license": "MIT"
24
+ }
25
+ }
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Robin Ebers (original macOS creator)
4
+ Copyright (c) 2026 barramee kottanawadee
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -1,3 +1,4 @@
1
+ // Adapted from barramee27/crossusage at 78b243b798abce1270d6fed775c79e65825b2c33; see LICENSE.
1
2
  (function () {
2
3
  const LOCAL_USER_ENDPOINT = "https://www.perplexity.ai/api/user"
3
4
  const REST_API_BASE = "https://www.perplexity.ai/rest/pplx-api/v2"
@@ -380,7 +381,128 @@
380
381
  return { groupId: groupId, group: group, usageAnalytics: usageAnalytics, rateLimits: rateLimits }
381
382
  }
382
383
 
384
+ // --- Web-session (cookie) auth -------------------------------------------
385
+ // The Bearer flow above only exists on macOS: it scrapes the CFURL cache of
386
+ // the native app. On Windows/Linux there is no Bearer token anywhere — the
387
+ // Electron app and the website both authenticate with next-auth cookies.
388
+ // So accept a pasted session cookie and talk to the same REST API the web
389
+ // client uses.
390
+ const WEB_ORIGIN = "https://www.perplexity.ai"
391
+ const WEB_QS = "?version=2.18&source=default"
392
+ const WEB_UA =
393
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36"
394
+
395
+ const WEB_MODE_CATEGORIES = [
396
+ { key: "pro_search", label: "Queries" },
397
+ { key: "research", label: "Deep Research" },
398
+ { key: "labs", label: "Labs" },
399
+ { key: "agentic_research", label: "Agentic Research" },
400
+ ]
401
+
402
+ function fetchWebJson(ctx, path) {
403
+ let resp
404
+ try {
405
+ resp = ctx.host.http.requestCookieSession({
406
+ method: "GET",
407
+ url: WEB_ORIGIN + path + WEB_QS,
408
+ headers: {
409
+ Accept: "application/json",
410
+ "User-Agent": WEB_UA,
411
+ Origin: WEB_ORIGIN,
412
+ Referer: WEB_ORIGIN + "/account/usage",
413
+ },
414
+ timeoutMs: 10000,
415
+ cookieSession: "configured",
416
+ })
417
+ } catch (e) {
418
+ ctx.host.log.warn("web request failed (" + path + "): " + String(e))
419
+ return null
420
+ }
421
+ if (typeof resp.bodyText === "string" && resp.bodyText.indexOf("Just a moment") !== -1) {
422
+ ctx.host.log.warn("cloudflare challenge on " + path + " — paste the full cookie string incl. cf_clearance")
423
+ return null
424
+ }
425
+ if (ctx.util.isAuthStatus(resp.status)) {
426
+ ctx.host.log.warn("web request unauthorized (" + path + "): status=" + String(resp.status))
427
+ return null
428
+ }
429
+ if (resp.status < 200 || resp.status >= 300) {
430
+ ctx.host.log.warn("web request status " + String(resp.status) + " (" + path + ")")
431
+ return null
432
+ }
433
+ const parsed = ctx.util.tryParseJson(resp.bodyText)
434
+ if (!parsed || typeof parsed !== "object") {
435
+ ctx.host.log.warn("web request returned invalid JSON (" + path + ")")
436
+ return null
437
+ }
438
+ return parsed
439
+ }
440
+
441
+ function describeModeAvailability(mode) {
442
+ if (!mode || typeof mode !== "object") return null
443
+ const detail = mode.remaining_detail || mode.remainingDetail
444
+ if (detail && detail.kind === "exact") {
445
+ const n = Number(detail.remaining)
446
+ if (Number.isFinite(n)) return String(Math.max(0, Math.floor(n))) + " remaining"
447
+ }
448
+ if (mode.available === true) return "available"
449
+ if (mode.available === false) return "not available"
450
+ return null
451
+ }
452
+
453
+ function probeViaCookie(ctx) {
454
+ ctx.host.log.info("session loaded from provider account (web cookie)")
455
+
456
+ const status = fetchWebJson(ctx, "/rest/rate-limit/status")
457
+ const authSession = fetchWebJson(ctx, "/api/auth/session")
458
+ const credits =
459
+ fetchWebJson(ctx, "/rest/billing/credits") ||
460
+ fetchWebJson(ctx, "/rest/billing/credits/computer-submit-gate")
461
+
462
+ if (!status && !authSession && !credits) {
463
+ throw "Session cookie rejected. Re-copy it from a logged-in perplexity.ai tab."
464
+ }
465
+
466
+ const lines = []
467
+
468
+ const balanceCents = credits ? readNumberField(credits, ["balance_cents", "balanceCents"]) : null
469
+ if (balanceCents !== null && Number.isFinite(balanceCents)) {
470
+ lines.push(ctx.line.text({
471
+ label: "API credits",
472
+ value: "$" + (balanceCents / 100).toFixed(2),
473
+ }))
474
+ }
475
+
476
+ const modes = status && (status.modes || status.Modes)
477
+ if (modes && typeof modes === "object") {
478
+ for (let i = 0; i < WEB_MODE_CATEGORIES.length; i += 1) {
479
+ const cat = WEB_MODE_CATEGORIES[i]
480
+ const text = describeModeAvailability(modes[cat.key])
481
+ if (text) lines.push(ctx.line.text({ label: cat.label, value: text }))
482
+ }
483
+ }
484
+
485
+ if (lines.length === 0) throw "Usage data unavailable. Try again later."
486
+
487
+ const user = authSession && authSession.user
488
+ const tier = user && (user.subscription_tier || user.subscriptionTier)
489
+ const plan =
490
+ typeof tier === "string" && tier
491
+ ? tier
492
+ .split("_")
493
+ .filter(Boolean)
494
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
495
+ .join(" ")
496
+ : null
497
+
498
+ return plan ? { plan: plan, lines: lines } : { lines: lines }
499
+ }
500
+
383
501
  function probe(ctx) {
502
+ if (ctx.provider?.settings?.cookies !== "off" && ctx.host.http.cookieSessionAvailable === true) {
503
+ return probeViaCookie(ctx)
504
+ }
505
+
384
506
  const session = loadLocalSession(ctx)
385
507
  if (!session) throw "Not logged in. Sign in via Perplexity app."
386
508
  if (session.sourcePath) ctx.host.log.info("using cache db: " + session.sourcePath)