@tenova/swt3-ai 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/README.md +21 -0
- package/package.json +1 -1
- package/dist/adapters/anthropic.d.ts +0 -32
- package/dist/adapters/anthropic.d.ts.map +0 -1
- package/dist/adapters/anthropic.js +0 -291
- package/dist/adapters/anthropic.js.map +0 -1
- package/dist/adapters/bedrock.d.ts +0 -33
- package/dist/adapters/bedrock.d.ts.map +0 -1
- package/dist/adapters/bedrock.js +0 -259
- package/dist/adapters/bedrock.js.map +0 -1
- package/dist/adapters/openai.d.ts +0 -19
- package/dist/adapters/openai.d.ts.map +0 -1
- package/dist/adapters/openai.js +0 -284
- package/dist/adapters/openai.js.map +0 -1
- package/dist/adapters/vercel-ai.d.ts +0 -64
- package/dist/adapters/vercel-ai.d.ts.map +0 -1
- package/dist/adapters/vercel-ai.js +0 -68
- package/dist/adapters/vercel-ai.js.map +0 -1
- package/dist/buffer.d.ts +0 -42
- package/dist/buffer.d.ts.map +0 -1
- package/dist/buffer.js +0 -161
- package/dist/buffer.js.map +0 -1
- package/dist/clearing.d.ts +0 -20
- package/dist/clearing.d.ts.map +0 -1
- package/dist/clearing.js +0 -268
- package/dist/clearing.js.map +0 -1
- package/dist/demo.d.ts +0 -11
- package/dist/demo.d.ts.map +0 -1
- package/dist/demo.js +0 -237
- package/dist/demo.js.map +0 -1
- package/dist/fingerprint.d.ts +0 -29
- package/dist/fingerprint.d.ts.map +0 -1
- package/dist/fingerprint.js +0 -57
- package/dist/fingerprint.js.map +0 -1
- package/dist/handoff.d.ts +0 -17
- package/dist/handoff.d.ts.map +0 -1
- package/dist/handoff.js +0 -82
- package/dist/handoff.js.map +0 -1
- package/dist/index.d.ts +0 -22
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -20
- package/dist/index.js.map +0 -1
- package/dist/signing.d.ts +0 -20
- package/dist/signing.d.ts.map +0 -1
- package/dist/signing.js +0 -28
- package/dist/signing.js.map +0 -1
- package/dist/types.d.ts +0 -96
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -17
- package/dist/types.js.map +0 -1
- package/dist/witness.d.ts +0 -114
- package/dist/witness.d.ts.map +0 -1
- package/dist/witness.js +0 -291
- package/dist/witness.js.map +0 -1
package/dist/types.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SWT3 AI Witness SDK — Type definitions.
|
|
3
|
-
*/
|
|
4
|
-
export interface WitnessConfig {
|
|
5
|
-
endpoint: string;
|
|
6
|
-
apiKey: string;
|
|
7
|
-
tenantId: string;
|
|
8
|
-
clearingLevel: 0 | 1 | 2 | 3;
|
|
9
|
-
bufferSize: number;
|
|
10
|
-
flushInterval: number;
|
|
11
|
-
timeout: number;
|
|
12
|
-
maxRetries: number;
|
|
13
|
-
latencyThresholdMs: number;
|
|
14
|
-
guardrailsRequired: number;
|
|
15
|
-
guardrailNames: string[];
|
|
16
|
-
procedures?: string[];
|
|
17
|
-
factorHandoff?: "file";
|
|
18
|
-
factorHandoffPath?: string;
|
|
19
|
-
agentId?: string;
|
|
20
|
-
signingKey?: string;
|
|
21
|
-
cycleId?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface WitnessPayload {
|
|
24
|
-
procedure_id: string;
|
|
25
|
-
factor_a: number;
|
|
26
|
-
factor_b: number;
|
|
27
|
-
factor_c: number;
|
|
28
|
-
clearing_level: number;
|
|
29
|
-
anchor_fingerprint: string;
|
|
30
|
-
anchor_epoch: number;
|
|
31
|
-
fingerprint_timestamp_ms: number;
|
|
32
|
-
ai_model_id?: string;
|
|
33
|
-
ai_prompt_hash?: string;
|
|
34
|
-
ai_response_hash?: string;
|
|
35
|
-
ai_system_prompt_hash?: string;
|
|
36
|
-
ai_latency_ms?: number;
|
|
37
|
-
ai_input_tokens?: number;
|
|
38
|
-
ai_output_tokens?: number;
|
|
39
|
-
ai_context?: {
|
|
40
|
-
provider?: string;
|
|
41
|
-
guardrails?: string[];
|
|
42
|
-
system_fingerprint?: string;
|
|
43
|
-
tool_name?: string;
|
|
44
|
-
tool_call_id?: string;
|
|
45
|
-
access_target?: string;
|
|
46
|
-
access_scope?: string;
|
|
47
|
-
access_granted?: boolean;
|
|
48
|
-
cycle_id?: string;
|
|
49
|
-
};
|
|
50
|
-
agent_id?: string;
|
|
51
|
-
cycle_id?: string;
|
|
52
|
-
payload_signature?: string;
|
|
53
|
-
}
|
|
54
|
-
export interface WitnessReceipt {
|
|
55
|
-
procedure_id: string;
|
|
56
|
-
verdict: "PASS" | "FAIL" | string;
|
|
57
|
-
swt3_anchor: string;
|
|
58
|
-
clearing_level: number;
|
|
59
|
-
witnessed_at: string;
|
|
60
|
-
verification_url: string;
|
|
61
|
-
ok: boolean;
|
|
62
|
-
error?: string;
|
|
63
|
-
}
|
|
64
|
-
export interface BatchResponse {
|
|
65
|
-
ok: boolean;
|
|
66
|
-
tenant_id: string;
|
|
67
|
-
total: number;
|
|
68
|
-
accepted: number;
|
|
69
|
-
rejected: number;
|
|
70
|
-
receipts: WitnessReceipt[];
|
|
71
|
-
}
|
|
72
|
-
export interface InferenceRecord {
|
|
73
|
-
modelId: string;
|
|
74
|
-
modelHash: string;
|
|
75
|
-
promptHash: string;
|
|
76
|
-
responseHash: string;
|
|
77
|
-
latencyMs: number;
|
|
78
|
-
inputTokens?: number;
|
|
79
|
-
outputTokens?: number;
|
|
80
|
-
guardrailsActive: number;
|
|
81
|
-
guardrailsRequired: number;
|
|
82
|
-
guardrailPassed: boolean;
|
|
83
|
-
hasRefusal: boolean;
|
|
84
|
-
provider: string;
|
|
85
|
-
systemFingerprint?: string;
|
|
86
|
-
systemPromptHash?: string;
|
|
87
|
-
guardrailNames: string[];
|
|
88
|
-
toolName?: string;
|
|
89
|
-
toolCallId?: string;
|
|
90
|
-
accessTarget?: string;
|
|
91
|
-
accessGranted?: boolean;
|
|
92
|
-
accessScope?: string;
|
|
93
|
-
}
|
|
94
|
-
/** Valid AI procedure IDs from SWT3 Spec v1.2.0 */
|
|
95
|
-
export declare const AI_PROCEDURES: Set<string>;
|
|
96
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB,EAAE,MAAM,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CA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IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,mDAAmD;AACnD,eAAO,MAAM,aAAa,aAWxB,CAAC"}
|
package/dist/types.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SWT3 AI Witness SDK — Type definitions.
|
|
3
|
-
*/
|
|
4
|
-
/** Valid AI procedure IDs from SWT3 Spec v1.2.0 */
|
|
5
|
-
export const AI_PROCEDURES = new Set([
|
|
6
|
-
"AI-INF.1", "AI-INF.2", "AI-INF.3",
|
|
7
|
-
"AI-MDL.1", "AI-MDL.2", "AI-MDL.3",
|
|
8
|
-
"AI-GRD.1", "AI-GRD.2", "AI-GRD.3",
|
|
9
|
-
"AI-FAIR.1", "AI-FAIR.2",
|
|
10
|
-
"AI-DATA.1", "AI-DATA.2",
|
|
11
|
-
"AI-HITL.1", "AI-HITL.2",
|
|
12
|
-
"AI-EXPL.1", "AI-EXPL.2",
|
|
13
|
-
"AI-TOOL.1",
|
|
14
|
-
"AI-ID.1",
|
|
15
|
-
"AI-ACC.1",
|
|
16
|
-
]);
|
|
17
|
-
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiGH,mDAAmD;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IACnC,UAAU,EAAE,UAAU,EAAE,UAAU;IAClC,UAAU,EAAE,UAAU,EAAE,UAAU;IAClC,UAAU,EAAE,UAAU,EAAE,UAAU;IAClC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,WAAW;IACX,SAAS;IACT,UAAU;CACX,CAAC,CAAC"}
|
package/dist/witness.d.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SWT3 AI Witness SDK — Core Witness class.
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* import { Witness } from "@tenova/swt3-ai";
|
|
6
|
-
* import OpenAI from "openai";
|
|
7
|
-
*
|
|
8
|
-
* const witness = new Witness({
|
|
9
|
-
* endpoint: "https://sovereign.tenova.io",
|
|
10
|
-
* apiKey: "axm_live_...",
|
|
11
|
-
* tenantId: "YOUR_TENANT_ID",
|
|
12
|
-
* });
|
|
13
|
-
*
|
|
14
|
-
* const client = witness.wrap(new OpenAI()) as OpenAI;
|
|
15
|
-
* const response = await client.chat.completions.create({ ... });
|
|
16
|
-
*
|
|
17
|
-
* // Graceful shutdown
|
|
18
|
-
* await witness.flush();
|
|
19
|
-
*
|
|
20
|
-
* Copyright (c) 2026 Tenable Nova LLC. Apache 2.0. Patent pending.
|
|
21
|
-
*/
|
|
22
|
-
import { type VercelOnFinishOptions } from "./adapters/vercel-ai.js";
|
|
23
|
-
import type { WitnessReceipt, InferenceRecord } from "./types.js";
|
|
24
|
-
export interface WitnessOptions {
|
|
25
|
-
endpoint: string;
|
|
26
|
-
apiKey: string;
|
|
27
|
-
tenantId: string;
|
|
28
|
-
clearingLevel?: 0 | 1 | 2 | 3;
|
|
29
|
-
bufferSize?: number;
|
|
30
|
-
flushInterval?: number;
|
|
31
|
-
timeout?: number;
|
|
32
|
-
maxRetries?: number;
|
|
33
|
-
latencyThresholdMs?: number;
|
|
34
|
-
guardrailsRequired?: number;
|
|
35
|
-
guardrailNames?: string[];
|
|
36
|
-
procedures?: string[];
|
|
37
|
-
factorHandoff?: "file";
|
|
38
|
-
factorHandoffPath?: string;
|
|
39
|
-
agentId?: string;
|
|
40
|
-
signingKey?: string;
|
|
41
|
-
cycleId?: string;
|
|
42
|
-
}
|
|
43
|
-
export declare class Witness {
|
|
44
|
-
private config;
|
|
45
|
-
private buffer;
|
|
46
|
-
private handoffWarned;
|
|
47
|
-
constructor(options: WitnessOptions);
|
|
48
|
-
/**
|
|
49
|
-
* Wrap an AI client with transparent witnessing.
|
|
50
|
-
*
|
|
51
|
-
* Supported: OpenAI, Anthropic
|
|
52
|
-
* Returns a proxy that behaves identically to the original client.
|
|
53
|
-
*
|
|
54
|
-
* Usage:
|
|
55
|
-
* const client = witness.wrap(new OpenAI()) as OpenAI;
|
|
56
|
-
* const client = witness.wrap(new Anthropic()) as Anthropic;
|
|
57
|
-
*/
|
|
58
|
-
wrap(client: unknown): unknown;
|
|
59
|
-
/**
|
|
60
|
-
* Wrap a function as a witnessed tool call (AI-TOOL.1).
|
|
61
|
-
*
|
|
62
|
-
* Usage:
|
|
63
|
-
* const search = witness.wrapTool(searchDatabase, "search_db");
|
|
64
|
-
* const result = await search("SELECT ...");
|
|
65
|
-
*
|
|
66
|
-
* Each call mints an AI-TOOL.1 anchor with:
|
|
67
|
-
* factor_a = 1 (tool was called)
|
|
68
|
-
* factor_b = latency_ms
|
|
69
|
-
* factor_c = 1 if succeeded, 0 if exception raised
|
|
70
|
-
*/
|
|
71
|
-
wrapTool<T extends (...args: any[]) => any>(fn: T, toolName?: string): T;
|
|
72
|
-
/**
|
|
73
|
-
* Wrap a function as a witnessed access attempt (AI-ACC.1).
|
|
74
|
-
*
|
|
75
|
-
* Usage:
|
|
76
|
-
* const queryDb = witness.wrapAccess(dbQuery, "prod-database", "read-only analytics");
|
|
77
|
-
* const result = await queryDb("SELECT ...");
|
|
78
|
-
*
|
|
79
|
-
* Each call mints an AI-ACC.1 anchor with:
|
|
80
|
-
* factor_a = 1 (access attempt occurred)
|
|
81
|
-
* factor_b = 1 if within declared scope (or no scope set), 0 if out of scope
|
|
82
|
-
* factor_c = 1 if access granted, 0 if denied/failed
|
|
83
|
-
*/
|
|
84
|
-
wrapAccess<T extends (...args: any[]) => any>(fn: T, resourceName?: string, scope?: string): T;
|
|
85
|
-
/**
|
|
86
|
-
* Record a witnessed inference. Extracts factors, applies clearing,
|
|
87
|
-
* and enqueues payloads for background flush.
|
|
88
|
-
*
|
|
89
|
-
* If factorHandoff is configured, factors are written to the handoff
|
|
90
|
-
* destination BEFORE clearing proceeds. If the handoff fails, the
|
|
91
|
-
* payload is NOT transmitted.
|
|
92
|
-
*/
|
|
93
|
-
record(inference: InferenceRecord): void;
|
|
94
|
-
/**
|
|
95
|
-
* Create a Vercel AI SDK `onFinish` callback for streamText / generateText.
|
|
96
|
-
*
|
|
97
|
-
* Usage:
|
|
98
|
-
* const result = await streamText({
|
|
99
|
-
* model: openai("gpt-4o"),
|
|
100
|
-
* prompt: myPrompt,
|
|
101
|
-
* onFinish: witness.vercelOnFinish({ promptText: myPrompt }),
|
|
102
|
-
* });
|
|
103
|
-
*/
|
|
104
|
-
vercelOnFinish(options?: VercelOnFinishOptions): (result: unknown) => void;
|
|
105
|
-
/** Force-flush all buffered payloads. */
|
|
106
|
-
flush(): Promise<WitnessReceipt[]>;
|
|
107
|
-
/** Stop the witness and flush remaining payloads. */
|
|
108
|
-
stop(): Promise<WitnessReceipt[]>;
|
|
109
|
-
/** Number of payloads waiting. */
|
|
110
|
-
get pending(): number;
|
|
111
|
-
/** All receipts from completed flushes. */
|
|
112
|
-
get receipts(): WitnessReceipt[];
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=witness.d.ts.map
|
package/dist/witness.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"witness.d.ts","sourceRoot":"","sources":["../src/witness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAUH,OAAO,EAAwB,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,KAAK,EAAiC,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjG,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,aAAa,CAAS;gBAElB,OAAO,EAAE,cAAc;IAmCnC;;;;;;;;;OASG;IACH,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;IAyB9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC;IAiExE;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAC1C,EAAE,EAAE,CAAC,EACL,YAAY,CAAC,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,MAAM,GACb,CAAC;IAiEJ;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAsCxC;;;;;;;;;OASG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI;IAI1E,yCAAyC;IACnC,KAAK,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIxC,qDAAqD;IAC/C,IAAI,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIvC,kCAAkC;IAClC,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,2CAA2C;IAC3C,IAAI,QAAQ,IAAI,cAAc,EAAE,CAE/B;CACF"}
|
package/dist/witness.js
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SWT3 AI Witness SDK — Core Witness class.
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* import { Witness } from "@tenova/swt3-ai";
|
|
6
|
-
* import OpenAI from "openai";
|
|
7
|
-
*
|
|
8
|
-
* const witness = new Witness({
|
|
9
|
-
* endpoint: "https://sovereign.tenova.io",
|
|
10
|
-
* apiKey: "axm_live_...",
|
|
11
|
-
* tenantId: "YOUR_TENANT_ID",
|
|
12
|
-
* });
|
|
13
|
-
*
|
|
14
|
-
* const client = witness.wrap(new OpenAI()) as OpenAI;
|
|
15
|
-
* const response = await client.chat.completions.create({ ... });
|
|
16
|
-
*
|
|
17
|
-
* // Graceful shutdown
|
|
18
|
-
* await witness.flush();
|
|
19
|
-
*
|
|
20
|
-
* Copyright (c) 2026 Tenable Nova LLC. Apache 2.0. Patent pending.
|
|
21
|
-
*/
|
|
22
|
-
import { randomUUID } from "node:crypto";
|
|
23
|
-
import { sha256Truncated } from "./fingerprint.js";
|
|
24
|
-
import { extractPayloads } from "./clearing.js";
|
|
25
|
-
import { WitnessBuffer } from "./buffer.js";
|
|
26
|
-
import { writeHandoffFiles } from "./handoff.js";
|
|
27
|
-
import { wrapOpenAI } from "./adapters/openai.js";
|
|
28
|
-
import { wrapAnthropic } from "./adapters/anthropic.js";
|
|
29
|
-
import { wrapBedrock } from "./adapters/bedrock.js";
|
|
30
|
-
import { createVercelOnFinish } from "./adapters/vercel-ai.js";
|
|
31
|
-
export class Witness {
|
|
32
|
-
config;
|
|
33
|
-
buffer;
|
|
34
|
-
handoffWarned = false;
|
|
35
|
-
constructor(options) {
|
|
36
|
-
if (!options.endpoint)
|
|
37
|
-
throw new Error("endpoint is required");
|
|
38
|
-
if (!options.apiKey)
|
|
39
|
-
throw new Error("apiKey is required");
|
|
40
|
-
if (!options.apiKey.startsWith("axm_"))
|
|
41
|
-
throw new Error("apiKey must start with 'axm_'");
|
|
42
|
-
if (!options.tenantId)
|
|
43
|
-
throw new Error("tenantId is required");
|
|
44
|
-
if (options.factorHandoff && options.factorHandoff !== "file") {
|
|
45
|
-
throw new Error("factorHandoff must be 'file' (other methods planned for v0.4.0)");
|
|
46
|
-
}
|
|
47
|
-
if (options.factorHandoff === "file" && !options.factorHandoffPath) {
|
|
48
|
-
throw new Error("factorHandoffPath is required when factorHandoff is 'file'");
|
|
49
|
-
}
|
|
50
|
-
this.config = {
|
|
51
|
-
endpoint: options.endpoint.replace(/\/+$/, ""),
|
|
52
|
-
apiKey: options.apiKey,
|
|
53
|
-
tenantId: options.tenantId,
|
|
54
|
-
clearingLevel: options.clearingLevel ?? 1,
|
|
55
|
-
bufferSize: options.bufferSize ?? 10,
|
|
56
|
-
flushInterval: options.flushInterval ?? 5.0,
|
|
57
|
-
timeout: options.timeout ?? 10000,
|
|
58
|
-
maxRetries: options.maxRetries ?? 3,
|
|
59
|
-
latencyThresholdMs: options.latencyThresholdMs ?? 30000,
|
|
60
|
-
guardrailsRequired: options.guardrailsRequired ?? 0,
|
|
61
|
-
guardrailNames: options.guardrailNames ?? [],
|
|
62
|
-
procedures: options.procedures,
|
|
63
|
-
factorHandoff: options.factorHandoff,
|
|
64
|
-
factorHandoffPath: options.factorHandoffPath,
|
|
65
|
-
agentId: options.agentId,
|
|
66
|
-
signingKey: options.signingKey,
|
|
67
|
-
cycleId: options.cycleId,
|
|
68
|
-
};
|
|
69
|
-
this.buffer = new WitnessBuffer(this.config);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Wrap an AI client with transparent witnessing.
|
|
73
|
-
*
|
|
74
|
-
* Supported: OpenAI, Anthropic
|
|
75
|
-
* Returns a proxy that behaves identically to the original client.
|
|
76
|
-
*
|
|
77
|
-
* Usage:
|
|
78
|
-
* const client = witness.wrap(new OpenAI()) as OpenAI;
|
|
79
|
-
* const client = witness.wrap(new Anthropic()) as Anthropic;
|
|
80
|
-
*/
|
|
81
|
-
wrap(client) {
|
|
82
|
-
const proto = Object.getPrototypeOf(client);
|
|
83
|
-
const name = proto?.constructor?.name ?? "";
|
|
84
|
-
const obj = client;
|
|
85
|
-
// OpenAI: has client.chat.completions
|
|
86
|
-
if (name === "OpenAI" || obj?.chat) {
|
|
87
|
-
return wrapOpenAI(client, this);
|
|
88
|
-
}
|
|
89
|
-
// Anthropic: has client.messages
|
|
90
|
-
if (name === "Anthropic" || (obj?.messages && !obj?.chat)) {
|
|
91
|
-
return wrapAnthropic(client, this);
|
|
92
|
-
}
|
|
93
|
-
// AWS Bedrock: has client.send and client.config
|
|
94
|
-
if (name === "BedrockRuntimeClient" || (obj?.send && obj?.config)) {
|
|
95
|
-
return wrapBedrock(client, this);
|
|
96
|
-
}
|
|
97
|
-
throw new TypeError(`Unsupported client: ${name || "unknown"}. Supported: OpenAI, Anthropic, BedrockRuntimeClient.`);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Wrap a function as a witnessed tool call (AI-TOOL.1).
|
|
101
|
-
*
|
|
102
|
-
* Usage:
|
|
103
|
-
* const search = witness.wrapTool(searchDatabase, "search_db");
|
|
104
|
-
* const result = await search("SELECT ...");
|
|
105
|
-
*
|
|
106
|
-
* Each call mints an AI-TOOL.1 anchor with:
|
|
107
|
-
* factor_a = 1 (tool was called)
|
|
108
|
-
* factor_b = latency_ms
|
|
109
|
-
* factor_c = 1 if succeeded, 0 if exception raised
|
|
110
|
-
*/
|
|
111
|
-
wrapTool(fn, toolName) {
|
|
112
|
-
const name = toolName ?? fn.name ?? "anonymous";
|
|
113
|
-
const self = this;
|
|
114
|
-
const wrapper = function (...args) {
|
|
115
|
-
const callId = randomUUID().replace(/-/g, "").slice(0, 12);
|
|
116
|
-
const start = performance.now();
|
|
117
|
-
let succeeded = true;
|
|
118
|
-
let result;
|
|
119
|
-
const finish = () => {
|
|
120
|
-
const elapsedMs = Math.round(performance.now() - start);
|
|
121
|
-
const inputHash = sha256Truncated(JSON.stringify(args));
|
|
122
|
-
const outputHash = sha256Truncated(succeeded ? JSON.stringify(result) : "ERROR");
|
|
123
|
-
const record = {
|
|
124
|
-
modelId: name,
|
|
125
|
-
modelHash: sha256Truncated(name),
|
|
126
|
-
promptHash: inputHash,
|
|
127
|
-
responseHash: outputHash,
|
|
128
|
-
latencyMs: elapsedMs,
|
|
129
|
-
guardrailsActive: 0,
|
|
130
|
-
guardrailsRequired: 0,
|
|
131
|
-
guardrailPassed: true,
|
|
132
|
-
hasRefusal: !succeeded,
|
|
133
|
-
provider: "tool",
|
|
134
|
-
guardrailNames: [],
|
|
135
|
-
toolName: name,
|
|
136
|
-
toolCallId: callId,
|
|
137
|
-
};
|
|
138
|
-
self.record(record);
|
|
139
|
-
};
|
|
140
|
-
try {
|
|
141
|
-
result = fn.apply(this, args);
|
|
142
|
-
}
|
|
143
|
-
catch (err) {
|
|
144
|
-
succeeded = false;
|
|
145
|
-
finish();
|
|
146
|
-
throw err;
|
|
147
|
-
}
|
|
148
|
-
// Handle async functions (Promise detection)
|
|
149
|
-
if (result && typeof result.then === "function") {
|
|
150
|
-
return result.then((v) => {
|
|
151
|
-
result = v;
|
|
152
|
-
finish();
|
|
153
|
-
return v;
|
|
154
|
-
}, (err) => {
|
|
155
|
-
succeeded = false;
|
|
156
|
-
finish();
|
|
157
|
-
throw err;
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
finish();
|
|
161
|
-
return result;
|
|
162
|
-
};
|
|
163
|
-
return wrapper;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Wrap a function as a witnessed access attempt (AI-ACC.1).
|
|
167
|
-
*
|
|
168
|
-
* Usage:
|
|
169
|
-
* const queryDb = witness.wrapAccess(dbQuery, "prod-database", "read-only analytics");
|
|
170
|
-
* const result = await queryDb("SELECT ...");
|
|
171
|
-
*
|
|
172
|
-
* Each call mints an AI-ACC.1 anchor with:
|
|
173
|
-
* factor_a = 1 (access attempt occurred)
|
|
174
|
-
* factor_b = 1 if within declared scope (or no scope set), 0 if out of scope
|
|
175
|
-
* factor_c = 1 if access granted, 0 if denied/failed
|
|
176
|
-
*/
|
|
177
|
-
wrapAccess(fn, resourceName, scope) {
|
|
178
|
-
const name = resourceName ?? fn.name ?? "unknown-resource";
|
|
179
|
-
const self = this;
|
|
180
|
-
const wrapper = function (...args) {
|
|
181
|
-
const start = performance.now();
|
|
182
|
-
let granted = true;
|
|
183
|
-
let result;
|
|
184
|
-
const finish = () => {
|
|
185
|
-
const elapsedMs = Math.round(performance.now() - start);
|
|
186
|
-
const inputHash = sha256Truncated(JSON.stringify(args));
|
|
187
|
-
const outputHash = sha256Truncated(granted ? JSON.stringify(result) : "ACCESS_DENIED");
|
|
188
|
-
const record = {
|
|
189
|
-
modelId: name,
|
|
190
|
-
modelHash: sha256Truncated(name),
|
|
191
|
-
promptHash: inputHash,
|
|
192
|
-
responseHash: outputHash,
|
|
193
|
-
latencyMs: elapsedMs,
|
|
194
|
-
guardrailsActive: 0,
|
|
195
|
-
guardrailsRequired: 0,
|
|
196
|
-
guardrailPassed: true,
|
|
197
|
-
hasRefusal: !granted,
|
|
198
|
-
provider: "access",
|
|
199
|
-
guardrailNames: [],
|
|
200
|
-
accessTarget: name,
|
|
201
|
-
accessGranted: granted,
|
|
202
|
-
accessScope: scope,
|
|
203
|
-
};
|
|
204
|
-
self.record(record);
|
|
205
|
-
};
|
|
206
|
-
try {
|
|
207
|
-
result = fn.apply(this, args);
|
|
208
|
-
}
|
|
209
|
-
catch (err) {
|
|
210
|
-
granted = false;
|
|
211
|
-
finish();
|
|
212
|
-
throw err;
|
|
213
|
-
}
|
|
214
|
-
// Handle async functions (Promise detection)
|
|
215
|
-
if (result && typeof result.then === "function") {
|
|
216
|
-
return result.then((v) => {
|
|
217
|
-
result = v;
|
|
218
|
-
finish();
|
|
219
|
-
return v;
|
|
220
|
-
}, (err) => {
|
|
221
|
-
granted = false;
|
|
222
|
-
finish();
|
|
223
|
-
throw err;
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
finish();
|
|
227
|
-
return result;
|
|
228
|
-
};
|
|
229
|
-
return wrapper;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Record a witnessed inference. Extracts factors, applies clearing,
|
|
233
|
-
* and enqueues payloads for background flush.
|
|
234
|
-
*
|
|
235
|
-
* If factorHandoff is configured, factors are written to the handoff
|
|
236
|
-
* destination BEFORE clearing proceeds. If the handoff fails, the
|
|
237
|
-
* payload is NOT transmitted.
|
|
238
|
-
*/
|
|
239
|
-
record(inference) {
|
|
240
|
-
// Merge guardrail config
|
|
241
|
-
if (this.config.guardrailNames.length > 0 && inference.guardrailNames.length === 0) {
|
|
242
|
-
inference.guardrailNames = this.config.guardrailNames;
|
|
243
|
-
inference.guardrailsActive = this.config.guardrailNames.length;
|
|
244
|
-
inference.guardrailsRequired = this.config.guardrailsRequired;
|
|
245
|
-
}
|
|
246
|
-
const payloads = extractPayloads(inference, this.config.tenantId, this.config.clearingLevel, this.config.latencyThresholdMs, this.config.guardrailsRequired, this.config.procedures, this.config.agentId, this.config.signingKey, this.config.cycleId);
|
|
247
|
-
// Factor handoff: write full (uncleared) data to custody destination
|
|
248
|
-
// BEFORE enqueuing the cleared payload for transmission.
|
|
249
|
-
// If this fails, we do NOT proceed.
|
|
250
|
-
if (this.config.factorHandoff === "file" && this.config.factorHandoffPath) {
|
|
251
|
-
writeHandoffFiles(payloads, inference, this.config.tenantId, this.config.factorHandoffPath);
|
|
252
|
-
if (!this.handoffWarned) {
|
|
253
|
-
this.handoffWarned = true;
|
|
254
|
-
console.info(`\n [SWT3] ${payloads.length} anchors saved locally to ${this.config.factorHandoffPath}` +
|
|
255
|
-
`\n [SWT3] \u26a0 Local anchors won\u2019t survive a compliance audit.` +
|
|
256
|
-
`\n [SWT3] Connect to Axiom Engine \u2192 https://sovereign.tenova.io/signup?ref=sdk (free)\n`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
this.buffer.enqueueMany(payloads);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Create a Vercel AI SDK `onFinish` callback for streamText / generateText.
|
|
263
|
-
*
|
|
264
|
-
* Usage:
|
|
265
|
-
* const result = await streamText({
|
|
266
|
-
* model: openai("gpt-4o"),
|
|
267
|
-
* prompt: myPrompt,
|
|
268
|
-
* onFinish: witness.vercelOnFinish({ promptText: myPrompt }),
|
|
269
|
-
* });
|
|
270
|
-
*/
|
|
271
|
-
vercelOnFinish(options) {
|
|
272
|
-
return createVercelOnFinish(this, options);
|
|
273
|
-
}
|
|
274
|
-
/** Force-flush all buffered payloads. */
|
|
275
|
-
async flush() {
|
|
276
|
-
return this.buffer.flush();
|
|
277
|
-
}
|
|
278
|
-
/** Stop the witness and flush remaining payloads. */
|
|
279
|
-
async stop() {
|
|
280
|
-
return this.buffer.stop();
|
|
281
|
-
}
|
|
282
|
-
/** Number of payloads waiting. */
|
|
283
|
-
get pending() {
|
|
284
|
-
return this.buffer.pending;
|
|
285
|
-
}
|
|
286
|
-
/** All receipts from completed flushes. */
|
|
287
|
-
get receipts() {
|
|
288
|
-
return this.buffer.receipts;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
//# sourceMappingURL=witness.js.map
|
package/dist/witness.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"witness.js","sourceRoot":"","sources":["../src/witness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAA8B,MAAM,yBAAyB,CAAC;AAuB3F,MAAM,OAAO,OAAO;IACV,MAAM,CAAgB;IACtB,MAAM,CAAgB;IACtB,aAAa,GAAG,KAAK,CAAC;IAE9B,YAAY,OAAuB;QACjC,IAAI,CAAC,OAAO,CAAC,QAAQ;YAAE,MAAM,IAAI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