| 1 | import { z, IntegrationDefinition } from '@botpress/sdk';
|
| 2 | import { integrationName } from './package.json';
|
| 3 |
|
| 4 | export default new IntegrationDefinition({
|
| 5 | name: integrationName,
|
| 6 | version: '0.3.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 | openClaspAgentToken: z
|
| 14 | .string()
|
| 15 | .min(20)
|
| 16 | .secret()
|
| 17 | .title('OpenClasp agent token')
|
| 18 | .describe('The oc_at_ token created for this exact agent in OpenClasp.'),
|
| 19 | openClaspUrl: z.string().url().default('https://openclasp.vercel.app').title('OpenClasp URL'),
|
| 20 | agentDescription: z
|
| 21 | .string()
|
| 22 | .max(500)
|
| 23 | .optional()
|
| 24 | .title('Public agent description')
|
| 25 | .describe('What this bot actually does. Synced to its OpenClasp Agent Card.'),
|
| 26 | agentCapabilities: z
|
| 27 | .string()
|
| 28 | .optional()
|
| 29 | .title('Public capabilities')
|
| 30 | .describe(
|
| 31 | 'Comma-separated task capabilities, for example: recruiting, candidate-screening.',
|
| 32 | ),
|
| 33 | agentLimitations: z
|
| 34 | .string()
|
| 35 | .optional()
|
| 36 | .title('Public limitations')
|
| 37 | .describe('Comma-separated limitations, for example: no-live-job-database.'),
|
| 38 | }),
|
| 39 | },
|
| 40 | actions: {
|
| 41 | completeInteraction: {
|
| 42 | title: 'Complete OpenClasp interaction',
|
| 43 | description:
|
| 44 | "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.",
|
| 45 | input: {
|
| 46 | schema: z.object({
|
| 47 | interactionId: z
|
| 48 | .string()
|
| 49 | .optional()
|
| 50 | .describe('OpenClasp interaction ID. Omit when only one unfinished session exists.'),
|
| 51 | outcome: z.enum(['success', 'partial', 'failure', 'cancelled']),
|
| 52 | summary: z.string().min(1).max(2000),
|
| 53 | criteria: z
|
| 54 | .array(
|
| 55 | z.object({
|
| 56 | criterion: z.string().min(1).max(1000),
|
| 57 | status: z.enum(['met', 'partially_met', 'missed', 'unknown']),
|
| 58 | explanation: z.string().max(1000).optional(),
|
| 59 | evidenceReferences: z.array(z.string().min(1).max(2048)).max(50).default([]),
|
| 60 | }),
|
| 61 | )
|
| 62 | .max(100),
|
| 63 | deliverables: z.array(z.string().min(1).max(1000)).max(100).default([]),
|
| 64 | actionsTaken: z.array(z.string().min(1).max(1000)).max(100).default([]),
|
| 65 | blockers: z.array(z.string().min(1).max(1000)).max(100).default([]),
|
| 66 | corrections: z.array(z.string().min(1).max(1000)).max(100).default([]),
|
| 67 | evidenceReferences: z.array(z.string().min(1).max(2048)).max(100).default([]),
|
| 68 | confidence: z.number().min(0).max(1),
|
| 69 | ratings: z.object({
|
| 70 | overall_satisfaction: z.number().min(0).max(1),
|
| 71 | outcome_satisfaction: z.number().min(0).max(1),
|
| 72 | communication: z.number().min(0).max(1),
|
| 73 | timeliness: z.number().min(0).max(1),
|
| 74 | scope_adherence: z.number().min(0).max(1),
|
| 75 | evidence_quality: z.number().min(0).max(1),
|
| 76 | correction_handling: z.number().min(0).max(1),
|
| 77 | reliability: z.number().min(0).max(1),
|
| 78 | }),
|
| 79 | wouldWorkAgain: z.enum(['yes', 'no', 'unsure']),
|
| 80 | reasonCodes: z.array(z.string().min(1).max(128)).max(32).default([]),
|
| 81 | privateComment: z.string().max(1000).optional(),
|
| 82 | }),
|
| 83 | },
|
| 84 | output: {
|
| 85 | schema: z.object({
|
| 86 | interactionId: z.string(),
|
| 87 | status: z.enum(['completed', 'already_completed']),
|
| 88 | feedbackRevealed: z.boolean(),
|
| 89 | }),
|
| 90 | },
|
| 91 | },
|
| 92 | },
|
| 93 | channels: {
|
| 94 | a2a: {
|
| 95 | title: 'Agent-to-agent conversation',
|
| 96 | description: 'A direct A2A conversation authorized by OpenClasp.',
|
| 97 | conversation: {
|
| 98 | tags: {
|
| 99 | interactionId: {
|
| 100 | title: 'OpenClasp interaction ID',
|
| 101 | description: 'Stable signed interaction and Botpress conversation mapping.',
|
| 102 | },
|
| 103 | },
|
| 104 | },
|
| 105 | messages: { text: { schema: z.object({ text: z.string() }) } },
|
| 106 | },
|
| 107 | },
|
| 108 | user: {
|
| 109 | tags: {
|
| 110 | agentId: { title: 'Peer agent ID', description: 'OpenClasp peer identity.' },
|
| 111 | },
|
| 112 | },
|
| 113 | states: {
|
| 114 | runtime: {
|
| 115 | type: 'integration',
|
| 116 | schema: z.object({
|
| 117 | agentId: z.string(),
|
| 118 | agentVersion: z.string().optional(),
|
| 119 | sessionsJson: z.string(),
|
| 120 | offersJson: z.string(),
|
| 121 | finalizationsJson: z.string().optional(),
|
| 122 | }),
|
| 123 | },
|
| 124 | },
|
| 125 | });
|