latentcode 0.1.0-alpha.1 → 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 CHANGED
@@ -5,7 +5,8 @@ Terminal coding agent that pays you for its idle time.
5
5
  - **Bring your own model access.** API keys or a provider subscription where the provider allows third-party clients. Connect them inside the app with `/connect`.
6
6
  - **Earn mode.** While the agent works, one clearly labelled sponsored line sits in the working bar. You earn USDC from it on your Latent wallet, the same wallet the other Latent surfaces use.
7
7
  - **The model is never for sale.** Ads never enter the model's context or output, and the agent never recommends sponsored tools. The only targeting signal that leaves your machine is a coarse category slug (for example `backend`), classified locally.
8
- - **Real attention.** An impression is billed once, and only after the ad has been on screen for 2 s while the terminal is focused (xterm focus events, DEC 1004).
8
+ - **Real attention.** An impression is billed once, and only after the ad has been on screen for 10 s while the terminal is focused (xterm focus events, DEC 1004) — the ad server's view floor, the same rule as every other Latent surface. A turn that ends earlier keeps the ad for the next turn instead of wasting it. Only impressions the server confirms count toward the session tally.
9
+ - **Clickable.** In terminals with hyperlinks (iTerm2, Ghostty, Kitty, WezTerm, VS Code, Windows Terminal) the sponsored copy itself is a link; elsewhere the short URL is shown beside it. A coloured monogram badge (stable per brand) leads the line in every terminal. `ctrl+o` works everywhere. Every click goes through the ad server's tracked redirect. `LATENTCODE_LINKS=osc8|plain|hybrid` overrides the detection.
9
10
 
10
11
  ## Install (alpha)
11
12
 
@@ -26,13 +27,42 @@ Type `/` for the command palette.
26
27
  | --- | --- |
27
28
  | `/model [name]` | Model picker: search across every provider, `tab` to filter by provider, `←` `→` to set the effort level, `ctrl+t` to test a model with your account. `✓` marks models proven to work with your account. |
28
29
  | `/providers` | Connected providers, how each is connected (account sign-in, API key, env var, built in) and how many models it offers. |
29
- | `/connect [provider]` | Connect a provider without leaving the app: paste an API key or sign in through the browser. Credentials are stored by the local engine. |
30
+ | `/connect [provider]` | Connect a provider without leaving the app: paste an API key or sign in through the browser. Credentials are stored by the local engine. The last entry, **+ Custom provider…** (or `/connect custom`), adds any OpenAI- or Anthropic-compatible endpoint — see below. |
30
31
  | `/login` | Connect the wallet Earn mode pays into: browser sign-in, or an address you control. |
31
32
  | `/earn`, `/ads on\|off` | Earnings so far; Earn mode on or off. |
32
33
  | `/new`, `/compact`, `/status`, `/help`, `/exit` | Session and app. |
33
34
 
34
35
  The agent's own commands (`/init`, `/review`, `/goal`) are in the palette too.
35
36
 
37
+ ### Custom providers
38
+
39
+ `/connect` → **+ Custom provider…** adds an endpoint the engine does not know by name: a self-hosted gateway, a reseller, vLLM, Ollama, LM Studio. It asks for
40
+
41
+ 1. a name (shown in the model picker),
42
+ 2. the API style — **OpenAI-compatible** (`/chat/completions`) or **Anthropic-compatible** (`/messages`),
43
+ 3. the base URL, usually ending in `/v1`,
44
+ 4. an API key (optional — leave empty for local servers),
45
+ 5. the model ids, comma-separated — or leave empty to import every model from the endpoint's `/models` list.
46
+
47
+ The endpoint is written to the `providers` section of the engine's global config (`~/.config/opencode/opencode.json`, or `opencode.jsonc` if that is the one you have) and the engine reloads it without a restart. The key goes into the engine's credential store, not into the config file. Adding a provider with the same name again updates it. Then pick a model with `/model`, or start with `latentcode --model <id>/<model>`.
48
+
49
+ The same entry can be written by hand:
50
+
51
+ ```json
52
+ {
53
+ "providers": {
54
+ "my-gateway": {
55
+ "name": "My Gateway",
56
+ "package": "@opencode/ai/providers/openai-compatible",
57
+ "settings": { "baseURL": "https://api.example.com/v1" },
58
+ "models": { "gpt-4.1": { "name": "gpt-4.1" } }
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ For an Anthropic-style endpoint the package is `@opencode/ai/providers/anthropic-compatible`.
65
+
36
66
  Keys: `esc` interrupts, `↑` `↓` recall earlier prompts, `ctrl+a` / `ctrl+e` and `alt+←` / `alt+→` move in the line, `ctrl+o` opens the sponsored link, `ctrl+c` twice quits. Pasted text keeps its line breaks.
37
67
 
38
68
  ### From the shell
@@ -77,7 +107,7 @@ latentcode (this repo) opencode serve (child process, 127.0.0.1, rand
77
107
  - `src/engine/catalog.ts` turns the engine's flat provider and model lists into what the picker shows: providers with a plain connection label, models with size, price and effort levels.
78
108
  - `src/boot.ts` runs start-up as named steps (engine, providers, model, safety, Earn) that the start card displays.
79
109
  - `src/ui/` is the Ink TUI: `App.tsx` (transcript, prompt, palette, status line), `panels/` (model picker, providers and connect, wallet), and the pure helpers `editor.ts`, `markdown.ts`, `commands.ts`, `stdin.ts`.
80
- - `src/ads/controller.ts` holds the ad lifecycle: fetch when work starts, accrue focused visible time, bill once, rotate after 30 s, hide when idle.
110
+ - `src/ads/controller.ts` holds the ad lifecycle: fetch when work starts, accrue focused visible time, bill once at the 10 s view floor, rotate after 10 s, hide when idle (an un-billed ad is held for the next turn while its token is valid). `src/ads/adline.ts` is the shared line format: `Brand — body`, the tracked click link, and the OSC 8 / plain-URL choice per terminal.
81
111
  - `src/ads/{sanitize,classify,killswitch}.ts` are ported from `latent-market/cli/src`. Keep them in sync.
82
112
 
83
113
  ## Tests