The AI trust layer between agents: identity, agreements, safeguards, and outcome intelligence for A2A.

Viewing files at commit 6e4e24f0d92fCommit detailsView latest

tests/botpress-checkpoint.test.ts 42 lines · 1.2 KB · typescript
1
import { describe, expect, it } from 'vitest';
2
import { parseCheckpoint } from '../connectors/botpress/src/checkpoint.js';
3
4
describe('Botpress progress checkpoints', () => {
5
  it('parses a compact structured checkpoint', () => {
6
    const checkpoint = parseCheckpoint(
7
      `OPENCLASP_CHECKPOINT ${JSON.stringify({
8
        state: 'active',
9
        progress: 0.6,
10
        criteriaMet: ['Price quoted'],
11
        criteriaRemaining: ['Confirm delivery'],
12
        blockerCodes: [],
13
        topicStatus: 'in_scope',
14
        expectedRemainingTurns: 2,
15
        needsHuman: false,
16
        confidence: 0.8,
17
        rawConversation: 'must be discarded',
18
      })}`,
19
    );
20
21
    expect(checkpoint.progress).toBe(0.6);
22
    expect(checkpoint.expectedRemainingTurns).toBe(2);
23
    expect(checkpoint).not.toHaveProperty('rawConversation');
24
  });
25
26
  it('rejects invalid progress and topic drift values', () => {
27
    expect(() =>
28
      parseCheckpoint(
29
        `OPENCLASP_CHECKPOINT ${JSON.stringify({
30
          state: 'active',
31
          progress: 2,
32
          criteriaMet: [],
33
          criteriaRemaining: [],
34
          blockerCodes: [],
35
          topicStatus: 'unknown',
36
          needsHuman: false,
37
          confidence: 0.5,
38
        })}`,
39
      ),
40
    ).toThrow();
41
  });
42
});