Commit graph

294 commits

Author SHA1 Message Date
Sebastian Herrlinger
dc8b93178a test(codemode): expect queued jobs to wait for a search inside a generator, as outside one
On dev, search's input crosses through the host-call path, which waits for
its promises without running other queued jobs first, around a search
outside a generator too. The test still checks that the two agree.
2026-11-18 20:53:49 +01:00
Sebastian Herrlinger
fda6f2df15 fix(codemode): park a search inside a sync generator up to the nearest async boundary 2026-11-18 18:56:13 +01:00
kommander
29915a5310 fix(codemode): assigning undefined fails like assigning a constant
As in the reference, `undefined = 12` and its compound, logical and destructuring forms throw "Cannot assign to constant 'undefined'." instead of a ReferenceError.

language/global-code/import.js fails in the reference as it does here (a relative import throws when it runs instead of a parse error), so it moves from rust-skipped.txt to the reference's skipped.txt.
2026-11-18 18:56:10 +01:00
kommander
e4c73711f3 feat(codemode): real array holes
Arrays hold holes from elisions, Array(n), delete, length and far writes. A hole is not an own property: reads and `in` fall through to the prototypes, keys and for-in skip it, and logs print it empty. Methods follow the reference: the callback methods skip indexes not in the array, the find methods read them live, sort puts holes last, flat drops them, and spreads and copies such as toReversed read them as undefined. Holes cross the extension boundary as holes.

Drops 40 files from rust-skipped.txt, and 15 stale entries from the reference's test262 skipped.txt that its runner passes.
2026-11-18 18:56:10 +01:00
kommander
a74841f11e fix(codemode): give function kinds their own prototypes, like the reference
Function.prototype is a function, and generator, async and async
generator functions inherit from their own prototype objects below it,
as the reference has them. Three test262 files the reference passes were
still in its skipped.txt; they are removed from it.
2026-11-18 18:56:09 +01:00
kommander
ebb15aeb19 feat(codemode): add URI functions, toExponential, Math.sumPrecise, f16round and copyWithin
- encodeURI/encodeURIComponent/decodeURI/decodeURIComponent with the
  reference's URIError messages.
- Number formatting follows JavaScriptCore: toString(radix) ports its exact
  integer digits and shortest-fraction algorithm, toExponential and
  toPrecision round half up on the exact value, toFixed keeps the sign of
  a negative that rounds to zero, and number-to-string picks the even
  digit when two shortest forms tie. Range errors use the host messages.
- Math.sumPrecise sums exactly and rounds once; Math.f16round rounds
  straight from the double; Array.prototype.copyWithin.

Number-to-string and its tie rule live in value.rs, so integers from 2^53
up print their shortest digits instead of every digit.

copyWithin converts its arguments through ToPrimitive like the other Array methods. Number-to-string decides ties in 128-bit integer arithmetic. test262: the reference's skipped.txt drops three copyWithin files the reference passes.
2026-11-18 18:56:09 +01:00
kommander
5cdf1ddc7c feat(codemode): add Iterator helpers, WeakMap, WeakSet, groupBy and Set methods
Iterator with Iterator.from and the lazy helpers (map, filter, take, drop,
flatMap) and consumers (reduce, toArray, forEach, some, every, find),
closing their source on early exit; Map getOrInsert(Computed), Map.groupBy,
Object.groupBy, the Set composition methods over Set-like operands, and
WeakMap/WeakSet. Map and Set methods now reject each other's receivers,
Iterator.prototype.next rejects foreign receivers, and exhausted built-in
iterators stay done, as in the reference.

RegExp: the flag accessors are listed on RegExp.prototype, and patterns
without u or v are matched as code units, so astral literals match.
No new dependencies.

test262: the reference's skipped.txt drops twelve Iterator and Set files the reference itself passes, which pass here too. Built-in iterators report their JS tags ([object Array Iterator], [object Set Iterator]), as the reference now does.
2026-11-18 18:56:09 +01:00
kommander
fccbad7d9e feat(codemode): add RegExp and regex-aware String methods
Regular expression literals, the RegExp constructor with flags, lastIndex,
exec/test, RegExp.escape, and match, matchAll, search, replace, replaceAll
and split with regex patterns, replacement templates and function
replacers.

Adds the regress crate (pure Rust, ECMAScript regex semantics, UTF-16
matching); the stripped embed example grows from 2139576 to 3047304 bytes.

The RegExp pattern, exec/test input and lastIndex convert without consulting program methods, as the reference's coerceToString/coerceToNumber do. test262: the files this fixes leave rust-skipped.txt, and the reference's skipped.txt drops Array lastIndexOf 15.4.4.15-5-21, which the reference passes since its Array arguments go through ToPrimitive.
2026-11-18 18:56:09 +01:00
kommander
230d462289 fix(codemode): parse Unicode 17 identifiers with acorn 8.16 2026-11-18 18:56:08 +01:00
kommander
3dbee2a738 fix(codemode): convert Array arguments, lengths and sort elements through ToPrimitive
The integer arguments of the Array methods, length = object, and the elements a default sort compares call the program's own valueOf/toString, as do String.fromCharCode/fromCodePoint, JSON.parse, and the string iterator's receiver. repeat(NaN) is "", as ToIntegerOrInfinity makes NaN 0.
2026-11-18 18:56:08 +01:00
kommander
0c5a6a6c2b fix(codemode): let in find an array hole's inherited index
The fast path for an integer in an array answered false for a hole; it now answers only for a present element and leaves the rest to the prototype walk, so forEach, some, and reduce visit an index inherited from Array.prototype.
2026-11-18 18:56:01 +01:00
kommander
58579fc70e fix(codemode): match JS in built-in object details
Resolving functions are anonymous, Set.prototype.keys is values, built-in iterators report their kind (Array Iterator, Map Iterator, ...), AggregateError has no own message unless given one, and generator and async functions inherit from their own non-callable function prototypes.
2026-11-18 18:56:01 +01:00
kommander
d4bb17439f fix(codemode): delete on a primitive base is true unless the wrapper owns the key
delete "abc"[5] and delete (1).x are true, as they delete from the wrapper; a string's own index or length still throws in strict mode.
2026-11-18 18:56:01 +01:00
kommander
e70845f198 fix(codemode): evaluate the right side of o.x = v before checking o
PutValue checks the base, so null.x = f() calls f before it throws, and (1).x = f() surfaces f's throw.
2026-11-18 18:55:49 +01:00
kommander
3afec0de63 fix(codemode): evaluate new arguments before checking the constructor
EvaluateNew evaluates the callee and its arguments before IsConstructor, so an argument's side effects and throws come first. Bumps the compiler version, since NEW no longer emits a separate check.
2026-11-18 18:55:49 +01:00
kommander
2a932f1331 fix(codemode): convert functions, generators and iterators through ToPrimitive
Operators and built-in arguments now call their valueOf/toString like any other object, as JS does: fn + 1 is "[object Function]1" and -fn is NaN. Promises and tool references still reject, so a missing await cannot hide.
2026-11-18 18:55:16 +01:00
kommander
798f27e891 docs(codemode): keep the TypeScript and Rust packages equally capable 2026-11-18 18:54:08 +01:00
Aiden Cline
db8730ebcd
fix(codemode): say why an import can't be resolved (#64587) 2026-11-17 22:45:39 -06:00
Aiden Cline
9cfff5f24d
feat(codemode): let an extension name the modules that load its globals (#64516) 2026-11-17 16:59:36 -06:00
Aiden Cline
e92fbcfba1
feat(codemode): let host functions cross back to the host and let globals be constructible (#64472) 2026-11-17 15:11:40 -06:00
James Long
b24d599d33
fix(codemode): let the runtime drop functions and await promises in host-call arguments (#64513) 2026-11-17 20:55:40 +00:00
James Long
2b5ea4977f
fix(codemode): reject an unknown tool's promise instead of throwing (#64510) 2026-11-17 20:42:14 +00:00
James Long
b9029e64a0
refactor(codemode): split the language layer from Code Mode (#64487) 2026-11-17 15:21:51 -05:00
Aiden Cline
f0def1f86f
feat(codemode): let each run pick which of the runtime's extensions it gets (#64482) 2026-11-17 11:53:55 -06:00
Aiden Cline
eaa6075572
feat(codemode): add Node's Buffer (#64365) 2026-11-16 23:55:30 -06:00
Aiden Cline
042badd23f
feat(codemode): let a synchronous global block on an Effect (#64363) 2026-11-16 23:54:45 -06:00
Aiden Cline
df46f6931d
fix(codemode): accept a plain string query in search (#64347) 2026-11-16 21:57:07 -06:00
Kit Langton
62d06fab22
feat(core): turn experimental schedules into automations (#64160) 2026-11-16 17:14:59 -08:00
github-actions[bot]
a554d70499
release: v2.3.0 (#63719)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-13 09:04:03 +00:00
Aiden Cline
27930d26c8
fix(codemode): suggest tools when a namespace is called (#63697) 2026-11-13 00:46:05 -06:00
Aiden Cline
e6f21f95cd
revert(core): restore tool dispatch before nested repair (#63630) 2026-11-13 00:06:23 +00:00
Aiden Cline
a8dde001d3
feat(codemode): stream fetch response bodies (#63436) 2026-11-12 17:50:06 -06:00
Aiden Cline
c80548e800
fix(core): honor plugin tool repairs in Code Mode (#63444) 2026-11-12 17:44:07 -06:00
Aiden Cline
a3d6e54b3d
fix(codemode): decode UTF-8 across chunk boundaries (#63600) 2026-11-12 20:30:06 +00:00
James Long
a73657f3f9
refactor(codemode): flatten the VM into src and remove two-engine leftovers (#63377) 2026-11-12 13:39:15 -05:00
James Long
72616be4db
refactor(codemode): remove the legacy interpreter; the VM is the only engine (#62642) 2026-11-11 11:25:37 -05:00
Dax Raad
36f559b0c6 chore: move the data site off sst
the stats site, its og worker and the sync workflow deploy from services/data with cf as
opencode-data-<stage>, opencode-data-og-<stage> and opencode-data-sync-<stage>. the beta
web app and the whole sst setup (sst.config.ts, infra/, sst-env.d.ts, the sst dependency)
are gone, so nothing deploys through sst anymore (security finding #920).
2026-11-10 22:46:25 -05:00
Aiden Cline
59ed43f0b8
feat(codemode): rank tool search with name-weighted BM25 (#62984) 2026-11-10 19:44:40 -06:00
Aiden Cline
53f2d631df
feat(core): use freeform tool input on models that support it (#61703) 2026-11-10 15:15:25 -06:00
github-actions[bot]
8aa00e805e
release: v2.2.7 (#63085)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-10 04:49:26 -06:00
github-actions[bot]
5f76acb125
release: v2.2.6 (#62450)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-10 01:36:56 -06:00
Adam
05099eaa0b
refactor(codemode): remove the import cycle in interpreter (#62886) 2026-11-09 07:38:49 -06:00
James Long
c33eaa170e
feat(codemode): idempotent and durable tools, and safe suspension on the VM (#62459)
Some checks failed
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check-test / affected packages (push) Waiting to run
check-test / unit (linux) (push) Waiting to run
check-test / unit (windows) (push) Waiting to run
check-test / build (linux) (push) Waiting to run
check-test / build (windows) (push) Waiting to run
check-test / e2e (, ) (push) Blocked by required conditions
check-test / e2e (linux) (push) Blocked by required conditions
check-test / e2e (windows) (push) Blocked by required conditions
check / typecheck (push) Waiting to run
deploy-files / deploy (push) Waiting to run
deploy-site / deploy (push) Waiting to run
deploy / deploy (push) Waiting to run
bot-docs-locale / sync-locales (push) Has been cancelled
Process daemon / Miri (callback ownership) (push) Has been cancelled
Process daemon / Core (macos-15) (push) Has been cancelled
Process daemon / Core (ubuntu-22.04) (push) Has been cancelled
Process daemon / Windows (arm64) (push) Has been cancelled
Process daemon / Windows (x64) (push) Has been cancelled
2026-11-07 13:06:40 -06:00
Filip
0f1ddb4643
fix: flaky CI tests and the app races behind them (#62597) 2026-11-07 18:50:37 +01:00
James Long
33f94fce96
feat(codemode): expose the VM's suspendable program API (#62413) 2026-11-06 16:44:13 -06:00
James Long
a04dc98d60
fix(codemode): drop test262 corpus symlinks committed by accident (#62394) 2026-11-06 12:51:26 -06:00
James Long
ffde0f7d47
feat(codemode): add a bytecode VM engine behind CodeMode.make({ engine: "vm" }) (#62357) 2026-11-06 11:37:45 -06:00
Aiden Cline
adcfc83d19
feat(codemode): let programs import globals by Node module name (#61151) 2026-11-01 21:52:57 -06:00
github-actions[bot]
4878a0e30f
release: v2.2.5 (#60744)
Brings the versions and changelog of the published v2.2.5 release back to dev.
2026-10-30 19:18:59 -04:00
github-actions[bot]
872f694b05
release: v2.2.4 (#60664)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-30 13:06:06 -04:00