@mnemom/agent-integrity-protocol 0.1.0 → 0.1.1
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 +58 -0
- package/dist/index.cjs +2 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/package.json +8 -1
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @mnemom/agent-integrity-protocol
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the Agent Integrity Protocol — real-time thinking block analysis for AI agent alignment.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mnemom/agent-integrity-protocol
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
checkIntegrity,
|
|
16
|
+
buildSignal,
|
|
17
|
+
AnthropicAdapter,
|
|
18
|
+
WindowManager,
|
|
19
|
+
} from '@mnemom/agent-integrity-protocol';
|
|
20
|
+
|
|
21
|
+
// Extract thinking block from LLM response
|
|
22
|
+
const adapter = new AnthropicAdapter();
|
|
23
|
+
const thinking = adapter.extract(response);
|
|
24
|
+
|
|
25
|
+
// Run integrity analysis
|
|
26
|
+
const checkpoint = await checkIntegrity({
|
|
27
|
+
thinkingBlock: thinking.content,
|
|
28
|
+
card: alignmentCard,
|
|
29
|
+
config: {
|
|
30
|
+
agentId: 'my-agent',
|
|
31
|
+
analysisLlm: {
|
|
32
|
+
model: 'claude-haiku-4-5-20251001',
|
|
33
|
+
baseUrl: 'https://api.anthropic.com',
|
|
34
|
+
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
35
|
+
maxTokens: 1024,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Act on the verdict
|
|
41
|
+
if (checkpoint.verdict === 'clear') {
|
|
42
|
+
proceed();
|
|
43
|
+
} else {
|
|
44
|
+
escalate(checkpoint.concerns);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
See the [full documentation](https://github.com/mnemom/aip#readme) and [specification](https://github.com/mnemom/aip/blob/main/docs/SPEC.md).
|
|
51
|
+
|
|
52
|
+
## Requirements
|
|
53
|
+
|
|
54
|
+
- Node.js >= 18.0.0
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
Apache 2.0. See [LICENSE](LICENSE) for details.
|
package/dist/index.cjs
CHANGED
|
@@ -1343,8 +1343,7 @@ function createClient(config) {
|
|
|
1343
1343
|
truncated: prompt.truncated,
|
|
1344
1344
|
confidence: thinking.confidence
|
|
1345
1345
|
},
|
|
1346
|
-
agentId: config.card.card_id,
|
|
1347
|
-
// Use card_id as agent proxy
|
|
1346
|
+
agentId: config.agent_id ?? config.card.card_id,
|
|
1348
1347
|
cardId: config.card.card_id,
|
|
1349
1348
|
sessionId: window.getSessionId(),
|
|
1350
1349
|
windowPosition: {
|
|
@@ -1434,7 +1433,7 @@ function buildSyntheticSignal(config, window, verdict) {
|
|
|
1434
1433
|
return {
|
|
1435
1434
|
checkpoint: {
|
|
1436
1435
|
checkpoint_id: `ic-synthetic-${Date.now()}`,
|
|
1437
|
-
agent_id: config.card.card_id,
|
|
1436
|
+
agent_id: config.agent_id ?? config.card.card_id,
|
|
1438
1437
|
card_id: config.card.card_id,
|
|
1439
1438
|
session_id: window.getSessionId(),
|
|
1440
1439
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|