@highflame/sdk 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -281,7 +281,7 @@ var Highflame = class {
|
|
|
281
281
|
const baseUrl = options.baseUrl ?? SAAS_BASE_URL;
|
|
282
282
|
const tokenUrl = options.tokenUrl ?? SAAS_TOKEN_URL;
|
|
283
283
|
this.#baseUrl = baseUrl.replace(/\/$/, "");
|
|
284
|
-
this.#tokenUrl = options.apiKey.startsWith("hf_sk") ? tokenUrl : void 0;
|
|
284
|
+
this.#tokenUrl = options.apiKey.startsWith("hf_sk") || options.apiKey.startsWith("hfa_") ? tokenUrl : void 0;
|
|
285
285
|
this.#apiKey = options.apiKey;
|
|
286
286
|
this.#timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
287
287
|
this.#maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
package/dist/index.d.cts
CHANGED
|
@@ -36,9 +36,9 @@ interface EvidenceSource {
|
|
|
36
36
|
/** */
|
|
37
37
|
interface ConditionResult {
|
|
38
38
|
/** Actual value from the context (null if field was missing). */
|
|
39
|
-
actual:
|
|
39
|
+
actual: unknown;
|
|
40
40
|
/** Expected value (threshold from the rule). */
|
|
41
|
-
expected:
|
|
41
|
+
expected: unknown;
|
|
42
42
|
/** Context field name. */
|
|
43
43
|
field: string;
|
|
44
44
|
/** Whether this condition matched. */
|
|
@@ -285,13 +285,13 @@ interface DeterminingPolicy {
|
|
|
285
285
|
/** */
|
|
286
286
|
interface EvaluatedExpression {
|
|
287
287
|
/** Actual value from the context. */
|
|
288
|
-
actual?:
|
|
288
|
+
actual?: unknown;
|
|
289
289
|
/** Child expression (for not nodes). */
|
|
290
290
|
child?: EvaluatedExpression;
|
|
291
291
|
/** Child expressions (for and/or nodes). */
|
|
292
292
|
children?: EvaluatedExpression[];
|
|
293
293
|
/** Expected value (threshold from the rule). */
|
|
294
|
-
expected?:
|
|
294
|
+
expected?: unknown;
|
|
295
295
|
/** Context field name. */
|
|
296
296
|
field?: string;
|
|
297
297
|
/** Expression kind: comparison, contains, like, has, and, or, not, raw. */
|
|
@@ -506,8 +506,8 @@ interface ProblemDetails {
|
|
|
506
506
|
interface StreamEvent {
|
|
507
507
|
/** Event payload (DetectorResult for detector_result, GuardResponse for decision). */
|
|
508
508
|
data: Record<string, unknown>;
|
|
509
|
-
/** Event type: detector_result (per-detector), decision (final), or
|
|
510
|
-
type: "detector_result" | "decision" | "error";
|
|
509
|
+
/** Event type: detector_result (per-detector), decision (final), error, or message (keepalive/info). */
|
|
510
|
+
type: "detector_result" | "decision" | "error" | "message";
|
|
511
511
|
}
|
|
512
512
|
/** Response from the token exchange endpoint (used by SDK auth). */
|
|
513
513
|
interface TokenResponse {
|
|
@@ -568,11 +568,11 @@ interface Logger {
|
|
|
568
568
|
warn(message: string, ...args: unknown[]): void;
|
|
569
569
|
}
|
|
570
570
|
interface HighflameOptions {
|
|
571
|
-
/** Service API key (`hf_sk_...`) or a raw JWT. */
|
|
571
|
+
/** Service API key (`hf_sk_...`), agent API key (`hfa_...`), or a raw JWT. */
|
|
572
572
|
apiKey: string;
|
|
573
573
|
/** Base URL of the guard service. Defaults to Highflame SaaS. */
|
|
574
574
|
baseUrl?: string;
|
|
575
|
-
/** Token exchange URL. Defaults to Highflame SaaS.
|
|
575
|
+
/** Token exchange URL. Defaults to Highflame SaaS. Used for `hf_sk_*` and `hfa_*` keys. */
|
|
576
576
|
tokenUrl?: string;
|
|
577
577
|
/** Request timeout in milliseconds. Default: 30000. */
|
|
578
578
|
timeout?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -36,9 +36,9 @@ interface EvidenceSource {
|
|
|
36
36
|
/** */
|
|
37
37
|
interface ConditionResult {
|
|
38
38
|
/** Actual value from the context (null if field was missing). */
|
|
39
|
-
actual:
|
|
39
|
+
actual: unknown;
|
|
40
40
|
/** Expected value (threshold from the rule). */
|
|
41
|
-
expected:
|
|
41
|
+
expected: unknown;
|
|
42
42
|
/** Context field name. */
|
|
43
43
|
field: string;
|
|
44
44
|
/** Whether this condition matched. */
|
|
@@ -285,13 +285,13 @@ interface DeterminingPolicy {
|
|
|
285
285
|
/** */
|
|
286
286
|
interface EvaluatedExpression {
|
|
287
287
|
/** Actual value from the context. */
|
|
288
|
-
actual?:
|
|
288
|
+
actual?: unknown;
|
|
289
289
|
/** Child expression (for not nodes). */
|
|
290
290
|
child?: EvaluatedExpression;
|
|
291
291
|
/** Child expressions (for and/or nodes). */
|
|
292
292
|
children?: EvaluatedExpression[];
|
|
293
293
|
/** Expected value (threshold from the rule). */
|
|
294
|
-
expected?:
|
|
294
|
+
expected?: unknown;
|
|
295
295
|
/** Context field name. */
|
|
296
296
|
field?: string;
|
|
297
297
|
/** Expression kind: comparison, contains, like, has, and, or, not, raw. */
|
|
@@ -506,8 +506,8 @@ interface ProblemDetails {
|
|
|
506
506
|
interface StreamEvent {
|
|
507
507
|
/** Event payload (DetectorResult for detector_result, GuardResponse for decision). */
|
|
508
508
|
data: Record<string, unknown>;
|
|
509
|
-
/** Event type: detector_result (per-detector), decision (final), or
|
|
510
|
-
type: "detector_result" | "decision" | "error";
|
|
509
|
+
/** Event type: detector_result (per-detector), decision (final), error, or message (keepalive/info). */
|
|
510
|
+
type: "detector_result" | "decision" | "error" | "message";
|
|
511
511
|
}
|
|
512
512
|
/** Response from the token exchange endpoint (used by SDK auth). */
|
|
513
513
|
interface TokenResponse {
|
|
@@ -568,11 +568,11 @@ interface Logger {
|
|
|
568
568
|
warn(message: string, ...args: unknown[]): void;
|
|
569
569
|
}
|
|
570
570
|
interface HighflameOptions {
|
|
571
|
-
/** Service API key (`hf_sk_...`) or a raw JWT. */
|
|
571
|
+
/** Service API key (`hf_sk_...`), agent API key (`hfa_...`), or a raw JWT. */
|
|
572
572
|
apiKey: string;
|
|
573
573
|
/** Base URL of the guard service. Defaults to Highflame SaaS. */
|
|
574
574
|
baseUrl?: string;
|
|
575
|
-
/** Token exchange URL. Defaults to Highflame SaaS.
|
|
575
|
+
/** Token exchange URL. Defaults to Highflame SaaS. Used for `hf_sk_*` and `hfa_*` keys. */
|
|
576
576
|
tokenUrl?: string;
|
|
577
577
|
/** Request timeout in milliseconds. Default: 30000. */
|
|
578
578
|
timeout?: number;
|
package/dist/index.js
CHANGED
|
@@ -243,7 +243,7 @@ var Highflame = class {
|
|
|
243
243
|
const baseUrl = options.baseUrl ?? SAAS_BASE_URL;
|
|
244
244
|
const tokenUrl = options.tokenUrl ?? SAAS_TOKEN_URL;
|
|
245
245
|
this.#baseUrl = baseUrl.replace(/\/$/, "");
|
|
246
|
-
this.#tokenUrl = options.apiKey.startsWith("hf_sk") ? tokenUrl : void 0;
|
|
246
|
+
this.#tokenUrl = options.apiKey.startsWith("hf_sk") || options.apiKey.startsWith("hfa_") ? tokenUrl : void 0;
|
|
247
247
|
this.#apiKey = options.apiKey;
|
|
248
248
|
this.#timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
249
249
|
this.#maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|