mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(spec): expose __sanderlingSampleInput__ corpus draw
This commit is contained in:
1 parent
6a084b6740
commit
71afe0c914
1 file changed
+8
@@ -9,6 +9,7 @@
|
||||
|
||||
import { Pcg } from "./pcg.ts";
|
||||
import { nextAction, walk } from "./pick.ts";
|
||||
import { INPUT_CORPUS } from "./corpus.ts";
|
||||
import type { ActionDescriptor, GeneratorNode, Host } from "./action-tree.ts";
|
||||
import type { Point } from "./types.ts";
|
||||
|
||||
@@ -130,6 +131,13 @@ export function installRuntime(
|
||||
const resolveRoot = typeof root === "function" ? root : () => root;
|
||||
const resolveSetup = () =>
|
||||
(globalThis as { setup?: GeneratorNode }).setup ?? null;
|
||||
// The LLM action backend (Go) types InputText values by drawing from the same
|
||||
// edge-case corpus the seeded `typing` builtin uses. Expose that draw here so
|
||||
// Go reuses the exact sampler rather than reimplementing the corpus.
|
||||
defineLockedGlobal(
|
||||
"__sanderlingSampleInput__",
|
||||
() => INPUT_CORPUS[rng.intN(INPUT_CORPUS.length)] ?? "",
|
||||
);
|
||||
defineLockedGlobal("__sanderlingExtractors__", () => evaluateExtractors());
|
||||
defineLockedGlobal("__sanderlingNextAction__", () => {
|
||||
// resolveRoot runs first: on web it also resets the per-tick candidate
|
||||
|
||||
Reference in new issue
Block a user