eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
26 lines (25 loc) • 1.01 kB
TypeScript
/**
* Outcome of a source-to-source edit attempt. Pure data. On success it carries
* the rewritten source, so the caller owns the filesystem write.
*/
export type SourceEdit = {
readonly kind: "applied";
readonly from: string;
readonly to: string;
readonly nextSource: string;
} | {
readonly kind: "bail";
readonly reason: string;
readonly line: number;
};
/**
* Rewrites the `model` string literal passed to `defineAgent({ ... })` in
* `sourceText`, returning the edited source.
*
* Pure transform: parses with Rolldown, finds the literal's byte span, and splices
* only those bytes, so comments, formatting, and quote style everywhere else
* are preserved by construction. Bails (no edit) when `model` is absent or
* isn't a plain string literal. An env reference, a template, an inlined SDK
* model object, or a spread all opt out into the manual path instead.
*/
export declare function applyModelNameToSource(sourceText: string, modelName: string): Promise<SourceEdit>;