latentcode 0.1.0-alpha.7 → 0.1.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/latentcode.mjs +32 -12
  2. package/package.json +1 -1
@@ -34874,6 +34874,7 @@ var AdController = class {
34874
34874
  shownAt = 0;
34875
34875
  visibleMs = 0;
34876
34876
  billed = false;
34877
+ verdict = null;
34877
34878
  lastTick = 0;
34878
34879
  fetching = false;
34879
34880
  /** Generation of the request in flight; a stale one never blocks a new turn. */
@@ -34931,6 +34932,7 @@ var AdController = class {
34931
34932
  idle: !this.working,
34932
34933
  visibleMs: this.visibleMs,
34933
34934
  billed: this.billed,
34935
+ verdict: this.verdict,
34934
34936
  focusTracked: this.o.focus.known,
34935
34937
  impressions: this.impressions,
34936
34938
  sessionEarned: this.sessionEarned,
@@ -34996,12 +34998,13 @@ var AdController = class {
34996
34998
  displayedMs: this.visibleMs,
34997
34999
  focusTracked: this.o.focus.known,
34998
35000
  eventUuid: shown.eventUuid
34999
- }).then((result) => {
35000
- if (result !== "tracked") return;
35001
- this.impressions += 1;
35002
- this.sessionEarned += shown.earn;
35001
+ }).catch(() => "error").then((result) => {
35002
+ if (this.current === shown) this.verdict = result;
35003
+ if (result === "tracked") {
35004
+ this.impressions += 1;
35005
+ this.sessionEarned += shown.earn;
35006
+ }
35003
35007
  this.emit();
35004
- }).catch(() => {
35005
35008
  });
35006
35009
  this.emit();
35007
35010
  }
@@ -35018,6 +35021,7 @@ var AdController = class {
35018
35021
  this.current = null;
35019
35022
  this.visibleMs = 0;
35020
35023
  this.billed = false;
35024
+ this.verdict = null;
35021
35025
  }
35022
35026
  async fetchNext() {
35023
35027
  const gen = this.generation;
@@ -35038,6 +35042,7 @@ var AdController = class {
35038
35042
  this.lastTick = this.shownAt;
35039
35043
  this.visibleMs = 0;
35040
35044
  this.billed = false;
35045
+ this.verdict = null;
35041
35046
  this.emit();
35042
35047
  } finally {
35043
35048
  if (this.fetchingGen === gen) this.fetching = false;
@@ -35841,11 +35846,25 @@ var fmtUsd2 = (n) => `$${n.toFixed(n !== 0 && Math.abs(n) < 0.01 ? 4 : 2)}`;
35841
35846
  function Rule({ width }) {
35842
35847
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.border, children: "\u2500".repeat(Math.max(0, width)) });
35843
35848
  }
35844
- function Progress({ ms, of, billed }) {
35845
- if (billed) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.ok, children: [
35846
- G.ok,
35847
- " view counted"
35848
- ] });
35849
+ function verdictLabel(v) {
35850
+ switch (v) {
35851
+ case "tracked":
35852
+ return { text: `${G.ok} view counted`, tone: "ok" };
35853
+ case "unearned":
35854
+ return { text: "view not paid on this device", tone: "warn" };
35855
+ case "skipped":
35856
+ return { text: "view not counted", tone: "faint" };
35857
+ case "error":
35858
+ return { text: "view not counted \xB7 server unreachable", tone: "warn" };
35859
+ default:
35860
+ return { text: "counting view\u2026", tone: "faint" };
35861
+ }
35862
+ }
35863
+ function Progress({ ms, of, billed, verdict }) {
35864
+ if (billed) {
35865
+ const l = verdictLabel(verdict);
35866
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: l.tone === "ok" ? C.ok : l.tone === "warn" ? C.warn : C.faint, children: l.text });
35867
+ }
35849
35868
  const n = 10;
35850
35869
  const filled = Math.min(n, Math.floor(ms / of * n));
35851
35870
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
@@ -35954,7 +35973,7 @@ function StatusPanel(p) {
35954
35973
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Rule, { width: inner }),
35955
35974
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { justifyContent: "space-between", children: [
35956
35975
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { wrap: "truncate-end", children: [
35957
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Progress, { ms: p.visibleMs ?? 0, of: p.minVisibleMs ?? 1e4, billed: !!p.billed }),
35976
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Progress, { ms: p.visibleMs ?? 0, of: p.minVisibleMs ?? 1e4, billed: !!p.billed, verdict: p.verdict }),
35958
35977
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.faint, children: " \xB7 Powered by Latent Ads" })
35959
35978
  ] }),
35960
35979
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexShrink: 0, marginLeft: 2, children: earnings })
@@ -38468,6 +38487,7 @@ Spend it here: /login connects the Latent provider (or /key lk_\u2026 with a key
38468
38487
  adIndex: ad.adIndex,
38469
38488
  visibleMs: ad.visibleMs,
38470
38489
  billed: ad.billed,
38490
+ verdict: ad.verdict,
38471
38491
  balance,
38472
38492
  sessionCredits: credits(ad.sessionEarned, bonus),
38473
38493
  views: ad.impressions,
@@ -38730,7 +38750,7 @@ function row(mark, label2, value, width = 10) {
38730
38750
 
38731
38751
  // src/index.tsx
38732
38752
  var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
38733
- var VERSION = "0.1.0-alpha.7";
38753
+ var VERSION = "0.1.0-alpha.8";
38734
38754
  var usage = () => `${logo()}
38735
38755
  ${a.dim(`v${VERSION} \xB7 terminal coding agent. Bring your own model access; earn while it works.`)}
38736
38756
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "latentcode",
3
- "version": "0.1.0-alpha.7",
3
+ "version": "0.1.0-alpha.8",
4
4
  "description": "Terminal coding agent that pays you for idle time. Bring your own subscription; the model is never for sale.",
5
5
  "type": "module",
6
6
  "bin": {