diff --git a/generators/guests/bin/prism-generators b/generators/guests/bin/prism-generators index 4a16540e..48ee97c0 100755 Binary files a/generators/guests/bin/prism-generators and b/generators/guests/bin/prism-generators differ diff --git a/generators/guests/lock.json b/generators/guests/lock.json index b79c2469..57e3ef8c 100644 --- a/generators/guests/lock.json +++ b/generators/guests/lock.json @@ -1,5 +1,5 @@ { "comment": "Written by tools/generators/build.sh. GN-01 fails when generators/guests or its program no longer match.", - "sources": "35aa266943615126e42f16c5b5187f7e92d68dcdd1a0be5d143e59b92fcfb7fc", - "program": "dd425c57a0d5aa7b97471ff2bfb239962d7d018f8de3fda49015f39221350213" + "sources": "b0c2fac7e803f1f7da2f58f118bf5571b79ab6d9fa322ee3f215fdc1782f110b", + "program": "19b568c1186582ca06bf7e745684817b28255d31e603beee2f37ce133690d1ff" } diff --git a/generators/guests/src/GenGuests.lex.tex b/generators/guests/src/GenGuests.lex.tex index 03f5fe1c..1ec06438 100644 --- a/generators/guests/src/GenGuests.lex.tex +++ b/generators/guests/src/GenGuests.lex.tex @@ -296,28 +296,56 @@ name: ggCore2P3, parameters: [], result: Bytes, - body: 0x61636b6564202620307866666666666666666e2929293b0a7d0a0a2f2f204120667265736820696e7374616e63652070657220726571756573743a20746865206775657374277320616c6c6f6361746f72206e657665722066726565732c20616e64206e6f2073746174652063617272696573206f7665722e0a6578706f7274 + body: 0x61636b6564202620307866666666666666666e2929293b0a7d0a0a2f2f204f6e6520696e7374616e63652c206b65707420616e6420707574206261636b20617320697420626567616e206265666f7265206561636820726571756573743a20697473206d656d6f72790a2f2f2061626f76652074686520737461636b20617320 } definition{ name: ggCore2P4, parameters: [], result: Bytes, - body: 0x206173796e632066756e6374696f6e206f70656e47756573742862797465732c2073686132353629207b0a2020636f6e7374206d6f64756c65203d20617761697420636f6d70696c652862797465732c20736861323536293b0a202072657475726e206173796e6320286c696e6529203d3e2072756e28286177616974205765 + body: 0x666972737420696e7374616e7469617465642c20616e6420776861742069742067726577206279207a65726f2e20416e20696e7374616e63650a2f2f2061207265717565737420747261707065642069732064726f707065642e20536f206e6f2073746174652063617272696573206f7665722c20616e642061736b696e6720 } definition{ name: ggCore2P5, parameters: [], result: Bytes, - body: 0x62417373656d626c792e696e7374616e7469617465286d6f64756c652c207b7d29292e6578706f7274732c206c696e65293b0a7d0a + body: 0x6f6674656e0a2f2f20646f6573206e6f74206c6561766520616e20696e7374616e636520626568696e6420656163682074696d652e0a6578706f7274206173796e632066756e6374696f6e206f70656e47756573742862797465732c2073686132353629207b0a2020636f6e7374206d6f64756c65203d20617761697420636f +} + +definition{ + name: ggCore2P6, + parameters: [], + result: Bytes, + body: 0x6d70696c652862797465732c20736861323536293b0a20206c65742078203d206e756c6c2c206669727374203d206e756c6c2c2066726f6d203d20303b0a202072657475726e206173796e6320286c696e6529203d3e207b0a20202020696620287829207b20636f6e7374206d656d6f7279203d206e65772055696e74384172 +} + +definition{ + name: ggCore2P7, + parameters: [], + result: Bytes, + body: 0x72617928782e6d656d6f72792e627566666572293b206d656d6f72792e7365742866697273742c2066726f6d293b206d656d6f72792e66696c6c28302c2066726f6d202b2066697273742e6c656e677468293b207d0a20202020656c7365207b2078203d2028617761697420576562417373656d626c792e696e7374616e7469 +} + +definition{ + name: ggCore2P8, + parameters: [], + result: Bytes, + body: 0x617465286d6f64756c652c207b7d29292e6578706f7274733b2066726f6d203d204e756d62657228782e5f5f737461636b5f686967683f2e76616c7565203f3f2030293b206669727374203d206e65772055696e7438417272617928782e6d656d6f72792e627566666572292e736c6963652866726f6d293b207d0a20202020 +} + +definition{ + name: ggCore2P9, + parameters: [], + result: Bytes, + body: 0x747279207b2072657475726e2072756e28782c206c696e65293b207d20636174636820286572726f7229207b2078203d206e756c6c3b207468726f77206572726f723b207d0a20207d3b0a7d0a } definition{ name: ggCore2, parameters: [], result: Bytes, - body: (ggApp (ggApp (ggCore2P0) (ggApp (ggCore2P1) (ggCore2P2))) (ggApp (ggCore2P3) (ggApp (ggCore2P4) (ggCore2P5)))) + body: (ggApp (ggCore2P0) (ggApp (ggCore2P1) (ggApp (ggCore2P2) (ggApp (ggCore2P3) (ggApp (ggCore2P4) (ggApp (ggCore2P5) (ggApp (ggCore2P6) (ggApp (ggCore2P7) (ggApp (ggCore2P8) (ggCore2P9)))))))))) } definition{ diff --git a/site/annotation/guest.mjs b/site/annotation/guest.mjs index 5348e795..c58804e3 100644 --- a/site/annotation/guest.mjs +++ b/site/annotation/guest.mjs @@ -24,8 +24,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/card.mjs b/site/card.mjs index 3e68f561..ef68158d 100644 --- a/site/card.mjs +++ b/site/card.mjs @@ -333,8 +333,14 @@ export default async function start({ app, reason, $ }) { return; } - // The root guest: " " in, the facet's answer out. - const line = async (text) => decoder.decode(await app.dispatch(encoder.encode(text))).trim(); + // The root guest: " " in, the facet's answer out. The guest takes + // no imports and each request runs alone, so the same line has the same + // answer: it is asked once and remembered. The runtime starts an instance for + // every request, and the browser can refuse one more before it has let the + // earlier ones go; a line refused so is asked again a moment later. + const ask = async (text, tries = 4) => { try { return decoder.decode(await app.dispatch(encoder.encode(text))).trim(); } catch (error) { if (tries < 2 || !/out of memory/i.test(String(error?.message ?? error))) throw error; await new Promise((again) => setTimeout(again, 250)); return ask(text, tries - 1); } }; + const asked = new Map(); + const line = (text) => asked.get(text) ?? (asked.size > 4096 && asked.clear(), asked.set(text, ask(text).catch((error) => { asked.delete(text); throw error; })).get(text)); // The vault: kept in this browser, every keep and read decided by the app. let vault = null; diff --git a/site/dest/guest.mjs b/site/dest/guest.mjs index 9e30d914..7e94ac67 100644 --- a/site/dest/guest.mjs +++ b/site/dest/guest.mjs @@ -24,8 +24,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/emma/guest.mjs b/site/emma/guest.mjs index 2a032dc7..a480e98a 100644 --- a/site/emma/guest.mjs +++ b/site/emma/guest.mjs @@ -33,8 +33,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/google/guest.mjs b/site/google/guest.mjs index cc578ddf..2632ff9f 100644 --- a/site/google/guest.mjs +++ b/site/google/guest.mjs @@ -27,8 +27,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/holon/guest.mjs b/site/holon/guest.mjs index 4b872f69..d62bf317 100644 --- a/site/holon/guest.mjs +++ b/site/holon/guest.mjs @@ -27,8 +27,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/kappa/guest.mjs b/site/kappa/guest.mjs index 3ea68014..6ef350b5 100644 --- a/site/kappa/guest.mjs +++ b/site/kappa/guest.mjs @@ -24,8 +24,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/message/guest.mjs b/site/message/guest.mjs index 9a73d5ad..501fb1ae 100644 --- a/site/message/guest.mjs +++ b/site/message/guest.mjs @@ -28,10 +28,18 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } // The same, answered synchronously once the one asynchronous step (check and diff --git a/site/prov/guest.mjs b/site/prov/guest.mjs index 9dee7762..80f6c957 100644 --- a/site/prov/guest.mjs +++ b/site/prov/guest.mjs @@ -27,8 +27,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/read/guest.mjs b/site/read/guest.mjs index 033e35eb..883e7172 100644 --- a/site/read/guest.mjs +++ b/site/read/guest.mjs @@ -27,10 +27,18 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } // The same, answered synchronously once the one asynchronous step (check and diff --git a/site/resonance/guest.mjs b/site/resonance/guest.mjs index 558f8398..7653a6de 100644 --- a/site/resonance/guest.mjs +++ b/site/resonance/guest.mjs @@ -24,8 +24,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/scxml/guest.mjs b/site/scxml/guest.mjs index e5bdb6ea..5f4f864e 100644 --- a/site/scxml/guest.mjs +++ b/site/scxml/guest.mjs @@ -24,8 +24,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/senses/guest.mjs b/site/senses/guest.mjs index d8a935fc..877f17c1 100644 --- a/site/senses/guest.mjs +++ b/site/senses/guest.mjs @@ -24,8 +24,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/turtle/guest.mjs b/site/turtle/guest.mjs index 3c3f5944..0fec864b 100644 --- a/site/turtle/guest.mjs +++ b/site/turtle/guest.mjs @@ -28,8 +28,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/site/uorc/guest.mjs b/site/uorc/guest.mjs index f5300d6e..b61cfd26 100644 --- a/site/uorc/guest.mjs +++ b/site/uorc/guest.mjs @@ -24,8 +24,16 @@ function run(x, line) { return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn))); } -// A fresh instance per request: the guest's allocator never frees, and no state carries over. +// One instance, kept and put back as it began before each request: its memory +// above the stack as first instantiated, and what it grew by zero. An instance +// a request trapped is dropped. So no state carries over, and asking often +// does not leave an instance behind each time. export async function openGuest(bytes, sha256) { const module = await compile(bytes, sha256); - return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line); + let x = null, first = null, from = 0; + return async (line) => { + if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); } + else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); } + try { return run(x, line); } catch (error) { x = null; throw error; } + }; } diff --git a/test/oracle/intent.test.mjs b/test/oracle/intent.test.mjs index 50e32db8..e7c73264 100644 --- a/test/oracle/intent.test.mjs +++ b/test/oracle/intent.test.mjs @@ -30,8 +30,7 @@ import { serve } from "./examples.mjs"; const { chromium } = createRequire(import.meta.url)("playwright"); const read = (path) => JSON.parse(readFileSync(new URL(path, import.meta.url), "utf8")); -const record = read("../../app/specs/product/quality/QR-16.json"); -const threshold = Object.fromEntries(record.measures.map((m) => [m.key, m.threshold])); +const threshold = Object.fromEntries(read("../../app/specs/product/quality/QR-16.json").measures.map((m) => [m.key, m.threshold])); const { corpus } = read("corpus.json"); const acts = corpus.filter((e) => e.kind === "act").map((e) => e.expect); const line = async (text) => judge(Object.fromEntries(FIELDS.map(([name], i) => [name, text.split(" ")[i + 1]]))); diff --git a/tools/oracle/gen.py b/tools/oracle/gen.py index 64791bd0..a26bc232 100644 --- a/tools/oracle/gen.py +++ b/tools/oracle/gen.py @@ -1504,10 +1504,9 @@ def read_similarity(raw): # the tests that read them (test/oracle/intent.test.mjs); written outside it. # They are downloaded, so it needs --fetch. if "--held" in args: - out = pathlib.Path(args[args.index("--held") + 1]) rows = [row for source in SPEC["sources"] if source.get("held") for row in dialogue_examples(fetch(source), source)] - out.write_text("\n".join(rows) + "\n", encoding="utf-8") - print(f"oracle: {len(rows)} held examples to {out}") + pathlib.Path(args[args.index("--held") + 1]).write_text("\n".join(rows) + "\n", encoding="utf-8") + print(f"oracle: {len(rows)} held examples written") sys.exit(0) corpus, texts = [], {}