Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/backends/sentience-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export interface SentienceContextState {
* Options for SentienceContext initialization.
*/
export interface SentienceContextOptions {
/** Sentience API key for gateway mode */
/** Canonical API key for gateway mode */
predicateApiKey?: string;
/** Backward-compatible API key alias */
sentienceApiKey?: string;
/** Force API vs extension mode (auto-detected if undefined) */
useApi?: boolean;
Expand Down Expand Up @@ -121,7 +123,7 @@ export class SentienceContext {
private _selector: Required<TopElementSelector>;

constructor(options: SentienceContextOptions = {}) {
this._apiKey = options.sentienceApiKey;
this._apiKey = options.predicateApiKey ?? options.sentienceApiKey;
this._useApi = options.useApi;
this._maxElements = options.maxElements ?? 60;
this._showOverlay = options.showOverlay ?? false;
Expand Down Expand Up @@ -165,7 +167,7 @@ export class SentienceContext {

// Set API options
if (this._apiKey) {
snapshotOptions.sentienceApiKey = this._apiKey;
snapshotOptions.predicateApiKey = this._apiKey;
}
if (this._useApi !== undefined) {
snapshotOptions.useApi = this._useApi;
Expand Down
4 changes: 3 additions & 1 deletion src/backends/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@
useApi?: boolean;
/** Gateway snapshot timeout (milliseconds) */
gatewayTimeoutMs?: number;
/** API key for server-side processing */
/** Canonical API key for server-side processing */
predicateApiKey?: string;
/** Backward-compatible API key alias */
sentienceApiKey?: string;
/** Goal/task description for ordinal support and gateway reranking */
goal?: string;
Expand Down Expand Up @@ -286,7 +288,7 @@

while (true) {
const elapsed = Date.now() - startTime;
pollCount++;

Check warning on line 291 in src/backends/snapshot.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20)

'pollCount' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 291 in src/backends/snapshot.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20)

'pollCount' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 291 in src/backends/snapshot.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20)

'pollCount' is assigned a value but never used. Allowed unused vars must match /^_/u

if (elapsed >= timeoutMs) {
// Gather diagnostics
Expand Down
2 changes: 1 addition & 1 deletion tests/backends/sentience-context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('SentienceContext', () => {

it('should use custom values', () => {
const ctx = new SentienceContext({
sentienceApiKey: 'test-key',
predicateApiKey: 'test-key',
maxElements: 100,
showOverlay: true,
topElementSelector: {
Expand Down
Loading