Commit Graph
9542 Commits
Author SHA1 Message Date
Adrià Arrufat 0035d31fc9 codex: use std.json.fmt for poll body 2026-07-29 09:12:16 +02:00
Adrià Arrufat 6c28c3d6c9 auth: log warning on token persistence failure 2026-07-29 09:11:46 +02:00
Adrià Arrufat 52c2b90d30 auth: set token file permissions on creation 2026-07-29 09:07:51 +02:00
Adrià Arrufat 041ca0ba51 auth: pass allocator to token store save/delete functions 2026-07-29 09:00:46 +02:00
Karl Seguin 8023f6e1da crash: Capture ExecutionTerminated and propagate it
Prevent re-entering JavaScript when watch/cdp-detection terminates the execution
This can result in a V8 DCHECK failure.
2026-07-29 14:53:02 +08:00
Karl Seguin c6afbdd224 remove _proto from Element 2026-07-29 10:34:03 +08:00
Karl Seguin c78c8b7e22 remove _proto from Node and CData 2026-07-29 10:34:03 +08:00
Karl Seguin a1a8fb6dc3 design: TaggedOpaque fromJS is now offset based
As part of the ongoing effort to remove the `_proto: *Parent` field,
TaggedOpaque.fromJS is now offset based. Technically this should perform better
since we're no longer walking through pointers. But the real goal is that we
can now start removing _proto fields.

But, for fromJS to be offset-based, we had to make sure every prototype chain
was a contiguous allocation. The Factory did this, but not everything used the
factory. Now, everything does. This change alone, without the fromJS change,
made every WebAPI allocation more consistent.
2026-07-29 10:34:03 +08:00
Karl Seguin 678971e320 design: rework cdata _type field
Ultimately, our goal is to remove the `_proto: *Field`. That would save 24
bytes per Text node (or Element, ...). Large websites have 20K+ nodes, so we're
talking 300-500KB savings.

ef756b0c96 was the first phase of this. This is
the second, and it's targetting at CData for a simple reason: CData currently
has an optimization that makes removal of `_proto: *Field` difficult: it
directly embeds its empty types (most notably, Text). Zig's @offsetOf doesn't
work on tagged unions, so we'd have to jump through hoops to figure it out (it
is doable though). Also, CData has a "incorrect" flattened CDATASection
specifically so that Text doesn't inherit a _type union..so that's another
problem.

The solution is to move to bare unions, which allows us to use our Factory
to control the layout of the CData and thus have predictable offsets.

CData is now an inconsistent with the rest, but, at the very least, all Node
types will move in this direction.
2026-07-29 10:34:03 +08:00
Karl Seguin d5183da540 design: add explicit Proto declaration to every type
This is groundwork for eventually removing the _proto: *X` field from some
types (in order to save 8 bytes per, e.g. Node). For now, all `_proto: *X`
fields are untouched, BUT, all compile-time chain walking now happens against
this new declaration.
2026-07-29 10:34:01 +08:00
Karl Seguin a2459b62d4 fix: collection bugs
Builds on top of the excellent https://github.com/lightpanda-io/browser/pull/3072

1 - HTMLAllCollection now composes NodeLive to get the performance benefit
2 - NodeLive now also optimizes for same-index access, e.g. x[i].a, x[i].b.
3 - NodeLive and RadioNodeList now don't lose their position when different
    operations types are mixed (e.g. next() wit getAtIndex())
2026-07-29 07:20:48 +08:00
Karl Seguin 5bbec625d0 Merge pull request #3068 from lightpanda-io/node-children-design
mem: optimize node child list
2026-07-29 06:45:51 +08:00
Karl Seguin 53ad5f53f6 Merge pull request #3067 from lightpanda-io/dead-imports
chore: remove unused imports
2026-07-29 06:45:30 +08:00
Karl Seguin 0c32de315f Merge pull request #3066 from lightpanda-io/svg-cleanup
webapi: SVG cleanup
2026-07-29 06:45:15 +08:00
Karl Seguin 1414a7d549 Merge pull request #3072 from staylor/fix/htmlcollection-indexed-walk
Keep ascending live collection reads linear
2026-07-28 19:46:14 +08:00
Adrià Arrufat a324ad9add build: update zenai dependency 2026-07-28 13:29:05 +02:00
Adrià Arrufat 8b6f7fe064 agent: simplify credential and key ownership handling 2026-07-28 13:05:46 +02:00
Adrià Arrufat a53fbcc6eb agent: introduce KeyOwnership union for credentials
Consolidates owned_key, session, and unowned env key management into a
tagged union KeyOwnership to simplify resource lifetime handling.
2026-07-28 12:44:37 +02:00
Adrià Arrufat 00cdc3ba8d agent: update zenai and switch auth to interruptible HTTP 2026-07-28 11:17:08 +02:00
Adrià Arrufat 01a7b091db agent: map models_dev_id and filter tool-call models 2026-07-28 10:56:24 +02:00
Adrià Arrufat 819aee3c07 agent: support login cancellation and provider completion` 2026-07-28 10:28:18 +02:00
Adrià Arrufat d7cc090ca1 Merge branch 'main' into codex 2026-07-28 10:11:31 +02:00
Adrià Arrufat c9f7a11e42 Merge pull request #3073 from lightpanda-io/agent-tool-cap
agent: reduce tool output cap to 64KB except for extract
2026-07-28 09:44:39 +02:00
Adrià Arrufat a2e8ce8f50 agent: reduce tool output cap to 64KB except for extract 2026-07-28 09:17:34 +02:00
Scott Taylor 90ce6cc8d5 Keep ascending live collection reads linear
Assisted-By: devx/c039aa47-6c81-41c4-bd11-6e6cb835334c
2026-07-27 23:49:48 -04:00
Karl Seguin 3bf98a33fd mem: optimize node child list
Reworks how a Node's child list is modeled. This used to be a optional pointer
to the child list, along with a Node representing this node's linkedlist node
in the parent's child list.

The new model is the same 24 bytes, but it's fully embedded: nodes with children
don't require another 16 byte allocation.

Generally speaking, this is more linked-list-ish, so it does simplify the code.
`linkToNode` is removed BUT, the first child's `_prev` points to the last child,
which is a bit unusual but necessary so that `lastChild` remains O(1).
2026-07-28 10:39:49 +08:00
Karl Seguin a67fe9f90a chore: remove unused imports 2026-07-28 09:39:02 +08:00
Karl Seguin 5fe387a46a Merge pull request #3065 from lightpanda-io/remove-sendMessageToTarget-assertion
crash: remove Target.sendMessageToTarget session_id assertion
2026-07-28 09:23:51 +08:00
Karl Seguin f02d73e978 Merge pull request #3063 from lightpanda-io/js-error-metrics
metrics: Add JS error count
2026-07-28 09:20:54 +08:00
Karl Seguin 2312972097 Merge pull request #3062 from lightpanda-io/remove-session-injection
chore: remove Session injection code (nothing is using it)
2026-07-28 09:20:38 +08:00
Karl Seguin cc33bb38d1 Merge pull request #3061 from lightpanda-io/consistent-clocks
chore: make our use of clock/timestamp more consistent
2026-07-28 09:20:18 +08:00
Karl Seguin b7b910cae5 Merge pull request #3060 from lightpanda-io/unmanaged-memory-pool
chore: Replace deprecated MemoryPool with Managed Memory Pool
2026-07-28 09:19:55 +08:00
Karl Seguin 738ff60b57 webapi: SVG cleanup
This is a follow up to the large SVG change that has landed (1). Most changes
are mechanical or superficial (proper license headers, removing "pub" where not
needed, ...). But there were also a few finalizer/arena tweaks to tighten
lifetimes.

(1) https://github.com/lightpanda-io/browser/pull/3012
2026-07-28 09:17:28 +08:00
Adrià Arrufat 8b34853629 Merge pull request #3064 from lightpanda-io/translate-c
Replace @cImport with build-system translateC
2026-07-27 20:06:28 +02:00
Karl Seguin 470c0ef782 Merge pull request #3032 from mh0pe/codex/svg-07-text
webapi: add dependency-free SVG text DOM
2026-07-27 21:58:43 +08:00
Karl Seguin 700dfe5b74 count in utf-16, like a browser 2026-07-27 20:27:51 +08:00
Madison Steiner 5e6395c6ad webapi: add dependency-free SVG text DOM 2026-07-27 19:59:08 +08:00
Karl Seguin 1e6cd4f4bf Merge pull request #3029 from mh0pe/codex/svg-06-resources
webapi: add live SVG resource elements
2026-07-27 19:56:23 +08:00
Karl Seguin 51d63098fd Fix license header
more consistent formatting. More consistent results with Chrome
2026-07-27 19:37:34 +08:00
Madison Steiner bb063c77bd webapi: add live SVG resource elements 2026-07-27 19:06:05 +08:00
Karl Seguin 708835b08b crash: remove Target.sendMessageToTarget session_id assertion
closeTarget above implies that the state this assertion guards against IS valid
AND we just had a crash report confirming. That's enough for me to remove it.
2026-07-27 18:56:29 +08:00
Karl Seguin 302fc79a59 Merge pull request #3031 from mh0pe/codex/svg-05-structure
webapi: add SVG structural elements
2026-07-27 18:56:06 +08:00
Karl Seguin 00a0517df3 Add correct license header
Format / consistency with rest of the codebase
2026-07-27 18:36:51 +08:00
Madison Steiner 0648da895c webapi: add SVG structural elements 2026-07-27 18:13:13 +08:00
Adrià Arrufat cbce632401 Replace @cImport with build-system translateC
Zig 0.17 removes @cImport in favor of translate-c steps in the build
system. Each library's link function now creates an addTranslateC step
exposed as a module import: curl and isocline translate their headers
straight from the dependency tree, while sqlite3 uses the artifact's
emitted include tree since the amalgamation lives in a sub-dependency.

Terminal.zig and prompt_assist.zig previously instantiated two
independent @cImport namespaces for isocline; they now share one
translated module, so its types are identical across both files.
2026-07-27 12:07:28 +02:00
Karl Seguin 3a84a83d8c Merge pull request #3033 from mh0pe/codex/svg-04-geometry
webapi: implement SVG geometry
2026-07-27 18:04:44 +08:00
Karl Seguin b364a8d487 metrics: Add JS error count
This isn't exhaustive, but it covers _most_ cases where we call v8 (and the
most important ones, e.g. from ScriptManager and EventManager).

There's also a Page counter which, in the future, I'd like to expose in some way
such as via a custom cdp command or in a fetch --dump json to provide insight
on the "health" of the page/result.
2026-07-27 18:04:14 +08:00
Karl Seguin 952a860119 Add re-usable buffer (instead of frame.arena) to limit memory usage
Fix PathData.zig flatness bug.

Ensure tests pass on Chrome, and match implementation to that
2026-07-27 17:27:06 +08:00
Adrià Arrufat e99a5ab99b agent: pivot subscription auth from Claude Code to Codex
Replace the Anthropic Claude-Code-import flow with OpenAI Codex (ChatGPT
subscription) OAuth: device-code login, a real token store (auth.json,
0600) with refresh-grant, and JWT ChatGPT-Account-Id extraction. Codex is
now a distinct zenai provider, so the bearer-mode credential collapses to
provider==.codex; account_id threads to the client via InitOptions.

Unit-tested (build green): JWT account-id extraction, token store
round-trip, OAuth request-body encoding, token-response parsing. The
device-login / refresh network path is unverified pending a subscription.

Pins zenai to the codex branch (6967324).
2026-07-27 11:24:01 +02:00
Madison Steiner 2e89b805fc webapi: implement SVG geometry 2026-07-27 13:48:18 +08:00