Commit Graph

172 Commits

Author SHA1 Message Date
Adrià Arrufat
c2e2717170 deps: update isocline dependency
Updates the isocline dependency to a newer commit and cleans up
redundant comments in Terminal.zig.
2026-06-06 11:07:05 +02:00
Adrià Arrufat
b009e416a6 terminal: add Ctrl-D exit confirmation
Updates the isocline dependency and implements a confirmation prompt
when pressing Ctrl-D to exit the terminal.
2026-06-06 10:42:36 +02:00
Adrià Arrufat
828abda838 terminal: support double Esc clear confirmation
Updates isocline and adds a status bar indicator when a clear
is pending after the first Esc press.
2026-06-06 09:47:00 +02:00
Adrià Arrufat
a771597caa terminal: support Backspace to exit JS mode
Updates the isocline dependency and the status bar exit hint.
2026-06-06 09:18:20 +02:00
Adrià Arrufat
3342813012 build: update isocline dependency 2026-06-05 19:21:22 +02:00
Adrià Arrufat
2d2914e878 agent: add /usage slash command to REPL
Adds a new `/usage` meta command to print cumulative token usage and
cache hit rate for the current session. Also updates zenai.
2026-06-05 13:35:34 +02:00
Adrià Arrufat
5f2330bb2f agent: add reasoning effort configuration
Adds the `--effort` CLI flag and `/effort` REPL command to control
the reasoning budget, persisting the setting in `.lp-agent.zon`.
2026-06-05 12:40:34 +02:00
Adrià Arrufat
6c9c6df3af build: update isocline dependency 2026-06-05 09:11:24 +02:00
Adrià Arrufat
19485f8640 agent: validate models for all providers
Generalizes model reconciliation to support all providers, not just
Ollama. Also updates the zenai dependency.
2026-06-04 20:01:12 +02:00
Adrià Arrufat
7eccdeed72 build: update zenai dependency 2026-06-04 19:35:03 +02:00
Adrià Arrufat
7dae410270 build: update zenai dependency 2026-06-04 19:33:11 +02:00
Adrià Arrufat
760059c085 build: update zenai dependency 2026-06-04 17:54:28 +02:00
Adrià Arrufat
0bb87330a7 agent: abort in-flight LLM requests on cancel
Updates the zenai dependency and integrates `zenai.http.Interrupt`
to immediately abort active LLM requests when cancellation is triggered.
2026-06-04 13:07:06 +02:00
Adrià Arrufat
b29f68ce82 build: bump zenai dependency 2026-06-04 08:34:32 +02:00
Adrià Arrufat
f7c2e0b886 Merge branch 'main' into agent 2026-06-04 08:34:10 +02:00
Karl Seguin
80bf294e1c update v8 dep 2026-06-04 12:49:51 +08:00
Adrià Arrufat
e208b4b638 repl: add dynamic status bar
Integrates isocline's top and bottom bar APIs to display the active
provider, model, and shortcut hints. Updates the status bar on
terminal resize and mode switches.
2026-06-03 15:09:09 +02:00
Adrià Arrufat
993315c770 agent: handle model safety refusals
Updates the `zenai` dependency to support safety finish reasons. Tracks
when a model refuses a request due to safety, prints a specific warning
message, and avoids re-prompting.
2026-06-02 19:39:37 +02:00
Adrià Arrufat
83d07e2c17 build: bump zenai and update help example 2026-06-02 17:31:47 +02:00
Adrià Arrufat
8e063f8e83 repl: add JS evaluation mode 2026-06-02 10:19:37 +02:00
Adrià Arrufat
12b2375969 terminal: support kitty keyboard protocol
Updates the isocline dependency and enables the kitty keyboard
protocol "disambiguate" mode to support Ctrl+Enter detection.
2026-06-02 09:11:56 +02:00
Adrià Arrufat
818b225d99 Merge branch 'main' into agent 2026-06-02 08:12:26 +02:00
Karl Seguin
94ba07913c Merge pull request #2584 from lightpanda-io/request_callback_terminate
Improve forced terminate on CDP client disconnect.
2026-06-02 11:10:57 +08:00
Karl Seguin
79cdbd285d Improve forced terminate on CDP client disconnect.
Depends on https://github.com/lightpanda-io/zig-v8-fork/pull/179

An improvement to https://github.com/lightpanda-io/browser/pull/2515 to prevent
a v8 assertion if we terminate as an inspector dispatch is happening.

The problem is that if we just immediately terminate, we aren't sure what the
worker thread is doing, and, apparently, if we terminate then dispatch a message
to the inspector, we fail an assertion.

With the way the code was, the only safe solution would be to hold a mutex
over the session dispatch, but that could block the network thread.

So instead of terminating from the network thread, we now ask v8 to execute
a callback. This gets executed on the worker thread, which can then terminate
the execution.

The initial version of 2515 delayed the termination from the network thread.
It's possible that solution would "solve" the issue, simply because it's very
unlikely that a worker would be "stuck" for 5 seconds and then get unstuck.
More likely that it exits immediately, or is stuck in an endless loop. But
that would still leave a window where we could terminate in network and then
dispatch in the worker. Less likely, but still possible. Hopefully this new
mechanism eliminates this from being a problem in all circumstances.
2026-06-02 08:27:49 +08:00
Adrià Arrufat
29408bda2b deps: update isocline dependency 2026-06-01 23:14:51 +02:00
Adrià Arrufat
2c39b77591 build: update isocline for bracketed paste 2026-06-01 23:03:10 +02:00
Adrià Arrufat
03e96d9e8f agent: extract settings and use shared utf8 truncation
Extracts provider and model settings logic from `Agent.zig` into a new
`settings.zig` module. Replaces custom UTF-8 truncation logic with
`truncateUtf8` from `string.zig`. Also updates the `zenai` dependency.
2026-06-01 15:03:42 +02:00
Adrià Arrufat
e048b4b293 Merge branch 'main' into agent 2026-06-01 12:36:08 +02:00
Adrià Arrufat
63f2706202 terminal: remove bare command validation
Stop highlighting bare tokens matching tool names as errors. Also
updates the zenai dependency.
2026-05-31 15:29:53 +02:00
Adrià Arrufat
0d22bd32a5 build: bump zenai dependency 2026-05-31 15:25:56 +02:00
Francis Bouvier
8052f0ad81 Agent model provider picker (#2581)
* agent: add a /model command to chnage current model

And remove the pick-model CLI option

* agent: add /provider to change the current provider

* agent: extract requireLlmNoArg helper

* agent: simplify provider detection

* repl: add tab completion for /model and /provider

Changes `/model` and `/provider` to accept an optional name argument
instead of prompting with a numbered list. Bare commands now print the
current selection, while Tab dynamically completes candidates. Model
lists are fetched and cached to prevent redundant network requests.

* agent: remember last selected provider and model

Persists the last selected AI provider and model in a local
`.lp-agent` file and resumes it on startup. Removes the
interactive provider picker in favor of deterministic auto-detection.

* agent: simplify requireLlm and model resolution

Changes `requireLlm` to return a boolean instead of credentials, and
cleans up the model initialization logic to use `resolved` directly.
Also removes unused user errors.

---------

Co-authored-by: Adrià Arrufat <adria.arrufat@gmail.com>
2026-05-30 19:02:44 +02:00
Adrià Arrufat
ff95f83f74 agent: track and print token usage in one-shot mode
Updates zenai and aggregates token usage across all model calls.
Prints a `$usage` summary to stderr at the end of a task.
2026-05-29 12:44:20 +02:00
Karl Seguin
320ffa2819 Improve WPT /url/ tests
This is a bit all over the place.

1 - Replace libidn2 with rust-idna. It looks like there are different idna
    profiles, and rust-idna (from the servo project) implements the whatwg
    one. libidn2 would be too strict in some cases and not strict enough in
    others. (Gemini says I could use libidn2 for this, but what it suggested
    didn't work, and I couldn't figure it out myself, and claude insisted it
    _did not_ have the correct implementation for what we want).

2 - We previously only ran a URL through idna if it wasn't ascii. Turns out
    we also need to run it if there's a "xn--" (aka, an IDNA ACE prefix) in
    there. This helps us pass hundreds of WPT cases, and it's pretty cheap.

3 - Implement more of the Area WebAPI. Mostly copied from Anchor.

4 - Add username/password accessor to Anchor/Area

5 - window.open validates the URL (i.e. tries to resolve it and handles the
    error)

6 - Invalid idna conversion maps to a TypeError

7 - Cleanup closed popups on the next tick (like destroyed pages), rather than
    at an interval or on shutdown. This one seems unrelated, but some of these
    tests are opening hundreds (thousands?) of popups and then closing them.
2026-05-29 18:06:44 +08:00
Adrià Arrufat
ddd9c84195 agent: update zenai and tune agent settings 2026-05-23 23:36:07 +02:00
Adrià Arrufat
e9943a3976 command: use Action enum for ToolCall name
Replaces the string `name` in `ToolCall` with `action: browser_tools.Action`.
This avoids repeated string-to-enum parsing and simplifies schema lookups.
Also updates `zenai` dependency to use its JSON duplication helper.
2026-05-21 22:51:52 +02:00
Adrià Arrufat
19c361c2e8 agent: use zenai credentials detection 2026-05-21 19:03:48 +02:00
Adrià Arrufat
2bd24ba30e agent: use zenai envVarName helper 2026-05-21 18:55:50 +02:00
Adrià Arrufat
0707187fa0 build: bump zenai dependency 2026-05-21 15:11:40 +02:00
Adrià Arrufat
c04062f4de build: bump zenai dependency 2026-05-21 15:04:56 +02:00
Adrià Arrufat
85276df004 deps: update zenai and use thinking_level 2026-05-20 00:16:03 +02:00
Adrià Arrufat
d0a8da453b agent: implement graceful Ctrl-C interruption 2026-05-15 18:45:56 +02:00
Adrià Arrufat
882ed74e89 agent: update zenai and default models 2026-05-14 19:35:38 +02:00
Adrià Arrufat
927340ee64 build: update zenai dependency 2026-05-14 19:07:36 +02:00
Adrià Arrufat
258d6463e5 Merge branch 'main' into agent 2026-05-12 14:42:29 +02:00
Adrià Arrufat
60a880a88c terminal: simplify command completion logic
Removes hardcoded starters and uses trailing spaces to trigger hints for
commands with parameters. Updates isocline dependency.
2026-05-12 11:19:48 +02:00
Karl Seguin
bcd94c4f9d Update v8 dep
https://github.com/lightpanda-io/browser/issues/2407
2026-05-12 14:06:17 +08:00
Adrià Arrufat
2078d332c2 agent: update zenai and tool call handling 2026-05-11 20:28:34 +02:00
Adrià Arrufat
aa9304f150 terminal: add inline hints for commands 2026-05-11 17:52:49 +02:00
Adrià Arrufat
e962ba9575 refactor: simplify terminal prompt and enable brace insertion
- Simplify prompt handling by relying on default markers.
- Enable brace insertion in the terminal.
- Optimize `lpEnvNames` by pre-allocating capacity.
- Clean up and trim verbose comments across `Terminal.zig`.
2026-05-11 17:52:49 +02:00
Adrià Arrufat
5d70174288 terminal: replace linenoise with isocline
Replaces the linenoise library with isocline for improved REPL
functionality. Updates build scripts and moves completion state from
global variables into the Terminal struct.
2026-05-11 17:52:49 +02:00