Skip to content

Commit cab088f

Browse files
author
Sentience Dev
committed
Merge pull request #85 from SentienceAPI/overlay
overlay
2 parents 782fd34 + 53de0ec commit cab088f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/agent.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export class SentienceAgent {
8888
private stepCount: number;
8989
private history: HistoryEntry[];
9090
private tokenUsage: TokenStats;
91+
private showOverlay: boolean;
9192

9293
/**
9394
* Initialize Sentience Agent
@@ -96,19 +97,22 @@ export class SentienceAgent {
9697
* @param snapshotLimit - Maximum elements to include in context (default: 50)
9798
* @param verbose - Print execution logs (default: true)
9899
* @param tracer - Optional tracer for recording execution (default: undefined)
100+
* @param showOverlay - Show green bbox overlay in browser (default: false)
99101
*/
100102
constructor(
101103
browser: SentienceBrowser,
102104
llm: LLMProvider,
103105
snapshotLimit: number = 50,
104106
verbose: boolean = true,
105-
tracer?: Tracer
107+
tracer?: Tracer,
108+
showOverlay: boolean = false
106109
) {
107110
this.browser = browser;
108111
this.llm = llm;
109112
this.snapshotLimit = snapshotLimit;
110113
this.verbose = verbose;
111114
this.tracer = tracer;
115+
this.showOverlay = showOverlay;
112116
this.stepCount = 0;
113117
this.history = [];
114118
this.tokenUsage = {
@@ -160,11 +164,15 @@ export class SentienceAgent {
160164
// 1. OBSERVE: Get refined semantic snapshot
161165
const startTime = Date.now();
162166

163-
const snapOpts = {
167+
const snapOpts: SnapshotOptions = {
164168
...snapshotOptions,
165169
goal: snapshotOptions?.goal ?? goal,
166170
limit: snapshotOptions?.limit || this.snapshotLimit,
167171
};
172+
// Apply showOverlay from agent config if not explicitly set in snapshotOptions
173+
if (snapshotOptions?.show_overlay === undefined) {
174+
snapOpts.show_overlay = this.showOverlay;
175+
}
168176

169177
const snap = await snapshot(this.browser, snapOpts);
170178

0 commit comments

Comments
 (0)