latentcode 0.1.0-alpha.12 → 0.1.0-alpha.14

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.
@@ -1380,7 +1380,7 @@ var require_react_development = __commonJS({
1380
1380
  }
1381
1381
  return dispatcher.useContext(Context);
1382
1382
  }
1383
- function useState9(initialState2) {
1383
+ function useState10(initialState2) {
1384
1384
  var dispatcher = resolveDispatcher();
1385
1385
  return dispatcher.useState(initialState2);
1386
1386
  }
@@ -2183,7 +2183,7 @@ var require_react_development = __commonJS({
2183
2183
  exports.useMemo = useMemo6;
2184
2184
  exports.useReducer = useReducer2;
2185
2185
  exports.useRef = useRef6;
2186
- exports.useState = useState9;
2186
+ exports.useState = useState10;
2187
2187
  exports.useSyncExternalStore = useSyncExternalStore2;
2188
2188
  exports.useTransition = useTransition;
2189
2189
  exports.version = ReactVersion;
@@ -7875,9 +7875,9 @@ var require_react_reconciler_development = __commonJS({
7875
7875
  module.exports = function $$$reconciler($$$hostConfig) {
7876
7876
  var exports2 = {};
7877
7877
  "use strict";
7878
- var React17 = require_react();
7878
+ var React18 = require_react();
7879
7879
  var Scheduler = require_scheduler();
7880
- var ReactSharedInternals = React17.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
7880
+ var ReactSharedInternals = React18.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
7881
7881
  var suppressWarning = false;
7882
7882
  function setSuppressWarning(newSuppressWarning) {
7883
7883
  {
@@ -27332,7 +27332,7 @@ var require_react_jsx_runtime_development = __commonJS({
27332
27332
  if (process.env.NODE_ENV !== "production") {
27333
27333
  (function() {
27334
27334
  "use strict";
27335
- var React17 = require_react();
27335
+ var React18 = require_react();
27336
27336
  var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
27337
27337
  var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
27338
27338
  var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
@@ -27358,7 +27358,7 @@ var require_react_jsx_runtime_development = __commonJS({
27358
27358
  }
27359
27359
  return null;
27360
27360
  }
27361
- var ReactSharedInternals = React17.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
27361
+ var ReactSharedInternals = React18.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
27362
27362
  function error(format) {
27363
27363
  {
27364
27364
  {
@@ -28208,11 +28208,11 @@ var require_react_jsx_runtime_development = __commonJS({
28208
28208
  return jsxWithValidation(type, props, key, false);
28209
28209
  }
28210
28210
  }
28211
- var jsx12 = jsxWithValidationDynamic;
28212
- var jsxs10 = jsxWithValidationStatic;
28211
+ var jsx13 = jsxWithValidationDynamic;
28212
+ var jsxs11 = jsxWithValidationStatic;
28213
28213
  exports.Fragment = REACT_FRAGMENT_TYPE;
28214
- exports.jsx = jsx12;
28215
- exports.jsxs = jsxs10;
28214
+ exports.jsx = jsx13;
28215
+ exports.jsxs = jsxs11;
28216
28216
  })();
28217
28217
  }
28218
28218
  }
@@ -34846,10 +34846,10 @@ ${seen.slice(-800)}`));
34846
34846
  };
34847
34847
 
34848
34848
  // src/index.tsx
34849
- import { spawnSync as spawnSync3 } from "node:child_process";
34849
+ import { spawnSync as spawnSync4 } from "node:child_process";
34850
34850
 
34851
34851
  // src/ui/Root.tsx
34852
- var import_react28 = __toESM(require_react(), 1);
34852
+ var import_react29 = __toESM(require_react(), 1);
34853
34853
 
34854
34854
  // src/engine/models.ts
34855
34855
  import { mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
@@ -35314,12 +35314,15 @@ function safeUrl(raw) {
35314
35314
  return raw && isSafeUrl(raw) ? new URL(raw).toString() : "";
35315
35315
  }
35316
35316
  function toDisplayAd(ad, opts = {}) {
35317
- const { brand, line } = composeAdCopy(ad.title, ad.body);
35318
- if (!brand && !line) return null;
35317
+ const { brand: title, line } = composeAdCopy(ad.title, ad.body);
35318
+ if (!title && !line) return null;
35319
+ const advertiser = composeAdCopy(ad.brand, ad.title).brand;
35320
+ const headline = advertiser ? composeAdCopy(advertiser, title).line || title : title;
35319
35321
  const url = safeUrl(ad.cta_url);
35320
35322
  return {
35321
35323
  ad,
35322
- title: brand,
35324
+ brand: advertiser,
35325
+ title: headline,
35323
35326
  body: line,
35324
35327
  ctaText: sanitizeAdText(ad.cta_text, AD_LIMITS.cta_text) || "Learn more",
35325
35328
  url,
@@ -36092,7 +36095,7 @@ async function boot(args, focus, report) {
36092
36095
  enabled: () => loadConfig().sync !== false,
36093
36096
  lastHash: fileHashStore(),
36094
36097
  collect: async () => buildSyncState({
36095
- appVersion: true ? "0.1.0-alpha.12" : "",
36098
+ appVersion: true ? "0.1.0-alpha.14" : "",
36096
36099
  engineVersion,
36097
36100
  model: await engine.defaultModel().then((m) => m ? `${m.providerID}/${m.id}` : session.key),
36098
36101
  catalog: await engine.catalog(),
@@ -36120,7 +36123,7 @@ function firstLine(e) {
36120
36123
  }
36121
36124
 
36122
36125
  // src/ui/App.tsx
36123
- var import_react27 = __toESM(require_react(), 1);
36126
+ var import_react28 = __toESM(require_react(), 1);
36124
36127
  import { homedir as homedir4 } from "node:os";
36125
36128
 
36126
36129
  // src/util/open.ts
@@ -36136,6 +36139,38 @@ function openUrl(url) {
36136
36139
  }
36137
36140
  }
36138
36141
 
36142
+ // src/util/clipboard.ts
36143
+ import { spawnSync as spawnSync2 } from "node:child_process";
36144
+ function clipboardCommands(platform2 = process.platform, env3 = process.env) {
36145
+ if (platform2 === "darwin") return [["pbcopy"]];
36146
+ if (platform2 === "win32") return [["clip"]];
36147
+ const list2 = [];
36148
+ if (env3.WAYLAND_DISPLAY) list2.push(["wl-copy"]);
36149
+ list2.push(["xclip", "-selection", "clipboard"], ["xsel", "--clipboard", "--input"]);
36150
+ return list2;
36151
+ }
36152
+ function osc52(text) {
36153
+ return `\x1B]52;c;${Buffer.from(text, "utf8").toString("base64")}\x07`;
36154
+ }
36155
+ function copyText(text, write = (s2) => process.stdout.write(s2), platform2 = process.platform, env3 = process.env) {
36156
+ const remote = !!(env3.SSH_TTY || env3.SSH_CONNECTION);
36157
+ if (!remote) {
36158
+ for (const [cmd, ...args] of clipboardCommands(platform2, env3)) {
36159
+ try {
36160
+ const r = spawnSync2(cmd, args, { input: text, stdio: ["pipe", "ignore", "ignore"], timeout: 2e3 });
36161
+ if (!r.error && r.status === 0) return "copied";
36162
+ } catch {
36163
+ }
36164
+ }
36165
+ }
36166
+ try {
36167
+ write(osc52(text));
36168
+ return "osc52";
36169
+ } catch {
36170
+ return "failed";
36171
+ }
36172
+ }
36173
+
36139
36174
  // src/engine/session.ts
36140
36175
  function initialState(sessionID, model = "") {
36141
36176
  return {
@@ -36460,15 +36495,19 @@ function StatusPanel(p) {
36460
36495
  const ad = p.earn === "ok" ? p.ad : null;
36461
36496
  let body;
36462
36497
  if (ad) {
36463
- const badge = adBadge(ad.title || ad.body);
36498
+ const badge = adBadge(ad.brand || ad.title || ad.body);
36464
36499
  const cta = ad.link ? `${ad.ctaText || "Open"} ${G.arrow}` : "";
36465
36500
  const ctaLen = cta ? cta.length + 8 : 0;
36466
- const brand = ad.title || ad.body;
36501
+ const headline = ad.title || ad.body;
36502
+ const lead = ad.brand ? `${ad.brand} \xB7 ` : "";
36467
36503
  const rest = ad.title && ad.body ? ` \u2014 ${ad.body}` : "";
36468
- const copyText = clip(brand + rest, Math.max(10, inner - 4 - ctaLen));
36504
+ const copyText2 = clip(lead + headline + rest, Math.max(10, inner - 4 - ctaLen));
36505
+ const cut = (from, to) => copyText2.slice(from, to);
36469
36506
  const copy = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
36470
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, underline: !!ad.link && p.osc8Links, children: copyText.slice(0, brand.length) }),
36471
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.muted, children: copyText.slice(brand.length) })
36507
+ ad.brand ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: badge.color, underline: !!ad.link && p.osc8Links, children: cut(0, ad.brand.length) }) : null,
36508
+ ad.brand ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.faint, children: cut(ad.brand.length, lead.length) }) : null,
36509
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, underline: !ad.brand && !!ad.link && p.osc8Links, children: cut(lead.length, lead.length + headline.length) }),
36510
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.muted, children: cut(lead.length + headline.length) })
36472
36511
  ] });
36473
36512
  body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
36474
36513
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { justifyContent: "space-between", children: [
@@ -36513,39 +36552,8 @@ function StatusPanel(p) {
36513
36552
  ] });
36514
36553
  }
36515
36554
 
36516
- // src/engine/overflow.ts
36517
- var OVERFLOW_MIN_CREDITS = 0.5;
36518
- var OVERFLOW_FALLBACKS = ["claude-sonnet-5-5", "claude-opus-5-5", "z-ai-glm-5-3", "qwen3-coder-480b-a35b-instruct-turbo"];
36519
- var compact = (s2) => s2.toLowerCase().replace(/[^a-z0-9]/g, "");
36520
- function bareId(key) {
36521
- const i = key.indexOf("/");
36522
- return i >= 0 ? key.slice(i + 1) : key;
36523
- }
36524
- function overflowTarget(failedKey, catalog) {
36525
- const latent = catalog.models.filter((m) => m.providerID === LATENT_ID);
36526
- if (!latent.length) return null;
36527
- const failed = catalog.models.find((m) => m.key === failedKey);
36528
- const wants = [compact(bareId(bareId(failedKey))), failed ? compact(failed.name) : ""].filter((w) => w.length >= 3);
36529
- for (const w of wants) {
36530
- const exact = latent.find((m) => compact(m.id) === w || compact(m.name) === w);
36531
- if (exact) return exact;
36532
- }
36533
- for (const w of wants) {
36534
- const near = latent.filter((m) => compact(m.id).includes(w) || compact(m.name).includes(w)).sort((a2, b) => a2.id.length - b.id.length);
36535
- if (near[0]) return near[0];
36536
- }
36537
- for (const id of OVERFLOW_FALLBACKS) {
36538
- const m = latent.find((x) => x.id === id);
36539
- if (m) return m;
36540
- }
36541
- return latent[0];
36542
- }
36543
- function overflowOffer(model, verdict, catalog, balance, offered) {
36544
- if (verdict.status !== "rate-limited" || !model || model.startsWith(`${LATENT_ID}/`)) return null;
36545
- if (balance === null || balance < OVERFLOW_MIN_CREDITS || offered.has(model)) return null;
36546
- const to = overflowTarget(model, catalog);
36547
- return to ? { from: model, to, credits: balance } : null;
36548
- }
36555
+ // src/ui/AdCard.tsx
36556
+ var import_react23 = __toESM(require_react(), 1);
36549
36557
 
36550
36558
  // src/ui/components.tsx
36551
36559
  var import_react22 = __toESM(require_react(), 1);
@@ -36946,6 +36954,89 @@ function padStart(s2, n) {
36946
36954
  return s2.length > n ? s2.slice(0, n) : s2.padStart(n);
36947
36955
  }
36948
36956
 
36957
+ // src/ui/AdCard.tsx
36958
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
36959
+ function AdCard({ ad, width, osc8Links, onOpen, onCopy, onClose }) {
36960
+ const [copied, setCopied] = (0, import_react23.useState)(null);
36961
+ const link2 = ad.link;
36962
+ use_input_default((ch, key) => {
36963
+ if (key.escape || key.ctrl && (ch === "o" || ch === "c")) return onClose();
36964
+ if (!link2) return;
36965
+ if (key.return || ch === "o") {
36966
+ onOpen(link2);
36967
+ return onClose();
36968
+ }
36969
+ if (ch === "c") setCopied(onCopy(link2));
36970
+ });
36971
+ const badge = adBadge(ad.brand || ad.title || ad.body);
36972
+ const headline = ad.title || ad.body;
36973
+ const body = ad.title ? ad.body : "";
36974
+ const site = ad.shownUrl.split(/[?#]/)[0].replace(/\/$/, "");
36975
+ const siteText = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.accent2, underline: !!link2 && osc8Links, children: site });
36976
+ const hints = link2 ? [
36977
+ ["enter", `${ad.ctaText || "Open"} ${G.arrow}`],
36978
+ ["c", "copy link"],
36979
+ ["esc", "close"]
36980
+ ] : [["esc", "close"]];
36981
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: C.earn, paddingX: 1, marginTop: 1, width, children: [
36982
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { justifyContent: "space-between", children: [
36983
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.faint, bold: true, children: "SPONSORED" }),
36984
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.faint, children: "Latent Ads" })
36985
+ ] }),
36986
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, children: [
36987
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexShrink: 0, children: [
36988
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { backgroundColor: badge.color, color: "#111827", bold: true, children: ` ${badge.letter} ` }),
36989
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { children: " " })
36990
+ ] }),
36991
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
36992
+ ad.brand ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, color: badge.color, wrap: "wrap", children: ad.brand }) : null,
36993
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, color: C.text, wrap: "wrap", children: headline }),
36994
+ body ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.muted, wrap: "wrap", children: body }) : null,
36995
+ site ? osc8Links && link2 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Transform, { transform: (o) => osc8(o, link2), children: siteText }) : siteText : null
36996
+ ] })
36997
+ ] }),
36998
+ copied === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.warn, wrap: "wrap", children: [
36999
+ "Could not copy \xB7 ",
37000
+ link2
37001
+ ] }) : copied ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.ok, children: "\u2713 link copied" }) : null,
37002
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Hints, { items: hints }) })
37003
+ ] });
37004
+ }
37005
+
37006
+ // src/engine/overflow.ts
37007
+ var OVERFLOW_MIN_CREDITS = 0.5;
37008
+ var OVERFLOW_FALLBACKS = ["claude-sonnet-5-5", "claude-opus-5-5", "z-ai-glm-5-3", "qwen3-coder-480b-a35b-instruct-turbo"];
37009
+ var compact = (s2) => s2.toLowerCase().replace(/[^a-z0-9]/g, "");
37010
+ function bareId(key) {
37011
+ const i = key.indexOf("/");
37012
+ return i >= 0 ? key.slice(i + 1) : key;
37013
+ }
37014
+ function overflowTarget(failedKey, catalog) {
37015
+ const latent = catalog.models.filter((m) => m.providerID === LATENT_ID);
37016
+ if (!latent.length) return null;
37017
+ const failed = catalog.models.find((m) => m.key === failedKey);
37018
+ const wants = [compact(bareId(bareId(failedKey))), failed ? compact(failed.name) : ""].filter((w) => w.length >= 3);
37019
+ for (const w of wants) {
37020
+ const exact = latent.find((m) => compact(m.id) === w || compact(m.name) === w);
37021
+ if (exact) return exact;
37022
+ }
37023
+ for (const w of wants) {
37024
+ const near = latent.filter((m) => compact(m.id).includes(w) || compact(m.name).includes(w)).sort((a2, b) => a2.id.length - b.id.length);
37025
+ if (near[0]) return near[0];
37026
+ }
37027
+ for (const id of OVERFLOW_FALLBACKS) {
37028
+ const m = latent.find((x) => x.id === id);
37029
+ if (m) return m;
37030
+ }
37031
+ return latent[0];
37032
+ }
37033
+ function overflowOffer(model, verdict, catalog, balance, offered) {
37034
+ if (verdict.status !== "rate-limited" || !model || model.startsWith(`${LATENT_ID}/`)) return null;
37035
+ if (balance === null || balance < OVERFLOW_MIN_CREDITS || offered.has(model)) return null;
37036
+ const to = overflowTarget(model, catalog);
37037
+ return to ? { from: model, to, credits: balance } : null;
37038
+ }
37039
+
36949
37040
  // src/ui/commands.ts
36950
37041
  var COMMANDS = [
36951
37042
  { name: "model", args: "[name]", desc: "Switch model \u2014 search, filter by provider, set effort", group: "Models", aliases: ["models"] },
@@ -36980,7 +37071,7 @@ function parseCommandLine(line) {
36980
37071
  }
36981
37072
 
36982
37073
  // src/ui/Transcript.tsx
36983
- var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
37074
+ var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
36984
37075
  function lastLines(text, n) {
36985
37076
  const lines = text.trimEnd().split("\n");
36986
37077
  return lines.length <= n ? lines.join("\n") : lines.slice(-n).join("\n");
@@ -37035,55 +37126,55 @@ function ToolView({ item, cwd: cwd2, width }) {
37035
37126
  const diff2 = item.diff ? parseDiff(item.diff) : null;
37036
37127
  const showOutput = item.output && (failed || !QUIET.has(item.name)) && !diff2;
37037
37128
  const out = showOutput ? firstLines(item.output, failed ? 8 : 6) : null;
37038
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", width, children: [
37039
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { wrap: "truncate-end", children: [
37040
- running ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spinner, { color: C.warn }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: failed ? C.err : C.ok, children: G.dot }),
37041
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { bold: true, color: t.verb === "$" ? C.accent2 : void 0, children: [
37129
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", width, children: [
37130
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate-end", children: [
37131
+ running ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { color: C.warn }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: failed ? C.err : C.ok, children: G.dot }),
37132
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { bold: true, color: t.verb === "$" ? C.accent2 : void 0, children: [
37042
37133
  " ",
37043
37134
  t.verb
37044
37135
  ] }),
37045
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
37136
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
37046
37137
  " ",
37047
37138
  clip(t.target, Math.max(20, width - t.verb.length - 24))
37048
37139
  ] }),
37049
- t.extra ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
37140
+ t.extra ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37050
37141
  " ",
37051
37142
  t.extra
37052
37143
  ] }) : null,
37053
- item.additions || item.deletions ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
37054
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.add, children: [
37144
+ item.additions || item.deletions ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
37145
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.add, children: [
37055
37146
  " +",
37056
37147
  item.additions ?? 0
37057
37148
  ] }),
37058
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.del, children: [
37149
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.del, children: [
37059
37150
  " \u2212",
37060
37151
  item.deletions ?? 0
37061
37152
  ] })
37062
37153
  ] }) : null,
37063
- item.ms !== void 0 && item.ms >= 1e3 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
37154
+ item.ms !== void 0 && item.ms >= 1e3 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37064
37155
  " \xB7 ",
37065
37156
  fmtDuration(item.ms)
37066
37157
  ] }) : null
37067
37158
  ] }),
37068
- diff2 && diff2.lines.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", marginLeft: 2, children: [
37069
- diff2.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { wrap: "truncate-end", color: l.t === "add" ? C.add : l.t === "del" ? C.del : C.faint, children: [
37159
+ diff2 && diff2.lines.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", marginLeft: 2, children: [
37160
+ diff2.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate-end", color: l.t === "add" ? C.add : l.t === "del" ? C.del : C.faint, children: [
37070
37161
  l.t === "add" ? "+ " : l.t === "del" ? "\u2212 " : l.t === "hunk" ? "" : " ",
37071
37162
  l.t === "hunk" ? "\u22EF" : l.text
37072
37163
  ] }, i)),
37073
- diff2.more ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
37164
+ diff2.more ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37074
37165
  "\u2026 ",
37075
37166
  diff2.more,
37076
37167
  " more lines"
37077
37168
  ] }) : null
37078
37169
  ] }) : null,
37079
- out ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginLeft: 2, children: [
37080
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
37170
+ out ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginLeft: 2, children: [
37171
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37081
37172
  G.elbow,
37082
37173
  " "
37083
37174
  ] }) }),
37084
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
37085
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: failed ? C.err : C.muted, children: out.text }),
37086
- out.more ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
37175
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
37176
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: failed ? C.err : C.muted, children: out.text }),
37177
+ out.more ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37087
37178
  "\u2026 ",
37088
37179
  out.more,
37089
37180
  " more lines"
@@ -37097,25 +37188,25 @@ var NOTICE_MARK = { info: G.bullet, ok: G.ok, warn: G.warn, error: G.no };
37097
37188
  function ItemView({ item, live, cwd: cwd2, width, maxLines }) {
37098
37189
  switch (item.kind) {
37099
37190
  case "user":
37100
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, width, children: [
37101
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.accent, bold: true, children: [
37191
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, width, children: [
37192
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.accent, bold: true, children: [
37102
37193
  G.prompt,
37103
37194
  " "
37104
37195
  ] }) }),
37105
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, children: item.text })
37196
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: item.text })
37106
37197
  ] });
37107
37198
  case "reasoning": {
37108
37199
  const text = item.text.trim();
37109
37200
  if (!text) return null;
37110
37201
  const shown = live ? lastLines(text, 4) : firstLines(text, 2);
37111
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, width, children: [
37112
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
37202
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, width, children: [
37203
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37113
37204
  G.thin,
37114
37205
  " "
37115
37206
  ] }) }),
37116
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
37117
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.faint, italic: true, children: typeof shown === "string" ? shown : shown.text }),
37118
- typeof shown !== "string" && shown.more ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
37207
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
37208
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, italic: true, children: typeof shown === "string" ? shown : shown.text }),
37209
+ typeof shown !== "string" && shown.more ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37119
37210
  "\u2026 thought for ",
37120
37211
  shown.more,
37121
37212
  " more lines"
@@ -37124,25 +37215,25 @@ function ItemView({ item, live, cwd: cwd2, width, maxLines }) {
37124
37215
  ] });
37125
37216
  }
37126
37217
  case "text":
37127
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { marginTop: 1, width, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { text: live ? lastLines(item.text, maxLines) : item.text }) });
37218
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginTop: 1, width, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Markdown, { text: live ? lastLines(item.text, maxLines) : item.text }) });
37128
37219
  case "tool":
37129
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToolView, { item, cwd: cwd2, width });
37220
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ToolView, { item, cwd: cwd2, width });
37130
37221
  case "error":
37131
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, width, children: [
37132
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.err, children: [
37222
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, width, children: [
37223
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.err, children: [
37133
37224
  G.no,
37134
37225
  " "
37135
37226
  ] }) }),
37136
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.err, wrap: "wrap", children: item.text })
37227
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.err, wrap: "wrap", children: item.text })
37137
37228
  ] });
37138
37229
  case "notice": {
37139
37230
  const tone = item.tone ?? "info";
37140
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, width, children: [
37141
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: NOTICE_COLOR[tone], children: [
37231
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, width, children: [
37232
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: NOTICE_COLOR[tone], children: [
37142
37233
  NOTICE_MARK[tone],
37143
37234
  " "
37144
37235
  ] }) }),
37145
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: tone === "info" ? C.muted : NOTICE_COLOR[tone], wrap: "wrap", children: item.text })
37236
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: tone === "info" ? C.muted : NOTICE_COLOR[tone], wrap: "wrap", children: item.text })
37146
37237
  ] });
37147
37238
  }
37148
37239
  }
@@ -37156,19 +37247,19 @@ function PermissionPrompt({ perm, selected, cwd: cwd2, width }) {
37156
37247
  const options = ["Allow once", "Always allow", "Reject"];
37157
37248
  const keys = ["y", "a", "n"];
37158
37249
  const what = perm.resources.map((r) => relPath(r, cwd2)).join(", ") || perm.message || "";
37159
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, borderStyle: "round", borderColor: C.warn, paddingX: 1, flexDirection: "column", width, children: [
37160
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { justifyContent: "space-between", children: [
37161
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, color: C.warn, children: PERMISSION_TITLE[perm.action] ?? `Allow ${perm.action}?` }),
37162
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.faint, children: perm.action })
37250
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, borderStyle: "round", borderColor: C.warn, paddingX: 1, flexDirection: "column", width, children: [
37251
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { justifyContent: "space-between", children: [
37252
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, color: C.warn, children: PERMISSION_TITLE[perm.action] ?? `Allow ${perm.action}?` }),
37253
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: perm.action })
37163
37254
  ] }),
37164
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { marginY: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: perm.action === "shell" ? C.accent2 : void 0, wrap: "wrap", children: [
37255
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginY: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: perm.action === "shell" ? C.accent2 : void 0, wrap: "wrap", children: [
37165
37256
  perm.action === "shell" ? "$ " : "",
37166
37257
  clip(what, 600)
37167
37258
  ] }) }),
37168
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
37259
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
37169
37260
  i ? " " : "",
37170
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: i === selected ? i === 2 ? C.err : C.ok : C.muted, bold: i === selected, inverse: i === selected, children: ` ${o} ` }),
37171
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
37261
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: i === selected ? i === 2 ? C.err : C.ok : C.muted, bold: i === selected, inverse: i === selected, children: ` ${o} ` }),
37262
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37172
37263
  " ",
37173
37264
  keys[i]
37174
37265
  ] })
@@ -37177,32 +37268,32 @@ function PermissionPrompt({ perm, selected, cwd: cwd2, width }) {
37177
37268
  }
37178
37269
 
37179
37270
  // src/ui/panels/ModelPicker.tsx
37180
- var import_react23 = __toESM(require_react(), 1);
37181
- var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
37271
+ var import_react24 = __toESM(require_react(), 1);
37272
+ var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
37182
37273
  function Mark({ status: status2, testing }) {
37183
- if (testing) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, {});
37274
+ if (testing) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {});
37184
37275
  switch (status2) {
37185
37276
  case "ok":
37186
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.ok, children: G.ok });
37277
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.ok, children: G.ok });
37187
37278
  case "unsupported":
37188
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.err, children: G.no });
37279
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: G.no });
37189
37280
  case "rate-limited":
37190
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.warn, children: G.wait });
37281
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.warn, children: G.wait });
37191
37282
  case "auth":
37192
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.warn, children: G.key });
37283
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.warn, children: G.key });
37193
37284
  case "error":
37194
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.err, children: G.warn });
37285
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: G.warn });
37195
37286
  default:
37196
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: "\xB7" });
37287
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: "\xB7" });
37197
37288
  }
37198
37289
  }
37199
37290
  function ModelPicker(p) {
37200
- const tabs = (0, import_react23.useMemo)(() => [void 0, ...p.catalog.providers.map((x) => x.id)], [p.catalog]);
37201
- const [tab2, setTab] = (0, import_react23.useState)(() => Math.max(0, tabs.indexOf(p.provider)));
37202
- const [sel, setSel] = (0, import_react23.useState)(0);
37203
- const [variantIdx, setVariantIdx] = (0, import_react23.useState)(null);
37204
- const [testing, setTesting] = (0, import_react23.useState)(/* @__PURE__ */ new Set());
37205
- const [, bump] = (0, import_react23.useState)(0);
37291
+ const tabs = (0, import_react24.useMemo)(() => [void 0, ...p.catalog.providers.map((x) => x.id)], [p.catalog]);
37292
+ const [tab2, setTab] = (0, import_react24.useState)(() => Math.max(0, tabs.indexOf(p.provider)));
37293
+ const [sel, setSel] = (0, import_react24.useState)(0);
37294
+ const [variantIdx, setVariantIdx] = (0, import_react24.useState)(null);
37295
+ const [testing, setTesting] = (0, import_react24.useState)(/* @__PURE__ */ new Set());
37296
+ const [, bump] = (0, import_react24.useState)(0);
37206
37297
  const field = useLineField({
37207
37298
  initial: p.query,
37208
37299
  onChange: () => {
@@ -37255,7 +37346,7 @@ function ModelPicker(p) {
37255
37346
  }
37256
37347
  });
37257
37348
  const provider = tabs[tab2];
37258
- const rows = (0, import_react23.useMemo)(
37349
+ const rows = (0, import_react24.useMemo)(
37259
37350
  () => pickerRows(p.catalog, field.text, { provider, status: p.status, current: p.current }),
37260
37351
  // `testing` changes when a verdict lands, which reorders the list.
37261
37352
  [p.catalog, field.text, provider, p.current, testing]
@@ -37282,14 +37373,14 @@ function ModelPicker(p) {
37282
37373
  const wId = Math.max(0, rest - wName);
37283
37374
  const kindOf = (id) => p.catalog.providers.find((x) => x.id === id)?.kind ?? "unknown";
37284
37375
  const verified = p.catalog.models.filter((m) => p.status(m.key) === "ok").length;
37285
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
37376
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
37286
37377
  Panel,
37287
37378
  {
37288
37379
  title: "Models",
37289
37380
  right: `${p.catalog.models.length} models \xB7 ${verified} verified with your account`,
37290
37381
  width: p.width,
37291
37382
  color: C.accent,
37292
- footer: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
37383
+ footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37293
37384
  Hints,
37294
37385
  {
37295
37386
  items: [
@@ -37303,36 +37394,36 @@ function ModelPicker(p) {
37303
37394
  }
37304
37395
  ),
37305
37396
  children: [
37306
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, children: [
37307
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.accent, children: [
37397
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, children: [
37398
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37308
37399
  G.search,
37309
37400
  " "
37310
37401
  ] }),
37311
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldText, { state: field.state, placeholder: "type to search \u2014 name, id or provider" })
37402
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, placeholder: "type to search \u2014 name, id or provider" })
37312
37403
  ] }),
37313
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginTop: 1, flexWrap: "wrap", children: tabs.map((id, i) => {
37404
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, flexWrap: "wrap", children: tabs.map((id, i) => {
37314
37405
  const prov = p.catalog.providers.find((x) => x.id === id);
37315
37406
  const text = prov ? `${prov.name} ${prov.models}` : `All ${p.catalog.models.length}`;
37316
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginRight: 2, children: i === tab2 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, color: C.accent, underline: true, children: text }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.muted, children: text }) }, id ?? "all");
37407
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginRight: 2, children: i === tab2 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, color: C.accent, underline: true, children: text }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: text }) }, id ?? "all");
37317
37408
  }) }),
37318
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37319
- above ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37409
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37410
+ above ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
37320
37411
  " ",
37321
37412
  G.up,
37322
37413
  " ",
37323
37414
  above,
37324
37415
  " more"
37325
37416
  ] }) : null,
37326
- shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.muted, children: [
37417
+ shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
37327
37418
  " No model matches \u201C",
37328
37419
  field.text,
37329
37420
  "\u201D."
37330
37421
  ] }) : null,
37331
37422
  shown.map((r, i) => {
37332
37423
  if (r.t === "head") {
37333
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate-end", children: [
37334
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, color: C.muted, children: r.label }),
37335
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37424
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
37425
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, color: C.muted, children: r.label }),
37426
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
37336
37427
  " ",
37337
37428
  r.hint
37338
37429
  ] })
@@ -37343,33 +37434,33 @@ function ModelPicker(p) {
37343
37434
  const st = p.status(m.key);
37344
37435
  const dead = st === "unsupported";
37345
37436
  const note = m.key === p.current ? "current" : st === "unsupported" ? "not on your plan" : st !== "unknown" && st !== "ok" ? label(st) : "";
37346
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate-end", children: [
37347
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.accent, children: [
37437
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
37438
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37348
37439
  on2 ? G.prompt : " ",
37349
37440
  " "
37350
37441
  ] }),
37351
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Mark, { status: st, testing: testing.has(m.key) }),
37352
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: " " }),
37353
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: on2, color: dead ? C.faint : on2 ? C.text : void 0, children: pad(m.name, wName) }),
37354
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37442
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Mark, { status: st, testing: testing.has(m.key) }),
37443
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: " " }),
37444
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: on2, color: dead ? C.faint : on2 ? C.text : void 0, children: pad(m.name, wName) }),
37445
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
37355
37446
  " ",
37356
37447
  pad(field.text || !provider ? m.key : m.id, wId)
37357
37448
  ] }),
37358
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.muted, children: [
37449
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
37359
37450
  " ",
37360
37451
  padStart(fmtContext(m.context), wCtx)
37361
37452
  ] }),
37362
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: m.costIn === 0 && m.costOut === 0 ? C.ok : C.muted, children: [
37453
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: m.costIn === 0 && m.costOut === 0 ? C.ok : C.muted, children: [
37363
37454
  " ",
37364
37455
  padStart(fmtPrice(m, kindOf(m.providerID)), wPrice)
37365
37456
  ] }),
37366
- note ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: m.key === p.current ? C.accent2 : dead ? C.faint : C.warn, children: [
37457
+ note ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: m.key === p.current ? C.accent2 : dead ? C.faint : C.warn, children: [
37367
37458
  " ",
37368
37459
  note
37369
37460
  ] }) : null
37370
37461
  ] }, m.key);
37371
37462
  }),
37372
- below ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
37463
+ below ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
37373
37464
  " ",
37374
37465
  G.down,
37375
37466
  " ",
@@ -37377,13 +37468,13 @@ function ModelPicker(p) {
37377
37468
  " more"
37378
37469
  ] }) : null
37379
37470
  ] }),
37380
- chosen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate-end", children: [
37381
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: "effort " }),
37382
- efforts.length > 1 ? efforts.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: i === effortAt ? C.accent2 : C.faint, bold: i === effortAt, children: [
37471
+ chosen ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
37472
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: "effort " }),
37473
+ efforts.length > 1 ? efforts.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: i === effortAt ? C.accent2 : C.faint, bold: i === effortAt, children: [
37383
37474
  i === effortAt ? `\u2039 ${e} \u203A` : e,
37384
37475
  i < efforts.length - 1 ? " " : ""
37385
- ] }, e)) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: "fixed for this model" }),
37386
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: " ctx \xB7 in/out per 1M tokens ($, or cr = Latent credits)" })
37476
+ ] }, e)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: "fixed for this model" }),
37477
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: " ctx \xB7 in/out per 1M tokens ($, or cr = Latent credits)" })
37387
37478
  ] }) }) : null
37388
37479
  ]
37389
37480
  }
@@ -37391,8 +37482,8 @@ function ModelPicker(p) {
37391
37482
  }
37392
37483
 
37393
37484
  // src/ui/panels/ProviderPanel.tsx
37394
- var import_react24 = __toESM(require_react(), 1);
37395
- var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
37485
+ var import_react25 = __toESM(require_react(), 1);
37486
+ var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
37396
37487
  var usable = (i) => i.methods.filter((m) => m.type === "key" || m.type === "oauth" || m.type === "external");
37397
37488
  var needsForm = (m) => "form" in m && Array.isArray(m.form) && m.form.some((f) => !f.hidden && f.required);
37398
37489
  var methodLabel = (m) => m.type === "key" ? m.label || "API key" : m.label;
@@ -37402,10 +37493,10 @@ function errText(e) {
37402
37493
  return m ? m[1] : s2;
37403
37494
  }
37404
37495
  function ProviderPanel(p) {
37405
- const [view, setView] = (0, import_react24.useState)(p.connect ? { v: "pick" } : { v: "list" });
37406
- const [integrations, setIntegrations] = (0, import_react24.useState)(null);
37407
- const [error, setError] = (0, import_react24.useState)("");
37408
- (0, import_react24.useEffect)(() => {
37496
+ const [view, setView] = (0, import_react25.useState)(p.connect ? { v: "pick" } : { v: "list" });
37497
+ const [integrations, setIntegrations] = (0, import_react25.useState)(null);
37498
+ const [error, setError] = (0, import_react25.useState)("");
37499
+ (0, import_react25.useEffect)(() => {
37409
37500
  let live = true;
37410
37501
  p.engine.integrations().then((list2) => live && setIntegrations(list2)).catch((e) => live && setError(errText(e)));
37411
37502
  return () => {
@@ -37447,7 +37538,7 @@ function ProviderPanel(p) {
37447
37538
  const common = { width: p.width, color: C.accent };
37448
37539
  switch (view.v) {
37449
37540
  case "list":
37450
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37541
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
37451
37542
  ProviderList,
37452
37543
  {
37453
37544
  ...p,
@@ -37456,7 +37547,7 @@ function ProviderPanel(p) {
37456
37547
  }
37457
37548
  );
37458
37549
  case "pick":
37459
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37550
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
37460
37551
  IntegrationPicker,
37461
37552
  {
37462
37553
  ...common,
@@ -37471,13 +37562,13 @@ function ProviderPanel(p) {
37471
37562
  }
37472
37563
  );
37473
37564
  case "connecting":
37474
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Panel, { title: `Connect ${view.integration.name}`, width: p.width, color: C.accent, footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["", "this can take a few seconds"]] }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
37475
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
37565
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Panel, { title: `Connect ${view.integration.name}`, width: p.width, color: C.accent, footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["", "this can take a few seconds"]] }), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
37566
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
37476
37567
  " ",
37477
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Checking the login on this machine and loading its models\u2026" })
37568
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Checking the login on this machine and loading its models\u2026" })
37478
37569
  ] }) }) });
37479
37570
  case "custom":
37480
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37571
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
37481
37572
  CustomProviderForm,
37482
37573
  {
37483
37574
  ...common,
@@ -37488,7 +37579,7 @@ function ProviderPanel(p) {
37488
37579
  }
37489
37580
  );
37490
37581
  case "method":
37491
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37582
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
37492
37583
  MethodPicker,
37493
37584
  {
37494
37585
  ...common,
@@ -37499,7 +37590,7 @@ function ProviderPanel(p) {
37499
37590
  }
37500
37591
  );
37501
37592
  case "key":
37502
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37593
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
37503
37594
  KeyEntry,
37504
37595
  {
37505
37596
  ...common,
@@ -37510,7 +37601,7 @@ function ProviderPanel(p) {
37510
37601
  }
37511
37602
  );
37512
37603
  case "oauth":
37513
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37604
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
37514
37605
  OAuthFlow,
37515
37606
  {
37516
37607
  ...common,
@@ -37522,11 +37613,11 @@ function ProviderPanel(p) {
37522
37613
  }
37523
37614
  );
37524
37615
  case "done":
37525
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Done, { ...common, name: view.name, models: view.models, note: view.note, onClose: p.onClose, onModels: () => p.onBrowse("") });
37616
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Done, { ...common, name: view.name, models: view.models, note: view.note, onClose: p.onClose, onModels: () => p.onBrowse("") });
37526
37617
  }
37527
37618
  }
37528
37619
  function ProviderList(p) {
37529
- const [sel, setSel] = (0, import_react24.useState)(0);
37620
+ const [sel, setSel] = (0, import_react25.useState)(0);
37530
37621
  const items = p.catalog.providers;
37531
37622
  const count = items.length + 1;
37532
37623
  use_input_default((ch, key) => {
@@ -37543,39 +37634,39 @@ function ProviderList(p) {
37543
37634
  const inner = p.width - 4;
37544
37635
  const wName = Math.min(24, Math.max(12, ...items.map((x) => x.name.length)) + 1);
37545
37636
  const wVia = Math.min(26, Math.max(10, ...items.map((x) => x.via.length)) + 1);
37546
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
37637
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
37547
37638
  Panel,
37548
37639
  {
37549
37640
  title: "Providers",
37550
37641
  right: `${items.length} connected \xB7 ${p.catalog.models.length} models`,
37551
37642
  width: p.width,
37552
37643
  color: C.accent,
37553
- footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "browse models"], ["c", "connect a provider"], ["esc", "close"]] }),
37644
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "browse models"], ["c", "connect a provider"], ["esc", "close"]] }),
37554
37645
  children: [
37555
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37646
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37556
37647
  items.map((prov, i) => {
37557
37648
  const ok = p.catalog.models.filter((m) => m.providerID === prov.id && p.status(m.key) === "ok").length;
37558
37649
  const dot = prov.kind === "builtin" ? C.faint : C.ok;
37559
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
37560
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37650
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { wrap: "truncate-end", children: [
37651
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
37561
37652
  i === sel ? G.prompt : " ",
37562
37653
  " "
37563
37654
  ] }),
37564
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: dot, children: [
37655
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: dot, children: [
37565
37656
  G.dot,
37566
37657
  " "
37567
37658
  ] }),
37568
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: i === sel, children: pad(prov.name, wName) }),
37569
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
37659
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: i === sel, children: pad(prov.name, wName) }),
37660
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.muted, children: [
37570
37661
  " ",
37571
37662
  pad(prov.via, wVia)
37572
37663
  ] }),
37573
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
37664
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.muted, children: [
37574
37665
  " ",
37575
37666
  String(prov.models).padStart(3),
37576
37667
  " models"
37577
37668
  ] }),
37578
- ok ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.ok, children: [
37669
+ ok ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.ok, children: [
37579
37670
  " ",
37580
37671
  G.ok,
37581
37672
  " ",
@@ -37584,23 +37675,23 @@ function ProviderList(p) {
37584
37675
  ] }) : null
37585
37676
  ] }, prov.id);
37586
37677
  }),
37587
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
37588
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37678
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
37679
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
37589
37680
  sel === items.length ? G.prompt : " ",
37590
37681
  " "
37591
37682
  ] }),
37592
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.accent2, bold: sel === items.length, children: "+ Connect a provider\u2026" })
37683
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.accent2, bold: sel === items.length, children: "+ Connect a provider\u2026" })
37593
37684
  ] })
37594
37685
  ] }),
37595
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, wrap: "wrap", children: clipTo("Bring your own access: an API key, or a subscription where the provider allows third-party clients. Credentials stay in the local engine.", inner * 2) }) }),
37596
- p.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: p.error }) : null
37686
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.faint, wrap: "wrap", children: clipTo("Bring your own access: an API key, or a subscription where the provider allows third-party clients. Credentials stay in the local engine.", inner * 2) }) }),
37687
+ p.error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, children: p.error }) : null
37597
37688
  ]
37598
37689
  }
37599
37690
  );
37600
37691
  }
37601
37692
  var clipTo = (s2, n) => s2.length > n ? s2.slice(0, n - 1) + "\u2026" : s2;
37602
37693
  function IntegrationPicker(p) {
37603
- const [sel, setSel] = (0, import_react24.useState)(0);
37694
+ const [sel, setSel] = (0, import_react25.useState)(0);
37604
37695
  const field = useLineField({
37605
37696
  initial: p.query,
37606
37697
  onChange: () => setSel(0),
@@ -37621,38 +37712,38 @@ function IntegrationPicker(p) {
37621
37712
  return false;
37622
37713
  }
37623
37714
  });
37624
- const list2 = (0, import_react24.useMemo)(() => searchIntegrations(p.integrations ?? [], field.text), [p.integrations, field.text]);
37715
+ const list2 = (0, import_react25.useMemo)(() => searchIntegrations(p.integrations ?? [], field.text), [p.integrations, field.text]);
37625
37716
  const selected = Math.min(sel, list2.length);
37626
37717
  const visible = Math.max(5, Math.min(11, p.rows - 15));
37627
37718
  const win = windowAround(list2.length, Math.min(selected, Math.max(0, list2.length - 1)), visible);
37628
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
37719
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
37629
37720
  Panel,
37630
37721
  {
37631
37722
  title: "Connect a provider",
37632
37723
  right: p.integrations ? `${list2.length} available` : "",
37633
37724
  width: p.width,
37634
37725
  color: p.color,
37635
- footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "choose"], ["esc", field.text ? "clear" : "back"]] }),
37726
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "choose"], ["esc", field.text ? "clear" : "back"]] }),
37636
37727
  children: [
37637
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, children: [
37638
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37728
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { marginTop: 1, children: [
37729
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
37639
37730
  G.search,
37640
37731
  " "
37641
37732
  ] }),
37642
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, placeholder: "search \u2014 Anthropic, OpenRouter, Google\u2026" })
37733
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldText, { state: field.state, placeholder: "search \u2014 Anthropic, OpenRouter, Google\u2026" })
37643
37734
  ] }),
37644
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37645
- !p.integrations && !p.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
37646
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
37735
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37736
+ !p.integrations && !p.error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
37737
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
37647
37738
  " ",
37648
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Loading providers\u2026" })
37739
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Loading providers\u2026" })
37649
37740
  ] }) : null,
37650
- p.integrations && !list2.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
37741
+ p.integrations && !list2.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.muted, children: [
37651
37742
  " Nothing matches \u201C",
37652
37743
  field.text,
37653
37744
  "\u201D."
37654
37745
  ] }) : null,
37655
- win.start > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
37746
+ win.start > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.faint, children: [
37656
37747
  " ",
37657
37748
  G.up,
37658
37749
  " ",
@@ -37663,47 +37754,47 @@ function IntegrationPicker(p) {
37663
37754
  const on2 = win.start + i === selected;
37664
37755
  const labels = usable(it).map((m) => m.type === "key" ? "API key" : m.label);
37665
37756
  const methods = labels.slice(0, 2).join(" \xB7 ") + (labels.length > 2 ? ` +${labels.length - 2}` : "");
37666
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
37667
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37757
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { wrap: "truncate-end", children: [
37758
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
37668
37759
  on2 ? G.prompt : " ",
37669
37760
  " "
37670
37761
  ] }),
37671
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: on2, children: pad(it.name, 26) }),
37672
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
37762
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: on2, children: pad(it.name, 26) }),
37763
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.muted, children: [
37673
37764
  " ",
37674
37765
  methods
37675
37766
  ] }),
37676
- p.connected.has(it.id) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.ok, children: [
37767
+ p.connected.has(it.id) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.ok, children: [
37677
37768
  " ",
37678
37769
  G.ok,
37679
37770
  " connected"
37680
37771
  ] }) : null
37681
37772
  ] }, it.id);
37682
37773
  }),
37683
- win.end < list2.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
37774
+ win.end < list2.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.faint, children: [
37684
37775
  " ",
37685
37776
  G.down,
37686
37777
  " ",
37687
37778
  list2.length - win.end,
37688
37779
  " more"
37689
37780
  ] }) : null,
37690
- p.integrations ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
37691
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37781
+ p.integrations ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { wrap: "truncate-end", children: [
37782
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
37692
37783
  selected === list2.length ? G.prompt : " ",
37693
37784
  " "
37694
37785
  ] }),
37695
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.accent2, bold: selected === list2.length, children: pad("+ Custom provider\u2026", 26) }),
37696
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: " any OpenAI- or Anthropic-compatible endpoint" })
37786
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.accent2, bold: selected === list2.length, children: pad("+ Custom provider\u2026", 26) }),
37787
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: " any OpenAI- or Anthropic-compatible endpoint" })
37697
37788
  ] }) : null
37698
37789
  ] }),
37699
- p.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: p.error }) : null
37790
+ p.error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, children: p.error }) : null
37700
37791
  ]
37701
37792
  }
37702
37793
  );
37703
37794
  }
37704
37795
  function MethodPicker(p) {
37705
37796
  const methods = usable(p.integration);
37706
- const [sel, setSel] = (0, import_react24.useState)(0);
37797
+ const [sel, setSel] = (0, import_react25.useState)(0);
37707
37798
  use_input_default((_ch, key) => {
37708
37799
  if (key.escape) return p.onBack();
37709
37800
  if (key.upArrow) return setSel((s2) => (s2 + methods.length - 1) % methods.length);
@@ -37712,38 +37803,38 @@ function MethodPicker(p) {
37712
37803
  });
37713
37804
  const wLabel = Math.min(40, Math.max(...methods.map((m) => methodLabel(m).length)) + 2);
37714
37805
  const env3 = p.integration.methods.find((m) => m.type === "env");
37715
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
37806
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
37716
37807
  Panel,
37717
37808
  {
37718
37809
  title: `Connect ${p.integration.name}`,
37719
37810
  width: p.width,
37720
37811
  color: p.color,
37721
- footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "continue"], ["esc", "back"]] }),
37812
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "continue"], ["esc", "back"]] }),
37722
37813
  children: [
37723
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37724
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "How do you want to connect?" }),
37725
- methods.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
37726
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37814
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37815
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "How do you want to connect?" }),
37816
+ methods.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
37817
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
37727
37818
  i === sel ? G.prompt : " ",
37728
37819
  " "
37729
37820
  ] }),
37730
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: i === sel, children: pad(methodLabel(m), wLabel) }),
37731
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: m.type === "oauth" ? "opens your browser" : m.type === "external" ? "uses the login on this machine" : "paste a key" })
37821
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: i === sel, children: pad(methodLabel(m), wLabel) }),
37822
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.faint, children: m.type === "oauth" ? "opens your browser" : m.type === "external" ? "uses the login on this machine" : "paste a key" })
37732
37823
  ] }, m.type + ("id" in m ? m.id : "")))
37733
37824
  ] }),
37734
- env3 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
37825
+ env3 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.faint, children: [
37735
37826
  "Or set ",
37736
37827
  env3.names[0],
37737
37828
  " in your shell before starting LatentCode."
37738
37829
  ] }) }) : null,
37739
- p.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: p.error }) : null
37830
+ p.error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, children: p.error }) : null
37740
37831
  ]
37741
37832
  }
37742
37833
  );
37743
37834
  }
37744
37835
  function KeyEntry(p) {
37745
- const [busy, setBusy] = (0, import_react24.useState)(false);
37746
- const [error, setError] = (0, import_react24.useState)("");
37836
+ const [busy, setBusy] = (0, import_react25.useState)(false);
37837
+ const [error, setError] = (0, import_react25.useState)("");
37747
37838
  const field = useLineField({
37748
37839
  active: !busy,
37749
37840
  onChange: () => setError(""),
@@ -37762,44 +37853,44 @@ function KeyEntry(p) {
37762
37853
  return false;
37763
37854
  }
37764
37855
  });
37765
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37856
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
37766
37857
  Panel,
37767
37858
  {
37768
37859
  title: `Connect ${p.integration.name}`,
37769
37860
  right: "API key",
37770
37861
  width: p.width,
37771
37862
  color: p.color,
37772
- footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["enter", "save"], ["esc", "back"]] }),
37773
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37774
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
37863
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["enter", "save"], ["esc", "back"]] }),
37864
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37865
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.muted, children: [
37775
37866
  "Paste your ",
37776
37867
  p.integration.name,
37777
37868
  " API key."
37778
37869
  ] }),
37779
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, children: [
37780
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37870
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { marginTop: 1, children: [
37871
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
37781
37872
  G.key,
37782
37873
  " "
37783
37874
  ] }),
37784
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, mask: true, placeholder: "paste the key here" })
37875
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldText, { state: field.state, mask: true, placeholder: "paste the key here" })
37785
37876
  ] }),
37786
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: busy ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
37787
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
37877
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: busy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
37878
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
37788
37879
  " ",
37789
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Saving\u2026" })
37790
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: "Stored by the local engine on this machine. Never sent to Latent." }) }),
37791
- error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: error }) : null
37880
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Saving\u2026" })
37881
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.faint, children: "Stored by the local engine on this machine. Never sent to Latent." }) }),
37882
+ error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, children: error }) : null
37792
37883
  ] })
37793
37884
  }
37794
37885
  );
37795
37886
  }
37796
37887
  function OAuthFlow(p) {
37797
- const [attempt, setAttempt] = (0, import_react24.useState)(null);
37798
- const [error, setError] = (0, import_react24.useState)("");
37799
- const [busy, setBusy] = (0, import_react24.useState)(false);
37800
- const attemptRef = (0, import_react24.useRef)(null);
37801
- const finished = (0, import_react24.useRef)(false);
37802
- (0, import_react24.useEffect)(() => {
37888
+ const [attempt, setAttempt] = (0, import_react25.useState)(null);
37889
+ const [error, setError] = (0, import_react25.useState)("");
37890
+ const [busy, setBusy] = (0, import_react25.useState)(false);
37891
+ const attemptRef = (0, import_react25.useRef)(null);
37892
+ const finished = (0, import_react25.useRef)(false);
37893
+ (0, import_react25.useEffect)(() => {
37803
37894
  let live = true;
37804
37895
  const answer = {};
37805
37896
  for (const f of p.method.form ?? []) if (f.default !== void 0) answer[f.key] = f.default;
@@ -37815,7 +37906,7 @@ function OAuthFlow(p) {
37815
37906
  if (a2 && !finished.current) void p.engine.cancelOAuth(p.integration.id, a2.attemptID);
37816
37907
  };
37817
37908
  }, []);
37818
- (0, import_react24.useEffect)(() => {
37909
+ (0, import_react25.useEffect)(() => {
37819
37910
  if (!attempt || attempt.mode !== "auto") return;
37820
37911
  const t = setInterval(() => {
37821
37912
  p.engine.oauthStatus(p.integration.id, attempt.attemptID).then((s2) => {
@@ -37855,50 +37946,50 @@ function OAuthFlow(p) {
37855
37946
  return false;
37856
37947
  }
37857
37948
  });
37858
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
37949
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
37859
37950
  Panel,
37860
37951
  {
37861
37952
  title: `Connect ${p.integration.name}`,
37862
37953
  right: p.method.label,
37863
37954
  width: p.width,
37864
37955
  color: p.color,
37865
- footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: codeMode ? [["enter", "submit code"], ["esc", "cancel"]] : [["esc", "cancel"]] }),
37866
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37867
- !attempt && !error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
37868
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
37956
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: codeMode ? [["enter", "submit code"], ["esc", "cancel"]] : [["esc", "cancel"]] }),
37957
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
37958
+ !attempt && !error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
37959
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
37869
37960
  " ",
37870
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Starting sign-in\u2026" })
37961
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Starting sign-in\u2026" })
37871
37962
  ] }) : null,
37872
- attempt ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
37873
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Your browser should open. If it does not, open this link:" }),
37874
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.accent2, wrap: "wrap", children: attempt.url }),
37875
- attempt.instructions ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: attempt.instructions }) }) : null,
37876
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: codeMode ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
37877
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
37963
+ attempt ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
37964
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Your browser should open. If it does not, open this link:" }),
37965
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.accent2, wrap: "wrap", children: attempt.url }),
37966
+ attempt.instructions ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: attempt.instructions }) }) : null,
37967
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: codeMode ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
37968
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
37878
37969
  G.key,
37879
37970
  " "
37880
37971
  ] }),
37881
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, placeholder: "paste the code from the browser" })
37882
- ] }) : error ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
37883
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
37972
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldText, { state: field.state, placeholder: "paste the code from the browser" })
37973
+ ] }) : error ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
37974
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
37884
37975
  " ",
37885
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Waiting for you to finish in the browser\u2026" })
37976
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Waiting for you to finish in the browser\u2026" })
37886
37977
  ] }) })
37887
37978
  ] }) : null,
37888
- error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: error }) : null
37979
+ error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, children: error }) : null
37889
37980
  ] })
37890
37981
  }
37891
37982
  );
37892
37983
  }
37893
37984
  var KINDS = ["openai", "anthropic"];
37894
37985
  function CustomProviderForm(p) {
37895
- const [step, setStep] = (0, import_react24.useState)("name");
37896
- const [name, setName] = (0, import_react24.useState)("");
37897
- const [kind, setKind] = (0, import_react24.useState)("openai");
37898
- const [url, setUrl] = (0, import_react24.useState)("");
37899
- const [key, setKey] = (0, import_react24.useState)("");
37900
- const [busy, setBusy] = (0, import_react24.useState)("");
37901
- const [error, setError] = (0, import_react24.useState)("");
37986
+ const [step, setStep] = (0, import_react25.useState)("name");
37987
+ const [name, setName] = (0, import_react25.useState)("");
37988
+ const [kind, setKind] = (0, import_react25.useState)("openai");
37989
+ const [url, setUrl] = (0, import_react25.useState)("");
37990
+ const [key, setKey] = (0, import_react25.useState)("");
37991
+ const [busy, setBusy] = (0, import_react25.useState)("");
37992
+ const [error, setError] = (0, import_react25.useState)("");
37902
37993
  const order = ["name", "kind", "url", "key", "models"];
37903
37994
  const back = () => {
37904
37995
  setError("");
@@ -37981,13 +38072,13 @@ function CustomProviderForm(p) {
37981
38072
  },
37982
38073
  { isActive: !busy && step === "kind" }
37983
38074
  );
37984
- const done = (label2, value) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
37985
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.ok, children: [
38075
+ const done = (label2, value) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { wrap: "truncate-end", children: [
38076
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.ok, children: [
37986
38077
  G.ok,
37987
38078
  " "
37988
38079
  ] }),
37989
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: pad(label2, 10) }),
37990
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: value })
38080
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: pad(label2, 10) }),
38081
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: value })
37991
38082
  ] });
37992
38083
  const at = order.indexOf(step);
37993
38084
  const prompt = {
@@ -38004,51 +38095,51 @@ function CustomProviderForm(p) {
38004
38095
  placeholder: "e.g. gpt-4.1, claude-sonnet-4"
38005
38096
  }
38006
38097
  };
38007
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38098
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
38008
38099
  Panel,
38009
38100
  {
38010
38101
  title: "Custom provider",
38011
38102
  right: `step ${at + 1} of ${order.length}`,
38012
38103
  width: p.width,
38013
38104
  color: p.color,
38014
- footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38105
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
38015
38106
  Hints,
38016
38107
  {
38017
38108
  items: step === "kind" ? [["\u2191\u2193", "choose"], ["enter", "continue"], ["esc", "back"]] : [["enter", step === "models" ? "save" : "continue"], ["esc", "back"]]
38018
38109
  }
38019
38110
  ),
38020
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38111
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38021
38112
  at > 0 ? done("Name", name) : null,
38022
38113
  at > 1 ? done("Type", KIND_LABEL[kind]) : null,
38023
38114
  at > 2 ? done("Base URL", url) : null,
38024
38115
  at > 3 ? done("API key", key ? "\u2022".repeat(Math.min(key.length, 12)) : "none") : null,
38025
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: at > 0 ? 1 : 0, flexDirection: "column", children: step === "kind" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
38026
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Which API does the endpoint speak?" }),
38027
- KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
38028
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
38116
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: at > 0 ? 1 : 0, flexDirection: "column", children: step === "kind" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
38117
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Which API does the endpoint speak?" }),
38118
+ KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
38119
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
38029
38120
  k === kind ? G.prompt : " ",
38030
38121
  " "
38031
38122
  ] }),
38032
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: k === kind, children: pad(KIND_LABEL[k], 24) }),
38033
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: k === "openai" ? "/chat/completions \u2014 most gateways, vLLM, Ollama" : "/messages \u2014 Anthropic-style proxies" })
38123
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: k === kind, children: pad(KIND_LABEL[k], 24) }),
38124
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.faint, children: k === "openai" ? "/chat/completions \u2014 most gateways, vLLM, Ollama" : "/messages \u2014 Anthropic-style proxies" })
38034
38125
  ] }, k))
38035
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
38036
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: prompt[step].hint }),
38037
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, children: [
38038
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
38126
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
38127
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: prompt[step].hint }),
38128
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { marginTop: 1, children: [
38129
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.accent, children: [
38039
38130
  step === "key" ? G.key : G.prompt,
38040
38131
  " "
38041
38132
  ] }),
38042
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: pad(prompt[step].label, 10) }),
38043
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, mask: step === "key", placeholder: prompt[step].placeholder })
38133
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: pad(prompt[step].label, 10) }),
38134
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldText, { state: field.state, mask: step === "key", placeholder: prompt[step].placeholder })
38044
38135
  ] })
38045
38136
  ] }) }),
38046
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: busy ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
38047
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
38137
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: busy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
38138
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
38048
38139
  " ",
38049
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: busy })
38050
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: "The endpoint goes into the engine config; the key into the engine's credential store. Never sent to Latent." }) }),
38051
- error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, wrap: "wrap", children: error }) : null
38140
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: busy })
38141
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.faint, children: "The endpoint goes into the engine config; the key into the engine's credential store. Never sent to Latent." }) }),
38142
+ error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, wrap: "wrap", children: error }) : null
38052
38143
  ] })
38053
38144
  }
38054
38145
  );
@@ -38058,30 +38149,30 @@ function Done(p) {
38058
38149
  if (key.return) return p.onModels();
38059
38150
  if (key.escape) p.onClose();
38060
38151
  });
38061
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
38152
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
38062
38153
  Panel,
38063
38154
  {
38064
38155
  title: "Connected",
38065
38156
  width: p.width,
38066
38157
  color: C.ok,
38067
- footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["enter", "pick a model"], ["esc", "close"]] }),
38158
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["enter", "pick a model"], ["esc", "close"]] }),
38068
38159
  children: [
38069
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
38070
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.ok, children: [
38160
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
38161
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.ok, children: [
38071
38162
  G.ok,
38072
38163
  " "
38073
38164
  ] }),
38074
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: p.name }),
38075
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: p.models ? ` is connected \u2014 ${p.models} models available.` : " is connected. Its models will appear after a moment." })
38165
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: p.name }),
38166
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: p.models ? ` is connected \u2014 ${p.models} models available.` : " is connected. Its models will appear after a moment." })
38076
38167
  ] }) }),
38077
- p.note ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, wrap: "wrap", children: p.note }) }) : null
38168
+ p.note ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.faint, wrap: "wrap", children: p.note }) }) : null
38078
38169
  ]
38079
38170
  }
38080
38171
  );
38081
38172
  }
38082
38173
 
38083
38174
  // src/ui/panels/WalletPanel.tsx
38084
- var import_react25 = __toESM(require_react(), 1);
38175
+ var import_react26 = __toESM(require_react(), 1);
38085
38176
 
38086
38177
  // src/account/privy.ts
38087
38178
  function trimServer(server) {
@@ -38277,7 +38368,7 @@ You can still connect an address you control: latentcode login --wallet 0x\u2026
38277
38368
  }
38278
38369
 
38279
38370
  // src/ui/panels/WalletPanel.tsx
38280
- var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
38371
+ var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
38281
38372
  var deps = (server, extra) => ({
38282
38373
  server,
38283
38374
  log: () => {
@@ -38289,20 +38380,20 @@ var deps = (server, extra) => ({
38289
38380
  ...extra
38290
38381
  });
38291
38382
  function WalletPanel(p) {
38292
- const [view, setView] = (0, import_react25.useState)({ v: "menu" });
38383
+ const [view, setView] = (0, import_react26.useState)({ v: "menu" });
38293
38384
  const done = (wallet) => {
38294
38385
  p.onWallet(wallet);
38295
38386
  setView({ v: "done", wallet });
38296
38387
  };
38297
38388
  switch (view.v) {
38298
38389
  case "menu":
38299
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Menu, { ...p, onPick: (v) => setView({ v }) });
38390
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Menu, { ...p, onPick: (v) => setView({ v }) });
38300
38391
  case "link":
38301
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AuthLink, { ...p, onDone: done, onBack: () => setView({ v: "menu" }) });
38392
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AuthLink, { ...p, onDone: done, onBack: () => setView({ v: "menu" }) });
38302
38393
  case "address":
38303
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Address, { ...p, onDone: done, onBack: () => setView({ v: "menu" }) });
38394
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Address, { ...p, onDone: done, onBack: () => setView({ v: "menu" }) });
38304
38395
  case "done":
38305
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Done2, { width: p.width, wallet: view.wallet, onClose: p.onClose });
38396
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Done2, { width: p.width, wallet: view.wallet, onClose: p.onClose });
38306
38397
  }
38307
38398
  }
38308
38399
  function Menu(p) {
@@ -38310,39 +38401,39 @@ function Menu(p) {
38310
38401
  { id: "link", label: "Sign in with your browser", hint: "creates or finds your Latent wallet" },
38311
38402
  { id: "address", label: "Use a wallet address", hint: "an address you already control" }
38312
38403
  ];
38313
- const [sel, setSel] = (0, import_react25.useState)(0);
38404
+ const [sel, setSel] = (0, import_react26.useState)(0);
38314
38405
  use_input_default((_ch, key) => {
38315
38406
  if (key.escape) return p.onClose();
38316
38407
  if (key.upArrow || key.downArrow || key.tab) return setSel((s2) => (s2 + 1) % options.length);
38317
38408
  if (key.return) p.onPick(options[sel].id);
38318
38409
  });
38319
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
38410
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
38320
38411
  Panel,
38321
38412
  {
38322
38413
  title: "Wallet",
38323
38414
  right: p.wallet ? `connected \xB7 ${shortWallet(p.wallet)}` : "not connected",
38324
38415
  width: p.width,
38325
38416
  color: C.earn,
38326
- footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "continue"], ["esc", "close"]] }),
38327
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38328
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, wrap: "wrap", children: p.wallet ? "Earn mode pays into this wallet. Connect a different one:" : "Earn mode pays you in Latent Credit while the agent works \u2014 model usage, or USDG when you sell. Connect the wallet it should pay into:" }),
38329
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
38330
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.earn, children: [
38417
+ footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "continue"], ["esc", "close"]] }),
38418
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38419
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, wrap: "wrap", children: p.wallet ? "Earn mode pays into this wallet. Connect a different one:" : "Earn mode pays you in Latent Credit while the agent works \u2014 model usage, or USDG when you sell. Connect the wallet it should pay into:" }),
38420
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
38421
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.earn, children: [
38331
38422
  i === sel ? G.prompt : " ",
38332
38423
  " "
38333
38424
  ] }),
38334
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: i === sel, children: o.label.padEnd(27) }),
38335
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.faint, children: o.hint })
38425
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: i === sel, children: o.label.padEnd(27) }),
38426
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.faint, children: o.hint })
38336
38427
  ] }, o.id)) })
38337
38428
  ] })
38338
38429
  }
38339
38430
  );
38340
38431
  }
38341
38432
  function AuthLink(p) {
38342
- const [link2, setLink] = (0, import_react25.useState)(null);
38343
- const [error, setError] = (0, import_react25.useState)("");
38344
- const cancelled = (0, import_react25.useRef)(false);
38345
- (0, import_react25.useEffect)(() => {
38433
+ const [link2, setLink] = (0, import_react26.useState)(null);
38434
+ const [error, setError] = (0, import_react26.useState)("");
38435
+ const cancelled = (0, import_react26.useRef)(false);
38436
+ (0, import_react26.useEffect)(() => {
38346
38437
  cancelled.current = false;
38347
38438
  loginWithAuthLink(
38348
38439
  deps(p.server, {
@@ -38361,40 +38452,40 @@ function AuthLink(p) {
38361
38452
  if (key.escape) p.onBack();
38362
38453
  if (key.return && link2) openUrl(link2.url);
38363
38454
  });
38364
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
38455
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
38365
38456
  Panel,
38366
38457
  {
38367
38458
  title: "Sign in",
38368
38459
  right: "Latent wallet",
38369
38460
  width: p.width,
38370
38461
  color: C.earn,
38371
- footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["enter", "open the link again"], ["esc", "cancel"]] }),
38372
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38373
- !link2 && !error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
38374
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { color: C.earn }),
38462
+ footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hints, { items: [["enter", "open the link again"], ["esc", "cancel"]] }),
38463
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38464
+ !link2 && !error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
38465
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { color: C.earn }),
38375
38466
  " ",
38376
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Preparing your sign-in link\u2026" })
38467
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: "Preparing your sign-in link\u2026" })
38377
38468
  ] }) : null,
38378
- link2 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
38379
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Your browser should open. If it does not, open:" }),
38380
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.accent2, wrap: "wrap", children: link2.url }),
38381
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
38382
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Code " }),
38383
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, color: C.earn, children: link2.code })
38469
+ link2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
38470
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: "Your browser should open. If it does not, open:" }),
38471
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.accent2, wrap: "wrap", children: link2.url }),
38472
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
38473
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: "Code " }),
38474
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: C.earn, children: link2.code })
38384
38475
  ] }) }),
38385
- error ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
38386
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { color: C.earn }),
38476
+ error ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
38477
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { color: C.earn }),
38387
38478
  " ",
38388
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Waiting for you to finish in the browser\u2026" })
38479
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: "Waiting for you to finish in the browser\u2026" })
38389
38480
  ] }) })
38390
38481
  ] }) : null,
38391
- error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, wrap: "wrap", children: error }) }) : null
38482
+ error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.err, wrap: "wrap", children: error }) }) : null
38392
38483
  ] })
38393
38484
  }
38394
38485
  );
38395
38486
  }
38396
38487
  function Address(p) {
38397
- const [error, setError] = (0, import_react25.useState)("");
38488
+ const [error, setError] = (0, import_react26.useState)("");
38398
38489
  const field = useLineField({
38399
38490
  onChange: () => setError(""),
38400
38491
  onKey: (_ch, key) => {
@@ -38411,23 +38502,23 @@ function Address(p) {
38411
38502
  return false;
38412
38503
  }
38413
38504
  });
38414
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
38505
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
38415
38506
  Panel,
38416
38507
  {
38417
38508
  title: "Wallet address",
38418
38509
  width: p.width,
38419
38510
  color: C.earn,
38420
- footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["enter", "save"], ["esc", "back"]] }),
38421
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38422
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Credit is earned on this address; sales pay USDG here. Use one you control." }),
38423
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { marginTop: 1, children: [
38424
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.earn, children: [
38511
+ footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hints, { items: [["enter", "save"], ["esc", "back"]] }),
38512
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38513
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: "Credit is earned on this address; sales pay USDG here. Use one you control." }),
38514
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { marginTop: 1, children: [
38515
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.earn, children: [
38425
38516
  G.earn,
38426
38517
  " "
38427
38518
  ] }),
38428
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldText, { state: field.state, placeholder: "0x\u2026" })
38519
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FieldText, { state: field.state, placeholder: "0x\u2026" })
38429
38520
  ] }),
38430
- error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, children: error }) : null
38521
+ error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.err, children: error }) : null
38431
38522
  ] })
38432
38523
  }
38433
38524
  );
@@ -38436,73 +38527,73 @@ function Done2(p) {
38436
38527
  use_input_default((_ch, key) => {
38437
38528
  if (key.return || key.escape) p.onClose();
38438
38529
  });
38439
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Panel, { title: "Wallet connected", width: p.width, color: C.ok, footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["enter", "continue"]] }), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
38440
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.ok, children: [
38530
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Panel, { title: "Wallet connected", width: p.width, color: C.ok, footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hints, { items: [["enter", "continue"]] }), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
38531
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.ok, children: [
38441
38532
  G.ok,
38442
38533
  " "
38443
38534
  ] }),
38444
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: "Earn mode pays into " }),
38445
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: shortWallet(p.wallet) }),
38446
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: ". You earn while the agent works." })
38535
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Earn mode pays into " }),
38536
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: shortWallet(p.wallet) }),
38537
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: ". You earn while the agent works." })
38447
38538
  ] }) }) });
38448
38539
  }
38449
38540
 
38450
38541
  // src/ui/panels/OverflowPanel.tsx
38451
- var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
38542
+ var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
38452
38543
  function OverflowPanel(p) {
38453
38544
  use_input_default((ch, key) => {
38454
38545
  if (key.return) p.onContinue();
38455
38546
  else if (ch === "s") p.onSwitch();
38456
38547
  else if (key.escape || ch === "n") p.onClose();
38457
38548
  });
38458
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
38549
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
38459
38550
  Panel,
38460
38551
  {
38461
38552
  title: "Limit reached",
38462
38553
  right: `${p.credits.toFixed(2)} credits`,
38463
38554
  width: p.width,
38464
38555
  color: C.earn,
38465
- footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hints, { items: [["enter", "switch & continue"], ["s", "switch only"], ["esc", "stay"]] }),
38466
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38467
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { wrap: "wrap", children: [
38468
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: p.fromName }),
38469
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: " hit its usage limit." })
38556
+ footer: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Hints, { items: [["enter", "switch & continue"], ["s", "switch only"], ["esc", "stay"]] }),
38557
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38558
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { wrap: "wrap", children: [
38559
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { bold: true, children: p.fromName }),
38560
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.muted, children: " hit its usage limit." })
38470
38561
  ] }),
38471
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { wrap: "wrap", children: [
38562
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { wrap: "wrap", children: [
38472
38563
  "Continue on ",
38473
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: C.earn, children: p.toName }),
38474
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.muted, children: [
38564
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { bold: true, color: C.earn, children: p.toName }),
38565
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: C.muted, children: [
38475
38566
  " via Venice, paid from the ",
38476
38567
  p.credits.toFixed(2),
38477
38568
  " credits you earned"
38478
38569
  ] }),
38479
- p.price ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.faint, children: [
38570
+ p.price ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: C.faint, children: [
38480
38571
  " (",
38481
38572
  p.price,
38482
38573
  " per 1M tokens)"
38483
38574
  ] }) : null,
38484
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: "?" })
38575
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.muted, children: "?" })
38485
38576
  ] }),
38486
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.faint, wrap: "wrap", children: "Your own plan stays connected; /model switches back any time." })
38577
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.faint, wrap: "wrap", children: "Your own plan stays connected; /model switches back any time." })
38487
38578
  ] })
38488
38579
  }
38489
38580
  );
38490
38581
  }
38491
38582
 
38492
38583
  // src/ui/panels/McpPanel.tsx
38493
- var import_react26 = __toESM(require_react(), 1);
38494
- var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
38584
+ var import_react27 = __toESM(require_react(), 1);
38585
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
38495
38586
  var DOT = { connected: C.ok, pending: C.warn, needs_auth: C.warn, failed: C.err, disabled: C.faint };
38496
38587
  function errText2(e) {
38497
38588
  return (e instanceof Error ? e.message : String(e)).split("\n")[0] ?? "";
38498
38589
  }
38499
38590
  function McpPanel(p) {
38500
- const [view, setView] = (0, import_react26.useState)(p.add !== void 0 ? { v: "add", initial: p.add } : { v: "list" });
38591
+ const [view, setView] = (0, import_react27.useState)(p.add !== void 0 ? { v: "add", initial: p.add } : { v: "list" });
38501
38592
  switch (view.v) {
38502
38593
  case "list":
38503
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(List, { ...p, onAdd: () => setView({ v: "add" }), onAuth: (integration, method, name) => setView({ v: "auth", integration, method, name }) });
38594
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(List, { ...p, onAdd: () => setView({ v: "add" }), onAuth: (integration, method, name) => setView({ v: "auth", integration, method, name }) });
38504
38595
  case "add":
38505
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
38596
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
38506
38597
  AddForm,
38507
38598
  {
38508
38599
  ...p,
@@ -38515,7 +38606,7 @@ function McpPanel(p) {
38515
38606
  }
38516
38607
  );
38517
38608
  case "auth":
38518
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
38609
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
38519
38610
  OAuthFlow,
38520
38611
  {
38521
38612
  width: p.width,
@@ -38535,14 +38626,14 @@ function McpPanel(p) {
38535
38626
  }
38536
38627
  }
38537
38628
  function List(p) {
38538
- const [list2, setList] = (0, import_react26.useState)(null);
38539
- const [sel, setSel] = (0, import_react26.useState)(0);
38540
- const [busy, setBusy] = (0, import_react26.useState)("");
38541
- const [note, setNote] = (0, import_react26.useState)("");
38542
- const [confirm, setConfirm] = (0, import_react26.useState)("");
38543
- const live = (0, import_react26.useRef)(true);
38629
+ const [list2, setList] = (0, import_react27.useState)(null);
38630
+ const [sel, setSel] = (0, import_react27.useState)(0);
38631
+ const [busy, setBusy] = (0, import_react27.useState)("");
38632
+ const [note, setNote] = (0, import_react27.useState)("");
38633
+ const [confirm, setConfirm] = (0, import_react27.useState)("");
38634
+ const live = (0, import_react27.useRef)(true);
38544
38635
  const refresh = () => p.engine.mcpList().then((l) => live.current && setList(l)).catch((e) => live.current && (setList([]), setNote(errText2(e))));
38545
- (0, import_react26.useEffect)(() => {
38636
+ (0, import_react27.useEffect)(() => {
38546
38637
  live.current = true;
38547
38638
  void refresh();
38548
38639
  const t = setInterval(() => void refresh(), 2e3);
@@ -38614,14 +38705,14 @@ function List(p) {
38614
38705
  const height = Math.max(3, Math.min(items.length, p.rows - 14));
38615
38706
  const win = windowAround(items.length, sel, height);
38616
38707
  const nameW = Math.min(24, Math.max(8, ...items.map((s2) => s2.name.length)) + 2);
38617
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
38708
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
38618
38709
  Panel,
38619
38710
  {
38620
38711
  title: "MCP servers",
38621
38712
  right: list2 ? `${sum.connected}/${sum.total} connected` : "",
38622
38713
  width: p.width,
38623
38714
  color: C.accent2,
38624
- footer: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
38715
+ footer: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
38625
38716
  Hints,
38626
38717
  {
38627
38718
  items: [
@@ -38634,54 +38725,54 @@ function List(p) {
38634
38725
  ]
38635
38726
  }
38636
38727
  ),
38637
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38638
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.muted, wrap: "wrap", children: "Shared with OpenCode: servers in your OpenCode config (global or this project) run here too, and the ones you add here show up in OpenCode." }),
38639
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: list2 === null ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
38640
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner, {}),
38728
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38729
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, wrap: "wrap", children: "Shared with OpenCode: servers in your OpenCode config (global or this project) run here too, and the ones you add here show up in OpenCode." }),
38730
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: list2 === null ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
38731
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, {}),
38641
38732
  " ",
38642
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.muted, children: "Reading MCP servers\u2026" })
38643
- ] }) : items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: C.muted, children: [
38733
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: "Reading MCP servers\u2026" })
38734
+ ] }) : items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: C.muted, children: [
38644
38735
  "No MCP servers yet. Press ",
38645
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { bold: true, children: "a" }),
38736
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: true, children: "a" }),
38646
38737
  " to add one, e.g.",
38647
38738
  " ",
38648
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.code, children: "context7 https://mcp.context7.com/mcp" })
38739
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.code, children: "context7 https://mcp.context7.com/mcp" })
38649
38740
  ] }) : items.slice(win.start, win.end).map((s2, i) => {
38650
38741
  const idx = win.start + i;
38651
38742
  const on2 = idx === sel;
38652
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { wrap: "truncate-end", children: [
38653
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: C.accent2, children: [
38743
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { wrap: "truncate-end", children: [
38744
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: C.accent2, children: [
38654
38745
  on2 ? G.prompt : " ",
38655
38746
  " "
38656
38747
  ] }),
38657
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: DOT[s2.status] ?? C.muted, children: [
38748
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: DOT[s2.status] ?? C.muted, children: [
38658
38749
  G.dot,
38659
38750
  " "
38660
38751
  ] }),
38661
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { bold: on2, children: pad(s2.name, nameW) }),
38662
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: DOT[s2.status] ?? C.muted, children: pad(statusLabel(s2.status), 15) }),
38663
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.faint, children: s2.title ?? "" })
38752
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: on2, children: pad(s2.name, nameW) }),
38753
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: DOT[s2.status] ?? C.muted, children: pad(statusLabel(s2.status), 15) }),
38754
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.faint, children: s2.title ?? "" })
38664
38755
  ] }, s2.name);
38665
38756
  }) }),
38666
- cur?.error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: cur.status === "needs_auth" ? C.warn : C.err, wrap: "wrap", children: cur.error }) }) : null,
38667
- busy ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
38668
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner, {}),
38757
+ cur?.error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: cur.status === "needs_auth" ? C.warn : C.err, wrap: "wrap", children: cur.error }) }) : null,
38758
+ busy ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
38759
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, {}),
38669
38760
  " ",
38670
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.muted, children: busy })
38761
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: busy })
38671
38762
  ] }) }) : null,
38672
- confirm ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: C.warn, children: [
38763
+ confirm ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: C.warn, children: [
38673
38764
  "Press x again to remove ",
38674
38765
  confirm,
38675
38766
  " from your config (OpenCode loses it too)."
38676
38767
  ] }) }) : null,
38677
- note && !busy ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.muted, wrap: "wrap", children: note }) }) : null
38768
+ note && !busy ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, wrap: "wrap", children: note }) }) : null
38678
38769
  ] })
38679
38770
  }
38680
38771
  );
38681
38772
  }
38682
38773
  function AddForm(p) {
38683
- const [error, setError] = (0, import_react26.useState)("");
38684
- const [busy, setBusy] = (0, import_react26.useState)("");
38774
+ const [error, setError] = (0, import_react27.useState)("");
38775
+ const [busy, setBusy] = (0, import_react27.useState)("");
38685
38776
  async function add(line) {
38686
38777
  const spec = parseMcpAdd(line);
38687
38778
  setBusy(`Adding ${spec.name}\u2026`);
@@ -38711,39 +38802,39 @@ function AddForm(p) {
38711
38802
  return false;
38712
38803
  }
38713
38804
  });
38714
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
38805
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
38715
38806
  Panel,
38716
38807
  {
38717
38808
  title: "Add an MCP server",
38718
38809
  right: "saved to your OpenCode config",
38719
38810
  width: p.width,
38720
38811
  color: C.accent2,
38721
- footer: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Hints, { items: [["enter", "add"], ["esc", "back"]] }),
38722
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38723
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.muted, children: "A name, then a URL (remote) or the command that starts it (local):" }),
38724
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.faint, children: " context7 https://mcp.context7.com/mcp" }),
38725
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.faint, children: ' github https://api.githubcopilot.com/mcp/ --header Authorization="Bearer \u2026"' }),
38726
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.faint, children: " playwright npx -y @playwright/mcp@latest" }),
38727
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { marginTop: 1, children: [
38728
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: C.accent2, children: [
38812
+ footer: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Hints, { items: [["enter", "add"], ["esc", "back"]] }),
38813
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38814
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: "A name, then a URL (remote) or the command that starts it (local):" }),
38815
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.faint, children: " context7 https://mcp.context7.com/mcp" }),
38816
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.faint, children: ' github https://api.githubcopilot.com/mcp/ --header Authorization="Bearer \u2026"' }),
38817
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.faint, children: " playwright npx -y @playwright/mcp@latest" }),
38818
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { marginTop: 1, children: [
38819
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: C.accent2, children: [
38729
38820
  G.prompt,
38730
38821
  " "
38731
38822
  ] }),
38732
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FieldText, { state: field.state, placeholder: "name url | command\u2026" })
38823
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FieldText, { state: field.state, placeholder: "name url | command\u2026" })
38733
38824
  ] }),
38734
- busy ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
38735
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner, {}),
38825
+ busy ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
38826
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, {}),
38736
38827
  " ",
38737
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.muted, children: busy })
38828
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: busy })
38738
38829
  ] }) : null,
38739
- error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.err, wrap: "wrap", children: error }) : null
38830
+ error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.err, wrap: "wrap", children: error }) : null
38740
38831
  ] })
38741
38832
  }
38742
38833
  );
38743
38834
  }
38744
38835
 
38745
38836
  // src/ui/App.tsx
38746
- var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
38837
+ var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
38747
38838
  var DASHBOARD = "latentprotocol.xyz/app";
38748
38839
  var MODE = { keep: "keep and spend (bonus)", auto_sell: "sell automatically for USDC", auto_list: "list at my price" };
38749
38840
  var notice = (text, tone = "info") => ({
@@ -38777,42 +38868,42 @@ function activityLabel(s2) {
38777
38868
  function StepMark({ status: status2 }) {
38778
38869
  switch (status2) {
38779
38870
  case "run":
38780
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, {});
38871
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, {});
38781
38872
  case "ok":
38782
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.ok, children: G.ok });
38873
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.ok, children: G.ok });
38783
38874
  case "warn":
38784
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.warn, children: G.ring });
38875
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.warn, children: G.ring });
38785
38876
  case "fail":
38786
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.err, children: G.no });
38877
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.err, children: G.no });
38787
38878
  default:
38788
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.faint, children: "\xB7" });
38879
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.faint, children: "\xB7" });
38789
38880
  }
38790
38881
  }
38791
38882
  function BootCard(p) {
38792
38883
  const wLabel = 10;
38793
38884
  const inner = p.width - 4;
38794
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", children: [
38795
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { marginTop: 1, marginLeft: 1, flexDirection: "column", children: [
38796
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Logo, { version: p.version }),
38797
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: TAGLINE })
38885
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
38886
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { marginTop: 1, marginLeft: 1, flexDirection: "column", children: [
38887
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Logo, { version: p.version }),
38888
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.muted, children: TAGLINE })
38798
38889
  ] }),
38799
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", borderStyle: "round", borderColor: p.error ? C.err : C.border, paddingX: 1, width: p.width, children: [
38800
- p.steps.map((st) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { wrap: "truncate-end", children: [
38801
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StepMark, { status: st.status }),
38802
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { bold: st.status === "run", color: st.status === "pending" ? C.faint : void 0, children: [
38890
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", borderStyle: "round", borderColor: p.error ? C.err : C.border, paddingX: 1, width: p.width, children: [
38891
+ p.steps.map((st) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { wrap: "truncate-end", children: [
38892
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StepMark, { status: st.status }),
38893
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { bold: st.status === "run", color: st.status === "pending" ? C.faint : void 0, children: [
38803
38894
  " ",
38804
38895
  pad(st.label, wLabel)
38805
38896
  ] }),
38806
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: st.status === "fail" ? C.err : st.status === "warn" ? C.warn : C.muted, children: st.status === "run" && !st.detail ? "starting\u2026" : clip(st.detail, inner - wLabel - 4) })
38897
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: st.status === "fail" ? C.err : st.status === "warn" ? C.warn : C.muted, children: st.status === "run" && !st.detail ? "starting\u2026" : clip(st.detail, inner - wLabel - 4) })
38807
38898
  ] }, st.id)),
38808
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { wrap: "truncate-end", children: [
38809
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.faint, children: "\xB7 " }),
38810
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.faint, children: pad("Project", wLabel) }),
38811
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: shortPath(p.cwd, homedir4(), inner - wLabel - 4) })
38899
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { wrap: "truncate-end", children: [
38900
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.faint, children: "\xB7 " }),
38901
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.faint, children: pad("Project", wLabel) }),
38902
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.muted, children: shortPath(p.cwd, homedir4(), inner - wLabel - 4) })
38812
38903
  ] })
38813
38904
  ] }),
38814
- p.error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginLeft: 1, marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.err, wrap: "wrap", children: p.error }) }) : null,
38815
- p.ready ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
38905
+ p.error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginLeft: 1, marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.err, wrap: "wrap", children: p.error }) }) : null,
38906
+ p.ready ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
38816
38907
  Hints,
38817
38908
  {
38818
38909
  items: [
@@ -38838,29 +38929,29 @@ function HelpPanel({ width, commands, onClose }) {
38838
38929
  ["ctrl+a / ctrl+e", "start / end of line"],
38839
38930
  ["alt+\u2190 / alt+\u2192", "jump a word"],
38840
38931
  ["ctrl+w / ctrl+u", "delete word / line"],
38841
- ["ctrl+o", "open the sponsored link"],
38932
+ ["ctrl+o", "show the sponsored card"],
38842
38933
  ["ctrl+c", "clear the line, twice to quit"]
38843
38934
  ];
38844
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Panel, { title: "Help", width, color: C.accent, footer: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Hints, { items: [["esc", "close"]] }), children: [
38935
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Panel, { title: "Help", width, color: C.accent, footer: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hints, { items: [["esc", "close"]] }), children: [
38845
38936
  groups.map((g) => {
38846
38937
  const list2 = commands.filter((c) => c.group === g);
38847
38938
  if (!list2.length) return null;
38848
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38849
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: true, color: C.muted, children: g }),
38850
- list2.map((c) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { wrap: "truncate-end", children: [
38851
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.accent2, children: pad(`/${c.name}${c.args ? " " + c.args : ""}`, 22) }),
38852
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: c.desc })
38939
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38940
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, color: C.muted, children: g }),
38941
+ list2.map((c) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { wrap: "truncate-end", children: [
38942
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.accent2, children: pad(`/${c.name}${c.args ? " " + c.args : ""}`, 22) }),
38943
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.muted, children: c.desc })
38853
38944
  ] }, c.name))
38854
38945
  ] }, g);
38855
38946
  }),
38856
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38857
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: true, color: C.muted, children: "Keys" }),
38858
- keys.map(([k, d]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
38859
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.accent2, children: pad(k, 22) }),
38860
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: d })
38947
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
38948
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, color: C.muted, children: "Keys" }),
38949
+ keys.map(([k, d]) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { children: [
38950
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.accent2, children: pad(k, 22) }),
38951
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.muted, children: d })
38861
38952
  ] }, k))
38862
38953
  ] }),
38863
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.faint, wrap: "wrap", children: `Privacy: ads never enter the model's context or its answers. The only thing sent to the ad server is a coarse category (for example "backend"), worked out on this machine.` }) })
38954
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.faint, wrap: "wrap", children: `Privacy: ads never enter the model's context or its answers. The only thing sent to the ad server is a coarse category (for example "backend"), worked out on this machine.` }) })
38864
38955
  ] });
38865
38956
  }
38866
38957
  var LINKS_OSC8 = linkShape() === "osc8";
@@ -38869,17 +38960,17 @@ function App2(props) {
38869
38960
  const { exit } = use_app_default();
38870
38961
  const { cols, rows } = useTermSize();
38871
38962
  const width = Math.max(40, Math.min(cols, 110));
38872
- const [sessionID, setSessionID] = (0, import_react27.useState)(props.sessionID);
38873
- const [state, dispatch] = (0, import_react27.useReducer)(
38963
+ const [sessionID, setSessionID] = (0, import_react28.useState)(props.sessionID);
38964
+ const [state, dispatch] = (0, import_react28.useReducer)(
38874
38965
  (s2, ev) => ev.type === "reset" ? { ...initialState(ev.sessionID, s2.model), variant: s2.variant } : reduce(s2, ev),
38875
38966
  { ...initialState(props.sessionID, props.model), variant: props.variant }
38876
38967
  );
38877
- const [catalog, setCatalog] = (0, import_react27.useState)(props.catalog);
38878
- const [wallet, setWallet] = (0, import_react27.useState)(props.wallet);
38879
- const [overlay, setOverlay] = (0, import_react27.useState)(null);
38880
- const [, tick] = (0, import_react27.useState)(0);
38881
- const [editor, setEditorState] = (0, import_react27.useState)(() => emptyEditor());
38882
- const editorRef = (0, import_react27.useRef)(editor);
38968
+ const [catalog, setCatalog] = (0, import_react28.useState)(props.catalog);
38969
+ const [wallet, setWallet] = (0, import_react28.useState)(props.wallet);
38970
+ const [overlay, setOverlay] = (0, import_react28.useState)(null);
38971
+ const [, tick] = (0, import_react28.useState)(0);
38972
+ const [editor, setEditorState] = (0, import_react28.useState)(() => emptyEditor());
38973
+ const editorRef = (0, import_react28.useRef)(editor);
38883
38974
  const setEditor = (next) => {
38884
38975
  if (next.text !== editorRef.current.text) {
38885
38976
  setPaletteAt(0);
@@ -38888,24 +38979,24 @@ function App2(props) {
38888
38979
  editorRef.current = next;
38889
38980
  setEditorState(next);
38890
38981
  };
38891
- const [paletteAt, setPaletteAt] = (0, import_react27.useState)(0);
38892
- const [paletteHidden, setPaletteHidden] = (0, import_react27.useState)(false);
38893
- const [permAt, setPermAt] = (0, import_react27.useState)(0);
38894
- const [quitArmed, setQuitArmed] = (0, import_react27.useState)(false);
38895
- const [leaving, setLeaving] = (0, import_react27.useState)(false);
38982
+ const [paletteAt, setPaletteAt] = (0, import_react28.useState)(0);
38983
+ const [paletteHidden, setPaletteHidden] = (0, import_react28.useState)(false);
38984
+ const [permAt, setPermAt] = (0, import_react28.useState)(0);
38985
+ const [quitArmed, setQuitArmed] = (0, import_react28.useState)(false);
38986
+ const [leaving, setLeaving] = (0, import_react28.useState)(false);
38896
38987
  const quit = () => {
38897
38988
  setLeaving(true);
38898
38989
  setTimeout(() => exit(), 20);
38899
38990
  };
38900
- const lastPrompt = (0, import_react27.useRef)("");
38901
- const currentModel = (0, import_react27.useRef)(props.model);
38991
+ const lastPrompt = (0, import_react28.useRef)("");
38992
+ const currentModel = (0, import_react28.useRef)(props.model);
38902
38993
  currentModel.current = state.model;
38903
38994
  const store = props.models;
38904
- const ad = (0, import_react27.useSyncExternalStore)(
38995
+ const ad = (0, import_react28.useSyncExternalStore)(
38905
38996
  (fn) => controller.subscribe(fn),
38906
38997
  () => controller.snapshot()
38907
38998
  );
38908
- const allCommands = (0, import_react27.useMemo)(
38999
+ const allCommands = (0, import_react28.useMemo)(
38909
39000
  () => [
38910
39001
  ...COMMANDS,
38911
39002
  ...props.commands.filter((c) => !findCommand(c.name)).map((c) => ({ name: c.name, args: "[text]", desc: c.description ?? "agent command", group: "Agent" }))
@@ -38915,8 +39006,8 @@ function App2(props) {
38915
39006
  const say = (text, tone = "info") => dispatch(notice(text, tone));
38916
39007
  const statusOf = (key) => store.get(key)?.status ?? "unknown";
38917
39008
  const modelName = (key) => catalog.models.find((m) => m.key === key)?.name ?? key;
38918
- const [bonus, setBonus] = (0, import_react27.useState)(1);
38919
- (0, import_react27.useEffect)(() => {
39009
+ const [bonus, setBonus] = (0, import_react28.useState)(1);
39010
+ (0, import_react28.useEffect)(() => {
38920
39011
  void api.creditQuote().then((q) => q && setBonus(q.bonus));
38921
39012
  }, [api]);
38922
39013
  props.summary.current = {
@@ -38926,7 +39017,7 @@ function App2(props) {
38926
39017
  earned: credits(ad.sessionEarned, bonus),
38927
39018
  impressions: ad.impressions
38928
39019
  };
38929
- (0, import_react27.useEffect)(() => {
39020
+ (0, import_react28.useEffect)(() => {
38930
39021
  const ac = new AbortController();
38931
39022
  void engine.subscribe((ev) => {
38932
39023
  dispatch(ev);
@@ -38938,11 +39029,11 @@ function App2(props) {
38938
39029
  if (props.startNotice) say(props.startNotice, "warn");
38939
39030
  return () => ac.abort();
38940
39031
  }, [engine]);
38941
- (0, import_react27.useEffect)(() => {
39032
+ (0, import_react28.useEffect)(() => {
38942
39033
  controller.setWorking(state.working, lastPrompt.current);
38943
39034
  }, [state.working, controller]);
38944
39035
  const lingering = !state.working && !!ad.current;
38945
- (0, import_react27.useEffect)(() => {
39036
+ (0, import_react28.useEffect)(() => {
38946
39037
  if (!state.working && !lingering) return;
38947
39038
  const t = setInterval(
38948
39039
  () => {
@@ -38953,13 +39044,13 @@ function App2(props) {
38953
39044
  );
38954
39045
  return () => clearInterval(t);
38955
39046
  }, [state.working, lingering, controller]);
38956
- const [balance, setBalance] = (0, import_react27.useState)(null);
38957
- const catalogRef = (0, import_react27.useRef)(catalog);
39047
+ const [balance, setBalance] = (0, import_react28.useState)(null);
39048
+ const catalogRef = (0, import_react28.useRef)(catalog);
38958
39049
  catalogRef.current = catalog;
38959
- const balanceRef = (0, import_react27.useRef)(balance);
39050
+ const balanceRef = (0, import_react28.useRef)(balance);
38960
39051
  balanceRef.current = balance;
38961
- const offered = (0, import_react27.useRef)(/* @__PURE__ */ new Set());
38962
- (0, import_react27.useEffect)(() => {
39052
+ const offered = (0, import_react28.useRef)(/* @__PURE__ */ new Set());
39053
+ (0, import_react28.useEffect)(() => {
38963
39054
  if (!wallet || state.working) return;
38964
39055
  let live2 = true;
38965
39056
  void api.creditSummary(wallet).then((c) => live2 && setBalance(c ? c.credits : null));
@@ -38967,8 +39058,8 @@ function App2(props) {
38967
39058
  live2 = false;
38968
39059
  };
38969
39060
  }, [api, wallet, state.working, ad.impressions]);
38970
- (0, import_react27.useEffect)(() => setPermAt(0), [state.permissions[0]?.id]);
38971
- (0, import_react27.useEffect)(() => {
39061
+ (0, import_react28.useEffect)(() => setPermAt(0), [state.permissions[0]?.id]);
39062
+ (0, import_react28.useEffect)(() => {
38972
39063
  if (!quitArmed) return;
38973
39064
  const t = setTimeout(() => setQuitArmed(false), 2e3);
38974
39065
  return () => clearTimeout(t);
@@ -39214,8 +39305,7 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39214
39305
  }
39215
39306
  if (quitArmed) setQuitArmed(false);
39216
39307
  if (key.ctrl && ch === "o") {
39217
- const url = controller.click();
39218
- if (url) openUrl(url);
39308
+ if (ad.status === "ok" && ad.current) setOverlay({ t: "ad", ad: ad.current });
39219
39309
  return;
39220
39310
  }
39221
39311
  if (key.escape) {
@@ -39245,22 +39335,22 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39245
39335
  const live = state.items.slice(cut);
39246
39336
  const elapsed = state.workingSince ? Math.max(0, Math.floor((Date.now() - state.workingSince) / 1e3)) : 0;
39247
39337
  const maxLines = Math.max(6, rows - 14);
39248
- const header = (0, import_react27.useMemo)(() => ({ id: "header" }), []);
39338
+ const header = (0, import_react28.useMemo)(() => ({ id: "header" }), []);
39249
39339
  const current = catalog.models.find((m) => m.key === state.model);
39250
39340
  const provider = catalog.providers.find((p) => p.id === (current?.providerID ?? parseKey(state.model)?.providerID));
39251
39341
  const close = () => setOverlay(null);
39252
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
39253
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Static, { items: [header, ...done.map((it) => ({ id: it.id, it }))], children: (entry) => "it" in entry ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ItemView, { item: entry.it, live: false, cwd: cwd2, width, maxLines }, entry.id) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BootCard, { steps: props.bootSteps, version, cwd: cwd2, width, ready: true }, entry.id) }),
39254
- live.map((it) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ItemView, { item: it, live: true, cwd: cwd2, width, maxLines }, it.id)),
39255
- perm ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PermissionPrompt, { perm, selected: permAt, cwd: cwd2, width }) : null,
39256
- state.working ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1, flexDirection: "column", width, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { wrap: "truncate-end", children: [
39257
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, {}),
39258
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
39342
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
39343
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Static, { items: [header, ...done.map((it) => ({ id: it.id, it }))], children: (entry) => "it" in entry ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ItemView, { item: entry.it, live: false, cwd: cwd2, width, maxLines }, entry.id) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BootCard, { steps: props.bootSteps, version, cwd: cwd2, width, ready: true }, entry.id) }),
39344
+ live.map((it) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ItemView, { item: it, live: true, cwd: cwd2, width, maxLines }, it.id)),
39345
+ perm ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PermissionPrompt, { perm, selected: permAt, cwd: cwd2, width }) : null,
39346
+ state.working ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginTop: 1, flexDirection: "column", width, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { wrap: "truncate-end", children: [
39347
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, {}),
39348
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { children: [
39259
39349
  " ",
39260
39350
  activityLabel(state),
39261
39351
  "\u2026"
39262
39352
  ] }),
39263
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: C.faint, children: [
39353
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { color: C.faint, children: [
39264
39354
  " ",
39265
39355
  elapsed,
39266
39356
  "s \xB7 ",
@@ -39272,7 +39362,7 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39272
39362
  " \xB7 esc to interrupt"
39273
39363
  ] })
39274
39364
  ] }) }) : null,
39275
- overlay?.t === "model" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
39365
+ overlay?.t === "model" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
39276
39366
  ModelPicker,
39277
39367
  {
39278
39368
  catalog,
@@ -39291,7 +39381,7 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39291
39381
  onClose: close
39292
39382
  }
39293
39383
  ) : null,
39294
- overlay?.t === "providers" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
39384
+ overlay?.t === "providers" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
39295
39385
  ProviderPanel,
39296
39386
  {
39297
39387
  engine,
@@ -39311,7 +39401,7 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39311
39401
  onClose: close
39312
39402
  }
39313
39403
  ) : null,
39314
- overlay?.t === "mcp" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
39404
+ overlay?.t === "mcp" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
39315
39405
  McpPanel,
39316
39406
  {
39317
39407
  engine,
@@ -39325,9 +39415,9 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39325
39415
  onClose: close
39326
39416
  }
39327
39417
  ) : null,
39328
- overlay?.t === "wallet" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(WalletPanel, { server: props.server, wallet, width, onWallet: changeWallet, onClose: close }) : null,
39329
- overlay?.t === "help" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HelpPanel, { width, commands: allCommands, onClose: close }) : null,
39330
- overlay?.t === "overflow" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
39418
+ overlay?.t === "wallet" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WalletPanel, { server: props.server, wallet, width, onWallet: changeWallet, onClose: close }) : null,
39419
+ overlay?.t === "help" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(HelpPanel, { width, commands: allCommands, onClose: close }) : null,
39420
+ overlay?.t === "overflow" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
39331
39421
  OverflowPanel,
39332
39422
  {
39333
39423
  width,
@@ -39351,8 +39441,9 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39351
39441
  onClose: close
39352
39442
  }
39353
39443
  ) : null,
39354
- overlay === null && !perm && !leaving ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
39355
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
39444
+ overlay?.t === "ad" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AdCard, { ad: overlay.ad, width, osc8Links: LINKS_OSC8, onOpen: openUrl, onCopy: (l) => copyText(l), onClose: close }) : null,
39445
+ overlay === null && !perm && !leaving ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
39446
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
39356
39447
  Box_default,
39357
39448
  {
39358
39449
  marginTop: 1,
@@ -39361,34 +39452,34 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39361
39452
  paddingX: 1,
39362
39453
  width,
39363
39454
  children: [
39364
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: C.accent, bold: true, children: [
39455
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { color: C.accent, bold: true, children: [
39365
39456
  G.prompt,
39366
39457
  " "
39367
39458
  ] }) }),
39368
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FieldText, { state: editor, placeholder: state.turns ? "reply, or / for commands" : "ask anything, or / for commands" })
39459
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldText, { state: editor, placeholder: state.turns ? "reply, or / for commands" : "ask anything, or / for commands" })
39369
39460
  ]
39370
39461
  }
39371
39462
  ),
39372
- paletteOpen ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", paddingX: 2, width, children: [
39373
- matches.slice(0, 8).map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { wrap: "truncate-end", children: [
39374
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: C.accent, children: [
39463
+ paletteOpen ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", paddingX: 2, width, children: [
39464
+ matches.slice(0, 8).map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { wrap: "truncate-end", children: [
39465
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { color: C.accent, children: [
39375
39466
  i === paletteSel ? G.prompt : " ",
39376
39467
  " "
39377
39468
  ] }),
39378
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: i === paletteSel, color: i === paletteSel ? C.accent2 : C.text, children: pad(`/${c.name}${c.args ? " " + c.args : ""}`, 20) }),
39379
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.muted, children: c.desc })
39469
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: i === paletteSel, color: i === paletteSel ? C.accent2 : C.text, children: pad(`/${c.name}${c.args ? " " + c.args : ""}`, 20) }),
39470
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.muted, children: c.desc })
39380
39471
  ] }, c.name)),
39381
- matches.length > 8 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: C.faint, children: [
39472
+ matches.length > 8 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { color: C.faint, children: [
39382
39473
  " ",
39383
39474
  G.down,
39384
39475
  " ",
39385
39476
  matches.length - 8,
39386
39477
  " more \u2014 keep typing"
39387
39478
  ] }) : null,
39388
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["tab", "complete"], ["enter", "run"], ["esc", "dismiss"]] })
39479
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["tab", "complete"], ["enter", "run"], ["esc", "dismiss"]] })
39389
39480
  ] }) : null
39390
39481
  ] }) : null,
39391
- paletteOpen || leaving ? null : quitArmed ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { paddingX: 1, width, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.warn, children: "Press ctrl+c again to quit" }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
39482
+ paletteOpen || leaving ? null : quitArmed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { paddingX: 1, width, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.warn, children: "Press ctrl+c again to quit" }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
39392
39483
  StatusPanel,
39393
39484
  {
39394
39485
  width,
@@ -39416,14 +39507,14 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
39416
39507
  }
39417
39508
 
39418
39509
  // src/ui/Root.tsx
39419
- var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
39510
+ var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
39420
39511
  function Root(p) {
39421
39512
  const { exit } = use_app_default();
39422
39513
  const { cols } = useTermSize();
39423
- const [steps, setSteps] = (0, import_react28.useState)(BOOT_STEPS);
39424
- const [booted, setBooted] = (0, import_react28.useState)(null);
39425
- const [error, setError] = (0, import_react28.useState)("");
39426
- (0, import_react28.useEffect)(() => {
39514
+ const [steps, setSteps] = (0, import_react29.useState)(BOOT_STEPS);
39515
+ const [booted, setBooted] = (0, import_react29.useState)(null);
39516
+ const [error, setError] = (0, import_react29.useState)("");
39517
+ (0, import_react29.useEffect)(() => {
39427
39518
  boot(p.args, p.focus, (id, patch) => setSteps((list2) => list2.map((s2) => s2.id === id ? { ...s2, ...patch } : s2))).then(setBooted).catch((e) => {
39428
39519
  const message = e instanceof Error ? e.message : String(e);
39429
39520
  setError(message);
@@ -39438,7 +39529,7 @@ function Root(p) {
39438
39529
  { isActive: !booted }
39439
39530
  );
39440
39531
  if (!booted) {
39441
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
39532
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
39442
39533
  BootCard,
39443
39534
  {
39444
39535
  steps,
@@ -39450,7 +39541,7 @@ function Root(p) {
39450
39541
  }
39451
39542
  );
39452
39543
  }
39453
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PasteContext.Provider, { value: p.paste, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(App2, { ...booted, version: p.version, bootSteps: steps, summary: p.summary }) });
39544
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PasteContext.Provider, { value: p.paste, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(App2, { ...booted, version: p.version, bootSteps: steps, summary: p.summary }) });
39454
39545
  }
39455
39546
 
39456
39547
  // src/ads/attention.ts
@@ -39666,7 +39757,7 @@ function row(mark, label2, value, width = 10) {
39666
39757
  }
39667
39758
 
39668
39759
  // src/mcpCli.ts
39669
- import { spawnSync as spawnSync2 } from "node:child_process";
39760
+ import { spawnSync as spawnSync3 } from "node:child_process";
39670
39761
  var HELP = `${a.bold("latentcode mcp")} \u2014 MCP servers (shared with OpenCode)
39671
39762
 
39672
39763
  latentcode mcp list status of every server
@@ -39731,7 +39822,7 @@ async function mcpCommand(argv, cwd2 = process.cwd()) {
39731
39822
  case "add": {
39732
39823
  const project = rest.includes("--project");
39733
39824
  const spec = parseMcpAdd(rest.filter((x) => x !== "--project"));
39734
- const r = spawnSync2(engineBin(), mcpAddArgv(spec, project ? "project" : "global"), { stdio: "inherit", cwd: cwd2 });
39825
+ const r = spawnSync3(engineBin(), mcpAddArgv(spec, project ? "project" : "global"), { stdio: "inherit", cwd: cwd2 });
39735
39826
  return r.status ?? 1;
39736
39827
  }
39737
39828
  case "remove":
@@ -39750,7 +39841,7 @@ async function mcpCommand(argv, cwd2 = process.cwd()) {
39750
39841
  }
39751
39842
  case "auth":
39752
39843
  case "logout": {
39753
- const r = spawnSync2(engineBin(), ["mcp", sub, ...rest, "--standalone"], { stdio: "inherit", cwd: cwd2 });
39844
+ const r = spawnSync3(engineBin(), ["mcp", sub, ...rest, "--standalone"], { stdio: "inherit", cwd: cwd2 });
39754
39845
  return r.status ?? 1;
39755
39846
  }
39756
39847
  case "help":
@@ -39766,8 +39857,8 @@ ${HELP}`);
39766
39857
  }
39767
39858
 
39768
39859
  // src/index.tsx
39769
- var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
39770
- var VERSION = "0.1.0-alpha.12";
39860
+ var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
39861
+ var VERSION = "0.1.0-alpha.14";
39771
39862
  var usage = () => `${logo()}
39772
39863
  ${a.dim(`v${VERSION} \xB7 terminal coding agent. Bring your own model access; earn while it works.`)}
39773
39864
 
@@ -39851,7 +39942,7 @@ ${usage()}`);
39851
39942
  function auth(argv) {
39852
39943
  const engine = resolveEngineBin();
39853
39944
  if (!engine) throw new EngineError(ENGINE_NOT_FOUND);
39854
- const r = spawnSync3(engine.path, ["auth", ...argv.length ? argv : ["login"], "--standalone"], { stdio: "inherit" });
39945
+ const r = spawnSync4(engine.path, ["auth", ...argv.length ? argv : ["login"], "--standalone"], { stdio: "inherit" });
39855
39946
  process.exit(r.status ?? 1);
39856
39947
  }
39857
39948
  async function status() {
@@ -39912,7 +40003,7 @@ async function main() {
39912
40003
  const summary = { current: { turns: 0, tokens: 0, cost: 0, earned: 0, impressions: 0 } };
39913
40004
  let fatal = false;
39914
40005
  const app = render_default(
39915
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
40006
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
39916
40007
  Root,
39917
40008
  {
39918
40009
  args: { cwd: cwd2, model: args.model, noAds: args.noAds, auto: args.auto },