mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
feat(spec): add llm() action-backend marker
This commit is contained in:
1 parent
6b0d6cb971
commit
e30ed6f7ed
3 files changed
+14
-1
No files matched your search
@@ -57,10 +57,13 @@ export type ActionDescriptor =
|
||||
// weighted: probabilistic choice over child nodes, scanned ascending.
|
||||
// actions: author callback returning a list to pick uniformly from.
|
||||
// builtin: host-backed leaf identified by a verb.
|
||||
// llm: marker selecting the LLM action backend; inert on the JS picker
|
||||
// (walk returns null), Go reads config.model off globalThis.actions.
|
||||
export type GeneratorNode =
|
||||
| { kind: "weighted"; branches: ReadonlyArray<readonly [number, GeneratorNode]> }
|
||||
| { kind: "actions"; generate: () => ActionDescriptor[] }
|
||||
| { kind: "builtin"; verb: BuiltinVerb };
|
||||
| { kind: "builtin"; verb: BuiltinVerb }
|
||||
| { kind: "llm"; config: { model: string } };
|
||||
|
||||
// Candidate is one host-enumerated target for a builtin verb. The host
|
||||
// resolves geometry (and a native selector) so no element handle crosses into
|
||||
|
||||
@@ -34,6 +34,15 @@ export function actions(generator: () => Action[]): GeneratorNode {
|
||||
return { kind: "actions", generate: generator as () => ActionDescriptor[] };
|
||||
}
|
||||
|
||||
// llm selects the LLM action backend: instead of the seeded picker drawing a
|
||||
// random candidate, Go drives an OpenRouter model that chooses which candidate
|
||||
// to act on from the screenshot + the candidate list. The returned marker is
|
||||
// inert on the JS picker (pick.ts walks it to null); Go reads its config.model
|
||||
// off globalThis.actions. API key comes from OPENROUTER_API_KEY.
|
||||
export function llm(config: { model: string }): GeneratorNode {
|
||||
return { kind: "llm", config };
|
||||
}
|
||||
|
||||
export function whenRoute(
|
||||
routeExtractor: { readonly current: string | null },
|
||||
routes: string | readonly string[],
|
||||
|
||||
@@ -42,6 +42,7 @@ export {
|
||||
actions,
|
||||
doubleTaps,
|
||||
from,
|
||||
llm,
|
||||
longPresses,
|
||||
pressKeys,
|
||||
scrolls,
|
||||
|
||||
Reference in new issue
Block a user