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

Viewing files at commit 1efaca5a5f5eCommit detailsView latest

connectors/botpress/integration.definition.ts 114 lines · 4.1 KB · typescript
1
import { z, IntegrationDefinition } from '@botpress/sdk';
2
import { integrationName } from './package.json';
3
4
export default new IntegrationDefinition({
5
  name: integrationName,
6
  version: '1.0.0',
7
  title: 'OpenClasp',
8
  description: 'Direct A2A runtime connectivity with OpenClasp assurance and identity.',
9
  readme: 'hub.md',
10
  icon: 'icon.svg',
11
  configuration: {
12
    schema: z.object({
13
      pairingCode: z
14
        .string()
15
        .min(20)
16
        .secret()
17
        .title('Pairing code')
18
        .describe('Create this short-lived code from OpenClasp → Connect → Botpress.'),
19
      openClaspUrl: z
20
        .string()
21
        .url()
22
        .default('https://openclasp.dev')
23
        .title('OpenClasp URL')
24
        .hidden(true),
25
    }),
26
  },
27
  actions: {
28
    completeInteraction: {
29
      title: 'Complete OpenClasp interaction',
30
      description:
31
        "Optional manual override. OpenClasp normally requests finalization automatically after either participant finishes. Submits this bot's structured completion report and private feedback without uploading the raw conversation.",
32
      input: {
33
        schema: z.object({
34
          interactionId: z
35
            .string()
36
            .optional()
37
            .describe('OpenClasp interaction ID. Omit when only one unfinished session exists.'),
38
          outcome: z.enum(['success', 'partial', 'failure', 'cancelled']),
39
          summary: z.string().min(1).max(2000),
40
          criteria: z
41
            .array(
42
              z.object({
43
                criterion: z.string().min(1).max(1000),
44
                status: z.enum(['met', 'partially_met', 'missed', 'unknown']),
45
                explanation: z.string().max(1000).optional(),
46
                evidenceReferences: z.array(z.string().min(1).max(2048)).max(50).default([]),
47
              }),
48
            )
49
            .max(100),
50
          deliverables: z.array(z.string().min(1).max(1000)).max(100).default([]),
51
          actionsTaken: z.array(z.string().min(1).max(1000)).max(100).default([]),
52
          blockers: z.array(z.string().min(1).max(1000)).max(100).default([]),
53
          corrections: z.array(z.string().min(1).max(1000)).max(100).default([]),
54
          evidenceReferences: z.array(z.string().min(1).max(2048)).max(100).default([]),
55
          confidence: z.number().min(0).max(1),
56
          ratings: z.object({
57
            overall_satisfaction: z.number().min(0).max(1),
58
            outcome_satisfaction: z.number().min(0).max(1),
59
            communication: z.number().min(0).max(1),
60
            timeliness: z.number().min(0).max(1),
61
            scope_adherence: z.number().min(0).max(1),
62
            evidence_quality: z.number().min(0).max(1),
63
            correction_handling: z.number().min(0).max(1),
64
            reliability: z.number().min(0).max(1),
65
          }),
66
          wouldWorkAgain: z.enum(['yes', 'no', 'unsure']),
67
          reasonCodes: z.array(z.string().min(1).max(128)).max(32).default([]),
68
          privateComment: z.string().max(1000).optional(),
69
        }),
70
      },
71
      output: {
72
        schema: z.object({
73
          interactionId: z.string(),
74
          status: z.enum(['completed', 'already_completed']),
75
          feedbackRevealed: z.boolean(),
76
        }),
77
      },
78
    },
79
  },
80
  channels: {
81
    a2a: {
82
      title: 'Agent-to-agent conversation',
83
      description: 'A direct A2A conversation authorized by OpenClasp.',
84
      conversation: {
85
        tags: {
86
          interactionId: {
87
            title: 'OpenClasp interaction ID',
88
            description: 'Stable signed interaction and Botpress conversation mapping.',
89
          },
90
        },
91
      },
92
      messages: { text: { schema: z.object({ text: z.string() }) } },
93
    },
94
  },
95
  user: {
96
    tags: {
97
      agentId: { title: 'Peer agent ID', description: 'OpenClasp peer identity.' },
98
    },
99
  },
100
  states: {
101
    runtime: {
102
      type: 'integration',
103
      schema: z.object({
104
        agentId: z.string(),
105
        agentVersion: z.string().optional(),
106
        sessionsJson: z.string(),
107
        offersJson: z.string(),
108
        finalizationsJson: z.string().optional(),
109
        accessToken: z.string().optional(),
110
        setupJson: z.string().optional(),
111
      }),
112
    },
113
  },
114
});