@tenova/swt3-ai 0.5.6 → 0.5.7

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 CHANGED
@@ -13,18 +13,44 @@ Works with OpenAI, Anthropic, AWS Bedrock, Vercel AI SDK, and any OpenAI-compati
13
13
 
14
14
  GPAI transparency obligations are enforceable now. EU AI Act high-risk enforcement begins **December 2, 2027**. This SDK gives you the evidence chain.
15
15
 
16
- ## What's New in v0.5.6
17
-
18
- - **METAGOV Namespace** -- 8 procedures for recursive governance: governance config attestation, layer registration, policy downgrade detection, circular dependency detection (Kahn's algorithm), governance authorization, emergency override, federation sync, attestation purity verification.
19
- - **Japan AI Promotion Act** -- 17th regulatory framework. 10 procedure mappings to Japan's AI Promotion Act and AI Utilization Guidelines.
20
- - **Model Trust Profiles** -- `verifyTrust()` / `presentCredential()` for AI-TRUST.1 and AI-TRUST.2 anchors. Chain verification across multi-agent handoffs.
21
- - **Anchor References** -- Link related anchors with `anchor_refs` for causal chains and dependency tracking.
22
- - **Coverage Scoring** -- `getCoverageScore()` computes namespace and framework coverage from minted anchors.
23
- - **CLI: `swt3 procedures`** -- List and filter UCT procedures by namespace or JSON output. `swt3 quickstart` generates a working example script.
24
- - **MCP Framework Filter** -- `list_procedures` tool now accepts `--framework` parameter for regulatory-scoped queries.
25
- - **Lifecycle Stage** -- `LIFECYCLE_STAGE_CODES` for AI-MDL.5 model weight witnessing across all 5 languages.
26
- - **Bidirectional Crosswalks** -- 420+ mappings across 17 frameworks in machine-readable JSON.
27
- - **15 profiles**, 88 procedures, 47 namespaces, 12 integrations
16
+ ## What's New in v0.5.7
17
+
18
+ **Autonomous Agent Attestation** -- Autonomous agents make decisions, delegate tasks, consume resources, and cross jurisdictions without human intervention at every step. SWT3 witnesses each transition as immutable evidence. When an examiner asks "what did this agent do and who authorized it?", these procedures provide the cryptographic answer. Every delegation, capability change, autonomy transition, resource draw, and lifecycle event is attested independently of the agent's own logs.
19
+
20
+ - **Delegation Tree Attestation (AI-DEL.1)** -- `witnessDelegation()` attests authority delegation between agents: scope hash, depth from human authorization, TTL, cascade revocation, and sub-delegation control. Evidence for EU AI Act Art. 14 human oversight.
21
+ - **Capability Attestation (AI-CAP.1)** -- `witnessCapabilityAttestation()` attests declared vs observed agent capabilities with manifest hashing and drift detection. Autonomy level binding for Art. 15 robustness.
22
+ - **Autonomy Level Transition (AI-AUTO.3)** -- `witnessAutonomyTransition()` attests agent promotion and demotion between autonomy levels 0-3. Risk-triggered downgrades, HITL checkpoints, and transition justification.
23
+ - **Resource Consumption Attestation (AI-COST.1)** -- `witnessResourceConsumption()` attests token usage, API call counts, and estimated cost as compliance evidence. Budget threshold awareness without billing enforcement.
24
+ - **Lifecycle Event Attestation (AI-LCM.1)** -- `witnessLifecycle()` attests spawn, checkpoint, migrate, terminate, and crash events with context size and state hash.
25
+
26
+ ```typescript
27
+ // Autonomous agent lifecycle: spawn -> delegate -> attest capabilities -> transition -> terminate
28
+ witness.witnessLifecycle("spawn", { contextTokens: 0 });
29
+ witness.witnessDelegation({ scope: "fraud-review", delegator: "orchestrator", depth: 1, ttlSeconds: 3600 });
30
+ witness.witnessCapabilityAttestation({ manifest: ["tool:search", "tool:flag"], autonomyLevel: 2 });
31
+ witness.witnessAutonomyTransition({ fromLevel: 2, toLevel: 1, trigger: "risk_threshold" });
32
+ witness.witnessLifecycle("terminate", { contextTokens: 8400 });
33
+ ```
34
+
35
+ **Cross-Silicon Hardware Attestation** -- auto-detect and attest accelerator inventory across competing silicon vendors. 6 discovery paths: NVIDIA GPU (`nvidia-smi`), Google TPU (JAX), AMD MI (`rocm-smi`), AWS Trainium (`neuron-ls`), Intel Gaudi (`hl-smi`), and PCI fallback. New `multi-silicon` profile for workloads that migrate between vendors. When your model moves from NVIDIA to TPU, the attestation follows.
36
+
37
+ ```typescript
38
+ witness.witnessHardware(); // auto-detects silicon vendor, GPU count, VRAM, driver version
39
+ ```
40
+
41
+ **Endpoint Attestation** -- witness the infrastructure decisions that shape how agents operate across boundaries.
42
+
43
+ - **Agent Transaction Witnessing (AI-FIN.1)** -- `witnessTransaction()` for autonomous agent financial operations. Authorization type, amount, and settlement status anchored before execution.
44
+ - **Tool Permission Attestation (AI-TOOL.2)** -- `witnessToolPermissions()` attests runtime tool sets against agent charter. Detects permission drift and escalation.
45
+ - **Cross-Border Inference Routing (AI-JUR.1)** -- `witnessRouting()` witnesses routing decisions with ISO 3166 region codes and compliance status.
46
+
47
+ **Adapters**
48
+
49
+ - **Cohere Adapter** -- `wrapCohere()` for Cohere V2 API. Chat and streaming witnessed transparently.
50
+ - **Qdrant RAG Witness** -- `wrapQdrant()` for database-level RAG pipeline compliance. Every vector search mints AI-RAG.1.
51
+ - **Ollama 0.30+ Refresh** -- explicit `wrapOllama()` export, GGUF model name normalization.
52
+
53
+ 103 procedures, 54 namespaces, 28 frameworks, 15 profiles, 16 integrations, 7 languages
28
54
 
29
55
  ## MCP Server -- Official Registry
30
56
 
@@ -94,7 +120,7 @@ All verification is local. Zero cloud overhead. No data exchanged until both age
94
120
 
95
121
  ## Offline Verification
96
122
 
97
- Verify any witness anchor without network calls. The fingerprint formula is deterministic and identical across all 6 SDK languages -- recompute it anywhere in microseconds.
123
+ Verify any witness anchor without network calls. The fingerprint formula is deterministic and identical across all 7 SDK languages -- recompute it anywhere in microseconds.
98
124
 
99
125
  ```typescript
100
126
  import { verifyAnchor } from "@tenova/swt3-ai";
@@ -108,7 +134,7 @@ const result = verifyAnchor(anchor, {
108
134
  // result.status: "CERTIFIED TRUTH" | "TAMPERED"
109
135
  ```
110
136
 
111
- Zero vendor dependency. Zero network calls. Works air-gapped. The same formula runs in Python, TypeScript, Rust, C#, and Ruby with identical output for identical inputs.
137
+ Zero vendor dependency. Zero network calls. Works air-gapped. The same formula runs in Python, TypeScript, Swift, Rust, C#, and Ruby with identical output for identical inputs.
112
138
 
113
139
  ## See It Work (No Account Needed)
114
140
 
@@ -722,7 +748,7 @@ All 76 SWT3 AI witnessing procedures map to specific EU AI Act obligations:
722
748
  | AI-EXPL.1 | Art. 13(1) | Transparency & Explainability | -| ✓ |
723
749
  | AI-EXPL.2 | Art. 13(3b) | Confidence Calibration | -| ✓ |
724
750
 
725
- The demo demonstrates 5 procedures using simulated data. All 76 are available in production with real inference data. 207 cross-language test vectors ensure fingerprint parity across Python, TypeScript, Rust, C#, and Ruby. [See live conformity →](https://sovereign.tenova.io/audit/axm_audit_demo_eu_ai_act_public)
751
+ The demo demonstrates 5 procedures using simulated data. All 76 are available in production with real inference data. 207 cross-language test vectors ensure fingerprint parity across Python, TypeScript, Swift, Rust, C#, and Ruby. [See live conformity →](https://sovereign.tenova.io/audit/axm_audit_demo_eu_ai_act_public)
726
752
 
727
753
  ## How Verdicts Work
728
754
 
@@ -0,0 +1,28 @@
1
+ /**
2
+ * SWT3 AI Witness SDK -- Cohere Adapter (ES6 Proxy).
3
+ *
4
+ * Wraps the Cohere client so that chat() and chatStream() are
5
+ * intercepted for witnessing. Flat API -- only one level of proxy.
6
+ *
7
+ * Cohere V2 response structure:
8
+ * response.message.content[0].text -> response text
9
+ * response.model -> string
10
+ * response.finishReason -> "COMPLETE" | "MAX_TOKENS" | "ERROR"
11
+ * response.usage.tokens.inputTokens / outputTokens
12
+ *
13
+ * Cohere streaming:
14
+ * chat_stream() returns an async iterable of events:
15
+ * message-start, content-delta, message-end
16
+ *
17
+ * Copyright (c) 2026 Tenable Nova LLC. Apache 2.0. Patent pending.
18
+ */
19
+ import type { Witness } from "../witness.js";
20
+ /**
21
+ * Wrap a Cohere client with an ES6 Proxy for transparent witnessing.
22
+ *
23
+ * Works with both sync and async Cohere clients. Intercepts:
24
+ * - chat() for non-streaming completions
25
+ * - chatStream() for streaming completions
26
+ */
27
+ export declare function wrapCohere(client: unknown, witness: Witness): unknown;
28
+ //# sourceMappingURL=cohere.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cohere.d.ts","sourceRoot":"","sources":["../../src/adapters/cohere.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAuBrE"}
@@ -0,0 +1,292 @@
1
+ /**
2
+ * SWT3 AI Witness SDK -- Cohere Adapter (ES6 Proxy).
3
+ *
4
+ * Wraps the Cohere client so that chat() and chatStream() are
5
+ * intercepted for witnessing. Flat API -- only one level of proxy.
6
+ *
7
+ * Cohere V2 response structure:
8
+ * response.message.content[0].text -> response text
9
+ * response.model -> string
10
+ * response.finishReason -> "COMPLETE" | "MAX_TOKENS" | "ERROR"
11
+ * response.usage.tokens.inputTokens / outputTokens
12
+ *
13
+ * Cohere streaming:
14
+ * chat_stream() returns an async iterable of events:
15
+ * message-start, content-delta, message-end
16
+ *
17
+ * Copyright (c) 2026 Tenable Nova LLC. Apache 2.0. Patent pending.
18
+ */
19
+ import { sha256Truncated } from "../fingerprint.js";
20
+ /**
21
+ * Wrap a Cohere client with an ES6 Proxy for transparent witnessing.
22
+ *
23
+ * Works with both sync and async Cohere clients. Intercepts:
24
+ * - chat() for non-streaming completions
25
+ * - chatStream() for streaming completions
26
+ */
27
+ export function wrapCohere(client, witness) {
28
+ return new Proxy(client, {
29
+ get(target, prop) {
30
+ if (typeof prop === "symbol")
31
+ return Reflect.get(target, prop);
32
+ const real = Reflect.get(target, prop);
33
+ if (prop === "chat") {
34
+ return createChatInterceptor(real, witness);
35
+ }
36
+ if (prop === "chatStream" || prop === "chat_stream") {
37
+ return createStreamInterceptor(real, witness);
38
+ }
39
+ return real;
40
+ },
41
+ });
42
+ }
43
+ // -- chat() interceptor -------------------------------------------------------
44
+ function createChatInterceptor(realMethod, witness) {
45
+ return function interceptedChat(...args) {
46
+ const kwargs = (args[0] ?? {});
47
+ const messages = kwargs.messages;
48
+ const model = kwargs.model ?? "unknown";
49
+ const promptText = extractPromptText(messages);
50
+ const promptHash = sha256Truncated(promptText);
51
+ // Hash system prompt separately (instruction drift detection)
52
+ const systemPromptText = extractSystemPrompt(messages);
53
+ const systemPromptHash = systemPromptText
54
+ ? sha256Truncated(systemPromptText)
55
+ : undefined;
56
+ // Gatekeeper pre-call check (strict mode only)
57
+ let authorizationId;
58
+ if (witness.strict) {
59
+ authorizationId = witness.gateCheck(messages, model);
60
+ }
61
+ const start = performance.now();
62
+ const result = realMethod.call(this, ...args);
63
+ // Result is Promise<ChatResponse>
64
+ return result.then((response) => {
65
+ const elapsedMs = Math.round(performance.now() - start);
66
+ const record = extractRecord(response, model, promptHash, elapsedMs, systemPromptHash);
67
+ witness.record(record, authorizationId);
68
+ return response;
69
+ });
70
+ };
71
+ }
72
+ // -- chatStream() interceptor -------------------------------------------------
73
+ function createStreamInterceptor(realMethod, witness) {
74
+ return function interceptedStream(...args) {
75
+ const kwargs = (args[0] ?? {});
76
+ const messages = kwargs.messages;
77
+ const model = kwargs.model ?? "unknown";
78
+ const promptText = extractPromptText(messages);
79
+ const promptHash = sha256Truncated(promptText);
80
+ const systemPromptText = extractSystemPrompt(messages);
81
+ const systemPromptHash = systemPromptText
82
+ ? sha256Truncated(systemPromptText)
83
+ : undefined;
84
+ let authorizationId;
85
+ if (witness.strict) {
86
+ authorizationId = witness.gateCheck(messages, model);
87
+ }
88
+ const start = performance.now();
89
+ const result = realMethod.call(this, ...args);
90
+ // chat_stream may return an async iterable directly or a Promise
91
+ if (result && typeof result.then === "function") {
92
+ return result.then((stream) => wrapCohereStream(stream, witness, model, promptHash, start, systemPromptHash, authorizationId));
93
+ }
94
+ return wrapCohereStream(result, witness, model, promptHash, start, systemPromptHash, authorizationId);
95
+ };
96
+ }
97
+ // -- Stream Accumulator -------------------------------------------------------
98
+ async function* streamAccumulator(stream, witness, model, promptHash, startTime, systemPromptHash, authorizationId) {
99
+ const textParts = [];
100
+ let actualModel = model;
101
+ let inputTokens;
102
+ let outputTokens;
103
+ for await (const event of stream) {
104
+ // Yield to developer immediately
105
+ yield event;
106
+ const e = event;
107
+ const type = e.type;
108
+ if (type === "message-start") {
109
+ const delta = e.delta;
110
+ if (delta) {
111
+ const message = delta.message;
112
+ if (message?.model)
113
+ actualModel = message.model;
114
+ }
115
+ }
116
+ if (type === "content-delta") {
117
+ const delta = e.delta;
118
+ if (delta) {
119
+ const message = delta.message;
120
+ if (message) {
121
+ const content = message.content;
122
+ if (content?.text) {
123
+ textParts.push(content.text);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ if (type === "message-end") {
129
+ const delta = e.delta;
130
+ if (delta) {
131
+ const usage = delta.usage;
132
+ if (usage) {
133
+ const tokens = usage.tokens;
134
+ if (tokens) {
135
+ if (tokens.input_tokens !== undefined)
136
+ inputTokens = tokens.input_tokens;
137
+ if (tokens.output_tokens !== undefined)
138
+ outputTokens = tokens.output_tokens;
139
+ }
140
+ // Also check camelCase variants
141
+ if (tokens === undefined) {
142
+ if (usage.inputTokens !== undefined)
143
+ inputTokens = usage.inputTokens;
144
+ if (usage.outputTokens !== undefined)
145
+ outputTokens = usage.outputTokens;
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ // Stream complete -- witness
152
+ const elapsedMs = Math.round(performance.now() - startTime);
153
+ const responseText = textParts.join("");
154
+ const record = {
155
+ modelId: actualModel,
156
+ modelHash: sha256Truncated(actualModel),
157
+ promptHash,
158
+ responseHash: sha256Truncated(responseText),
159
+ latencyMs: elapsedMs,
160
+ inputTokens,
161
+ outputTokens,
162
+ guardrailsActive: 0,
163
+ guardrailsRequired: 0,
164
+ guardrailPassed: true,
165
+ hasRefusal: false,
166
+ provider: "cohere",
167
+ guardrailNames: [],
168
+ systemPromptHash,
169
+ };
170
+ witness.record(record, authorizationId);
171
+ }
172
+ function wrapCohereStream(stream, witness, model, promptHash, startTime, systemPromptHash, authorizationId) {
173
+ const s = stream;
174
+ const gen = streamAccumulator(s, witness, model, promptHash, startTime, systemPromptHash, authorizationId);
175
+ return new Proxy(s, {
176
+ get(target, prop) {
177
+ if (prop === Symbol.asyncIterator) {
178
+ return () => gen;
179
+ }
180
+ const value = Reflect.get(target, prop);
181
+ if (typeof value === "function") {
182
+ return value.bind(target);
183
+ }
184
+ return value;
185
+ },
186
+ });
187
+ }
188
+ // -- Factor Extraction --------------------------------------------------------
189
+ function extractSystemPrompt(messages) {
190
+ if (!Array.isArray(messages))
191
+ return undefined;
192
+ for (const msg of messages) {
193
+ if (typeof msg !== "object" || msg === null)
194
+ continue;
195
+ const m = msg;
196
+ if (m.role !== "system")
197
+ continue;
198
+ const content = m.content;
199
+ if (typeof content === "string")
200
+ return content;
201
+ if (Array.isArray(content)) {
202
+ const parts = [];
203
+ for (const block of content) {
204
+ if (typeof block === "object" && block !== null) {
205
+ const b = block;
206
+ if (typeof b.text === "string")
207
+ parts.push(b.text);
208
+ }
209
+ }
210
+ return parts.length > 0 ? parts.join("\n") : undefined;
211
+ }
212
+ }
213
+ return undefined;
214
+ }
215
+ function extractPromptText(messages) {
216
+ const parts = [];
217
+ if (Array.isArray(messages)) {
218
+ for (const msg of messages) {
219
+ if (typeof msg !== "object" || msg === null)
220
+ continue;
221
+ const m = msg;
222
+ const content = m.content;
223
+ if (typeof content === "string") {
224
+ parts.push(content);
225
+ }
226
+ else if (Array.isArray(content)) {
227
+ for (const block of content) {
228
+ if (typeof block === "object" && block !== null) {
229
+ const b = block;
230
+ if (typeof b.text === "string")
231
+ parts.push(b.text);
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+ return parts.join("\n");
238
+ }
239
+ function extractRecord(response, model, promptHash, elapsedMs, systemPromptHash) {
240
+ const r = response;
241
+ // Extract text from message.content
242
+ let responseText = "";
243
+ const message = r.message;
244
+ if (message) {
245
+ const content = message.content;
246
+ if (Array.isArray(content)) {
247
+ const texts = [];
248
+ for (const block of content) {
249
+ if (typeof block.text === "string")
250
+ texts.push(block.text);
251
+ }
252
+ responseText = texts.join("\n");
253
+ }
254
+ }
255
+ // Finish reason
256
+ const finishReason = r.finish_reason ?? r.finishReason ?? "";
257
+ const hasRefusal = !["COMPLETE", "MAX_TOKENS", "TOOL_CALL"].includes(finishReason);
258
+ // Token usage
259
+ const usage = r.usage;
260
+ let inputTokens;
261
+ let outputTokens;
262
+ if (usage) {
263
+ const tokens = usage.tokens;
264
+ if (tokens) {
265
+ inputTokens = tokens.input_tokens;
266
+ outputTokens = tokens.output_tokens;
267
+ // camelCase fallback
268
+ if (inputTokens === undefined)
269
+ inputTokens = tokens.inputTokens;
270
+ if (outputTokens === undefined)
271
+ outputTokens = tokens.outputTokens;
272
+ }
273
+ }
274
+ const actualModel = r.model ?? model;
275
+ return {
276
+ modelId: actualModel,
277
+ modelHash: sha256Truncated(actualModel),
278
+ promptHash,
279
+ responseHash: sha256Truncated(responseText),
280
+ latencyMs: elapsedMs,
281
+ inputTokens,
282
+ outputTokens,
283
+ guardrailsActive: 0,
284
+ guardrailsRequired: 0,
285
+ guardrailPassed: true,
286
+ hasRefusal,
287
+ provider: "cohere",
288
+ systemPromptHash,
289
+ guardrailNames: [],
290
+ };
291
+ }
292
+ //# sourceMappingURL=cohere.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cohere.js","sourceRoot":"","sources":["../../src/adapters/cohere.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,MAAe,EAAE,OAAgB;IAC1D,OAAO,IAAI,KAAK,CAAC,MAAgB,EAAE;QACjC,GAAG,CAAC,MAAc,EAAE,IAAqB;YACvC,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAEv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B,gBAAgB;QAChB,cAAc,EAAE,EAAE;KACnB,CAAC;AACJ,CAAC"}
@@ -5,9 +5,29 @@
5
5
  * provider="ollama". Ollama uses an OpenAI-compatible API at
6
6
  * http://localhost:11434/v1.
7
7
  *
8
+ * Compatible with Ollama 0.30+ (GGUF models, structured outputs via
9
+ * OpenAI-compatible API). Model names with tags and quantization suffixes
10
+ * are preserved as-is (e.g., "llama3.2:latest", "qwen2.5:7b-instruct-q4_0").
11
+ *
8
12
  * Auto-detected by witness.wrap() when base_url contains ":11434".
9
13
  */
10
14
  import type { Witness } from "../witness.js";
15
+ /**
16
+ * Wrap an OpenAI client (pointed at Ollama) with transparent witnessing.
17
+ *
18
+ * Identical to the OpenAI adapter but tags all InferenceRecords with
19
+ * provider="ollama" for accurate lineage tracking.
20
+ */
11
21
  export declare function wrapOllama(client: unknown, witness: Witness): unknown;
12
22
  export declare function isOllamaClient(client: unknown): boolean;
23
+ /**
24
+ * Normalize an Ollama model name, preserving GGUF tags and quantization.
25
+ *
26
+ * Ollama 0.30+ model names include tags and quantization suffixes that
27
+ * are significant for lineage tracking:
28
+ * "llama3.2:latest" -> "llama3.2:latest"
29
+ * "qwen2.5:7b-instruct-q4_0" -> "qwen2.5:7b-instruct-q4_0"
30
+ * "mistral" -> "mistral"
31
+ */
32
+ export declare function normalizeOllamaModel(model: string): string;
13
33
  //# sourceMappingURL=ollama.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../src/adapters/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAErE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAGvD"}
1
+ {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../src/adapters/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAErE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAGvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -5,9 +5,19 @@
5
5
  * provider="ollama". Ollama uses an OpenAI-compatible API at
6
6
  * http://localhost:11434/v1.
7
7
  *
8
+ * Compatible with Ollama 0.30+ (GGUF models, structured outputs via
9
+ * OpenAI-compatible API). Model names with tags and quantization suffixes
10
+ * are preserved as-is (e.g., "llama3.2:latest", "qwen2.5:7b-instruct-q4_0").
11
+ *
8
12
  * Auto-detected by witness.wrap() when base_url contains ":11434".
9
13
  */
10
14
  import { wrapOpenAI } from "./openai.js";
15
+ /**
16
+ * Wrap an OpenAI client (pointed at Ollama) with transparent witnessing.
17
+ *
18
+ * Identical to the OpenAI adapter but tags all InferenceRecords with
19
+ * provider="ollama" for accurate lineage tracking.
20
+ */
11
21
  export function wrapOllama(client, witness) {
12
22
  return wrapOpenAI(client, witness, "ollama");
13
23
  }
@@ -15,6 +25,18 @@ export function isOllamaClient(client) {
15
25
  const baseURL = getBaseURL(client);
16
26
  return baseURL.includes(":11434");
17
27
  }
28
+ /**
29
+ * Normalize an Ollama model name, preserving GGUF tags and quantization.
30
+ *
31
+ * Ollama 0.30+ model names include tags and quantization suffixes that
32
+ * are significant for lineage tracking:
33
+ * "llama3.2:latest" -> "llama3.2:latest"
34
+ * "qwen2.5:7b-instruct-q4_0" -> "qwen2.5:7b-instruct-q4_0"
35
+ * "mistral" -> "mistral"
36
+ */
37
+ export function normalizeOllamaModel(model) {
38
+ return model?.trim() || "unknown";
39
+ }
18
40
  function getBaseURL(client) {
19
41
  if (client === null || client === undefined)
20
42
  return "";
@@ -1 +1 @@
1
- {"version":3,"file":"ollama.js","sourceRoot":"","sources":["../../src/adapters/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,UAAU,UAAU,CAAC,MAAe,EAAE,OAAgB;IAC1D,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAe;IAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,UAAU,CAAC,MAAe;IACjC,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACvD,MAAM,GAAG,GAAG,MAAiC,CAAC;IAC9C,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC"}
1
+ {"version":3,"file":"ollama.js","sourceRoot":"","sources":["../../src/adapters/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,MAAe,EAAE,OAAgB;IAC1D,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAe;IAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;AACpC,CAAC;AAED,SAAS,UAAU,CAAC,MAAe;IACjC,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACvD,MAAM,GAAG,GAAG,MAAiC,CAAC;IAC9C,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * SWT3 AI Witness SDK -- Qdrant Vector Database Adapter.
3
+ *
4
+ * Wraps the Qdrant JavaScript/TypeScript client to witness vector search
5
+ * operations. Mints AI-RAG.1 anchors for each retrieval, creating
6
+ * database-level compliance evidence for RAG pipelines.
7
+ *
8
+ * Usage:
9
+ * import { QdrantClient } from "@qdrant/js-client-rest";
10
+ * import { wrapQdrant } from "@tenova/swt3-ai/adapters/qdrant";
11
+ *
12
+ * const witness = new Witness({ endpoint: "...", apiKey: "...", tenantId: "..." });
13
+ * const client = new QdrantClient({ url: "http://localhost:6333" });
14
+ * const witnessed = wrapQdrant(client, witness);
15
+ *
16
+ * const results = await witnessed.search("docs", { vector: [...], limit: 10 });
17
+ *
18
+ * Copyright (c) 2026 Tenable Nova LLC. Apache 2.0. Patent pending.
19
+ */
20
+ import type { Witness } from "../witness.js";
21
+ /**
22
+ * Wrap a QdrantClient with an ES6 Proxy for transparent RAG witnessing.
23
+ *
24
+ * Intercepts search() and query() to mint AI-RAG.1 anchors for every
25
+ * vector retrieval operation.
26
+ */
27
+ export declare function wrapQdrant(client: unknown, witness: Witness): unknown;
28
+ //# sourceMappingURL=qdrant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qdrant.d.ts","sourceRoot":"","sources":["../../src/adapters/qdrant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAkBrE"}