From 88fb255ec7a623102c138b41c2777af81f511fe9 Mon Sep 17 00:00:00 2001 From: SentienceDEV Date: Wed, 11 Feb 2026 18:37:12 -0800 Subject: [PATCH] Canonical predicate* params --- src/backends/sentience-context.ts | 8 +++++--- src/backends/snapshot.ts | 4 +++- tests/backends/sentience-context.test.ts | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/backends/sentience-context.ts b/src/backends/sentience-context.ts index 785ff6c..68b1b70 100644 --- a/src/backends/sentience-context.ts +++ b/src/backends/sentience-context.ts @@ -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; @@ -121,7 +123,7 @@ export class SentienceContext { private _selector: Required; 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; @@ -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; diff --git a/src/backends/snapshot.ts b/src/backends/snapshot.ts index c86057c..4d18fec 100644 --- a/src/backends/snapshot.ts +++ b/src/backends/snapshot.ts @@ -106,7 +106,9 @@ export interface SnapshotOptions { 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; diff --git a/tests/backends/sentience-context.test.ts b/tests/backends/sentience-context.test.ts index 2993660..992fab0 100644 --- a/tests/backends/sentience-context.test.ts +++ b/tests/backends/sentience-context.test.ts @@ -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: {