@artemiskit/adapter-anthropic 0.1.10 → 0.1.12
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/CHANGELOG.md +137 -0
- package/dist/index.js +12 -12
- package/dist/src/index.js +2871 -0
- package/openai/dist/index.js +5579 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,142 @@
|
|
|
1
1
|
# @artemiskit/adapter-anthropic
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ## v0.3.0 - SDK, Guardian Mode & OWASP Compliance
|
|
8
|
+
|
|
9
|
+
This major release delivers the full programmatic SDK, runtime protection with Guardian Mode, OWASP LLM Top 10 2025 attack vectors, and agentic framework adapters.
|
|
10
|
+
|
|
11
|
+
### Programmatic SDK (`@artemiskit/sdk`)
|
|
12
|
+
|
|
13
|
+
The new SDK package provides a complete programmatic API for LLM evaluation:
|
|
14
|
+
|
|
15
|
+
- **ArtemisKit class** with `run()`, `redteam()`, and `stress()` methods
|
|
16
|
+
- **Jest integration** with custom matchers (`toPassAllCases`, `toHaveSuccessRate`, etc.)
|
|
17
|
+
- **Vitest integration** with identical matchers
|
|
18
|
+
- **Event handling** for real-time progress updates
|
|
19
|
+
- **13 custom matchers** for run, red team, and stress test assertions
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { ArtemisKit } from "@artemiskit/sdk";
|
|
23
|
+
import { jestMatchers } from "@artemiskit/sdk/jest";
|
|
24
|
+
|
|
25
|
+
expect.extend(jestMatchers);
|
|
26
|
+
|
|
27
|
+
const kit = new ArtemisKit({ provider: "openai", model: "gpt-4o" });
|
|
28
|
+
const results = await kit.run({ scenario: "./tests.yaml" });
|
|
29
|
+
expect(results).toPassAllCases();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Guardian Mode (Runtime Protection)
|
|
33
|
+
|
|
34
|
+
New Guardian Mode provides runtime protection for AI/LLM applications:
|
|
35
|
+
|
|
36
|
+
- **Three operating modes**: `testing`, `guardian`, `hybrid`
|
|
37
|
+
- **Prompt injection detection** and blocking
|
|
38
|
+
- **PII detection & redaction** (email, SSN, phone, API keys)
|
|
39
|
+
- **Action validation** for agent tool/function calls
|
|
40
|
+
- **Intent classification** with risk assessment
|
|
41
|
+
- **Circuit breaker** for automatic blocking on repeated violations
|
|
42
|
+
- **Rate limiting** and **cost limiting**
|
|
43
|
+
- **Custom policies** via TypeScript or YAML
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { createGuardian } from "@artemiskit/sdk/guardian";
|
|
47
|
+
|
|
48
|
+
const guardian = createGuardian({ mode: "guardian", blockOnFailure: true });
|
|
49
|
+
const protectedClient = guardian.protect(myLLMClient);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### OWASP LLM Top 10 2025 Attack Vectors
|
|
53
|
+
|
|
54
|
+
New red team mutations aligned with OWASP LLM Top 10 2025:
|
|
55
|
+
|
|
56
|
+
| Mutation | OWASP | Description |
|
|
57
|
+
| -------------------- | ----- | ------------------------------ |
|
|
58
|
+
| `bad-likert-judge` | LLM01 | Exploit evaluation capability |
|
|
59
|
+
| `crescendo` | LLM01 | Multi-turn gradual escalation |
|
|
60
|
+
| `deceptive-delight` | LLM01 | Positive framing bypass |
|
|
61
|
+
| `system-extraction` | LLM07 | System prompt leakage |
|
|
62
|
+
| `output-injection` | LLM05 | XSS, SQLi in output |
|
|
63
|
+
| `excessive-agency` | LLM06 | Unauthorized action claims |
|
|
64
|
+
| `hallucination-trap` | LLM09 | Confident fabrication triggers |
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
akit redteam scenario.yaml --owasp LLM01,LLM05
|
|
68
|
+
akit redteam scenario.yaml --owasp-full
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Agentic Framework Adapters
|
|
72
|
+
|
|
73
|
+
New adapters for testing agentic AI systems:
|
|
74
|
+
|
|
75
|
+
**LangChain Adapter** (`@artemiskit/adapter-langchain`)
|
|
76
|
+
|
|
77
|
+
- Test chains, agents, and runnables
|
|
78
|
+
- Capture intermediate steps and tool usage
|
|
79
|
+
- Support for LCEL, ReAct agents, RAG chains
|
|
80
|
+
|
|
81
|
+
**DeepAgents Adapter** (`@artemiskit/adapter-deepagents`)
|
|
82
|
+
|
|
83
|
+
- Test multi-agent systems and workflows
|
|
84
|
+
- Capture agent traces and inter-agent messages
|
|
85
|
+
- Support for sequential, parallel, and hierarchical workflows
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { createLangChainAdapter } from "@artemiskit/adapter-langchain";
|
|
89
|
+
import { createDeepAgentsAdapter } from "@artemiskit/adapter-deepagents";
|
|
90
|
+
|
|
91
|
+
const adapter = createLangChainAdapter(myChain, {
|
|
92
|
+
captureIntermediateSteps: true,
|
|
93
|
+
});
|
|
94
|
+
const result = await adapter.generate({ prompt: "Test query" });
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Supabase Storage Enhancements
|
|
98
|
+
|
|
99
|
+
Enhanced cloud storage capabilities:
|
|
100
|
+
|
|
101
|
+
- **Analytics tables** for metrics tracking
|
|
102
|
+
- **Case results table** for granular analysis
|
|
103
|
+
- **Baseline management** for regression detection
|
|
104
|
+
- **Trend analysis** queries
|
|
105
|
+
|
|
106
|
+
### Bug Fixes
|
|
107
|
+
|
|
108
|
+
- **adapter-openai**: Use `max_completion_tokens` for newer OpenAI models (o1, o3, gpt-4.5)
|
|
109
|
+
- **redteam**: Resolve TypeScript and flaky test issues in OWASP mutations
|
|
110
|
+
- **adapters**: Fix TypeScript build errors for agentic adapters
|
|
111
|
+
- **core**: Add `langchain` and `deepagents` to ProviderType union
|
|
112
|
+
|
|
113
|
+
### Examples
|
|
114
|
+
|
|
115
|
+
New comprehensive examples organized by feature:
|
|
116
|
+
|
|
117
|
+
- `examples/guardian/` - Guardian Mode examples (testing, guardian, hybrid modes)
|
|
118
|
+
- `examples/sdk/` - SDK usage examples (Jest, Vitest, events)
|
|
119
|
+
- `examples/adapters/` - Agentic adapter examples
|
|
120
|
+
- `examples/owasp/` - OWASP LLM Top 10 test scenarios
|
|
121
|
+
|
|
122
|
+
### Documentation
|
|
123
|
+
|
|
124
|
+
- Complete SDK documentation with API reference
|
|
125
|
+
- Guardian Mode guide with all three modes explained
|
|
126
|
+
- Agentic adapters documentation (LangChain, DeepAgents)
|
|
127
|
+
- Test matchers reference for Jest/Vitest
|
|
128
|
+
- OWASP LLM Top 10 testing scenarios
|
|
129
|
+
|
|
130
|
+
- Updated dependencies
|
|
131
|
+
- @artemiskit/core@0.3.0
|
|
132
|
+
|
|
133
|
+
## 0.1.11
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- Updated dependencies [16604a6]
|
|
138
|
+
- @artemiskit/core@0.2.4
|
|
139
|
+
|
|
3
140
|
## 0.1.10
|
|
4
141
|
|
|
5
142
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1961,12 +1961,12 @@ class PromptCachingBetaMessageStream {
|
|
|
1961
1961
|
}
|
|
1962
1962
|
__classPrivateFieldGet2(this, _PromptCachingBetaMessageStream_instances, "m", _PromptCachingBetaMessageStream_endRequest).call(this);
|
|
1963
1963
|
}
|
|
1964
|
-
[(_PromptCachingBetaMessageStream_currentMessageSnapshot = new WeakMap, _PromptCachingBetaMessageStream_connectedPromise = new WeakMap, _PromptCachingBetaMessageStream_resolveConnectedPromise = new WeakMap, _PromptCachingBetaMessageStream_rejectConnectedPromise = new WeakMap, _PromptCachingBetaMessageStream_endPromise = new WeakMap, _PromptCachingBetaMessageStream_resolveEndPromise = new WeakMap, _PromptCachingBetaMessageStream_rejectEndPromise = new WeakMap, _PromptCachingBetaMessageStream_listeners = new WeakMap, _PromptCachingBetaMessageStream_ended = new WeakMap, _PromptCachingBetaMessageStream_errored = new WeakMap, _PromptCachingBetaMessageStream_aborted = new WeakMap, _PromptCachingBetaMessageStream_catchingPromiseCreated = new WeakMap, _PromptCachingBetaMessageStream_handleError = new WeakMap, _PromptCachingBetaMessageStream_instances = new WeakSet, _PromptCachingBetaMessageStream_getFinalMessage = function
|
|
1964
|
+
[(_PromptCachingBetaMessageStream_currentMessageSnapshot = new WeakMap, _PromptCachingBetaMessageStream_connectedPromise = new WeakMap, _PromptCachingBetaMessageStream_resolveConnectedPromise = new WeakMap, _PromptCachingBetaMessageStream_rejectConnectedPromise = new WeakMap, _PromptCachingBetaMessageStream_endPromise = new WeakMap, _PromptCachingBetaMessageStream_resolveEndPromise = new WeakMap, _PromptCachingBetaMessageStream_rejectEndPromise = new WeakMap, _PromptCachingBetaMessageStream_listeners = new WeakMap, _PromptCachingBetaMessageStream_ended = new WeakMap, _PromptCachingBetaMessageStream_errored = new WeakMap, _PromptCachingBetaMessageStream_aborted = new WeakMap, _PromptCachingBetaMessageStream_catchingPromiseCreated = new WeakMap, _PromptCachingBetaMessageStream_handleError = new WeakMap, _PromptCachingBetaMessageStream_instances = new WeakSet, _PromptCachingBetaMessageStream_getFinalMessage = function _PromptCachingBetaMessageStream_getFinalMessage2() {
|
|
1965
1965
|
if (this.receivedMessages.length === 0) {
|
|
1966
1966
|
throw new AnthropicError("stream ended without producing a PromptCachingBetaMessage with role=assistant");
|
|
1967
1967
|
}
|
|
1968
1968
|
return this.receivedMessages.at(-1);
|
|
1969
|
-
}, _PromptCachingBetaMessageStream_getFinalText = function
|
|
1969
|
+
}, _PromptCachingBetaMessageStream_getFinalText = function _PromptCachingBetaMessageStream_getFinalText2() {
|
|
1970
1970
|
if (this.receivedMessages.length === 0) {
|
|
1971
1971
|
throw new AnthropicError("stream ended without producing a PromptCachingBetaMessage with role=assistant");
|
|
1972
1972
|
}
|
|
@@ -1975,11 +1975,11 @@ class PromptCachingBetaMessageStream {
|
|
|
1975
1975
|
throw new AnthropicError("stream ended without producing a content block with type=text");
|
|
1976
1976
|
}
|
|
1977
1977
|
return textBlocks.join(" ");
|
|
1978
|
-
}, _PromptCachingBetaMessageStream_beginRequest = function
|
|
1978
|
+
}, _PromptCachingBetaMessageStream_beginRequest = function _PromptCachingBetaMessageStream_beginRequest2() {
|
|
1979
1979
|
if (this.ended)
|
|
1980
1980
|
return;
|
|
1981
1981
|
__classPrivateFieldSet2(this, _PromptCachingBetaMessageStream_currentMessageSnapshot, undefined, "f");
|
|
1982
|
-
}, _PromptCachingBetaMessageStream_addStreamEvent = function
|
|
1982
|
+
}, _PromptCachingBetaMessageStream_addStreamEvent = function _PromptCachingBetaMessageStream_addStreamEvent2(event) {
|
|
1983
1983
|
if (this.ended)
|
|
1984
1984
|
return;
|
|
1985
1985
|
const messageSnapshot = __classPrivateFieldGet2(this, _PromptCachingBetaMessageStream_instances, "m", _PromptCachingBetaMessageStream_accumulateMessage).call(this, event);
|
|
@@ -2013,7 +2013,7 @@ class PromptCachingBetaMessageStream {
|
|
|
2013
2013
|
case "message_delta":
|
|
2014
2014
|
break;
|
|
2015
2015
|
}
|
|
2016
|
-
}, _PromptCachingBetaMessageStream_endRequest = function
|
|
2016
|
+
}, _PromptCachingBetaMessageStream_endRequest = function _PromptCachingBetaMessageStream_endRequest2() {
|
|
2017
2017
|
if (this.ended) {
|
|
2018
2018
|
throw new AnthropicError(`stream has ended, this shouldn't happen`);
|
|
2019
2019
|
}
|
|
@@ -2023,7 +2023,7 @@ class PromptCachingBetaMessageStream {
|
|
|
2023
2023
|
}
|
|
2024
2024
|
__classPrivateFieldSet2(this, _PromptCachingBetaMessageStream_currentMessageSnapshot, undefined, "f");
|
|
2025
2025
|
return snapshot;
|
|
2026
|
-
}, _PromptCachingBetaMessageStream_accumulateMessage = function
|
|
2026
|
+
}, _PromptCachingBetaMessageStream_accumulateMessage = function _PromptCachingBetaMessageStream_accumulateMessage2(event) {
|
|
2027
2027
|
let snapshot = __classPrivateFieldGet2(this, _PromptCachingBetaMessageStream_currentMessageSnapshot, "f");
|
|
2028
2028
|
if (event.type === "message_start") {
|
|
2029
2029
|
if (snapshot) {
|
|
@@ -2427,12 +2427,12 @@ class MessageStream {
|
|
|
2427
2427
|
}
|
|
2428
2428
|
__classPrivateFieldGet3(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this);
|
|
2429
2429
|
}
|
|
2430
|
-
[(_MessageStream_currentMessageSnapshot = new WeakMap, _MessageStream_connectedPromise = new WeakMap, _MessageStream_resolveConnectedPromise = new WeakMap, _MessageStream_rejectConnectedPromise = new WeakMap, _MessageStream_endPromise = new WeakMap, _MessageStream_resolveEndPromise = new WeakMap, _MessageStream_rejectEndPromise = new WeakMap, _MessageStream_listeners = new WeakMap, _MessageStream_ended = new WeakMap, _MessageStream_errored = new WeakMap, _MessageStream_aborted = new WeakMap, _MessageStream_catchingPromiseCreated = new WeakMap, _MessageStream_handleError = new WeakMap, _MessageStream_instances = new WeakSet, _MessageStream_getFinalMessage = function
|
|
2430
|
+
[(_MessageStream_currentMessageSnapshot = new WeakMap, _MessageStream_connectedPromise = new WeakMap, _MessageStream_resolveConnectedPromise = new WeakMap, _MessageStream_rejectConnectedPromise = new WeakMap, _MessageStream_endPromise = new WeakMap, _MessageStream_resolveEndPromise = new WeakMap, _MessageStream_rejectEndPromise = new WeakMap, _MessageStream_listeners = new WeakMap, _MessageStream_ended = new WeakMap, _MessageStream_errored = new WeakMap, _MessageStream_aborted = new WeakMap, _MessageStream_catchingPromiseCreated = new WeakMap, _MessageStream_handleError = new WeakMap, _MessageStream_instances = new WeakSet, _MessageStream_getFinalMessage = function _MessageStream_getFinalMessage2() {
|
|
2431
2431
|
if (this.receivedMessages.length === 0) {
|
|
2432
2432
|
throw new AnthropicError("stream ended without producing a Message with role=assistant");
|
|
2433
2433
|
}
|
|
2434
2434
|
return this.receivedMessages.at(-1);
|
|
2435
|
-
}, _MessageStream_getFinalText = function
|
|
2435
|
+
}, _MessageStream_getFinalText = function _MessageStream_getFinalText2() {
|
|
2436
2436
|
if (this.receivedMessages.length === 0) {
|
|
2437
2437
|
throw new AnthropicError("stream ended without producing a Message with role=assistant");
|
|
2438
2438
|
}
|
|
@@ -2441,11 +2441,11 @@ class MessageStream {
|
|
|
2441
2441
|
throw new AnthropicError("stream ended without producing a content block with type=text");
|
|
2442
2442
|
}
|
|
2443
2443
|
return textBlocks.join(" ");
|
|
2444
|
-
}, _MessageStream_beginRequest = function
|
|
2444
|
+
}, _MessageStream_beginRequest = function _MessageStream_beginRequest2() {
|
|
2445
2445
|
if (this.ended)
|
|
2446
2446
|
return;
|
|
2447
2447
|
__classPrivateFieldSet3(this, _MessageStream_currentMessageSnapshot, undefined, "f");
|
|
2448
|
-
}, _MessageStream_addStreamEvent = function
|
|
2448
|
+
}, _MessageStream_addStreamEvent = function _MessageStream_addStreamEvent2(event) {
|
|
2449
2449
|
if (this.ended)
|
|
2450
2450
|
return;
|
|
2451
2451
|
const messageSnapshot = __classPrivateFieldGet3(this, _MessageStream_instances, "m", _MessageStream_accumulateMessage).call(this, event);
|
|
@@ -2479,7 +2479,7 @@ class MessageStream {
|
|
|
2479
2479
|
case "message_delta":
|
|
2480
2480
|
break;
|
|
2481
2481
|
}
|
|
2482
|
-
}, _MessageStream_endRequest = function
|
|
2482
|
+
}, _MessageStream_endRequest = function _MessageStream_endRequest2() {
|
|
2483
2483
|
if (this.ended) {
|
|
2484
2484
|
throw new AnthropicError(`stream has ended, this shouldn't happen`);
|
|
2485
2485
|
}
|
|
@@ -2489,7 +2489,7 @@ class MessageStream {
|
|
|
2489
2489
|
}
|
|
2490
2490
|
__classPrivateFieldSet3(this, _MessageStream_currentMessageSnapshot, undefined, "f");
|
|
2491
2491
|
return snapshot;
|
|
2492
|
-
}, _MessageStream_accumulateMessage = function
|
|
2492
|
+
}, _MessageStream_accumulateMessage = function _MessageStream_accumulateMessage2(event) {
|
|
2493
2493
|
let snapshot = __classPrivateFieldGet3(this, _MessageStream_currentMessageSnapshot, "f");
|
|
2494
2494
|
if (event.type === "message_start") {
|
|
2495
2495
|
if (snapshot) {
|