@webdecoy/node 0.25.2 → 0.26.0

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.js CHANGED
@@ -74,6 +74,7 @@ __export(index_exports, {
74
74
  createClearanceGate: () => createClearanceGate,
75
75
  createDetectAndGate: () => createDetectAndGate,
76
76
  createFetchGuard: () => createFetchGuard,
77
+ createOffensiveToolchainEvidence: () => createOffensiveToolchainEvidence,
77
78
  deriveAndArm: () => deriveAndArm,
78
79
  deriveKey: () => deriveKey,
79
80
  filter: () => filter,
@@ -255,7 +256,11 @@ var WebDecoyClient = class {
255
256
  }
256
257
  throw new Error(`API request failed: HTTP ${response.status}`);
257
258
  }
258
- return response.data;
259
+ const detection = response.data;
260
+ if (request.decision_mode === "unified_v1" && (detection?.decision_mode !== "unified_v1" || !(typeof detection.unified_score === "number" && Number.isInteger(detection.unified_score) && detection.unified_score >= 0 && detection.unified_score <= 100) || !(Number.isInteger(detection.confidence) && detection.confidence >= 0 && detection.confidence <= 100) || !["allow", "challenge", "block"].includes(detection.decision) || typeof detection.detection_id !== "string" || !detection.detection_id)) {
261
+ throw new Error("WebDecoy did not return a valid unified decision");
262
+ }
263
+ return detection;
259
264
  }
260
265
  async createSSRFCanary(options) {
261
266
  const response = await this.request("POST", "/api/v1/sdk/ssrf/markers", {
@@ -3476,6 +3481,100 @@ function isTestTriggerUserAgent(userAgent) {
3476
3481
  return userAgent.trimStart().toLowerCase().startsWith(TEST_TRIGGER_UA_PREFIX.toLowerCase());
3477
3482
  }
3478
3483
 
3484
+ // src/offensive-toolchain.ts
3485
+ var TOOLCHAIN_REGISTRY_REVISION = 1;
3486
+ var FRAMEWORK_REGISTRY_REVISION = 5;
3487
+ var reviewedTools = Object.freeze({
3488
+ nmap_scan: "network_reconnaissance",
3489
+ nmap_advanced_scan: "network_reconnaissance",
3490
+ masscan_scan: "network_reconnaissance",
3491
+ nuclei_scan: "vulnerability_scanning",
3492
+ sqlmap_scan: "injection_testing",
3493
+ metasploit_run: "exploitation"
3494
+ });
3495
+ async function createOffensiveToolchainEvidence(input) {
3496
+ const sensor = input.sensor.trim();
3497
+ if (!/^[a-z0-9][a-z0-9_.-]{0,127}$/i.test(sensor)) {
3498
+ throw new Error("sensor must be a 1-128 character stable identifier");
3499
+ }
3500
+ if (!input.runId || input.runId.length > 1024) {
3501
+ throw new Error("runId must be 1-1024 characters");
3502
+ }
3503
+ if (input.correlationSecret.length < 32 || input.correlationSecret.length > 4096) {
3504
+ throw new Error("correlationSecret must be 32-4096 characters");
3505
+ }
3506
+ if (!Array.isArray(input.invocations) || input.invocations.length === 0 || input.invocations.length > 256) {
3507
+ throw new Error("invocations must contain 1-256 entries");
3508
+ }
3509
+ const sequence = [];
3510
+ let redactedArgumentCount = 0;
3511
+ let droppedToolCount = 0;
3512
+ for (const invocation of input.invocations) {
3513
+ if (!invocation.tool || invocation.tool.length > 128) {
3514
+ throw new Error("tool must be 1-128 characters");
3515
+ }
3516
+ const redacted = invocation.redactedArgumentCount ?? 0;
3517
+ if (!Number.isInteger(redacted) || redacted < 0 || redacted > 1024) {
3518
+ throw new Error("redactedArgumentCount must be an integer from 0 through 1024");
3519
+ }
3520
+ const family = reviewedTools[invocation.tool.trim().toLowerCase()];
3521
+ if (!family) {
3522
+ droppedToolCount++;
3523
+ continue;
3524
+ }
3525
+ sequence.push(family);
3526
+ redactedArgumentCount += redacted;
3527
+ if (redactedArgumentCount > 1024) throw new Error("redacted argument count exceeds 1024");
3528
+ }
3529
+ if (sequence.length === 0) throw new Error("no reviewed offensive tools were observed");
3530
+ const families = [...new Set(sequence)].sort();
3531
+ const offensive_toolchain = {
3532
+ schema_version: 1,
3533
+ registry_revision: TOOLCHAIN_REGISTRY_REVISION,
3534
+ plane: "model_api",
3535
+ sensor,
3536
+ run_correlation_id: await hmacSha256Hex(input.correlationSecret, input.runId),
3537
+ tool_families: families,
3538
+ invocation_count: sequence.length,
3539
+ family_set_sha256: await fingerprintIDs(families),
3540
+ sequence_sha256: await sha256Hex(sequence.join("\n")),
3541
+ redacted_argument_count: redactedArgumentCount,
3542
+ dropped_tool_count: droppedToolCount
3543
+ };
3544
+ const evidence = { offensive_toolchain };
3545
+ if (input.orchestrator === "hexstrike_ai") {
3546
+ evidence.framework_evidence = await hexStrikeEvidence();
3547
+ }
3548
+ return evidence;
3549
+ }
3550
+ async function hexStrikeEvidence() {
3551
+ const family = {
3552
+ family_id: "orchestrator_identity",
3553
+ count: 1,
3554
+ sha256: await fingerprintIDs(["hexstrike-ai-mcp"])
3555
+ };
3556
+ return {
3557
+ schema_version: 1,
3558
+ registry_revision: FRAMEWORK_REGISTRY_REVISION,
3559
+ framework: "hexstrike_ai",
3560
+ plane: "model_api",
3561
+ evidence: [family],
3562
+ observation_sha256: await fingerprintEvidence([family])
3563
+ };
3564
+ }
3565
+ async function fingerprintIDs(values) {
3566
+ const canonical = [
3567
+ ...new Set(values.map((value) => value.trim().toLowerCase()).filter(Boolean))
3568
+ ].sort();
3569
+ return sha256Hex(canonical.join("\n"));
3570
+ }
3571
+ async function fingerprintEvidence(evidence) {
3572
+ const canonical = evidence.map(
3573
+ (value) => `${value.family_id.trim().toLowerCase()}\0${value.count}\0${value.sha256.trim().toLowerCase()}`
3574
+ );
3575
+ return fingerprintIDs(canonical);
3576
+ }
3577
+
3479
3578
  // src/sdk.ts
3480
3579
  var WebDecoy = class {
3481
3580
  constructor(config = {}) {
@@ -3498,7 +3597,8 @@ var WebDecoy = class {
3498
3597
  apiKey: config.apiKey,
3499
3598
  apiUrl: config.apiUrl || "https://in.webdecoy.com",
3500
3599
  enableTLSFingerprinting: config.enableTLSFingerprinting ?? true,
3501
- threatScoreThreshold: config.threatScoreThreshold ?? 80,
3600
+ decisionMode: config.decisionMode ?? "legacy",
3601
+ threatScoreThreshold: config.threatScoreThreshold,
3502
3602
  timeout: config.timeout ?? 5e3,
3503
3603
  debug: config.debug ?? false,
3504
3604
  tlsRejectUnauthorized: config.tlsRejectUnauthorized ?? true,
@@ -3520,7 +3620,7 @@ var WebDecoy = class {
3520
3620
  }
3521
3621
  this.webBotAuthOptions = config.webBotAuth;
3522
3622
  this.characteristics = config.characteristics ?? DEFAULT_CHARACTERISTICS;
3523
- this.decisionCache = config.decisionCache === false ? null : new DecisionCache(config.decisionCache ?? {});
3623
+ this.decisionCache = config.decisionCache === false || this.config.decisionMode === "unified_v1" ? null : new DecisionCache(config.decisionCache ?? {});
3524
3624
  const rules = config.rules ?? [tripwire()];
3525
3625
  if (rules.length > 0) {
3526
3626
  this.ruleEngine = new RuleEngine(rules);
@@ -3743,6 +3843,38 @@ var WebDecoy = class {
3743
3843
  honeyCredentialFingerprint(tokenId, bearer) {
3744
3844
  return hmacSha256Hex(this.config.apiKey, `webdecoy/honey-credential/v1\0${tokenId}\0${bearer}`);
3745
3845
  }
3846
+ /**
3847
+ * Report a privacy-bounded model-plane tool run. The helper sends only
3848
+ * reviewed generic families, counts, and digests; it never sends prompts,
3849
+ * arguments, results, credentials, targets, or the raw run ID.
3850
+ */
3851
+ async reportOffensiveToolchain(input) {
3852
+ if (!this.client) {
3853
+ throw new Error("An apiKey is required to report an offensive toolchain");
3854
+ }
3855
+ const evidence = await createOffensiveToolchainEvidence(input);
3856
+ return this.client.detect({
3857
+ request_metadata: {
3858
+ method: "MODEL",
3859
+ path: "/model-toolchain",
3860
+ // The existing SDK route requires an address. Model-plane evidence has
3861
+ // no target client IP, so use the unspecified address rather than
3862
+ // inventing an identity that could enter actor correlation.
3863
+ ip: "0.0.0.0",
3864
+ headers: {},
3865
+ timestamp: Date.now()
3866
+ },
3867
+ local_analysis: {
3868
+ suspicious_headers: false,
3869
+ missing_sec_ch_ua: false,
3870
+ datacenter_ip: false,
3871
+ local_score: 0,
3872
+ needs_verification: true,
3873
+ flags: ["model_plane_toolchain"]
3874
+ },
3875
+ ...evidence
3876
+ });
3877
+ }
3746
3878
  /**
3747
3879
  * Whether this SDK instance has filter rules that need async enrichment
3748
3880
  */
@@ -3769,7 +3901,8 @@ var WebDecoy = class {
3769
3901
  this.referralCounter?.observe(metadata);
3770
3902
  const span = startSpan(this.tracer, "webdecoy.protect");
3771
3903
  try {
3772
- const decision = (await this.decide(metadata, options)).withEdge(edge);
3904
+ setAttribute(span, "webdecoy.cloud.decision_mode", this.config.decisionMode);
3905
+ const decision = (await this.decide(metadata, options, span)).withEdge(edge);
3773
3906
  setAttribute(span, "webdecoy.decision.id", decision.id);
3774
3907
  setAttribute(span, "webdecoy.decision.conclusion", decision.conclusion);
3775
3908
  setAttribute(span, "webdecoy.decision.allowed", decision.allowed);
@@ -3793,7 +3926,7 @@ var WebDecoy = class {
3793
3926
  endSpan(span);
3794
3927
  }
3795
3928
  }
3796
- async decide(metadata, options = {}) {
3929
+ async decide(metadata, options, span) {
3797
3930
  const id = newDecisionId();
3798
3931
  let key = metadata.ip || "unknown";
3799
3932
  try {
@@ -3804,6 +3937,7 @@ var WebDecoy = class {
3804
3937
  metadata.timestamp = Date.now();
3805
3938
  }
3806
3939
  if (isTestTriggerUserAgent(metadata.user_agent)) {
3940
+ setAttribute(span, "webdecoy.cloud.admission", "test_trigger");
3807
3941
  return this.reportTestTrigger(metadata, id);
3808
3942
  }
3809
3943
  const needsAsync = this._hasFilterRules || this._hasAgentRules || this._preparingRules.length > 0;
@@ -3812,6 +3946,7 @@ var WebDecoy = class {
3812
3946
  const agentVerdict = context.agent;
3813
3947
  const ruleResult = this.ruleEngine ? this.runRules(context) : null;
3814
3948
  if (ruleResult && ruleResult.action !== "ALLOW") {
3949
+ setAttribute(span, "webdecoy.cloud.admission", "local_rule");
3815
3950
  const throttled = ruleResult.action === "THROTTLE";
3816
3951
  return new Decision({
3817
3952
  conclusion: "DENY",
@@ -3832,6 +3967,7 @@ var WebDecoy = class {
3832
3967
  });
3833
3968
  }
3834
3969
  if (!this.client) {
3970
+ setAttribute(span, "webdecoy.cloud.admission", "no_api_key");
3835
3971
  return new Decision({
3836
3972
  conclusion: "ALLOW",
3837
3973
  detection: {
@@ -3850,7 +3986,10 @@ var WebDecoy = class {
3850
3986
  });
3851
3987
  }
3852
3988
  const cached = this.decisionCache?.get(key);
3853
- if (cached) return cached.asCached();
3989
+ if (cached) {
3990
+ setAttribute(span, "webdecoy.cloud.admission", "cached");
3991
+ return cached.asCached();
3992
+ }
3854
3993
  const localAnalysis = options.skipLocalAnalysis ? {
3855
3994
  suspicious_headers: false,
3856
3995
  missing_sec_ch_ua: false,
@@ -3860,12 +3999,11 @@ var WebDecoy = class {
3860
3999
  flags: ["local_analysis_skipped"]
3861
4000
  } : analyzeRequest(metadata);
3862
4001
  this.log.debug("Local analysis", { ...localAnalysis });
3863
- const detectionRequest = {
3864
- request_metadata: metadata,
3865
- local_analysis: localAnalysis
3866
- };
3867
4002
  const shouldCallServer = localAnalysis.needs_verification || this.config.enableTLSFingerprinting && metadata.tls_info;
3868
4003
  if (!shouldCallServer) {
4004
+ setAttribute(span, "webdecoy.cloud.admission", "local_gate");
4005
+ setAttribute(span, "webdecoy.cloud.gate_datacenter_ip", localAnalysis.datacenter_ip);
4006
+ setAttribute(span, "webdecoy.cloud.gate_missing_sec_ch_ua", localAnalysis.missing_sec_ch_ua);
3869
4007
  return new Decision({
3870
4008
  conclusion: "ALLOW",
3871
4009
  detection: {
@@ -3883,8 +4021,14 @@ var WebDecoy = class {
3883
4021
  key
3884
4022
  });
3885
4023
  }
3886
- const detection = await this.client.detect(detectionRequest);
3887
- const threshold = options.threshold ?? this.config.threatScoreThreshold;
4024
+ const unified = this.config.decisionMode === "unified_v1";
4025
+ setAttribute(span, "webdecoy.cloud.admission", "cloud");
4026
+ const detection = await this.client.detect({
4027
+ request_metadata: metadata,
4028
+ local_analysis: localAnalysis,
4029
+ ...unified && { decision_mode: "unified_v1" }
4030
+ });
4031
+ const threshold = options.threshold ?? this.config.threatScoreThreshold ?? (unified ? 0 : 80);
3888
4032
  const allowed = detection.decision === "allow" || detection.confidence < threshold;
3889
4033
  this.log.debug("Server detection", {
3890
4034
  decision: detection.decision,
@@ -3894,7 +4038,7 @@ var WebDecoy = class {
3894
4038
  const conclusion = allowed ? "ALLOW" : detection.decision === "challenge" ? "CHALLENGE" : "DENY";
3895
4039
  const decision = new Decision({
3896
4040
  conclusion,
3897
- reason: allowed ? void 0 : `Threat score ${detection.confidence} (threshold ${threshold})`,
4041
+ reason: allowed ? void 0 : unified ? `Unified verdict ${detection.decision} (score ${detection.unified_score}, confidence ${detection.confidence})` : `Threat score ${detection.confidence} (threshold ${threshold})`,
3898
4042
  detection,
3899
4043
  id,
3900
4044
  results: ruleResult?.results ?? [],
@@ -3906,6 +4050,9 @@ var WebDecoy = class {
3906
4050
  if (this.decisionCache) this.decisionCache.set(key, decision);
3907
4051
  return decision;
3908
4052
  } catch (error) {
4053
+ if (error instanceof WebDecoyUnavailableError) {
4054
+ setAttribute(span, "webdecoy.cloud.admission", "backoff");
4055
+ }
3909
4056
  const log = error instanceof WebDecoyUnavailableError ? this.log.debug.bind(this.log) : this.log.error.bind(this.log);
3910
4057
  log("Protection error", {
3911
4058
  error: error instanceof Error ? error.message : String(error)
@@ -3959,6 +4106,7 @@ var WebDecoy = class {
3959
4106
  try {
3960
4107
  const detection = await this.client.detect({
3961
4108
  request_metadata: metadata,
4109
+ ...this.config.decisionMode === "unified_v1" && { decision_mode: "unified_v1" },
3962
4110
  local_analysis: {
3963
4111
  suspicious_headers: false,
3964
4112
  missing_sec_ch_ua: false,
@@ -7759,6 +7907,7 @@ function createCaptchaEndpoints(options = {}) {
7759
7907
  createClearanceGate,
7760
7908
  createDetectAndGate,
7761
7909
  createFetchGuard,
7910
+ createOffensiveToolchainEvidence,
7762
7911
  deriveAndArm,
7763
7912
  deriveKey,
7764
7913
  filter,
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  resolveGateEnv,
12
12
  ruleBlockResponse,
13
13
  shouldSkipPath
14
- } from "./chunk-G5WMRJSQ.mjs";
14
+ } from "./chunk-CFJ7R2CG.mjs";
15
15
  import {
16
16
  ATTACK_SIGNATURE_IDS,
17
17
  AgentVerifier,
@@ -47,6 +47,7 @@ import {
47
47
  classifyUserAgent,
48
48
  consoleLogger,
49
49
  createAgentVerifier,
50
+ createOffensiveToolchainEvidence,
50
51
  deriveKey,
51
52
  filter,
52
53
  fnv1a64Hex,
@@ -68,7 +69,7 @@ import {
68
69
  tripwire,
69
70
  upstashRateLimitStore,
70
71
  webBotAuth
71
- } from "./chunk-AUHVIVMA.mjs";
72
+ } from "./chunk-2SIFEEYE.mjs";
72
73
 
73
74
  // src/client-signals.ts
74
75
  var MemoryClientSignalStore = class {
@@ -2204,6 +2205,7 @@ export {
2204
2205
  createClearanceGate,
2205
2206
  createDetectAndGate,
2206
2207
  createFetchGuard,
2208
+ createOffensiveToolchainEvidence,
2207
2209
  deriveAndArm,
2208
2210
  deriveKey,
2209
2211
  filter,
@@ -595,6 +595,7 @@ interface Tracer {
595
595
  * Based on the ingest service API contract
596
596
  */
597
597
 
598
+ type DecisionMode = 'legacy' | 'unified_v1';
598
599
  /**
599
600
  * Configuration options for the Web Decoy SDK
600
601
  */
@@ -618,9 +619,14 @@ interface WebDecoyConfig {
618
619
  */
619
620
  enableTLSFingerprinting?: boolean;
620
621
  /**
621
- * Threat score threshold for blocking (0-100)
622
- * Requests with scores above this will be blocked
623
- * @default 80
622
+ * Cloud decision policy. Legacy is the default. Opt in to unified_v1 to
623
+ * use the ingest verdict based on the same synchronous score as its row.
624
+ */
625
+ decisionMode?: DecisionMode;
626
+ /**
627
+ * Minimum cloud confidence (0–100) required to act on a block or challenge.
628
+ * Defaults to 80 in legacy mode. Unified mode uses ingest's confidence
629
+ * gates unless a minimum is explicitly set.
624
630
  */
625
631
  threatScoreThreshold?: number;
626
632
  /**
@@ -678,7 +684,7 @@ interface WebDecoyConfig {
678
684
  /**
679
685
  * Reuse of decisions that cost a network round trip. `false` disables it.
680
686
  *
681
- * Only server-derived DENY and CHALLENGE verdicts are cached — never ALLOW,
687
+ * Used in legacy mode. Only server-derived DENY and CHALLENGE verdicts are cached — never ALLOW,
682
688
  * and never a rule outcome, because a rate limiter has to see every request.
683
689
  * @default { ttl: 60_000, max: 10_000 }
684
690
  */
@@ -843,11 +849,48 @@ interface LocalAnalysis {
843
849
  interface SDKDetectionRequest {
844
850
  request_metadata: RequestMetadata;
845
851
  local_analysis: LocalAnalysis;
852
+ /** Sent only when a caller explicitly requests unified admission. */
853
+ decision_mode?: 'unified_v1';
854
+ /** Privacy-bounded model-plane tool orchestration; never raw arguments or results. */
855
+ offensive_toolchain?: OffensiveToolchainObservation;
856
+ /** Reviewed framework identity evidence produced by an SDK helper. */
857
+ framework_evidence?: FrameworkEvidenceObservation;
858
+ }
859
+ type OffensiveToolFamily = 'network_reconnaissance' | 'vulnerability_scanning' | 'injection_testing' | 'exploitation';
860
+ interface OffensiveToolchainObservation {
861
+ schema_version: 1;
862
+ registry_revision: 1;
863
+ plane: 'model_api';
864
+ sensor: string;
865
+ /** HMAC-SHA-256 digest; never the raw run or conversation ID. */
866
+ run_correlation_id: string;
867
+ tool_families: OffensiveToolFamily[];
868
+ invocation_count: number;
869
+ family_set_sha256: string;
870
+ sequence_sha256: string;
871
+ redacted_argument_count: number;
872
+ dropped_tool_count: number;
873
+ }
874
+ interface FrameworkEvidenceObservation {
875
+ schema_version: 1;
876
+ registry_revision: number;
877
+ framework: string;
878
+ plane: 'model_api';
879
+ evidence: Array<{
880
+ family_id: string;
881
+ count: number;
882
+ sha256: string;
883
+ }>;
884
+ observation_sha256: string;
846
885
  }
847
886
  /**
848
887
  * Detection response from the ingest service
849
888
  */
850
889
  interface SDKDetectionResponse {
890
+ /** Present for a verdict produced by the unified policy. */
891
+ decision_mode?: 'unified_v1';
892
+ /** Synchronous ingest score (0–100), before asynchronous enrichment. */
893
+ unified_score?: number;
851
894
  /** Decision: "allow", "block", or "challenge" */
852
895
  decision: 'allow' | 'block' | 'challenge';
853
896
  /** Confidence score (0-100) */
@@ -867,7 +910,7 @@ interface SDKDetectionResponse {
867
910
  * Options for the protect() method
868
911
  */
869
912
  interface ProtectOptions {
870
- /** Custom threat score threshold for this request */
913
+ /** Minimum cloud confidence required to act on this request */
871
914
  threshold?: number;
872
915
  /** Skip local analysis and only use server-side detection */
873
916
  skipLocalAnalysis?: boolean;
@@ -1386,6 +1429,37 @@ declare class WebDecoyClient {
1386
1429
  validateAPIKey(): Promise<boolean>;
1387
1430
  }
1388
1431
 
1432
+ interface OffensiveToolInvocation {
1433
+ /** Reviewed tool identifier. Unknown identifiers are counted and dropped. */
1434
+ tool: string;
1435
+ /** Number of argument values the sensor removed before reporting. */
1436
+ redactedArgumentCount?: number;
1437
+ }
1438
+ interface OffensiveToolchainEvidenceInput {
1439
+ /** Stable name for the authenticated model-plane sensor, at most 128 characters. */
1440
+ sensor: string;
1441
+ /** Raw run ID used only as HMAC input. It is never returned. */
1442
+ runId: string;
1443
+ /** Deployment-held HMAC secret used to pseudonymize run IDs. */
1444
+ correlationSecret: string;
1445
+ invocations: readonly OffensiveToolInvocation[];
1446
+ /** Set only when instrumenting the official HexStrike AI MCP orchestrator. */
1447
+ orchestrator?: 'hexstrike_ai';
1448
+ }
1449
+ interface OffensiveToolchainEvidence {
1450
+ offensive_toolchain: OffensiveToolchainObservation;
1451
+ framework_evidence?: FrameworkEvidenceObservation;
1452
+ }
1453
+ /**
1454
+ * Build the strict model-plane evidence accepted by WebDecoy ingest.
1455
+ *
1456
+ * Tool arguments, results, prompts, credentials and targets are intentionally
1457
+ * absent from this API. Unknown tool names are counted and discarded. One
1458
+ * recognized family can be reported for coverage but does not correlate; the
1459
+ * backend requires coordinated use of at least two reviewed families.
1460
+ */
1461
+ declare function createOffensiveToolchainEvidence(input: OffensiveToolchainEvidenceInput): Promise<OffensiveToolchainEvidence>;
1462
+
1389
1463
  declare class WebDecoy {
1390
1464
  private client;
1391
1465
  private config;
@@ -1479,6 +1553,12 @@ declare class WebDecoy {
1479
1553
  */
1480
1554
  observeHoneyCredentialPresentation(candidate: string, handle: HoneyCredentialHandle, routeTemplate: string): Promise<HoneyCredentialPresentationResult>;
1481
1555
  private honeyCredentialFingerprint;
1556
+ /**
1557
+ * Report a privacy-bounded model-plane tool run. The helper sends only
1558
+ * reviewed generic families, counts, and digests; it never sends prompts,
1559
+ * arguments, results, credentials, targets, or the raw run ID.
1560
+ */
1561
+ reportOffensiveToolchain(input: OffensiveToolchainEvidenceInput): Promise<SDKDetectionResponse>;
1482
1562
  /**
1483
1563
  * Whether this SDK instance has filter rules that need async enrichment
1484
1564
  */
@@ -1541,4 +1621,4 @@ declare class WebDecoy {
1541
1621
  destroy(): Promise<void>;
1542
1622
  }
1543
1623
 
1544
- export { type SSRFInitiationReceipt as $, type AgentCategory as A, type BotRuleConfig as B, type Characteristic as C, DEFAULT_CHARACTERISTICS as D, EDGE_CLASS_HEADER as E, type FilterConfig as F, type HoneyCredentialPresentationResult as G, type HoneyCredentialHandle as H, type HoneyCredentialReceipt as I, type IPEnrichmentData as J, type LogFields as K, type LocalAnalysis as L, type Logger as M, MemoryRateLimitStore as N, type ProtectOptions as O, type ProtectResult as P, type RequestMetadata as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type RuleOutcome as U, type RuleState as V, WebDecoy as W, type SDKDetectionRequest as X, type SDKDetectionResponse as Y, type SSRFCanary as Z, type SSRFCanaryOptions as _, type RuleContext as a, type Span as a0, type SyncRateLimitStore as a1, type TLSInfo as a2, type Tracer as a3, type ViolationEvent as a4, type WebDecoyConfig as a5, classifyUserAgent as a6, consoleLogger as a7, deriveKey as a8, fromPino as a9, matchUserAgent as aa, newDecisionId as ab, readEdgeVerdict as ac, silentLogger as ad, type RuleResult as b, type RuleEngineResult as c, type RateLimitConfig as d, type BotAgent as e, type BotCategory as f, type RateLimitStore as g, type RateLimitConsume as h, type RateLimitOutcome as i, type AgentVerifierOptions as j, type AgentRequestInput as k, type AgentVerdict as l, type AgentStatus as m, BOT_CATEGORIES as n, BOT_REGISTRY as o, type BotVerdict as p, type Conclusion as q, type CreatedHoneyCredential as r, Decision as s, DecisionCache as t, type DecisionCacheOptions as u, type DecisionInit as v, EDGE_CLEARANCE_HEADER as w, type EdgeClass as x, type EdgeVerdict as y, type HoneyCredentialOptions as z };
1624
+ export { type RequestMetadata as $, type AgentCategory as A, type BotRuleConfig as B, type Characteristic as C, DEFAULT_CHARACTERISTICS as D, EDGE_CLASS_HEADER as E, type FilterConfig as F, type FrameworkEvidenceObservation as G, type HoneyCredentialHandle as H, type HoneyCredentialOptions as I, type HoneyCredentialPresentationResult as J, type HoneyCredentialReceipt as K, type IPEnrichmentData as L, type LocalAnalysis as M, type LogFields as N, type Logger as O, type ProtectResult as P, MemoryRateLimitStore as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type OffensiveToolFamily as U, type OffensiveToolInvocation as V, WebDecoy as W, type OffensiveToolchainEvidence as X, type OffensiveToolchainEvidenceInput as Y, type OffensiveToolchainObservation as Z, type ProtectOptions as _, type RuleContext as a, type RuleOutcome as a0, type RuleState as a1, type SDKDetectionRequest as a2, type SDKDetectionResponse as a3, type SSRFCanary as a4, type SSRFCanaryOptions as a5, type SSRFInitiationReceipt as a6, type Span as a7, type SyncRateLimitStore as a8, type TLSInfo as a9, type Tracer as aa, type ViolationEvent as ab, type WebDecoyConfig as ac, classifyUserAgent as ad, consoleLogger as ae, createOffensiveToolchainEvidence as af, deriveKey as ag, fromPino as ah, matchUserAgent as ai, newDecisionId as aj, readEdgeVerdict as ak, silentLogger as al, type RuleResult as b, type RuleEngineResult as c, type RateLimitConfig as d, type BotAgent as e, type BotCategory as f, type RateLimitStore as g, type RateLimitConsume as h, type RateLimitOutcome as i, type AgentVerifierOptions as j, type AgentRequestInput as k, type AgentVerdict as l, type AgentStatus as m, BOT_CATEGORIES as n, BOT_REGISTRY as o, type BotVerdict as p, type Conclusion as q, type CreatedHoneyCredential as r, Decision as s, DecisionCache as t, type DecisionCacheOptions as u, type DecisionInit as v, type DecisionMode as w, EDGE_CLEARANCE_HEADER as x, type EdgeClass as y, type EdgeVerdict as z };
@@ -595,6 +595,7 @@ interface Tracer {
595
595
  * Based on the ingest service API contract
596
596
  */
597
597
 
598
+ type DecisionMode = 'legacy' | 'unified_v1';
598
599
  /**
599
600
  * Configuration options for the Web Decoy SDK
600
601
  */
@@ -618,9 +619,14 @@ interface WebDecoyConfig {
618
619
  */
619
620
  enableTLSFingerprinting?: boolean;
620
621
  /**
621
- * Threat score threshold for blocking (0-100)
622
- * Requests with scores above this will be blocked
623
- * @default 80
622
+ * Cloud decision policy. Legacy is the default. Opt in to unified_v1 to
623
+ * use the ingest verdict based on the same synchronous score as its row.
624
+ */
625
+ decisionMode?: DecisionMode;
626
+ /**
627
+ * Minimum cloud confidence (0–100) required to act on a block or challenge.
628
+ * Defaults to 80 in legacy mode. Unified mode uses ingest's confidence
629
+ * gates unless a minimum is explicitly set.
624
630
  */
625
631
  threatScoreThreshold?: number;
626
632
  /**
@@ -678,7 +684,7 @@ interface WebDecoyConfig {
678
684
  /**
679
685
  * Reuse of decisions that cost a network round trip. `false` disables it.
680
686
  *
681
- * Only server-derived DENY and CHALLENGE verdicts are cached — never ALLOW,
687
+ * Used in legacy mode. Only server-derived DENY and CHALLENGE verdicts are cached — never ALLOW,
682
688
  * and never a rule outcome, because a rate limiter has to see every request.
683
689
  * @default { ttl: 60_000, max: 10_000 }
684
690
  */
@@ -843,11 +849,48 @@ interface LocalAnalysis {
843
849
  interface SDKDetectionRequest {
844
850
  request_metadata: RequestMetadata;
845
851
  local_analysis: LocalAnalysis;
852
+ /** Sent only when a caller explicitly requests unified admission. */
853
+ decision_mode?: 'unified_v1';
854
+ /** Privacy-bounded model-plane tool orchestration; never raw arguments or results. */
855
+ offensive_toolchain?: OffensiveToolchainObservation;
856
+ /** Reviewed framework identity evidence produced by an SDK helper. */
857
+ framework_evidence?: FrameworkEvidenceObservation;
858
+ }
859
+ type OffensiveToolFamily = 'network_reconnaissance' | 'vulnerability_scanning' | 'injection_testing' | 'exploitation';
860
+ interface OffensiveToolchainObservation {
861
+ schema_version: 1;
862
+ registry_revision: 1;
863
+ plane: 'model_api';
864
+ sensor: string;
865
+ /** HMAC-SHA-256 digest; never the raw run or conversation ID. */
866
+ run_correlation_id: string;
867
+ tool_families: OffensiveToolFamily[];
868
+ invocation_count: number;
869
+ family_set_sha256: string;
870
+ sequence_sha256: string;
871
+ redacted_argument_count: number;
872
+ dropped_tool_count: number;
873
+ }
874
+ interface FrameworkEvidenceObservation {
875
+ schema_version: 1;
876
+ registry_revision: number;
877
+ framework: string;
878
+ plane: 'model_api';
879
+ evidence: Array<{
880
+ family_id: string;
881
+ count: number;
882
+ sha256: string;
883
+ }>;
884
+ observation_sha256: string;
846
885
  }
847
886
  /**
848
887
  * Detection response from the ingest service
849
888
  */
850
889
  interface SDKDetectionResponse {
890
+ /** Present for a verdict produced by the unified policy. */
891
+ decision_mode?: 'unified_v1';
892
+ /** Synchronous ingest score (0–100), before asynchronous enrichment. */
893
+ unified_score?: number;
851
894
  /** Decision: "allow", "block", or "challenge" */
852
895
  decision: 'allow' | 'block' | 'challenge';
853
896
  /** Confidence score (0-100) */
@@ -867,7 +910,7 @@ interface SDKDetectionResponse {
867
910
  * Options for the protect() method
868
911
  */
869
912
  interface ProtectOptions {
870
- /** Custom threat score threshold for this request */
913
+ /** Minimum cloud confidence required to act on this request */
871
914
  threshold?: number;
872
915
  /** Skip local analysis and only use server-side detection */
873
916
  skipLocalAnalysis?: boolean;
@@ -1386,6 +1429,37 @@ declare class WebDecoyClient {
1386
1429
  validateAPIKey(): Promise<boolean>;
1387
1430
  }
1388
1431
 
1432
+ interface OffensiveToolInvocation {
1433
+ /** Reviewed tool identifier. Unknown identifiers are counted and dropped. */
1434
+ tool: string;
1435
+ /** Number of argument values the sensor removed before reporting. */
1436
+ redactedArgumentCount?: number;
1437
+ }
1438
+ interface OffensiveToolchainEvidenceInput {
1439
+ /** Stable name for the authenticated model-plane sensor, at most 128 characters. */
1440
+ sensor: string;
1441
+ /** Raw run ID used only as HMAC input. It is never returned. */
1442
+ runId: string;
1443
+ /** Deployment-held HMAC secret used to pseudonymize run IDs. */
1444
+ correlationSecret: string;
1445
+ invocations: readonly OffensiveToolInvocation[];
1446
+ /** Set only when instrumenting the official HexStrike AI MCP orchestrator. */
1447
+ orchestrator?: 'hexstrike_ai';
1448
+ }
1449
+ interface OffensiveToolchainEvidence {
1450
+ offensive_toolchain: OffensiveToolchainObservation;
1451
+ framework_evidence?: FrameworkEvidenceObservation;
1452
+ }
1453
+ /**
1454
+ * Build the strict model-plane evidence accepted by WebDecoy ingest.
1455
+ *
1456
+ * Tool arguments, results, prompts, credentials and targets are intentionally
1457
+ * absent from this API. Unknown tool names are counted and discarded. One
1458
+ * recognized family can be reported for coverage but does not correlate; the
1459
+ * backend requires coordinated use of at least two reviewed families.
1460
+ */
1461
+ declare function createOffensiveToolchainEvidence(input: OffensiveToolchainEvidenceInput): Promise<OffensiveToolchainEvidence>;
1462
+
1389
1463
  declare class WebDecoy {
1390
1464
  private client;
1391
1465
  private config;
@@ -1479,6 +1553,12 @@ declare class WebDecoy {
1479
1553
  */
1480
1554
  observeHoneyCredentialPresentation(candidate: string, handle: HoneyCredentialHandle, routeTemplate: string): Promise<HoneyCredentialPresentationResult>;
1481
1555
  private honeyCredentialFingerprint;
1556
+ /**
1557
+ * Report a privacy-bounded model-plane tool run. The helper sends only
1558
+ * reviewed generic families, counts, and digests; it never sends prompts,
1559
+ * arguments, results, credentials, targets, or the raw run ID.
1560
+ */
1561
+ reportOffensiveToolchain(input: OffensiveToolchainEvidenceInput): Promise<SDKDetectionResponse>;
1482
1562
  /**
1483
1563
  * Whether this SDK instance has filter rules that need async enrichment
1484
1564
  */
@@ -1541,4 +1621,4 @@ declare class WebDecoy {
1541
1621
  destroy(): Promise<void>;
1542
1622
  }
1543
1623
 
1544
- export { type SSRFInitiationReceipt as $, type AgentCategory as A, type BotRuleConfig as B, type Characteristic as C, DEFAULT_CHARACTERISTICS as D, EDGE_CLASS_HEADER as E, type FilterConfig as F, type HoneyCredentialPresentationResult as G, type HoneyCredentialHandle as H, type HoneyCredentialReceipt as I, type IPEnrichmentData as J, type LogFields as K, type LocalAnalysis as L, type Logger as M, MemoryRateLimitStore as N, type ProtectOptions as O, type ProtectResult as P, type RequestMetadata as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type RuleOutcome as U, type RuleState as V, WebDecoy as W, type SDKDetectionRequest as X, type SDKDetectionResponse as Y, type SSRFCanary as Z, type SSRFCanaryOptions as _, type RuleContext as a, type Span as a0, type SyncRateLimitStore as a1, type TLSInfo as a2, type Tracer as a3, type ViolationEvent as a4, type WebDecoyConfig as a5, classifyUserAgent as a6, consoleLogger as a7, deriveKey as a8, fromPino as a9, matchUserAgent as aa, newDecisionId as ab, readEdgeVerdict as ac, silentLogger as ad, type RuleResult as b, type RuleEngineResult as c, type RateLimitConfig as d, type BotAgent as e, type BotCategory as f, type RateLimitStore as g, type RateLimitConsume as h, type RateLimitOutcome as i, type AgentVerifierOptions as j, type AgentRequestInput as k, type AgentVerdict as l, type AgentStatus as m, BOT_CATEGORIES as n, BOT_REGISTRY as o, type BotVerdict as p, type Conclusion as q, type CreatedHoneyCredential as r, Decision as s, DecisionCache as t, type DecisionCacheOptions as u, type DecisionInit as v, EDGE_CLEARANCE_HEADER as w, type EdgeClass as x, type EdgeVerdict as y, type HoneyCredentialOptions as z };
1624
+ export { type RequestMetadata as $, type AgentCategory as A, type BotRuleConfig as B, type Characteristic as C, DEFAULT_CHARACTERISTICS as D, EDGE_CLASS_HEADER as E, type FilterConfig as F, type FrameworkEvidenceObservation as G, type HoneyCredentialHandle as H, type HoneyCredentialOptions as I, type HoneyCredentialPresentationResult as J, type HoneyCredentialReceipt as K, type IPEnrichmentData as L, type LocalAnalysis as M, type LogFields as N, type Logger as O, type ProtectResult as P, MemoryRateLimitStore as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type OffensiveToolFamily as U, type OffensiveToolInvocation as V, WebDecoy as W, type OffensiveToolchainEvidence as X, type OffensiveToolchainEvidenceInput as Y, type OffensiveToolchainObservation as Z, type ProtectOptions as _, type RuleContext as a, type RuleOutcome as a0, type RuleState as a1, type SDKDetectionRequest as a2, type SDKDetectionResponse as a3, type SSRFCanary as a4, type SSRFCanaryOptions as a5, type SSRFInitiationReceipt as a6, type Span as a7, type SyncRateLimitStore as a8, type TLSInfo as a9, type Tracer as aa, type ViolationEvent as ab, type WebDecoyConfig as ac, classifyUserAgent as ad, consoleLogger as ae, createOffensiveToolchainEvidence as af, deriveKey as ag, fromPino as ah, matchUserAgent as ai, newDecisionId as aj, readEdgeVerdict as ak, silentLogger as al, type RuleResult as b, type RuleEngineResult as c, type RateLimitConfig as d, type BotAgent as e, type BotCategory as f, type RateLimitStore as g, type RateLimitConsume as h, type RateLimitOutcome as i, type AgentVerifierOptions as j, type AgentRequestInput as k, type AgentVerdict as l, type AgentStatus as m, BOT_CATEGORIES as n, BOT_REGISTRY as o, type BotVerdict as p, type Conclusion as q, type CreatedHoneyCredential as r, Decision as s, DecisionCache as t, type DecisionCacheOptions as u, type DecisionInit as v, type DecisionMode as w, EDGE_CLEARANCE_HEADER as x, type EdgeClass as y, type EdgeVerdict as z };
@@ -1,4 +1,4 @@
1
- import { a5 as WebDecoyConfig, Q as RequestMetadata, W as WebDecoy, P as ProtectResult, V as RuleState } from './sdk-UlKzxL3L.mjs';
1
+ import { ac as WebDecoyConfig, $ as RequestMetadata, W as WebDecoy, P as ProtectResult, a1 as RuleState } from './sdk-Dh8Jj07-.mjs';
2
2
 
3
3
  /**
4
4
  * Testing utilities, for the application's test suite rather than ours.
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a5 as WebDecoyConfig, Q as RequestMetadata, W as WebDecoy, P as ProtectResult, V as RuleState } from './sdk-UlKzxL3L.js';
1
+ import { ac as WebDecoyConfig, $ as RequestMetadata, W as WebDecoy, P as ProtectResult, a1 as RuleState } from './sdk-Dh8Jj07-.js';
2
2
 
3
3
  /**
4
4
  * Testing utilities, for the application's test suite rather than ours.