latentcode 0.1.0-alpha.2 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/latentcode.mjs +574 -450
- package/package.json +1 -1
package/dist/latentcode.mjs
CHANGED
|
@@ -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
|
|
28212
|
-
var
|
|
28211
|
+
var jsx10 = jsxWithValidationDynamic;
|
|
28212
|
+
var jsxs8 = jsxWithValidationStatic;
|
|
28213
28213
|
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
28214
|
-
exports.jsx =
|
|
28215
|
-
exports.jsxs =
|
|
28214
|
+
exports.jsx = jsx10;
|
|
28215
|
+
exports.jsxs = jsxs8;
|
|
28216
28216
|
})();
|
|
28217
28217
|
}
|
|
28218
28218
|
}
|
|
@@ -33576,6 +33576,12 @@ function Static(props) {
|
|
|
33576
33576
|
|
|
33577
33577
|
// node_modules/ink/build/components/Transform.js
|
|
33578
33578
|
var import_react12 = __toESM(require_react(), 1);
|
|
33579
|
+
function Transform({ children, transform }) {
|
|
33580
|
+
if (children === void 0 || children === null) {
|
|
33581
|
+
return null;
|
|
33582
|
+
}
|
|
33583
|
+
return import_react12.default.createElement("ink-text", { style: { flexGrow: 0, flexShrink: 1, flexDirection: "row" }, internal_transform: transform }, children);
|
|
33584
|
+
}
|
|
33579
33585
|
|
|
33580
33586
|
// node_modules/ink/build/components/Newline.js
|
|
33581
33587
|
var import_react13 = __toESM(require_react(), 1);
|
|
@@ -34538,6 +34544,96 @@ function chooseStartModel(def, all, store) {
|
|
|
34538
34544
|
return ok ? { model: ok, switchedFrom: def } : { model: def };
|
|
34539
34545
|
}
|
|
34540
34546
|
|
|
34547
|
+
// src/ads/controller.ts
|
|
34548
|
+
import { randomUUID } from "node:crypto";
|
|
34549
|
+
|
|
34550
|
+
// src/ads/sanitize.ts
|
|
34551
|
+
var ESC_SEQ = /\x1b\][\s\S]*?(?:\x07|\x1b\\|$)|\x1b\[[0-?]*[ -/]*[@-~]|\x1b[ -/]*[0-~]|\x1b[@-_]/g;
|
|
34552
|
+
var CONTROL = /[\x00-\x1f\x7f-\x9f]/g;
|
|
34553
|
+
var BIDI = /[--]/g;
|
|
34554
|
+
function sanitizeAdText(input, max = 140) {
|
|
34555
|
+
let s2 = String(input ?? "");
|
|
34556
|
+
s2 = s2.replace(ESC_SEQ, "").replace(CONTROL, " ").replace(BIDI, "");
|
|
34557
|
+
s2 = s2.replace(/\s+/g, " ").trim();
|
|
34558
|
+
if (max > 0 && s2.length > max) s2 = `${s2.slice(0, Math.max(0, max - 1)).trimEnd()}\u2026`;
|
|
34559
|
+
return s2;
|
|
34560
|
+
}
|
|
34561
|
+
var AD_LIMITS = { title: 30, body: 140, cta_text: 24 };
|
|
34562
|
+
|
|
34563
|
+
// src/ads/adline.ts
|
|
34564
|
+
var WORD = /[\p{L}\p{N}]/u;
|
|
34565
|
+
var LEAD_SEP = /^[\s\-:–—]+/;
|
|
34566
|
+
function clampField(value, max) {
|
|
34567
|
+
const t = value.trim();
|
|
34568
|
+
if (t.length <= max) return t;
|
|
34569
|
+
return `${t.slice(0, Math.max(1, max - 1)).trimEnd()}\u2026`;
|
|
34570
|
+
}
|
|
34571
|
+
function dedupeBrand(brand, body) {
|
|
34572
|
+
let t = body.trim();
|
|
34573
|
+
const b = brand.trim();
|
|
34574
|
+
if (!b) return t;
|
|
34575
|
+
const lb = b.toLowerCase();
|
|
34576
|
+
while (t.toLowerCase().startsWith(lb)) {
|
|
34577
|
+
const after = t.charAt(b.length);
|
|
34578
|
+
if (after !== "" && WORD.test(after)) break;
|
|
34579
|
+
const rest = t.slice(b.length).replace(LEAD_SEP, "");
|
|
34580
|
+
if (rest === t) break;
|
|
34581
|
+
t = rest;
|
|
34582
|
+
if (t === "") break;
|
|
34583
|
+
}
|
|
34584
|
+
return t;
|
|
34585
|
+
}
|
|
34586
|
+
function composeAdCopy(title, body) {
|
|
34587
|
+
const brandRaw = sanitizeAdText(title, 0);
|
|
34588
|
+
const bodyRaw = sanitizeAdText(body, 0);
|
|
34589
|
+
return { brand: clampField(brandRaw, 30), line: clampField(dedupeBrand(brandRaw, bodyRaw), 60) };
|
|
34590
|
+
}
|
|
34591
|
+
function isSafeUrl(raw, allowLoopbackHttp = false) {
|
|
34592
|
+
if (typeof raw !== "string" || !raw) return false;
|
|
34593
|
+
if (/[\x00-\x20\x7f-\x9f]/.test(raw)) return false;
|
|
34594
|
+
try {
|
|
34595
|
+
const u = new URL(raw);
|
|
34596
|
+
if (u.username || u.password) return false;
|
|
34597
|
+
if (u.protocol === "https:") return true;
|
|
34598
|
+
return allowLoopbackHttp && u.protocol === "http:" && (u.hostname === "127.0.0.1" || u.hostname === "localhost");
|
|
34599
|
+
} catch {
|
|
34600
|
+
return false;
|
|
34601
|
+
}
|
|
34602
|
+
}
|
|
34603
|
+
function displayUrl(url) {
|
|
34604
|
+
return url.startsWith("https://") ? url.slice("https://".length).replace(/\/$/, "") : "";
|
|
34605
|
+
}
|
|
34606
|
+
function clickLink(server, ad, wallet, ctaUrl) {
|
|
34607
|
+
const base = server.replace(/\/+$/, "");
|
|
34608
|
+
if (!ad.click_token || !isSafeUrl(base, true)) return ctaUrl;
|
|
34609
|
+
return `${base}/ad/click?ad=${encodeURIComponent(ad.ad_id)}&w=${encodeURIComponent(wallet)}&t=${encodeURIComponent(ad.click_token)}`;
|
|
34610
|
+
}
|
|
34611
|
+
function linkShape(env3 = process.env, platform2 = process.platform) {
|
|
34612
|
+
if (env3.LATENTCODE_LINKS === "osc8" || env3.LATENTCODE_LINKS === "plain" || env3.LATENTCODE_LINKS === "hybrid") {
|
|
34613
|
+
return env3.LATENTCODE_LINKS;
|
|
34614
|
+
}
|
|
34615
|
+
if (env3.TMUX) return "plain";
|
|
34616
|
+
if (env3.SSH_TTY || env3.SSH_CONNECTION) return "hybrid";
|
|
34617
|
+
if (env3.KITTY_WINDOW_ID || env3.WEZTERM_PANE || env3.ITERM_SESSION_ID || env3.GHOSTTY_RESOURCES_DIR) return "osc8";
|
|
34618
|
+
if (env3.ALACRITTY_SOCKET || env3.ALACRITTY_WINDOW_ID) return "plain";
|
|
34619
|
+
const term = env3.TERM_PROGRAM || "";
|
|
34620
|
+
if (term === "vscode" || term === "iTerm.app" || term === "WezTerm" || term === "ghostty") return "osc8";
|
|
34621
|
+
if (term === "Apple_Terminal" || term === "WarpTerminal") return "plain";
|
|
34622
|
+
if (env3.WT_SESSION) return "osc8";
|
|
34623
|
+
return platform2 === "win32" ? "plain" : "hybrid";
|
|
34624
|
+
}
|
|
34625
|
+
function osc8(text, url) {
|
|
34626
|
+
if (!isSafeUrl(url, true)) return text;
|
|
34627
|
+
return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`;
|
|
34628
|
+
}
|
|
34629
|
+
var BADGE_COLORS = ["#F87171", "#FB923C", "#FBBF24", "#A3E635", "#34D399", "#22D3EE", "#60A5FA", "#A78BFA", "#F472B6"];
|
|
34630
|
+
function adBadge(brand) {
|
|
34631
|
+
const letter = ([...brand].find((c) => /[\p{L}\p{N}]/u.test(c)) ?? "").toLocaleUpperCase();
|
|
34632
|
+
let h = 2166136261;
|
|
34633
|
+
for (const c of brand.toLowerCase()) h = Math.imul(h ^ c.codePointAt(0), 16777619);
|
|
34634
|
+
return { letter: letter || "\u2022", color: BADGE_COLORS[(h >>> 0) % BADGE_COLORS.length] };
|
|
34635
|
+
}
|
|
34636
|
+
|
|
34541
34637
|
// src/ads/classify.ts
|
|
34542
34638
|
import { existsSync as existsSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
34543
34639
|
import { join as join4 } from "node:path";
|
|
@@ -34733,43 +34829,28 @@ function classifyPrompt(prompt, cwd2 = process.cwd()) {
|
|
|
34733
34829
|
return best;
|
|
34734
34830
|
}
|
|
34735
34831
|
|
|
34736
|
-
// src/ads/sanitize.ts
|
|
34737
|
-
var ESC_SEQ = /\x1b\][\s\S]*?(?:\x07|\x1b\\|$)|\x1b\[[0-?]*[ -/]*[@-~]|\x1b[ -/]*[0-~]|\x1b[@-_]/g;
|
|
34738
|
-
var CONTROL = /[\x00-\x1f\x7f-\x9f]/g;
|
|
34739
|
-
var BIDI = /[--]/g;
|
|
34740
|
-
function sanitizeAdText(input, max = 140) {
|
|
34741
|
-
let s2 = String(input ?? "");
|
|
34742
|
-
s2 = s2.replace(ESC_SEQ, "").replace(CONTROL, " ").replace(BIDI, "");
|
|
34743
|
-
s2 = s2.replace(/\s+/g, " ").trim();
|
|
34744
|
-
if (max > 0 && s2.length > max) s2 = `${s2.slice(0, Math.max(0, max - 1)).trimEnd()}\u2026`;
|
|
34745
|
-
return s2;
|
|
34746
|
-
}
|
|
34747
|
-
var AD_LIMITS = { title: 30, body: 140, cta_text: 24 };
|
|
34748
|
-
|
|
34749
34832
|
// src/ads/controller.ts
|
|
34750
|
-
var MIN_VISIBLE_MS =
|
|
34751
|
-
var ROTATE_MS =
|
|
34833
|
+
var MIN_VISIBLE_MS = 1e4;
|
|
34834
|
+
var ROTATE_MS = 1e4;
|
|
34835
|
+
var HOLD_MS = 27e4;
|
|
34752
34836
|
function safeUrl(raw) {
|
|
34753
|
-
|
|
34754
|
-
if (/[\x00-\x1f\x7f-\x9f\s]/.test(raw)) return "";
|
|
34755
|
-
try {
|
|
34756
|
-
const u = new URL(raw);
|
|
34757
|
-
return u.protocol === "https:" ? u.toString() : "";
|
|
34758
|
-
} catch {
|
|
34759
|
-
return "";
|
|
34760
|
-
}
|
|
34837
|
+
return raw && isSafeUrl(raw) ? new URL(raw).toString() : "";
|
|
34761
34838
|
}
|
|
34762
|
-
function toDisplayAd(ad) {
|
|
34763
|
-
const
|
|
34764
|
-
|
|
34765
|
-
|
|
34839
|
+
function toDisplayAd(ad, opts = {}) {
|
|
34840
|
+
const { brand, line } = composeAdCopy(ad.title, ad.body);
|
|
34841
|
+
if (!brand && !line) return null;
|
|
34842
|
+
const url = safeUrl(ad.cta_url);
|
|
34766
34843
|
return {
|
|
34767
34844
|
ad,
|
|
34768
|
-
title,
|
|
34769
|
-
body,
|
|
34845
|
+
title: brand,
|
|
34846
|
+
body: line,
|
|
34770
34847
|
ctaText: sanitizeAdText(ad.cta_text, AD_LIMITS.cta_text) || "Learn more",
|
|
34771
|
-
url
|
|
34772
|
-
|
|
34848
|
+
url,
|
|
34849
|
+
link: url && opts.server && opts.wallet ? clickLink(opts.server, ad, opts.wallet, url) : url,
|
|
34850
|
+
shownUrl: displayUrl(url),
|
|
34851
|
+
earn: typeof ad.earn_amount === "number" && Number.isFinite(ad.earn_amount) ? ad.earn_amount : 0,
|
|
34852
|
+
eventUuid: randomUUID(),
|
|
34853
|
+
fetchedAt: opts.now ?? Date.now()
|
|
34773
34854
|
};
|
|
34774
34855
|
}
|
|
34775
34856
|
var AdController = class {
|
|
@@ -34795,6 +34876,7 @@ var AdController = class {
|
|
|
34795
34876
|
now: opts.now ?? Date.now,
|
|
34796
34877
|
minVisibleMs: opts.minVisibleMs ?? MIN_VISIBLE_MS,
|
|
34797
34878
|
rotateMs: opts.rotateMs ?? ROTATE_MS,
|
|
34879
|
+
holdMs: opts.holdMs ?? HOLD_MS,
|
|
34798
34880
|
classify: opts.classify ?? ((p, cwd2) => classifyPrompt(p, cwd2))
|
|
34799
34881
|
};
|
|
34800
34882
|
opts.focus.onChange(() => this.emit());
|
|
@@ -34841,29 +34923,49 @@ var AdController = class {
|
|
|
34841
34923
|
this.lastTick = this.o.now();
|
|
34842
34924
|
if (working) {
|
|
34843
34925
|
this.context = this.o.classify(prompt, this.o.cwd);
|
|
34844
|
-
|
|
34845
|
-
|
|
34926
|
+
if (!this.holding()) {
|
|
34927
|
+
this.clear();
|
|
34928
|
+
void this.fetchNext();
|
|
34929
|
+
}
|
|
34930
|
+
} else if (this.billed || !this.current) {
|
|
34846
34931
|
this.clear();
|
|
34932
|
+
} else {
|
|
34933
|
+
this.generation += 1;
|
|
34847
34934
|
}
|
|
34848
34935
|
this.emit();
|
|
34849
34936
|
}
|
|
34937
|
+
/** An un-billed ad that may still be shown and billed. */
|
|
34938
|
+
holding() {
|
|
34939
|
+
return !!this.current && !this.billed && this.o.now() - this.current.fetchedAt < this.o.holdMs;
|
|
34940
|
+
}
|
|
34850
34941
|
/** Advance the attention clock. Call every ~250ms. */
|
|
34851
34942
|
tick() {
|
|
34852
34943
|
const now = this.o.now();
|
|
34853
34944
|
const dt = Math.max(0, now - this.lastTick);
|
|
34854
34945
|
this.lastTick = now;
|
|
34855
34946
|
if (!this.working || !this.current) return;
|
|
34947
|
+
if (!this.billed && !this.holding()) {
|
|
34948
|
+
this.clear();
|
|
34949
|
+
void this.fetchNext();
|
|
34950
|
+
return;
|
|
34951
|
+
}
|
|
34856
34952
|
if (this.o.focus.focused) this.visibleMs += dt;
|
|
34857
34953
|
if (!this.billed && this.visibleMs >= this.o.minVisibleMs) {
|
|
34858
34954
|
this.billed = true;
|
|
34859
|
-
this.
|
|
34860
|
-
this.sessionEarned += this.current.earn;
|
|
34955
|
+
const shown = this.current;
|
|
34861
34956
|
void this.o.api.impression({
|
|
34862
|
-
ad:
|
|
34957
|
+
ad: shown.ad,
|
|
34863
34958
|
wallet: this.o.wallet,
|
|
34864
34959
|
context: this.context,
|
|
34865
34960
|
displayedMs: this.visibleMs,
|
|
34866
|
-
focusTracked: this.o.focus.known
|
|
34961
|
+
focusTracked: this.o.focus.known,
|
|
34962
|
+
eventUuid: shown.eventUuid
|
|
34963
|
+
}).then((result) => {
|
|
34964
|
+
if (result !== "tracked") return;
|
|
34965
|
+
this.impressions += 1;
|
|
34966
|
+
this.sessionEarned += shown.earn;
|
|
34967
|
+
this.emit();
|
|
34968
|
+
}).catch(() => {
|
|
34867
34969
|
});
|
|
34868
34970
|
this.emit();
|
|
34869
34971
|
}
|
|
@@ -34871,12 +34973,10 @@ var AdController = class {
|
|
|
34871
34973
|
void this.fetchNext();
|
|
34872
34974
|
}
|
|
34873
34975
|
}
|
|
34874
|
-
/** User
|
|
34976
|
+
/** User asked to open the ad (keyboard): the tracked link, or null. The server counts the click on redirect. */
|
|
34875
34977
|
click() {
|
|
34876
34978
|
const ad = this.working ? this.current : null;
|
|
34877
|
-
|
|
34878
|
-
void this.o.api.click({ ad: ad.ad, wallet: this.o.wallet, context: this.context });
|
|
34879
|
-
return ad.url;
|
|
34979
|
+
return ad?.link || null;
|
|
34880
34980
|
}
|
|
34881
34981
|
clear() {
|
|
34882
34982
|
this.generation += 1;
|
|
@@ -34891,7 +34991,7 @@ var AdController = class {
|
|
|
34891
34991
|
try {
|
|
34892
34992
|
const ad = await this.o.api.request({ wallet: this.o.wallet, context: this.context, sessionId: this.o.sessionId });
|
|
34893
34993
|
if (gen !== this.generation || !this.working || this.status !== "ok") return;
|
|
34894
|
-
const display = ad ? toDisplayAd(ad) : null;
|
|
34994
|
+
const display = ad ? toDisplayAd(ad, { server: this.o.api.server, wallet: this.o.wallet, now: this.o.now() }) : null;
|
|
34895
34995
|
if (!display) {
|
|
34896
34996
|
if (this.current) this.shownAt = this.o.now();
|
|
34897
34997
|
return;
|
|
@@ -34912,9 +35012,6 @@ var AdController = class {
|
|
|
34912
35012
|
}
|
|
34913
35013
|
};
|
|
34914
35014
|
|
|
34915
|
-
// src/ads/api.ts
|
|
34916
|
-
import { randomUUID } from "node:crypto";
|
|
34917
|
-
|
|
34918
35015
|
// src/ads/killswitch.ts
|
|
34919
35016
|
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
|
|
34920
35017
|
import { join as join5 } from "node:path";
|
|
@@ -34997,6 +35094,7 @@ function recordServerResult(ok, now = Date.now()) {
|
|
|
34997
35094
|
var SURFACE_WORKING_BAR = "status_line";
|
|
34998
35095
|
function httpAdApi(server = resolveServer()) {
|
|
34999
35096
|
return {
|
|
35097
|
+
server,
|
|
35000
35098
|
async request({ wallet, context, sessionId }) {
|
|
35001
35099
|
void refreshKillswitch(server);
|
|
35002
35100
|
if (!shouldServe().ok) return null;
|
|
@@ -35025,8 +35123,8 @@ function httpAdApi(server = resolveServer()) {
|
|
|
35025
35123
|
return null;
|
|
35026
35124
|
}
|
|
35027
35125
|
},
|
|
35028
|
-
async impression({ ad, wallet, context, displayedMs, focusTracked }) {
|
|
35029
|
-
if (!shouldServe().ok) return;
|
|
35126
|
+
async impression({ ad, wallet, context, displayedMs, focusTracked, eventUuid }) {
|
|
35127
|
+
if (!shouldServe().ok) return "error";
|
|
35030
35128
|
const device = await ensureDeviceCredential(server);
|
|
35031
35129
|
try {
|
|
35032
35130
|
const res = await fetch(`${server}/ad/impression`, {
|
|
@@ -35040,7 +35138,7 @@ function httpAdApi(server = resolveServer()) {
|
|
|
35040
35138
|
surface: SURFACE_WORKING_BAR,
|
|
35041
35139
|
context,
|
|
35042
35140
|
device_id: device,
|
|
35043
|
-
event_uuid:
|
|
35141
|
+
event_uuid: eventUuid,
|
|
35044
35142
|
displayed_ms: Math.round(displayedMs),
|
|
35045
35143
|
// Attention signal: the dwell above was measured with real terminal
|
|
35046
35144
|
// focus events, not assumed. Servers that don't know it ignore it.
|
|
@@ -35049,27 +35147,12 @@ function httpAdApi(server = resolveServer()) {
|
|
|
35049
35147
|
signal: AbortSignal.timeout(2e3)
|
|
35050
35148
|
});
|
|
35051
35149
|
recordServerResult(res.status < 500);
|
|
35150
|
+
if (!res.ok) return "error";
|
|
35151
|
+
const status2 = (await res.json().catch(() => ({}))).status;
|
|
35152
|
+
return status2 === "tracked" || status2 === "skipped" || status2 === "unearned" ? status2 : "error";
|
|
35052
35153
|
} catch {
|
|
35053
35154
|
recordServerResult(false);
|
|
35054
|
-
|
|
35055
|
-
},
|
|
35056
|
-
async click({ ad, wallet, context }) {
|
|
35057
|
-
const device = await ensureDeviceCredential(server);
|
|
35058
|
-
try {
|
|
35059
|
-
await fetch(`${server}/ad/click`, {
|
|
35060
|
-
method: "POST",
|
|
35061
|
-
headers: { "Content-Type": "application/json" },
|
|
35062
|
-
body: JSON.stringify({
|
|
35063
|
-
ad_id: ad.ad_id,
|
|
35064
|
-
user_wallet: wallet,
|
|
35065
|
-
agent: AGENT_LATENTCODE,
|
|
35066
|
-
surface: SURFACE_WORKING_BAR,
|
|
35067
|
-
context,
|
|
35068
|
-
device_id: device
|
|
35069
|
-
}),
|
|
35070
|
-
signal: AbortSignal.timeout(2e3)
|
|
35071
|
-
});
|
|
35072
|
-
} catch {
|
|
35155
|
+
return "error";
|
|
35073
35156
|
}
|
|
35074
35157
|
},
|
|
35075
35158
|
async balance(wallet) {
|
|
@@ -35490,6 +35573,51 @@ function reduce(state, ev, now = Date.now()) {
|
|
|
35490
35573
|
}
|
|
35491
35574
|
}
|
|
35492
35575
|
|
|
35576
|
+
// src/ui/SponsoredLine.tsx
|
|
35577
|
+
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
35578
|
+
var MAX_BARE_URL = 60;
|
|
35579
|
+
var SHAPE = linkShape();
|
|
35580
|
+
function SponsoredLine({ ad, billed, shape = SHAPE }) {
|
|
35581
|
+
const linked = !!ad.link && shape !== "plain";
|
|
35582
|
+
const showUrl = !!ad.shownUrl && shape !== "osc8" && ad.shownUrl.length <= MAX_BARE_URL;
|
|
35583
|
+
const badge = adBadge(ad.title || ad.body);
|
|
35584
|
+
const copy = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
35585
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, underline: linked, children: ad.title || ad.body }),
|
|
35586
|
+
ad.title && ad.body ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.muted, children: [
|
|
35587
|
+
" \u2014 ",
|
|
35588
|
+
ad.body
|
|
35589
|
+
] }) : null
|
|
35590
|
+
] });
|
|
35591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { justifyContent: "space-between", children: [
|
|
35592
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
35593
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.earn, children: [
|
|
35594
|
+
G.earn,
|
|
35595
|
+
" Sponsored"
|
|
35596
|
+
] }),
|
|
35597
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.faint, children: [
|
|
35598
|
+
" ",
|
|
35599
|
+
G.thin,
|
|
35600
|
+
" "
|
|
35601
|
+
] }),
|
|
35602
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { backgroundColor: badge.color, color: "#111827", bold: true, children: ` ${badge.letter} ` }),
|
|
35603
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " }),
|
|
35604
|
+
linked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Transform, { transform: (out) => osc8(out, ad.link), children: copy }) : copy,
|
|
35605
|
+
showUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.accent2, children: [
|
|
35606
|
+
" \xB7 ",
|
|
35607
|
+
ad.shownUrl
|
|
35608
|
+
] }) : null,
|
|
35609
|
+
ad.link ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.faint, children: [
|
|
35610
|
+
" \xB7 ctrl+o ",
|
|
35611
|
+
ad.ctaText
|
|
35612
|
+
] }) : null
|
|
35613
|
+
] }),
|
|
35614
|
+
billed && ad.earn > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.earn, children: [
|
|
35615
|
+
" +$",
|
|
35616
|
+
ad.earn.toFixed(4)
|
|
35617
|
+
] }) : null
|
|
35618
|
+
] });
|
|
35619
|
+
}
|
|
35620
|
+
|
|
35493
35621
|
// src/ui/components.tsx
|
|
35494
35622
|
var import_react22 = __toESM(require_react(), 1);
|
|
35495
35623
|
|
|
@@ -35706,7 +35834,7 @@ function parseDiff(patch, max = 14) {
|
|
|
35706
35834
|
}
|
|
35707
35835
|
|
|
35708
35836
|
// src/ui/components.tsx
|
|
35709
|
-
var
|
|
35837
|
+
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
35710
35838
|
function useTermSize() {
|
|
35711
35839
|
const { stdout } = use_stdout_default();
|
|
35712
35840
|
const read = () => ({ cols: stdout.columns || 80, rows: stdout.rows || 24 });
|
|
@@ -35726,21 +35854,21 @@ function Spinner({ color = C.accent }) {
|
|
|
35726
35854
|
const t = setInterval(() => setI((n) => (n + 1) % SPINNER.length), 90);
|
|
35727
35855
|
return () => clearInterval(t);
|
|
35728
35856
|
}, []);
|
|
35729
|
-
return /* @__PURE__ */ (0,
|
|
35857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color, children: SPINNER[i] });
|
|
35730
35858
|
}
|
|
35731
35859
|
function Logo({ version }) {
|
|
35732
|
-
return /* @__PURE__ */ (0,
|
|
35733
|
-
/* @__PURE__ */ (0,
|
|
35734
|
-
/* @__PURE__ */ (0,
|
|
35735
|
-
/* @__PURE__ */ (0,
|
|
35736
|
-
row2 === 1 && version ? /* @__PURE__ */ (0,
|
|
35860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", children: [0, 1].map((row2) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
35861
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.accent, children: LOGO.latent[row2] }),
|
|
35862
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
|
|
35863
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.accent2, children: LOGO.code[row2] }),
|
|
35864
|
+
row2 === 1 && version ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: C.faint, children: [
|
|
35737
35865
|
" v",
|
|
35738
35866
|
version
|
|
35739
35867
|
] }) : null
|
|
35740
35868
|
] }, row2)) });
|
|
35741
35869
|
}
|
|
35742
35870
|
function Panel(props) {
|
|
35743
|
-
return /* @__PURE__ */ (0,
|
|
35871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
35744
35872
|
Box_default,
|
|
35745
35873
|
{
|
|
35746
35874
|
flexDirection: "column",
|
|
@@ -35750,21 +35878,21 @@ function Panel(props) {
|
|
|
35750
35878
|
width: props.width,
|
|
35751
35879
|
marginTop: 1,
|
|
35752
35880
|
children: [
|
|
35753
|
-
/* @__PURE__ */ (0,
|
|
35754
|
-
/* @__PURE__ */ (0,
|
|
35755
|
-
props.right ? /* @__PURE__ */ (0,
|
|
35881
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { justifyContent: "space-between", children: [
|
|
35882
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, color: props.color ?? C.accent, children: props.title }),
|
|
35883
|
+
props.right ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.faint, children: props.right }) : null
|
|
35756
35884
|
] }),
|
|
35757
35885
|
props.children,
|
|
35758
|
-
props.footer ? /* @__PURE__ */ (0,
|
|
35886
|
+
props.footer ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { marginTop: 1, children: props.footer }) : null
|
|
35759
35887
|
]
|
|
35760
35888
|
}
|
|
35761
35889
|
);
|
|
35762
35890
|
}
|
|
35763
35891
|
function Hints({ items }) {
|
|
35764
|
-
return /* @__PURE__ */ (0,
|
|
35765
|
-
i ? /* @__PURE__ */ (0,
|
|
35766
|
-
/* @__PURE__ */ (0,
|
|
35767
|
-
/* @__PURE__ */ (0,
|
|
35892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { wrap: "truncate-end", children: items.map(([k, label2], i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
35893
|
+
i ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.faint, children: " \xB7 " }) : null,
|
|
35894
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.muted, children: k }),
|
|
35895
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: C.faint, children: [
|
|
35768
35896
|
" ",
|
|
35769
35897
|
label2
|
|
35770
35898
|
] })
|
|
@@ -35782,16 +35910,16 @@ function usePaste(handler, active = true) {
|
|
|
35782
35910
|
}
|
|
35783
35911
|
function FieldText({ state, mask, placeholder }) {
|
|
35784
35912
|
if (!state.text && placeholder) {
|
|
35785
|
-
return /* @__PURE__ */ (0,
|
|
35786
|
-
/* @__PURE__ */ (0,
|
|
35787
|
-
/* @__PURE__ */ (0,
|
|
35913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
35914
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { inverse: true, children: " " }),
|
|
35915
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.faint, children: placeholder })
|
|
35788
35916
|
] });
|
|
35789
35917
|
}
|
|
35790
35918
|
const shown = mask ? { ...state, text: "\u2022".repeat(state.text.length) } : state;
|
|
35791
35919
|
const { before, at, after } = splitAtCursor(shown);
|
|
35792
|
-
return /* @__PURE__ */ (0,
|
|
35920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
35793
35921
|
before,
|
|
35794
|
-
/* @__PURE__ */ (0,
|
|
35922
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { inverse: true, children: at }),
|
|
35795
35923
|
after
|
|
35796
35924
|
] });
|
|
35797
35925
|
}
|
|
@@ -35817,64 +35945,64 @@ function useLineField(opts) {
|
|
|
35817
35945
|
return { state, text: state.text, set: (t) => update(setText(ref.current, t)) };
|
|
35818
35946
|
}
|
|
35819
35947
|
function Spans({ spans }) {
|
|
35820
|
-
return /* @__PURE__ */ (0,
|
|
35948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: spans.map((s2, i) => {
|
|
35821
35949
|
switch (s2.t) {
|
|
35822
35950
|
case "bold":
|
|
35823
|
-
return /* @__PURE__ */ (0,
|
|
35951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: s2.v }, i);
|
|
35824
35952
|
case "italic":
|
|
35825
|
-
return /* @__PURE__ */ (0,
|
|
35953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { italic: true, children: s2.v }, i);
|
|
35826
35954
|
case "code":
|
|
35827
|
-
return /* @__PURE__ */ (0,
|
|
35955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.code, children: s2.v }, i);
|
|
35828
35956
|
case "link":
|
|
35829
|
-
return /* @__PURE__ */ (0,
|
|
35830
|
-
/* @__PURE__ */ (0,
|
|
35831
|
-
s2.url !== s2.v ? /* @__PURE__ */ (0,
|
|
35957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
35958
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { underline: true, children: s2.v }),
|
|
35959
|
+
s2.url !== s2.v ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: C.faint, children: [
|
|
35832
35960
|
" (",
|
|
35833
35961
|
s2.url,
|
|
35834
35962
|
")"
|
|
35835
35963
|
] }) : null
|
|
35836
35964
|
] }, i);
|
|
35837
35965
|
default:
|
|
35838
|
-
return /* @__PURE__ */ (0,
|
|
35966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: s2.v }, i);
|
|
35839
35967
|
}
|
|
35840
35968
|
}) });
|
|
35841
35969
|
}
|
|
35842
35970
|
function BlockView({ b }) {
|
|
35843
35971
|
switch (b.t) {
|
|
35844
35972
|
case "h":
|
|
35845
|
-
return /* @__PURE__ */ (0,
|
|
35973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, color: b.level <= 2 ? C.accent : void 0, underline: b.level === 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spans, { spans: b.spans }) });
|
|
35846
35974
|
case "li":
|
|
35847
|
-
return /* @__PURE__ */ (0,
|
|
35848
|
-
/* @__PURE__ */ (0,
|
|
35975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { marginLeft: b.indent * 2, children: [
|
|
35976
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: C.accent, children: [
|
|
35849
35977
|
b.marker,
|
|
35850
35978
|
" "
|
|
35851
35979
|
] }),
|
|
35852
|
-
/* @__PURE__ */ (0,
|
|
35980
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spans, { spans: b.spans }) })
|
|
35853
35981
|
] });
|
|
35854
35982
|
case "quote":
|
|
35855
|
-
return /* @__PURE__ */ (0,
|
|
35856
|
-
/* @__PURE__ */ (0,
|
|
35983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
|
|
35984
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: C.faint, children: [
|
|
35857
35985
|
G.thin,
|
|
35858
35986
|
" "
|
|
35859
35987
|
] }),
|
|
35860
|
-
/* @__PURE__ */ (0,
|
|
35988
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.muted, italic: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spans, { spans: b.spans }) })
|
|
35861
35989
|
] });
|
|
35862
35990
|
case "code":
|
|
35863
|
-
return /* @__PURE__ */ (0,
|
|
35864
|
-
b.lang ? /* @__PURE__ */ (0,
|
|
35865
|
-
/* @__PURE__ */ (0,
|
|
35991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "single", borderColor: C.border, borderTop: false, borderRight: false, borderBottom: false, paddingLeft: 1, children: [
|
|
35992
|
+
b.lang ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.faint, children: b.lang }) : null,
|
|
35993
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.code, children: b.lines.join("\n") || " " })
|
|
35866
35994
|
] });
|
|
35867
35995
|
case "rule":
|
|
35868
|
-
return /* @__PURE__ */ (0,
|
|
35996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.faint, children: "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" });
|
|
35869
35997
|
case "gap":
|
|
35870
|
-
return /* @__PURE__ */ (0,
|
|
35998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " });
|
|
35871
35999
|
default:
|
|
35872
|
-
return /* @__PURE__ */ (0,
|
|
36000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spans, { spans: b.spans }) });
|
|
35873
36001
|
}
|
|
35874
36002
|
}
|
|
35875
36003
|
function Markdown({ text }) {
|
|
35876
36004
|
const blocks = parseMarkdown(text);
|
|
35877
|
-
return /* @__PURE__ */ (0,
|
|
36005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", children: blocks.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BlockView, { b }, i)) });
|
|
35878
36006
|
}
|
|
35879
36007
|
function windowAround(total, selected, size) {
|
|
35880
36008
|
if (total <= size) return { start: 0, end: total };
|
|
@@ -35920,7 +36048,7 @@ function parseCommandLine(line) {
|
|
|
35920
36048
|
}
|
|
35921
36049
|
|
|
35922
36050
|
// src/ui/Transcript.tsx
|
|
35923
|
-
var
|
|
36051
|
+
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
35924
36052
|
function lastLines(text, n) {
|
|
35925
36053
|
const lines = text.trimEnd().split("\n");
|
|
35926
36054
|
return lines.length <= n ? lines.join("\n") : lines.slice(-n).join("\n");
|
|
@@ -35975,55 +36103,55 @@ function ToolView({ item, cwd: cwd2, width }) {
|
|
|
35975
36103
|
const diff2 = item.diff ? parseDiff(item.diff) : null;
|
|
35976
36104
|
const showOutput = item.output && (failed || !QUIET.has(item.name)) && !diff2;
|
|
35977
36105
|
const out = showOutput ? firstLines(item.output, failed ? 8 : 6) : null;
|
|
35978
|
-
return /* @__PURE__ */ (0,
|
|
35979
|
-
/* @__PURE__ */ (0,
|
|
35980
|
-
running ? /* @__PURE__ */ (0,
|
|
35981
|
-
/* @__PURE__ */ (0,
|
|
36106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", width, children: [
|
|
36107
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
36108
|
+
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 }),
|
|
36109
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { bold: true, color: t.verb === "$" ? C.accent2 : void 0, children: [
|
|
35982
36110
|
" ",
|
|
35983
36111
|
t.verb
|
|
35984
36112
|
] }),
|
|
35985
|
-
/* @__PURE__ */ (0,
|
|
36113
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
|
|
35986
36114
|
" ",
|
|
35987
36115
|
clip(t.target, Math.max(20, width - t.verb.length - 24))
|
|
35988
36116
|
] }),
|
|
35989
|
-
t.extra ? /* @__PURE__ */ (0,
|
|
36117
|
+
t.extra ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
|
|
35990
36118
|
" ",
|
|
35991
36119
|
t.extra
|
|
35992
36120
|
] }) : null,
|
|
35993
|
-
item.additions || item.deletions ? /* @__PURE__ */ (0,
|
|
35994
|
-
/* @__PURE__ */ (0,
|
|
36121
|
+
item.additions || item.deletions ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
|
|
36122
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.add, children: [
|
|
35995
36123
|
" +",
|
|
35996
36124
|
item.additions ?? 0
|
|
35997
36125
|
] }),
|
|
35998
|
-
/* @__PURE__ */ (0,
|
|
36126
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.del, children: [
|
|
35999
36127
|
" \u2212",
|
|
36000
36128
|
item.deletions ?? 0
|
|
36001
36129
|
] })
|
|
36002
36130
|
] }) : null,
|
|
36003
|
-
item.ms !== void 0 && item.ms >= 1e3 ? /* @__PURE__ */ (0,
|
|
36131
|
+
item.ms !== void 0 && item.ms >= 1e3 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
|
|
36004
36132
|
" \xB7 ",
|
|
36005
36133
|
fmtDuration(item.ms)
|
|
36006
36134
|
] }) : null
|
|
36007
36135
|
] }),
|
|
36008
|
-
diff2 && diff2.lines.length ? /* @__PURE__ */ (0,
|
|
36009
|
-
diff2.lines.map((l, i) => /* @__PURE__ */ (0,
|
|
36136
|
+
diff2 && diff2.lines.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", marginLeft: 2, children: [
|
|
36137
|
+
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: [
|
|
36010
36138
|
l.t === "add" ? "+ " : l.t === "del" ? "\u2212 " : l.t === "hunk" ? "" : " ",
|
|
36011
36139
|
l.t === "hunk" ? "\u22EF" : l.text
|
|
36012
36140
|
] }, i)),
|
|
36013
|
-
diff2.more ? /* @__PURE__ */ (0,
|
|
36141
|
+
diff2.more ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
|
|
36014
36142
|
"\u2026 ",
|
|
36015
36143
|
diff2.more,
|
|
36016
36144
|
" more lines"
|
|
36017
36145
|
] }) : null
|
|
36018
36146
|
] }) : null,
|
|
36019
|
-
out ? /* @__PURE__ */ (0,
|
|
36020
|
-
/* @__PURE__ */ (0,
|
|
36147
|
+
out ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginLeft: 2, children: [
|
|
36148
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
|
|
36021
36149
|
G.elbow,
|
|
36022
36150
|
" "
|
|
36023
36151
|
] }) }),
|
|
36024
|
-
/* @__PURE__ */ (0,
|
|
36025
|
-
/* @__PURE__ */ (0,
|
|
36026
|
-
out.more ? /* @__PURE__ */ (0,
|
|
36152
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
36153
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: failed ? C.err : C.muted, children: out.text }),
|
|
36154
|
+
out.more ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
|
|
36027
36155
|
"\u2026 ",
|
|
36028
36156
|
out.more,
|
|
36029
36157
|
" more lines"
|
|
@@ -36037,25 +36165,25 @@ var NOTICE_MARK = { info: G.bullet, ok: G.ok, warn: G.warn, error: G.no };
|
|
|
36037
36165
|
function ItemView({ item, live, cwd: cwd2, width, maxLines }) {
|
|
36038
36166
|
switch (item.kind) {
|
|
36039
36167
|
case "user":
|
|
36040
|
-
return /* @__PURE__ */ (0,
|
|
36041
|
-
/* @__PURE__ */ (0,
|
|
36168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, width, children: [
|
|
36169
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.accent, bold: true, children: [
|
|
36042
36170
|
G.prompt,
|
|
36043
36171
|
" "
|
|
36044
36172
|
] }) }),
|
|
36045
|
-
/* @__PURE__ */ (0,
|
|
36173
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, children: item.text })
|
|
36046
36174
|
] });
|
|
36047
36175
|
case "reasoning": {
|
|
36048
36176
|
const text = item.text.trim();
|
|
36049
36177
|
if (!text) return null;
|
|
36050
36178
|
const shown = live ? lastLines(text, 4) : firstLines(text, 2);
|
|
36051
|
-
return /* @__PURE__ */ (0,
|
|
36052
|
-
/* @__PURE__ */ (0,
|
|
36179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, width, children: [
|
|
36180
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
|
|
36053
36181
|
G.thin,
|
|
36054
36182
|
" "
|
|
36055
36183
|
] }) }),
|
|
36056
|
-
/* @__PURE__ */ (0,
|
|
36057
|
-
/* @__PURE__ */ (0,
|
|
36058
|
-
typeof shown !== "string" && shown.more ? /* @__PURE__ */ (0,
|
|
36184
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
36185
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.faint, italic: true, children: typeof shown === "string" ? shown : shown.text }),
|
|
36186
|
+
typeof shown !== "string" && shown.more ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
|
|
36059
36187
|
"\u2026 thought for ",
|
|
36060
36188
|
shown.more,
|
|
36061
36189
|
" more lines"
|
|
@@ -36064,25 +36192,25 @@ function ItemView({ item, live, cwd: cwd2, width, maxLines }) {
|
|
|
36064
36192
|
] });
|
|
36065
36193
|
}
|
|
36066
36194
|
case "text":
|
|
36067
|
-
return /* @__PURE__ */ (0,
|
|
36195
|
+
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 }) });
|
|
36068
36196
|
case "tool":
|
|
36069
|
-
return /* @__PURE__ */ (0,
|
|
36197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToolView, { item, cwd: cwd2, width });
|
|
36070
36198
|
case "error":
|
|
36071
|
-
return /* @__PURE__ */ (0,
|
|
36072
|
-
/* @__PURE__ */ (0,
|
|
36199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, width, children: [
|
|
36200
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.err, children: [
|
|
36073
36201
|
G.no,
|
|
36074
36202
|
" "
|
|
36075
36203
|
] }) }),
|
|
36076
|
-
/* @__PURE__ */ (0,
|
|
36204
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.err, wrap: "wrap", children: item.text })
|
|
36077
36205
|
] });
|
|
36078
36206
|
case "notice": {
|
|
36079
36207
|
const tone = item.tone ?? "info";
|
|
36080
|
-
return /* @__PURE__ */ (0,
|
|
36081
|
-
/* @__PURE__ */ (0,
|
|
36208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, width, children: [
|
|
36209
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: NOTICE_COLOR[tone], children: [
|
|
36082
36210
|
NOTICE_MARK[tone],
|
|
36083
36211
|
" "
|
|
36084
36212
|
] }) }),
|
|
36085
|
-
/* @__PURE__ */ (0,
|
|
36213
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: tone === "info" ? C.muted : NOTICE_COLOR[tone], wrap: "wrap", children: item.text })
|
|
36086
36214
|
] });
|
|
36087
36215
|
}
|
|
36088
36216
|
}
|
|
@@ -36096,19 +36224,19 @@ function PermissionPrompt({ perm, selected, cwd: cwd2, width }) {
|
|
|
36096
36224
|
const options = ["Allow once", "Always allow", "Reject"];
|
|
36097
36225
|
const keys = ["y", "a", "n"];
|
|
36098
36226
|
const what = perm.resources.map((r) => relPath(r, cwd2)).join(", ") || perm.message || "";
|
|
36099
|
-
return /* @__PURE__ */ (0,
|
|
36100
|
-
/* @__PURE__ */ (0,
|
|
36101
|
-
/* @__PURE__ */ (0,
|
|
36102
|
-
/* @__PURE__ */ (0,
|
|
36227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, borderStyle: "round", borderColor: C.warn, paddingX: 1, flexDirection: "column", width, children: [
|
|
36228
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { justifyContent: "space-between", children: [
|
|
36229
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, color: C.warn, children: PERMISSION_TITLE[perm.action] ?? `Allow ${perm.action}?` }),
|
|
36230
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.faint, children: perm.action })
|
|
36103
36231
|
] }),
|
|
36104
|
-
/* @__PURE__ */ (0,
|
|
36232
|
+
/* @__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: [
|
|
36105
36233
|
perm.action === "shell" ? "$ " : "",
|
|
36106
36234
|
clip(what, 600)
|
|
36107
36235
|
] }) }),
|
|
36108
|
-
/* @__PURE__ */ (0,
|
|
36236
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
|
|
36109
36237
|
i ? " " : "",
|
|
36110
|
-
/* @__PURE__ */ (0,
|
|
36111
|
-
/* @__PURE__ */ (0,
|
|
36238
|
+
/* @__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} ` }),
|
|
36239
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.faint, children: [
|
|
36112
36240
|
" ",
|
|
36113
36241
|
keys[i]
|
|
36114
36242
|
] })
|
|
@@ -36118,22 +36246,22 @@ function PermissionPrompt({ perm, selected, cwd: cwd2, width }) {
|
|
|
36118
36246
|
|
|
36119
36247
|
// src/ui/panels/ModelPicker.tsx
|
|
36120
36248
|
var import_react23 = __toESM(require_react(), 1);
|
|
36121
|
-
var
|
|
36249
|
+
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
36122
36250
|
function Mark({ status: status2, testing }) {
|
|
36123
|
-
if (testing) return /* @__PURE__ */ (0,
|
|
36251
|
+
if (testing) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, {});
|
|
36124
36252
|
switch (status2) {
|
|
36125
36253
|
case "ok":
|
|
36126
|
-
return /* @__PURE__ */ (0,
|
|
36254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.ok, children: G.ok });
|
|
36127
36255
|
case "unsupported":
|
|
36128
|
-
return /* @__PURE__ */ (0,
|
|
36256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.err, children: G.no });
|
|
36129
36257
|
case "rate-limited":
|
|
36130
|
-
return /* @__PURE__ */ (0,
|
|
36258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.warn, children: G.wait });
|
|
36131
36259
|
case "auth":
|
|
36132
|
-
return /* @__PURE__ */ (0,
|
|
36260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.warn, children: G.key });
|
|
36133
36261
|
case "error":
|
|
36134
|
-
return /* @__PURE__ */ (0,
|
|
36262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.err, children: G.warn });
|
|
36135
36263
|
default:
|
|
36136
|
-
return /* @__PURE__ */ (0,
|
|
36264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: "\xB7" });
|
|
36137
36265
|
}
|
|
36138
36266
|
}
|
|
36139
36267
|
function ModelPicker(p) {
|
|
@@ -36222,14 +36350,14 @@ function ModelPicker(p) {
|
|
|
36222
36350
|
const wId = Math.max(0, rest - wName);
|
|
36223
36351
|
const kindOf = (id) => p.catalog.providers.find((x) => x.id === id)?.kind ?? "unknown";
|
|
36224
36352
|
const verified = p.catalog.models.filter((m) => p.status(m.key) === "ok").length;
|
|
36225
|
-
return /* @__PURE__ */ (0,
|
|
36353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
36226
36354
|
Panel,
|
|
36227
36355
|
{
|
|
36228
36356
|
title: "Models",
|
|
36229
36357
|
right: `${p.catalog.models.length} models \xB7 ${verified} verified with your account`,
|
|
36230
36358
|
width: p.width,
|
|
36231
36359
|
color: C.accent,
|
|
36232
|
-
footer: /* @__PURE__ */ (0,
|
|
36360
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
36233
36361
|
Hints,
|
|
36234
36362
|
{
|
|
36235
36363
|
items: [
|
|
@@ -36243,36 +36371,36 @@ function ModelPicker(p) {
|
|
|
36243
36371
|
}
|
|
36244
36372
|
),
|
|
36245
36373
|
children: [
|
|
36246
|
-
/* @__PURE__ */ (0,
|
|
36247
|
-
/* @__PURE__ */ (0,
|
|
36374
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, children: [
|
|
36375
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.accent, children: [
|
|
36248
36376
|
G.search,
|
|
36249
36377
|
" "
|
|
36250
36378
|
] }),
|
|
36251
|
-
/* @__PURE__ */ (0,
|
|
36379
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldText, { state: field.state, placeholder: "type to search \u2014 name, id or provider" })
|
|
36252
36380
|
] }),
|
|
36253
|
-
/* @__PURE__ */ (0,
|
|
36381
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginTop: 1, flexWrap: "wrap", children: tabs.map((id, i) => {
|
|
36254
36382
|
const prov = p.catalog.providers.find((x) => x.id === id);
|
|
36255
36383
|
const text = prov ? `${prov.name} ${prov.models}` : `All ${p.catalog.models.length}`;
|
|
36256
|
-
return /* @__PURE__ */ (0,
|
|
36384
|
+
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");
|
|
36257
36385
|
}) }),
|
|
36258
|
-
/* @__PURE__ */ (0,
|
|
36259
|
-
above ? /* @__PURE__ */ (0,
|
|
36386
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
36387
|
+
above ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
|
|
36260
36388
|
" ",
|
|
36261
36389
|
G.up,
|
|
36262
36390
|
" ",
|
|
36263
36391
|
above,
|
|
36264
36392
|
" more"
|
|
36265
36393
|
] }) : null,
|
|
36266
|
-
shown.length === 0 ? /* @__PURE__ */ (0,
|
|
36394
|
+
shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.muted, children: [
|
|
36267
36395
|
" No model matches \u201C",
|
|
36268
36396
|
field.text,
|
|
36269
36397
|
"\u201D."
|
|
36270
36398
|
] }) : null,
|
|
36271
36399
|
shown.map((r, i) => {
|
|
36272
36400
|
if (r.t === "head") {
|
|
36273
|
-
return /* @__PURE__ */ (0,
|
|
36274
|
-
/* @__PURE__ */ (0,
|
|
36275
|
-
/* @__PURE__ */ (0,
|
|
36401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
36402
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, color: C.muted, children: r.label }),
|
|
36403
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
|
|
36276
36404
|
" ",
|
|
36277
36405
|
r.hint
|
|
36278
36406
|
] })
|
|
@@ -36283,33 +36411,33 @@ function ModelPicker(p) {
|
|
|
36283
36411
|
const st = p.status(m.key);
|
|
36284
36412
|
const dead = st === "unsupported";
|
|
36285
36413
|
const note = m.key === p.current ? "current" : st === "unsupported" ? "not on your plan" : st !== "unknown" && st !== "ok" ? label(st) : "";
|
|
36286
|
-
return /* @__PURE__ */ (0,
|
|
36287
|
-
/* @__PURE__ */ (0,
|
|
36414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
36415
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.accent, children: [
|
|
36288
36416
|
on2 ? G.prompt : " ",
|
|
36289
36417
|
" "
|
|
36290
36418
|
] }),
|
|
36291
|
-
/* @__PURE__ */ (0,
|
|
36292
|
-
/* @__PURE__ */ (0,
|
|
36293
|
-
/* @__PURE__ */ (0,
|
|
36294
|
-
/* @__PURE__ */ (0,
|
|
36419
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Mark, { status: st, testing: testing.has(m.key) }),
|
|
36420
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: " " }),
|
|
36421
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: on2, color: dead ? C.faint : on2 ? C.text : void 0, children: pad(m.name, wName) }),
|
|
36422
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
|
|
36295
36423
|
" ",
|
|
36296
36424
|
pad(field.text || !provider ? m.key : m.id, wId)
|
|
36297
36425
|
] }),
|
|
36298
|
-
/* @__PURE__ */ (0,
|
|
36426
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.muted, children: [
|
|
36299
36427
|
" ",
|
|
36300
36428
|
padStart(fmtContext(m.context), wCtx)
|
|
36301
36429
|
] }),
|
|
36302
|
-
/* @__PURE__ */ (0,
|
|
36430
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: m.costIn === 0 && m.costOut === 0 ? C.ok : C.muted, children: [
|
|
36303
36431
|
" ",
|
|
36304
36432
|
padStart(fmtPrice(m, kindOf(m.providerID)), wPrice)
|
|
36305
36433
|
] }),
|
|
36306
|
-
note ? /* @__PURE__ */ (0,
|
|
36434
|
+
note ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: m.key === p.current ? C.accent2 : dead ? C.faint : C.warn, children: [
|
|
36307
36435
|
" ",
|
|
36308
36436
|
note
|
|
36309
36437
|
] }) : null
|
|
36310
36438
|
] }, m.key);
|
|
36311
36439
|
}),
|
|
36312
|
-
below ? /* @__PURE__ */ (0,
|
|
36440
|
+
below ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.faint, children: [
|
|
36313
36441
|
" ",
|
|
36314
36442
|
G.down,
|
|
36315
36443
|
" ",
|
|
@@ -36317,13 +36445,13 @@ function ModelPicker(p) {
|
|
|
36317
36445
|
" more"
|
|
36318
36446
|
] }) : null
|
|
36319
36447
|
] }),
|
|
36320
|
-
chosen ? /* @__PURE__ */ (0,
|
|
36321
|
-
/* @__PURE__ */ (0,
|
|
36322
|
-
efforts.length > 1 ? efforts.map((e, i) => /* @__PURE__ */ (0,
|
|
36448
|
+
chosen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
36449
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: "effort " }),
|
|
36450
|
+
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: [
|
|
36323
36451
|
i === effortAt ? `\u2039 ${e} \u203A` : e,
|
|
36324
36452
|
i < efforts.length - 1 ? " " : ""
|
|
36325
|
-
] }, e)) : /* @__PURE__ */ (0,
|
|
36326
|
-
/* @__PURE__ */ (0,
|
|
36453
|
+
] }, e)) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: "fixed for this model" }),
|
|
36454
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.faint, children: " ctx \xB7 $ in/out per 1M tokens" })
|
|
36327
36455
|
] }) }) : null
|
|
36328
36456
|
]
|
|
36329
36457
|
}
|
|
@@ -36480,7 +36608,7 @@ function parseModelsResponse(body) {
|
|
|
36480
36608
|
}
|
|
36481
36609
|
|
|
36482
36610
|
// src/ui/panels/ProviderPanel.tsx
|
|
36483
|
-
var
|
|
36611
|
+
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
|
36484
36612
|
var usable = (i) => i.methods.filter((m) => m.type === "key" || m.type === "oauth");
|
|
36485
36613
|
var needsForm = (m) => "form" in m && Array.isArray(m.form) && m.form.some((f) => !f.hidden && f.required);
|
|
36486
36614
|
var methodLabel = (m) => m.type === "key" ? m.label || "API key" : m.label;
|
|
@@ -36527,7 +36655,7 @@ function ProviderPanel(p) {
|
|
|
36527
36655
|
const common = { width: p.width, color: C.accent };
|
|
36528
36656
|
switch (view.v) {
|
|
36529
36657
|
case "list":
|
|
36530
|
-
return /* @__PURE__ */ (0,
|
|
36658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
36531
36659
|
ProviderList,
|
|
36532
36660
|
{
|
|
36533
36661
|
...p,
|
|
@@ -36536,7 +36664,7 @@ function ProviderPanel(p) {
|
|
|
36536
36664
|
}
|
|
36537
36665
|
);
|
|
36538
36666
|
case "pick":
|
|
36539
|
-
return /* @__PURE__ */ (0,
|
|
36667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
36540
36668
|
IntegrationPicker,
|
|
36541
36669
|
{
|
|
36542
36670
|
...common,
|
|
@@ -36551,7 +36679,7 @@ function ProviderPanel(p) {
|
|
|
36551
36679
|
}
|
|
36552
36680
|
);
|
|
36553
36681
|
case "custom":
|
|
36554
|
-
return /* @__PURE__ */ (0,
|
|
36682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
36555
36683
|
CustomProviderForm,
|
|
36556
36684
|
{
|
|
36557
36685
|
...common,
|
|
@@ -36562,7 +36690,7 @@ function ProviderPanel(p) {
|
|
|
36562
36690
|
}
|
|
36563
36691
|
);
|
|
36564
36692
|
case "method":
|
|
36565
|
-
return /* @__PURE__ */ (0,
|
|
36693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
36566
36694
|
MethodPicker,
|
|
36567
36695
|
{
|
|
36568
36696
|
...common,
|
|
@@ -36573,7 +36701,7 @@ function ProviderPanel(p) {
|
|
|
36573
36701
|
}
|
|
36574
36702
|
);
|
|
36575
36703
|
case "key":
|
|
36576
|
-
return /* @__PURE__ */ (0,
|
|
36704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
36577
36705
|
KeyEntry,
|
|
36578
36706
|
{
|
|
36579
36707
|
...common,
|
|
@@ -36584,7 +36712,7 @@ function ProviderPanel(p) {
|
|
|
36584
36712
|
}
|
|
36585
36713
|
);
|
|
36586
36714
|
case "oauth":
|
|
36587
|
-
return /* @__PURE__ */ (0,
|
|
36715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
36588
36716
|
OAuthFlow,
|
|
36589
36717
|
{
|
|
36590
36718
|
...common,
|
|
@@ -36596,7 +36724,7 @@ function ProviderPanel(p) {
|
|
|
36596
36724
|
}
|
|
36597
36725
|
);
|
|
36598
36726
|
case "done":
|
|
36599
|
-
return /* @__PURE__ */ (0,
|
|
36727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Done, { ...common, name: view.name, models: view.models, note: view.note, onClose: p.onClose, onModels: () => p.onBrowse("") });
|
|
36600
36728
|
}
|
|
36601
36729
|
}
|
|
36602
36730
|
function ProviderList(p) {
|
|
@@ -36617,39 +36745,39 @@ function ProviderList(p) {
|
|
|
36617
36745
|
const inner = p.width - 4;
|
|
36618
36746
|
const wName = Math.min(24, Math.max(12, ...items.map((x) => x.name.length)) + 1);
|
|
36619
36747
|
const wVia = Math.min(26, Math.max(10, ...items.map((x) => x.via.length)) + 1);
|
|
36620
|
-
return /* @__PURE__ */ (0,
|
|
36748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
36621
36749
|
Panel,
|
|
36622
36750
|
{
|
|
36623
36751
|
title: "Providers",
|
|
36624
36752
|
right: `${items.length} connected \xB7 ${p.catalog.models.length} models`,
|
|
36625
36753
|
width: p.width,
|
|
36626
36754
|
color: C.accent,
|
|
36627
|
-
footer: /* @__PURE__ */ (0,
|
|
36755
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "browse models"], ["c", "connect a provider"], ["esc", "close"]] }),
|
|
36628
36756
|
children: [
|
|
36629
|
-
/* @__PURE__ */ (0,
|
|
36757
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
36630
36758
|
items.map((prov, i) => {
|
|
36631
36759
|
const ok = p.catalog.models.filter((m) => m.providerID === prov.id && p.status(m.key) === "ok").length;
|
|
36632
36760
|
const dot = prov.kind === "builtin" ? C.faint : C.ok;
|
|
36633
|
-
return /* @__PURE__ */ (0,
|
|
36634
|
-
/* @__PURE__ */ (0,
|
|
36761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
36762
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
36635
36763
|
i === sel ? G.prompt : " ",
|
|
36636
36764
|
" "
|
|
36637
36765
|
] }),
|
|
36638
|
-
/* @__PURE__ */ (0,
|
|
36766
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: dot, children: [
|
|
36639
36767
|
G.dot,
|
|
36640
36768
|
" "
|
|
36641
36769
|
] }),
|
|
36642
|
-
/* @__PURE__ */ (0,
|
|
36643
|
-
/* @__PURE__ */ (0,
|
|
36770
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: i === sel, children: pad(prov.name, wName) }),
|
|
36771
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
|
|
36644
36772
|
" ",
|
|
36645
36773
|
pad(prov.via, wVia)
|
|
36646
36774
|
] }),
|
|
36647
|
-
/* @__PURE__ */ (0,
|
|
36775
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
|
|
36648
36776
|
" ",
|
|
36649
36777
|
String(prov.models).padStart(3),
|
|
36650
36778
|
" models"
|
|
36651
36779
|
] }),
|
|
36652
|
-
ok ? /* @__PURE__ */ (0,
|
|
36780
|
+
ok ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.ok, children: [
|
|
36653
36781
|
" ",
|
|
36654
36782
|
G.ok,
|
|
36655
36783
|
" ",
|
|
@@ -36658,16 +36786,16 @@ function ProviderList(p) {
|
|
|
36658
36786
|
] }) : null
|
|
36659
36787
|
] }, prov.id);
|
|
36660
36788
|
}),
|
|
36661
|
-
/* @__PURE__ */ (0,
|
|
36662
|
-
/* @__PURE__ */ (0,
|
|
36789
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
36790
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
36663
36791
|
sel === items.length ? G.prompt : " ",
|
|
36664
36792
|
" "
|
|
36665
36793
|
] }),
|
|
36666
|
-
/* @__PURE__ */ (0,
|
|
36794
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.accent2, bold: sel === items.length, children: "+ Connect a provider\u2026" })
|
|
36667
36795
|
] })
|
|
36668
36796
|
] }),
|
|
36669
|
-
/* @__PURE__ */ (0,
|
|
36670
|
-
p.error ? /* @__PURE__ */ (0,
|
|
36797
|
+
/* @__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) }) }),
|
|
36798
|
+
p.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: p.error }) : null
|
|
36671
36799
|
]
|
|
36672
36800
|
}
|
|
36673
36801
|
);
|
|
@@ -36699,34 +36827,34 @@ function IntegrationPicker(p) {
|
|
|
36699
36827
|
const selected = Math.min(sel, list.length);
|
|
36700
36828
|
const visible = Math.max(5, Math.min(11, p.rows - 15));
|
|
36701
36829
|
const win = windowAround(list.length, Math.min(selected, Math.max(0, list.length - 1)), visible);
|
|
36702
|
-
return /* @__PURE__ */ (0,
|
|
36830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
36703
36831
|
Panel,
|
|
36704
36832
|
{
|
|
36705
36833
|
title: "Connect a provider",
|
|
36706
36834
|
right: p.integrations ? `${list.length} available` : "",
|
|
36707
36835
|
width: p.width,
|
|
36708
36836
|
color: p.color,
|
|
36709
|
-
footer: /* @__PURE__ */ (0,
|
|
36837
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "choose"], ["esc", field.text ? "clear" : "back"]] }),
|
|
36710
36838
|
children: [
|
|
36711
|
-
/* @__PURE__ */ (0,
|
|
36712
|
-
/* @__PURE__ */ (0,
|
|
36839
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, children: [
|
|
36840
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
36713
36841
|
G.search,
|
|
36714
36842
|
" "
|
|
36715
36843
|
] }),
|
|
36716
|
-
/* @__PURE__ */ (0,
|
|
36844
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, placeholder: "search \u2014 Anthropic, OpenRouter, Google\u2026" })
|
|
36717
36845
|
] }),
|
|
36718
|
-
/* @__PURE__ */ (0,
|
|
36719
|
-
!p.integrations && !p.error ? /* @__PURE__ */ (0,
|
|
36720
|
-
/* @__PURE__ */ (0,
|
|
36846
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
36847
|
+
!p.integrations && !p.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
36848
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
|
|
36721
36849
|
" ",
|
|
36722
|
-
/* @__PURE__ */ (0,
|
|
36850
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Loading providers\u2026" })
|
|
36723
36851
|
] }) : null,
|
|
36724
|
-
p.integrations && !list.length ? /* @__PURE__ */ (0,
|
|
36852
|
+
p.integrations && !list.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
|
|
36725
36853
|
" Nothing matches \u201C",
|
|
36726
36854
|
field.text,
|
|
36727
36855
|
"\u201D."
|
|
36728
36856
|
] }) : null,
|
|
36729
|
-
win.start > 0 ? /* @__PURE__ */ (0,
|
|
36857
|
+
win.start > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
|
|
36730
36858
|
" ",
|
|
36731
36859
|
G.up,
|
|
36732
36860
|
" ",
|
|
@@ -36737,40 +36865,40 @@ function IntegrationPicker(p) {
|
|
|
36737
36865
|
const on2 = win.start + i === selected;
|
|
36738
36866
|
const labels = usable(it).map((m) => m.type === "key" ? "API key" : m.label);
|
|
36739
36867
|
const methods = labels.slice(0, 2).join(" \xB7 ") + (labels.length > 2 ? ` +${labels.length - 2}` : "");
|
|
36740
|
-
return /* @__PURE__ */ (0,
|
|
36741
|
-
/* @__PURE__ */ (0,
|
|
36868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
36869
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
36742
36870
|
on2 ? G.prompt : " ",
|
|
36743
36871
|
" "
|
|
36744
36872
|
] }),
|
|
36745
|
-
/* @__PURE__ */ (0,
|
|
36746
|
-
/* @__PURE__ */ (0,
|
|
36873
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: on2, children: pad(it.name, 26) }),
|
|
36874
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
|
|
36747
36875
|
" ",
|
|
36748
36876
|
methods
|
|
36749
36877
|
] }),
|
|
36750
|
-
p.connected.has(it.id) ? /* @__PURE__ */ (0,
|
|
36878
|
+
p.connected.has(it.id) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.ok, children: [
|
|
36751
36879
|
" ",
|
|
36752
36880
|
G.ok,
|
|
36753
36881
|
" connected"
|
|
36754
36882
|
] }) : null
|
|
36755
36883
|
] }, it.id);
|
|
36756
36884
|
}),
|
|
36757
|
-
win.end < list.length ? /* @__PURE__ */ (0,
|
|
36885
|
+
win.end < list.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
|
|
36758
36886
|
" ",
|
|
36759
36887
|
G.down,
|
|
36760
36888
|
" ",
|
|
36761
36889
|
list.length - win.end,
|
|
36762
36890
|
" more"
|
|
36763
36891
|
] }) : null,
|
|
36764
|
-
p.integrations ? /* @__PURE__ */ (0,
|
|
36765
|
-
/* @__PURE__ */ (0,
|
|
36892
|
+
p.integrations ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
36893
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
36766
36894
|
selected === list.length ? G.prompt : " ",
|
|
36767
36895
|
" "
|
|
36768
36896
|
] }),
|
|
36769
|
-
/* @__PURE__ */ (0,
|
|
36770
|
-
/* @__PURE__ */ (0,
|
|
36897
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.accent2, bold: selected === list.length, children: pad("+ Custom provider\u2026", 26) }),
|
|
36898
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: " any OpenAI- or Anthropic-compatible endpoint" })
|
|
36771
36899
|
] }) : null
|
|
36772
36900
|
] }),
|
|
36773
|
-
p.error ? /* @__PURE__ */ (0,
|
|
36901
|
+
p.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: p.error }) : null
|
|
36774
36902
|
]
|
|
36775
36903
|
}
|
|
36776
36904
|
);
|
|
@@ -36786,31 +36914,31 @@ function MethodPicker(p) {
|
|
|
36786
36914
|
});
|
|
36787
36915
|
const wLabel = Math.min(40, Math.max(...methods.map((m) => methodLabel(m).length)) + 2);
|
|
36788
36916
|
const env3 = p.integration.methods.find((m) => m.type === "env");
|
|
36789
|
-
return /* @__PURE__ */ (0,
|
|
36917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
36790
36918
|
Panel,
|
|
36791
36919
|
{
|
|
36792
36920
|
title: `Connect ${p.integration.name}`,
|
|
36793
36921
|
width: p.width,
|
|
36794
36922
|
color: p.color,
|
|
36795
|
-
footer: /* @__PURE__ */ (0,
|
|
36923
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "continue"], ["esc", "back"]] }),
|
|
36796
36924
|
children: [
|
|
36797
|
-
/* @__PURE__ */ (0,
|
|
36798
|
-
/* @__PURE__ */ (0,
|
|
36799
|
-
methods.map((m, i) => /* @__PURE__ */ (0,
|
|
36800
|
-
/* @__PURE__ */ (0,
|
|
36925
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
36926
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "How do you want to connect?" }),
|
|
36927
|
+
methods.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
36928
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
36801
36929
|
i === sel ? G.prompt : " ",
|
|
36802
36930
|
" "
|
|
36803
36931
|
] }),
|
|
36804
|
-
/* @__PURE__ */ (0,
|
|
36805
|
-
/* @__PURE__ */ (0,
|
|
36932
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: i === sel, children: pad(methodLabel(m), wLabel) }),
|
|
36933
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: m.type === "oauth" ? "opens your browser" : "paste a key" })
|
|
36806
36934
|
] }, m.type + ("id" in m ? m.id : "")))
|
|
36807
36935
|
] }),
|
|
36808
|
-
env3 ? /* @__PURE__ */ (0,
|
|
36936
|
+
env3 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.faint, children: [
|
|
36809
36937
|
"Or set ",
|
|
36810
36938
|
env3.names[0],
|
|
36811
36939
|
" in your shell before starting LatentCode."
|
|
36812
36940
|
] }) }) : null,
|
|
36813
|
-
p.error ? /* @__PURE__ */ (0,
|
|
36941
|
+
p.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: p.error }) : null
|
|
36814
36942
|
]
|
|
36815
36943
|
}
|
|
36816
36944
|
);
|
|
@@ -36836,33 +36964,33 @@ function KeyEntry(p) {
|
|
|
36836
36964
|
return false;
|
|
36837
36965
|
}
|
|
36838
36966
|
});
|
|
36839
|
-
return /* @__PURE__ */ (0,
|
|
36967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
36840
36968
|
Panel,
|
|
36841
36969
|
{
|
|
36842
36970
|
title: `Connect ${p.integration.name}`,
|
|
36843
36971
|
right: "API key",
|
|
36844
36972
|
width: p.width,
|
|
36845
36973
|
color: p.color,
|
|
36846
|
-
footer: /* @__PURE__ */ (0,
|
|
36847
|
-
children: /* @__PURE__ */ (0,
|
|
36848
|
-
/* @__PURE__ */ (0,
|
|
36974
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["enter", "save"], ["esc", "back"]] }),
|
|
36975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
36976
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.muted, children: [
|
|
36849
36977
|
"Paste your ",
|
|
36850
36978
|
p.integration.name,
|
|
36851
36979
|
" API key."
|
|
36852
36980
|
] }),
|
|
36853
|
-
/* @__PURE__ */ (0,
|
|
36854
|
-
/* @__PURE__ */ (0,
|
|
36981
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, children: [
|
|
36982
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
36855
36983
|
G.key,
|
|
36856
36984
|
" "
|
|
36857
36985
|
] }),
|
|
36858
|
-
/* @__PURE__ */ (0,
|
|
36986
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, mask: true, placeholder: "paste the key here" })
|
|
36859
36987
|
] }),
|
|
36860
|
-
/* @__PURE__ */ (0,
|
|
36861
|
-
/* @__PURE__ */ (0,
|
|
36988
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: busy ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
36989
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
|
|
36862
36990
|
" ",
|
|
36863
|
-
/* @__PURE__ */ (0,
|
|
36864
|
-
] }) : /* @__PURE__ */ (0,
|
|
36865
|
-
error ? /* @__PURE__ */ (0,
|
|
36991
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Saving\u2026" })
|
|
36992
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.faint, children: "Stored by the local engine on this machine. Never sent to Latent." }) }),
|
|
36993
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: error }) : null
|
|
36866
36994
|
] })
|
|
36867
36995
|
}
|
|
36868
36996
|
);
|
|
@@ -36929,37 +37057,37 @@ function OAuthFlow(p) {
|
|
|
36929
37057
|
return false;
|
|
36930
37058
|
}
|
|
36931
37059
|
});
|
|
36932
|
-
return /* @__PURE__ */ (0,
|
|
37060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
36933
37061
|
Panel,
|
|
36934
37062
|
{
|
|
36935
37063
|
title: `Connect ${p.integration.name}`,
|
|
36936
37064
|
right: p.method.label,
|
|
36937
37065
|
width: p.width,
|
|
36938
37066
|
color: p.color,
|
|
36939
|
-
footer: /* @__PURE__ */ (0,
|
|
36940
|
-
children: /* @__PURE__ */ (0,
|
|
36941
|
-
!attempt && !error ? /* @__PURE__ */ (0,
|
|
36942
|
-
/* @__PURE__ */ (0,
|
|
37067
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: codeMode ? [["enter", "submit code"], ["esc", "cancel"]] : [["esc", "cancel"]] }),
|
|
37068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37069
|
+
!attempt && !error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
37070
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
|
|
36943
37071
|
" ",
|
|
36944
|
-
/* @__PURE__ */ (0,
|
|
37072
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Starting sign-in\u2026" })
|
|
36945
37073
|
] }) : null,
|
|
36946
|
-
attempt ? /* @__PURE__ */ (0,
|
|
36947
|
-
/* @__PURE__ */ (0,
|
|
36948
|
-
/* @__PURE__ */ (0,
|
|
36949
|
-
attempt.instructions ? /* @__PURE__ */ (0,
|
|
36950
|
-
/* @__PURE__ */ (0,
|
|
36951
|
-
/* @__PURE__ */ (0,
|
|
37074
|
+
attempt ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
37075
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Your browser should open. If it does not, open this link:" }),
|
|
37076
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.accent2, wrap: "wrap", children: attempt.url }),
|
|
37077
|
+
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,
|
|
37078
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: codeMode ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
37079
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
36952
37080
|
G.key,
|
|
36953
37081
|
" "
|
|
36954
37082
|
] }),
|
|
36955
|
-
/* @__PURE__ */ (0,
|
|
36956
|
-
] }) : error ? null : /* @__PURE__ */ (0,
|
|
36957
|
-
/* @__PURE__ */ (0,
|
|
37083
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, placeholder: "paste the code from the browser" })
|
|
37084
|
+
] }) : error ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
37085
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
|
|
36958
37086
|
" ",
|
|
36959
|
-
/* @__PURE__ */ (0,
|
|
37087
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Waiting for you to finish in the browser\u2026" })
|
|
36960
37088
|
] }) })
|
|
36961
37089
|
] }) : null,
|
|
36962
|
-
error ? /* @__PURE__ */ (0,
|
|
37090
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, children: error }) : null
|
|
36963
37091
|
] })
|
|
36964
37092
|
}
|
|
36965
37093
|
);
|
|
@@ -37055,13 +37183,13 @@ function CustomProviderForm(p) {
|
|
|
37055
37183
|
},
|
|
37056
37184
|
{ isActive: !busy && step === "kind" }
|
|
37057
37185
|
);
|
|
37058
|
-
const done = (label2, value) => /* @__PURE__ */ (0,
|
|
37059
|
-
/* @__PURE__ */ (0,
|
|
37186
|
+
const done = (label2, value) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
37187
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.ok, children: [
|
|
37060
37188
|
G.ok,
|
|
37061
37189
|
" "
|
|
37062
37190
|
] }),
|
|
37063
|
-
/* @__PURE__ */ (0,
|
|
37064
|
-
/* @__PURE__ */ (0,
|
|
37191
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: pad(label2, 10) }),
|
|
37192
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: value })
|
|
37065
37193
|
] });
|
|
37066
37194
|
const at = order.indexOf(step);
|
|
37067
37195
|
const prompt = {
|
|
@@ -37078,51 +37206,51 @@ function CustomProviderForm(p) {
|
|
|
37078
37206
|
placeholder: "e.g. gpt-4.1, claude-sonnet-4"
|
|
37079
37207
|
}
|
|
37080
37208
|
};
|
|
37081
|
-
return /* @__PURE__ */ (0,
|
|
37209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
37082
37210
|
Panel,
|
|
37083
37211
|
{
|
|
37084
37212
|
title: "Custom provider",
|
|
37085
37213
|
right: `step ${at + 1} of ${order.length}`,
|
|
37086
37214
|
width: p.width,
|
|
37087
37215
|
color: p.color,
|
|
37088
|
-
footer: /* @__PURE__ */ (0,
|
|
37216
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
37089
37217
|
Hints,
|
|
37090
37218
|
{
|
|
37091
37219
|
items: step === "kind" ? [["\u2191\u2193", "choose"], ["enter", "continue"], ["esc", "back"]] : [["enter", step === "models" ? "save" : "continue"], ["esc", "back"]]
|
|
37092
37220
|
}
|
|
37093
37221
|
),
|
|
37094
|
-
children: /* @__PURE__ */ (0,
|
|
37222
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37095
37223
|
at > 0 ? done("Name", name) : null,
|
|
37096
37224
|
at > 1 ? done("Type", KIND_LABEL[kind]) : null,
|
|
37097
37225
|
at > 2 ? done("Base URL", url) : null,
|
|
37098
37226
|
at > 3 ? done("API key", key ? "\u2022".repeat(Math.min(key.length, 12)) : "none") : null,
|
|
37099
|
-
/* @__PURE__ */ (0,
|
|
37100
|
-
/* @__PURE__ */ (0,
|
|
37101
|
-
KINDS.map((k) => /* @__PURE__ */ (0,
|
|
37102
|
-
/* @__PURE__ */ (0,
|
|
37227
|
+
/* @__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: [
|
|
37228
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: "Which API does the endpoint speak?" }),
|
|
37229
|
+
KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
37230
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
37103
37231
|
k === kind ? G.prompt : " ",
|
|
37104
37232
|
" "
|
|
37105
37233
|
] }),
|
|
37106
|
-
/* @__PURE__ */ (0,
|
|
37107
|
-
/* @__PURE__ */ (0,
|
|
37234
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: k === kind, children: pad(KIND_LABEL[k], 24) }),
|
|
37235
|
+
/* @__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" })
|
|
37108
37236
|
] }, k))
|
|
37109
|
-
] }) : /* @__PURE__ */ (0,
|
|
37110
|
-
/* @__PURE__ */ (0,
|
|
37111
|
-
/* @__PURE__ */ (0,
|
|
37112
|
-
/* @__PURE__ */ (0,
|
|
37237
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
37238
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: prompt[step].hint }),
|
|
37239
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, children: [
|
|
37240
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.accent, children: [
|
|
37113
37241
|
step === "key" ? G.key : G.prompt,
|
|
37114
37242
|
" "
|
|
37115
37243
|
] }),
|
|
37116
|
-
/* @__PURE__ */ (0,
|
|
37117
|
-
/* @__PURE__ */ (0,
|
|
37244
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: pad(prompt[step].label, 10) }),
|
|
37245
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldText, { state: field.state, mask: step === "key", placeholder: prompt[step].placeholder })
|
|
37118
37246
|
] })
|
|
37119
37247
|
] }) }),
|
|
37120
|
-
/* @__PURE__ */ (0,
|
|
37121
|
-
/* @__PURE__ */ (0,
|
|
37248
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: busy ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
37249
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, {}),
|
|
37122
37250
|
" ",
|
|
37123
|
-
/* @__PURE__ */ (0,
|
|
37124
|
-
] }) : /* @__PURE__ */ (0,
|
|
37125
|
-
error ? /* @__PURE__ */ (0,
|
|
37251
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.muted, children: busy })
|
|
37252
|
+
] }) : /* @__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." }) }),
|
|
37253
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: C.err, wrap: "wrap", children: error }) : null
|
|
37126
37254
|
] })
|
|
37127
37255
|
}
|
|
37128
37256
|
);
|
|
@@ -37132,23 +37260,23 @@ function Done(p) {
|
|
|
37132
37260
|
if (key.return) return p.onModels();
|
|
37133
37261
|
if (key.escape) p.onClose();
|
|
37134
37262
|
});
|
|
37135
|
-
return /* @__PURE__ */ (0,
|
|
37263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
37136
37264
|
Panel,
|
|
37137
37265
|
{
|
|
37138
37266
|
title: "Connected",
|
|
37139
37267
|
width: p.width,
|
|
37140
37268
|
color: C.ok,
|
|
37141
|
-
footer: /* @__PURE__ */ (0,
|
|
37269
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hints, { items: [["enter", "pick a model"], ["esc", "close"]] }),
|
|
37142
37270
|
children: [
|
|
37143
|
-
/* @__PURE__ */ (0,
|
|
37144
|
-
/* @__PURE__ */ (0,
|
|
37271
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
|
|
37272
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: C.ok, children: [
|
|
37145
37273
|
G.ok,
|
|
37146
37274
|
" "
|
|
37147
37275
|
] }),
|
|
37148
|
-
/* @__PURE__ */ (0,
|
|
37149
|
-
/* @__PURE__ */ (0,
|
|
37276
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: p.name }),
|
|
37277
|
+
/* @__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." })
|
|
37150
37278
|
] }) }),
|
|
37151
|
-
p.note ? /* @__PURE__ */ (0,
|
|
37279
|
+
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
|
|
37152
37280
|
]
|
|
37153
37281
|
}
|
|
37154
37282
|
);
|
|
@@ -37320,7 +37448,7 @@ You can still connect an address you control: latentcode login --wallet 0x\u2026
|
|
|
37320
37448
|
}
|
|
37321
37449
|
|
|
37322
37450
|
// src/ui/panels/WalletPanel.tsx
|
|
37323
|
-
var
|
|
37451
|
+
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
|
37324
37452
|
var deps = (server, extra) => ({
|
|
37325
37453
|
server,
|
|
37326
37454
|
log: () => {
|
|
@@ -37338,13 +37466,13 @@ function WalletPanel(p) {
|
|
|
37338
37466
|
};
|
|
37339
37467
|
switch (view.v) {
|
|
37340
37468
|
case "menu":
|
|
37341
|
-
return /* @__PURE__ */ (0,
|
|
37469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Menu, { ...p, onPick: (v) => setView({ v }) });
|
|
37342
37470
|
case "link":
|
|
37343
|
-
return /* @__PURE__ */ (0,
|
|
37471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AuthLink, { ...p, onDone: done, onBack: () => setView({ v: "menu" }) });
|
|
37344
37472
|
case "address":
|
|
37345
|
-
return /* @__PURE__ */ (0,
|
|
37473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Address, { ...p, onDone: done, onBack: () => setView({ v: "menu" }) });
|
|
37346
37474
|
case "done":
|
|
37347
|
-
return /* @__PURE__ */ (0,
|
|
37475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Done2, { width: p.width, wallet: view.wallet, onClose: p.onClose });
|
|
37348
37476
|
}
|
|
37349
37477
|
}
|
|
37350
37478
|
function Menu(p) {
|
|
@@ -37358,23 +37486,23 @@ function Menu(p) {
|
|
|
37358
37486
|
if (key.upArrow || key.downArrow || key.tab) return setSel((s2) => (s2 + 1) % options.length);
|
|
37359
37487
|
if (key.return) p.onPick(options[sel].id);
|
|
37360
37488
|
});
|
|
37361
|
-
return /* @__PURE__ */ (0,
|
|
37489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
37362
37490
|
Panel,
|
|
37363
37491
|
{
|
|
37364
37492
|
title: "Wallet",
|
|
37365
37493
|
right: p.wallet ? `connected \xB7 ${shortWallet(p.wallet)}` : "not connected",
|
|
37366
37494
|
width: p.width,
|
|
37367
37495
|
color: C.earn,
|
|
37368
|
-
footer: /* @__PURE__ */ (0,
|
|
37369
|
-
children: /* @__PURE__ */ (0,
|
|
37370
|
-
/* @__PURE__ */ (0,
|
|
37371
|
-
/* @__PURE__ */ (0,
|
|
37372
|
-
/* @__PURE__ */ (0,
|
|
37496
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["enter", "continue"], ["esc", "close"]] }),
|
|
37497
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37498
|
+
/* @__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 USDC while the agent works. Connect the wallet it should pay into:" }),
|
|
37499
|
+
/* @__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: [
|
|
37500
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.earn, children: [
|
|
37373
37501
|
i === sel ? G.prompt : " ",
|
|
37374
37502
|
" "
|
|
37375
37503
|
] }),
|
|
37376
|
-
/* @__PURE__ */ (0,
|
|
37377
|
-
/* @__PURE__ */ (0,
|
|
37504
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: i === sel, children: o.label.padEnd(27) }),
|
|
37505
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.faint, children: o.hint })
|
|
37378
37506
|
] }, o.id)) })
|
|
37379
37507
|
] })
|
|
37380
37508
|
}
|
|
@@ -37403,34 +37531,34 @@ function AuthLink(p) {
|
|
|
37403
37531
|
if (key.escape) p.onBack();
|
|
37404
37532
|
if (key.return && link2) openUrl(link2.url);
|
|
37405
37533
|
});
|
|
37406
|
-
return /* @__PURE__ */ (0,
|
|
37534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
37407
37535
|
Panel,
|
|
37408
37536
|
{
|
|
37409
37537
|
title: "Sign in",
|
|
37410
37538
|
right: "Latent wallet",
|
|
37411
37539
|
width: p.width,
|
|
37412
37540
|
color: C.earn,
|
|
37413
|
-
footer: /* @__PURE__ */ (0,
|
|
37414
|
-
children: /* @__PURE__ */ (0,
|
|
37415
|
-
!link2 && !error ? /* @__PURE__ */ (0,
|
|
37416
|
-
/* @__PURE__ */ (0,
|
|
37541
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["enter", "open the link again"], ["esc", "cancel"]] }),
|
|
37542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37543
|
+
!link2 && !error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
|
|
37544
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { color: C.earn }),
|
|
37417
37545
|
" ",
|
|
37418
|
-
/* @__PURE__ */ (0,
|
|
37546
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Preparing your sign-in link\u2026" })
|
|
37419
37547
|
] }) : null,
|
|
37420
|
-
link2 ? /* @__PURE__ */ (0,
|
|
37421
|
-
/* @__PURE__ */ (0,
|
|
37422
|
-
/* @__PURE__ */ (0,
|
|
37423
|
-
/* @__PURE__ */ (0,
|
|
37424
|
-
/* @__PURE__ */ (0,
|
|
37425
|
-
/* @__PURE__ */ (0,
|
|
37548
|
+
link2 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
37549
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Your browser should open. If it does not, open:" }),
|
|
37550
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.accent2, wrap: "wrap", children: link2.url }),
|
|
37551
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
|
|
37552
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Code " }),
|
|
37553
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, color: C.earn, children: link2.code })
|
|
37426
37554
|
] }) }),
|
|
37427
|
-
error ? null : /* @__PURE__ */ (0,
|
|
37428
|
-
/* @__PURE__ */ (0,
|
|
37555
|
+
error ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
|
|
37556
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { color: C.earn }),
|
|
37429
37557
|
" ",
|
|
37430
|
-
/* @__PURE__ */ (0,
|
|
37558
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Waiting for you to finish in the browser\u2026" })
|
|
37431
37559
|
] }) })
|
|
37432
37560
|
] }) : null,
|
|
37433
|
-
error ? /* @__PURE__ */ (0,
|
|
37561
|
+
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
|
|
37434
37562
|
] })
|
|
37435
37563
|
}
|
|
37436
37564
|
);
|
|
@@ -37453,23 +37581,23 @@ function Address(p) {
|
|
|
37453
37581
|
return false;
|
|
37454
37582
|
}
|
|
37455
37583
|
});
|
|
37456
|
-
return /* @__PURE__ */ (0,
|
|
37584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
37457
37585
|
Panel,
|
|
37458
37586
|
{
|
|
37459
37587
|
title: "Wallet address",
|
|
37460
37588
|
width: p.width,
|
|
37461
37589
|
color: C.earn,
|
|
37462
|
-
footer: /* @__PURE__ */ (0,
|
|
37463
|
-
children: /* @__PURE__ */ (0,
|
|
37464
|
-
/* @__PURE__ */ (0,
|
|
37465
|
-
/* @__PURE__ */ (0,
|
|
37466
|
-
/* @__PURE__ */ (0,
|
|
37590
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Hints, { items: [["enter", "save"], ["esc", "back"]] }),
|
|
37591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37592
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: "Earnings are paid in USDC to this address. Use one you control." }),
|
|
37593
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { marginTop: 1, children: [
|
|
37594
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.earn, children: [
|
|
37467
37595
|
G.earn,
|
|
37468
37596
|
" "
|
|
37469
37597
|
] }),
|
|
37470
|
-
/* @__PURE__ */ (0,
|
|
37598
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldText, { state: field.state, placeholder: "0x\u2026" })
|
|
37471
37599
|
] }),
|
|
37472
|
-
error ? /* @__PURE__ */ (0,
|
|
37600
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.err, children: error }) : null
|
|
37473
37601
|
] })
|
|
37474
37602
|
}
|
|
37475
37603
|
);
|
|
@@ -37478,19 +37606,19 @@ function Done2(p) {
|
|
|
37478
37606
|
use_input_default((_ch, key) => {
|
|
37479
37607
|
if (key.return || key.escape) p.onClose();
|
|
37480
37608
|
});
|
|
37481
|
-
return /* @__PURE__ */ (0,
|
|
37482
|
-
/* @__PURE__ */ (0,
|
|
37609
|
+
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: [
|
|
37610
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.ok, children: [
|
|
37483
37611
|
G.ok,
|
|
37484
37612
|
" "
|
|
37485
37613
|
] }),
|
|
37486
|
-
/* @__PURE__ */ (0,
|
|
37487
|
-
/* @__PURE__ */ (0,
|
|
37488
|
-
/* @__PURE__ */ (0,
|
|
37614
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: "Earn mode pays into " }),
|
|
37615
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: shortWallet(p.wallet) }),
|
|
37616
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.muted, children: ". You earn while the agent works." })
|
|
37489
37617
|
] }) }) });
|
|
37490
37618
|
}
|
|
37491
37619
|
|
|
37492
37620
|
// src/ui/App.tsx
|
|
37493
|
-
var
|
|
37621
|
+
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
|
|
37494
37622
|
var notice = (text, tone = "info") => ({
|
|
37495
37623
|
type: "latentcode.notice",
|
|
37496
37624
|
created: Date.now(),
|
|
@@ -37522,42 +37650,42 @@ function activityLabel(s2) {
|
|
|
37522
37650
|
function StepMark({ status: status2 }) {
|
|
37523
37651
|
switch (status2) {
|
|
37524
37652
|
case "run":
|
|
37525
|
-
return /* @__PURE__ */ (0,
|
|
37653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, {});
|
|
37526
37654
|
case "ok":
|
|
37527
|
-
return /* @__PURE__ */ (0,
|
|
37655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.ok, children: G.ok });
|
|
37528
37656
|
case "warn":
|
|
37529
|
-
return /* @__PURE__ */ (0,
|
|
37657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.warn, children: G.ring });
|
|
37530
37658
|
case "fail":
|
|
37531
|
-
return /* @__PURE__ */ (0,
|
|
37659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.err, children: G.no });
|
|
37532
37660
|
default:
|
|
37533
|
-
return /* @__PURE__ */ (0,
|
|
37661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.faint, children: "\xB7" });
|
|
37534
37662
|
}
|
|
37535
37663
|
}
|
|
37536
37664
|
function BootCard(p) {
|
|
37537
37665
|
const wLabel = 10;
|
|
37538
37666
|
const inner = p.width - 4;
|
|
37539
|
-
return /* @__PURE__ */ (0,
|
|
37540
|
-
/* @__PURE__ */ (0,
|
|
37541
|
-
/* @__PURE__ */ (0,
|
|
37542
|
-
/* @__PURE__ */ (0,
|
|
37667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
37668
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { marginTop: 1, marginLeft: 1, flexDirection: "column", children: [
|
|
37669
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Logo, { version: p.version }),
|
|
37670
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: TAGLINE })
|
|
37543
37671
|
] }),
|
|
37544
|
-
/* @__PURE__ */ (0,
|
|
37545
|
-
p.steps.map((st) => /* @__PURE__ */ (0,
|
|
37546
|
-
/* @__PURE__ */ (0,
|
|
37547
|
-
/* @__PURE__ */ (0,
|
|
37672
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", borderStyle: "round", borderColor: p.error ? C.err : C.border, paddingX: 1, width: p.width, children: [
|
|
37673
|
+
p.steps.map((st) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
37674
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StepMark, { status: st.status }),
|
|
37675
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { bold: st.status === "run", color: st.status === "pending" ? C.faint : void 0, children: [
|
|
37548
37676
|
" ",
|
|
37549
37677
|
pad(st.label, wLabel)
|
|
37550
37678
|
] }),
|
|
37551
|
-
/* @__PURE__ */ (0,
|
|
37679
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.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) })
|
|
37552
37680
|
] }, st.id)),
|
|
37553
|
-
/* @__PURE__ */ (0,
|
|
37554
|
-
/* @__PURE__ */ (0,
|
|
37555
|
-
/* @__PURE__ */ (0,
|
|
37556
|
-
/* @__PURE__ */ (0,
|
|
37681
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
37682
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.faint, children: "\xB7 " }),
|
|
37683
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.faint, children: pad("Project", wLabel) }),
|
|
37684
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: shortPath(p.cwd, homedir4(), inner - wLabel - 4) })
|
|
37557
37685
|
] })
|
|
37558
37686
|
] }),
|
|
37559
|
-
p.error ? /* @__PURE__ */ (0,
|
|
37560
|
-
p.ready ? /* @__PURE__ */ (0,
|
|
37687
|
+
p.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginLeft: 1, marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.err, wrap: "wrap", children: p.error }) }) : null,
|
|
37688
|
+
p.ready ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
37561
37689
|
Hints,
|
|
37562
37690
|
{
|
|
37563
37691
|
items: [
|
|
@@ -37586,26 +37714,26 @@ function HelpPanel({ width, commands, onClose }) {
|
|
|
37586
37714
|
["ctrl+o", "open the sponsored link"],
|
|
37587
37715
|
["ctrl+c", "clear the line, twice to quit"]
|
|
37588
37716
|
];
|
|
37589
|
-
return /* @__PURE__ */ (0,
|
|
37717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Panel, { title: "Help", width, color: C.accent, footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hints, { items: [["esc", "close"]] }), children: [
|
|
37590
37718
|
groups.map((g) => {
|
|
37591
37719
|
const list = commands.filter((c) => c.group === g);
|
|
37592
37720
|
if (!list.length) return null;
|
|
37593
|
-
return /* @__PURE__ */ (0,
|
|
37594
|
-
/* @__PURE__ */ (0,
|
|
37595
|
-
list.map((c) => /* @__PURE__ */ (0,
|
|
37596
|
-
/* @__PURE__ */ (0,
|
|
37597
|
-
/* @__PURE__ */ (0,
|
|
37721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37722
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: C.muted, children: g }),
|
|
37723
|
+
list.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
37724
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.accent2, children: pad(`/${c.name}${c.args ? " " + c.args : ""}`, 22) }),
|
|
37725
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: c.desc })
|
|
37598
37726
|
] }, c.name))
|
|
37599
37727
|
] }, g);
|
|
37600
37728
|
}),
|
|
37601
|
-
/* @__PURE__ */ (0,
|
|
37602
|
-
/* @__PURE__ */ (0,
|
|
37603
|
-
keys.map(([k, d]) => /* @__PURE__ */ (0,
|
|
37604
|
-
/* @__PURE__ */ (0,
|
|
37605
|
-
/* @__PURE__ */ (0,
|
|
37729
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37730
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: C.muted, children: "Keys" }),
|
|
37731
|
+
keys.map(([k, d]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
37732
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.accent2, children: pad(k, 22) }),
|
|
37733
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: d })
|
|
37606
37734
|
] }, k))
|
|
37607
37735
|
] }),
|
|
37608
|
-
/* @__PURE__ */ (0,
|
|
37736
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.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.` }) })
|
|
37609
37737
|
] });
|
|
37610
37738
|
}
|
|
37611
37739
|
function App2(props) {
|
|
@@ -37903,19 +38031,19 @@ Wallet ${shortWallet(wallet)} \xB7 unpaid balance ${bal === null ? "unavailable
|
|
|
37903
38031
|
const current = catalog.models.find((m) => m.key === state.model);
|
|
37904
38032
|
const provider = catalog.providers.find((p) => p.id === (current?.providerID ?? parseKey(state.model)?.providerID));
|
|
37905
38033
|
const close = () => setOverlay(null);
|
|
37906
|
-
return /* @__PURE__ */ (0,
|
|
37907
|
-
/* @__PURE__ */ (0,
|
|
37908
|
-
live.map((it) => /* @__PURE__ */ (0,
|
|
37909
|
-
perm ? /* @__PURE__ */ (0,
|
|
37910
|
-
state.working ? /* @__PURE__ */ (0,
|
|
37911
|
-
/* @__PURE__ */ (0,
|
|
37912
|
-
/* @__PURE__ */ (0,
|
|
37913
|
-
/* @__PURE__ */ (0,
|
|
38034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
38035
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Static, { items: [header, ...done.map((it) => ({ id: it.id, it }))], children: (entry) => "it" in entry ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ItemView, { item: entry.it, live: false, cwd: cwd2, width, maxLines }, entry.id) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BootCard, { steps: props.bootSteps, version, cwd: cwd2, width, ready: true }, entry.id) }),
|
|
38036
|
+
live.map((it) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ItemView, { item: it, live: true, cwd: cwd2, width, maxLines }, it.id)),
|
|
38037
|
+
perm ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PermissionPrompt, { perm, selected: permAt, cwd: cwd2, width }) : null,
|
|
38038
|
+
state.working ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", width, children: [
|
|
38039
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
38040
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, {}),
|
|
38041
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
37914
38042
|
" ",
|
|
37915
38043
|
activityLabel(state),
|
|
37916
38044
|
"\u2026"
|
|
37917
38045
|
] }),
|
|
37918
|
-
/* @__PURE__ */ (0,
|
|
38046
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.faint, children: [
|
|
37919
38047
|
" ",
|
|
37920
38048
|
elapsed,
|
|
37921
38049
|
"s \xB7 ",
|
|
@@ -37927,34 +38055,9 @@ Wallet ${shortWallet(wallet)} \xB7 unpaid balance ${bal === null ? "unavailable
|
|
|
37927
38055
|
" \xB7 esc to interrupt"
|
|
37928
38056
|
] })
|
|
37929
38057
|
] }),
|
|
37930
|
-
ad.current ? /* @__PURE__ */ (0,
|
|
37931
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
37932
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.earn, children: [
|
|
37933
|
-
G.earn,
|
|
37934
|
-
" Sponsored"
|
|
37935
|
-
] }),
|
|
37936
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.faint, children: [
|
|
37937
|
-
" ",
|
|
37938
|
-
G.thin,
|
|
37939
|
-
" "
|
|
37940
|
-
] }),
|
|
37941
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: ad.current.title }),
|
|
37942
|
-
ad.current.body ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.muted, children: [
|
|
37943
|
-
" \u2014 ",
|
|
37944
|
-
ad.current.body
|
|
37945
|
-
] }) : null,
|
|
37946
|
-
ad.current.url ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.faint, children: [
|
|
37947
|
-
" \xB7 ctrl+o ",
|
|
37948
|
-
ad.current.ctaText
|
|
37949
|
-
] }) : null
|
|
37950
|
-
] }),
|
|
37951
|
-
ad.billed && ad.current.earn > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.earn, children: [
|
|
37952
|
-
" +$",
|
|
37953
|
-
ad.current.earn.toFixed(4)
|
|
37954
|
-
] }) : null
|
|
37955
|
-
] }) : null
|
|
38058
|
+
ad.current ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SponsoredLine, { ad: ad.current, billed: ad.billed }) : null
|
|
37956
38059
|
] }) : null,
|
|
37957
|
-
overlay?.t === "model" ? /* @__PURE__ */ (0,
|
|
38060
|
+
overlay?.t === "model" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
37958
38061
|
ModelPicker,
|
|
37959
38062
|
{
|
|
37960
38063
|
catalog,
|
|
@@ -37973,7 +38076,7 @@ Wallet ${shortWallet(wallet)} \xB7 unpaid balance ${bal === null ? "unavailable
|
|
|
37973
38076
|
onClose: close
|
|
37974
38077
|
}
|
|
37975
38078
|
) : null,
|
|
37976
|
-
overlay?.t === "providers" ? /* @__PURE__ */ (0,
|
|
38079
|
+
overlay?.t === "providers" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
37977
38080
|
ProviderPanel,
|
|
37978
38081
|
{
|
|
37979
38082
|
engine,
|
|
@@ -37992,10 +38095,10 @@ Wallet ${shortWallet(wallet)} \xB7 unpaid balance ${bal === null ? "unavailable
|
|
|
37992
38095
|
onClose: close
|
|
37993
38096
|
}
|
|
37994
38097
|
) : null,
|
|
37995
|
-
overlay?.t === "wallet" ? /* @__PURE__ */ (0,
|
|
37996
|
-
overlay?.t === "help" ? /* @__PURE__ */ (0,
|
|
37997
|
-
overlay === null && !perm && !leaving ? /* @__PURE__ */ (0,
|
|
37998
|
-
/* @__PURE__ */ (0,
|
|
38098
|
+
overlay?.t === "wallet" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WalletPanel, { server: props.server, wallet, width, onWallet: changeWallet, onClose: close }) : null,
|
|
38099
|
+
overlay?.t === "help" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HelpPanel, { width, commands: allCommands, onClose: close }) : null,
|
|
38100
|
+
overlay === null && !perm && !leaving ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
38101
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
37999
38102
|
Box_default,
|
|
38000
38103
|
{
|
|
38001
38104
|
marginTop: 1,
|
|
@@ -38004,45 +38107,45 @@ Wallet ${shortWallet(wallet)} \xB7 unpaid balance ${bal === null ? "unavailable
|
|
|
38004
38107
|
paddingX: 1,
|
|
38005
38108
|
width,
|
|
38006
38109
|
children: [
|
|
38007
|
-
/* @__PURE__ */ (0,
|
|
38110
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.accent, bold: true, children: [
|
|
38008
38111
|
G.prompt,
|
|
38009
38112
|
" "
|
|
38010
38113
|
] }) }),
|
|
38011
|
-
/* @__PURE__ */ (0,
|
|
38114
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FieldText, { state: editor, placeholder: state.turns ? "reply, or / for commands" : "ask anything, or / for commands" })
|
|
38012
38115
|
]
|
|
38013
38116
|
}
|
|
38014
38117
|
),
|
|
38015
|
-
paletteOpen ? /* @__PURE__ */ (0,
|
|
38016
|
-
matches.slice(0, 8).map((c, i) => /* @__PURE__ */ (0,
|
|
38017
|
-
/* @__PURE__ */ (0,
|
|
38118
|
+
paletteOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", paddingX: 2, width, children: [
|
|
38119
|
+
matches.slice(0, 8).map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
38120
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.accent, children: [
|
|
38018
38121
|
i === paletteSel ? G.prompt : " ",
|
|
38019
38122
|
" "
|
|
38020
38123
|
] }),
|
|
38021
|
-
/* @__PURE__ */ (0,
|
|
38022
|
-
/* @__PURE__ */ (0,
|
|
38124
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: i === paletteSel, color: i === paletteSel ? C.accent2 : C.text, children: pad(`/${c.name}${c.args ? " " + c.args : ""}`, 20) }),
|
|
38125
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.muted, children: c.desc })
|
|
38023
38126
|
] }, c.name)),
|
|
38024
|
-
matches.length > 8 ? /* @__PURE__ */ (0,
|
|
38127
|
+
matches.length > 8 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.faint, children: [
|
|
38025
38128
|
" ",
|
|
38026
38129
|
G.down,
|
|
38027
38130
|
" ",
|
|
38028
38131
|
matches.length - 8,
|
|
38029
38132
|
" more \u2014 keep typing"
|
|
38030
38133
|
] }) : null,
|
|
38031
|
-
/* @__PURE__ */ (0,
|
|
38134
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hints, { items: [["\u2191\u2193", "move"], ["tab", "complete"], ["enter", "run"], ["esc", "dismiss"]] })
|
|
38032
38135
|
] }) : null
|
|
38033
38136
|
] }) : null,
|
|
38034
|
-
paletteOpen || leaving ? null : /* @__PURE__ */ (0,
|
|
38035
|
-
/* @__PURE__ */ (0,
|
|
38036
|
-
/* @__PURE__ */ (0,
|
|
38037
|
-
state.variant ? /* @__PURE__ */ (0,
|
|
38137
|
+
paletteOpen || leaving ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { width, justifyContent: "space-between", paddingX: 1, children: [
|
|
38138
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { wrap: "truncate-end", children: quitArmed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.warn, children: "Press ctrl+c again to quit" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
38139
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: current ? C.text : C.warn, children: current?.name ?? (state.model || "no model") }),
|
|
38140
|
+
state.variant ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.accent2, children: [
|
|
38038
38141
|
" ",
|
|
38039
38142
|
state.variant
|
|
38040
38143
|
] }) : null,
|
|
38041
|
-
provider ? /* @__PURE__ */ (0,
|
|
38144
|
+
provider ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.faint, children: [
|
|
38042
38145
|
" \xB7 ",
|
|
38043
38146
|
provider.name
|
|
38044
38147
|
] }) : null,
|
|
38045
|
-
state.tokens.input + state.tokens.output ? /* @__PURE__ */ (0,
|
|
38148
|
+
state.tokens.input + state.tokens.output ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.faint, children: [
|
|
38046
38149
|
" ",
|
|
38047
38150
|
"\xB7 ",
|
|
38048
38151
|
fmtTokens(state.tokens.input + state.tokens.output),
|
|
@@ -38050,21 +38153,21 @@ Wallet ${shortWallet(wallet)} \xB7 unpaid balance ${bal === null ? "unavailable
|
|
|
38050
38153
|
state.cost ? ` \xB7 ${fmtUsd(state.cost)}` : ""
|
|
38051
38154
|
] }) : null
|
|
38052
38155
|
] }) }),
|
|
38053
|
-
/* @__PURE__ */ (0,
|
|
38156
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { wrap: "truncate-end", children: ad.status === "ok" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.earn, children: [
|
|
38054
38157
|
G.earn,
|
|
38055
38158
|
" $",
|
|
38056
38159
|
ad.sessionEarned.toFixed(4),
|
|
38057
38160
|
" earned",
|
|
38058
|
-
/* @__PURE__ */ (0,
|
|
38161
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.faint, children: [
|
|
38059
38162
|
" \xB7 ",
|
|
38060
38163
|
ad.impressions,
|
|
38061
38164
|
" view",
|
|
38062
38165
|
ad.impressions === 1 ? "" : "s"
|
|
38063
38166
|
] })
|
|
38064
|
-
] }) : ad.status === "disabled" ? /* @__PURE__ */ (0,
|
|
38167
|
+
] }) : ad.status === "disabled" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.faint, children: [
|
|
38065
38168
|
G.earn,
|
|
38066
38169
|
" Earn off \xB7 /ads on"
|
|
38067
|
-
] }) : /* @__PURE__ */ (0,
|
|
38170
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.warn, children: [
|
|
38068
38171
|
G.earn,
|
|
38069
38172
|
" /login to start earning"
|
|
38070
38173
|
] }) })
|
|
@@ -38073,7 +38176,7 @@ Wallet ${shortWallet(wallet)} \xB7 unpaid balance ${bal === null ? "unavailable
|
|
|
38073
38176
|
}
|
|
38074
38177
|
|
|
38075
38178
|
// src/ui/Root.tsx
|
|
38076
|
-
var
|
|
38179
|
+
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
38077
38180
|
function Root(p) {
|
|
38078
38181
|
const { exit } = use_app_default();
|
|
38079
38182
|
const { cols } = useTermSize();
|
|
@@ -38095,7 +38198,7 @@ function Root(p) {
|
|
|
38095
38198
|
{ isActive: !booted }
|
|
38096
38199
|
);
|
|
38097
38200
|
if (!booted) {
|
|
38098
|
-
return /* @__PURE__ */ (0,
|
|
38201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
38099
38202
|
BootCard,
|
|
38100
38203
|
{
|
|
38101
38204
|
steps,
|
|
@@ -38107,7 +38210,7 @@ function Root(p) {
|
|
|
38107
38210
|
}
|
|
38108
38211
|
);
|
|
38109
38212
|
}
|
|
38110
|
-
return /* @__PURE__ */ (0,
|
|
38213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PasteContext.Provider, { value: p.paste, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(App2, { ...booted, version: p.version, bootSteps: steps, summary: p.summary }) });
|
|
38111
38214
|
}
|
|
38112
38215
|
|
|
38113
38216
|
// src/ads/attention.ts
|
|
@@ -38157,6 +38260,27 @@ var FocusTracker = class {
|
|
|
38157
38260
|
}
|
|
38158
38261
|
};
|
|
38159
38262
|
|
|
38263
|
+
// src/ui/syncOutput.ts
|
|
38264
|
+
var BSU = "\x1B[?2026h";
|
|
38265
|
+
var ESU = "\x1B[?2026l";
|
|
38266
|
+
function wrapFrame(chunk) {
|
|
38267
|
+
if (typeof chunk === "string") return chunk ? BSU + chunk + ESU : chunk;
|
|
38268
|
+
if (!chunk.length) return chunk;
|
|
38269
|
+
return Buffer.concat([Buffer.from(BSU), chunk, Buffer.from(ESU)]);
|
|
38270
|
+
}
|
|
38271
|
+
function syncedStdout(stream = process.stdout, env3 = process.env) {
|
|
38272
|
+
if (env3.LATENTCODE_SYNC_OUTPUT === "off") return stream;
|
|
38273
|
+
return new Proxy(stream, {
|
|
38274
|
+
get(target, prop) {
|
|
38275
|
+
if (prop === "write") {
|
|
38276
|
+
return (chunk, ...rest) => target.write(wrapFrame(chunk), ...rest);
|
|
38277
|
+
}
|
|
38278
|
+
const v = Reflect.get(target, prop, target);
|
|
38279
|
+
return typeof v === "function" ? v.bind(target) : v;
|
|
38280
|
+
}
|
|
38281
|
+
});
|
|
38282
|
+
}
|
|
38283
|
+
|
|
38160
38284
|
// src/ui/stdin.ts
|
|
38161
38285
|
import { PassThrough as PassThrough2 } from "node:stream";
|
|
38162
38286
|
var PASTE_ENABLE = "\x1B[?2004h";
|
|
@@ -38302,8 +38426,8 @@ function row(mark, label2, value, width = 10) {
|
|
|
38302
38426
|
}
|
|
38303
38427
|
|
|
38304
38428
|
// src/index.tsx
|
|
38305
|
-
var
|
|
38306
|
-
var VERSION = "0.1.0-alpha.
|
|
38429
|
+
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
38430
|
+
var VERSION = "0.1.0-alpha.3";
|
|
38307
38431
|
var usage = () => `${logo()}
|
|
38308
38432
|
${a.dim(`v${VERSION} \xB7 terminal coding agent. Bring your own model access; earn while it works.`)}
|
|
38309
38433
|
|
|
@@ -38443,7 +38567,7 @@ async function main() {
|
|
|
38443
38567
|
const summary = { current: { turns: 0, tokens: 0, cost: 0, earned: 0, impressions: 0 } };
|
|
38444
38568
|
let fatal = false;
|
|
38445
38569
|
const app = render_default(
|
|
38446
|
-
/* @__PURE__ */ (0,
|
|
38570
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
38447
38571
|
Root,
|
|
38448
38572
|
{
|
|
38449
38573
|
args: { cwd: cwd2, model: args.model, noAds: args.noAds, auto: args.auto },
|
|
@@ -38456,7 +38580,7 @@ async function main() {
|
|
|
38456
38580
|
}
|
|
38457
38581
|
}
|
|
38458
38582
|
),
|
|
38459
|
-
{ stdin, exitOnCtrlC: false }
|
|
38583
|
+
{ stdin, stdout: syncedStdout(), exitOnCtrlC: false }
|
|
38460
38584
|
);
|
|
38461
38585
|
await app.waitUntilExit();
|
|
38462
38586
|
if (!fatal && (summary.current.turns || summary.current.impressions)) process.stdout.write(goodbye(summary.current));
|