@helpai/elements 0.12.2 → 0.13.0

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/schema.json CHANGED
@@ -164,11 +164,19 @@
164
164
  "type": "string",
165
165
  "minLength": 1,
166
166
  "maxLength": 2048
167
+ },
168
+ "intake": {
169
+ "default": "/ai/agent/intake",
170
+ "description": "Pre-chat intake submission endpoint. The widget POSTs the captured lead values here on completion (fire-and-forget), keyed by the same visitorId + sessionId as the conversation. Optional — a 404 is ignored.",
171
+ "type": "string",
172
+ "minLength": 1,
173
+ "maxLength": 2048
167
174
  }
168
175
  },
169
176
  "required": [
170
177
  "upload",
171
- "transcribe"
178
+ "transcribe",
179
+ "intake"
172
180
  ],
173
181
  "additionalProperties": {},
174
182
  "description": "HTTP endpoint overrides. Paths are appended to baseUrl; absolute URLs are accepted too.",
@@ -179,6 +187,9 @@
179
187
  },
180
188
  {
181
189
  "upload": "https://help.ai/uploads/presign"
190
+ },
191
+ {
192
+ "intake": "https://crm.acme.com/leads/intake"
182
193
  }
183
194
  ]
184
195
  },
@@ -1311,11 +1322,17 @@
1311
1322
  }
1312
1323
  ]
1313
1324
  }
1325
+ },
1326
+ "humanInLoop": {
1327
+ "default": true,
1328
+ "description": "Render human-in-the-loop tool UI — the inline ask-input form + approve/reject controls for gated tools. `true` (default) shows them; `false` suppresses the UI (the wire still carries the signals).",
1329
+ "type": "boolean"
1314
1330
  }
1315
1331
  },
1316
1332
  "required": [
1317
1333
  "files",
1318
- "voice"
1334
+ "voice",
1335
+ "humanInLoop"
1319
1336
  ],
1320
1337
  "additionalProperties": {},
1321
1338
  "description": "Capability flags — file upload, voice mode, and the tools the assistant may invoke.",
@@ -1337,6 +1354,231 @@
1337
1354
  }
1338
1355
  ]
1339
1356
  },
1357
+ "intake": {
1358
+ "type": "object",
1359
+ "properties": {
1360
+ "enabled": {
1361
+ "default": false,
1362
+ "description": "Turn the pre-chat intake gate on. Off by default.",
1363
+ "type": "boolean"
1364
+ },
1365
+ "title": {
1366
+ "description": "Form heading (e.g. 'Before we start').",
1367
+ "type": "string",
1368
+ "maxLength": 120
1369
+ },
1370
+ "description": {
1371
+ "description": "Sub-heading under the title.",
1372
+ "type": "string",
1373
+ "maxLength": 500
1374
+ },
1375
+ "fields": {
1376
+ "default": [],
1377
+ "description": "The questions to ask, in order. The gate is only active when there is ≥1 field.",
1378
+ "maxItems": 20,
1379
+ "type": "array",
1380
+ "items": {
1381
+ "type": "object",
1382
+ "properties": {
1383
+ "name": {
1384
+ "type": "string",
1385
+ "minLength": 1,
1386
+ "maxLength": 80,
1387
+ "description": "Stable key the answer is recorded under (e.g. `email`). Sent to the agent as captured context."
1388
+ },
1389
+ "label": {
1390
+ "type": "string",
1391
+ "minLength": 1,
1392
+ "maxLength": 200,
1393
+ "description": "Visible field label."
1394
+ },
1395
+ "type": {
1396
+ "type": "string",
1397
+ "enum": [
1398
+ "text",
1399
+ "email",
1400
+ "tel",
1401
+ "url",
1402
+ "number",
1403
+ "textarea",
1404
+ "select",
1405
+ "radio",
1406
+ "checkbox",
1407
+ "multiselect"
1408
+ ],
1409
+ "description": "Field renderer + built-in validation (`email`/`tel`/`url`/`number` are checked)."
1410
+ },
1411
+ "placeholder": {
1412
+ "type": "string",
1413
+ "maxLength": 200
1414
+ },
1415
+ "required": {
1416
+ "default": true,
1417
+ "description": "Must be answered to submit. Set `false` to allow skipping.",
1418
+ "type": "boolean"
1419
+ },
1420
+ "defaultValue": {
1421
+ "description": "Pre-filled value (comma-join for `multiselect`).",
1422
+ "type": "string",
1423
+ "maxLength": 2000
1424
+ },
1425
+ "options": {
1426
+ "description": "Choices for `select` / `radio` / `multiselect`.",
1427
+ "maxItems": 50,
1428
+ "type": "array",
1429
+ "items": {
1430
+ "type": "object",
1431
+ "properties": {
1432
+ "value": {
1433
+ "type": "string",
1434
+ "minLength": 1,
1435
+ "maxLength": 200,
1436
+ "description": "The value recorded when this choice is picked."
1437
+ },
1438
+ "label": {
1439
+ "description": "Display text; falls back to `value`.",
1440
+ "type": "string",
1441
+ "minLength": 1,
1442
+ "maxLength": 200
1443
+ },
1444
+ "description": {
1445
+ "description": "Optional sub-label under the choice.",
1446
+ "type": "string",
1447
+ "maxLength": 280
1448
+ }
1449
+ },
1450
+ "required": [
1451
+ "value"
1452
+ ],
1453
+ "additionalProperties": {}
1454
+ }
1455
+ },
1456
+ "validation": {
1457
+ "type": "object",
1458
+ "properties": {
1459
+ "pattern": {
1460
+ "description": "Regex source string — text-like fields (e.g. `^\\d{5}$`).",
1461
+ "type": "string",
1462
+ "maxLength": 500
1463
+ },
1464
+ "minLength": {
1465
+ "type": "integer",
1466
+ "minimum": 0,
1467
+ "maximum": 10000
1468
+ },
1469
+ "maxLength": {
1470
+ "type": "integer",
1471
+ "minimum": 1,
1472
+ "maximum": 10000
1473
+ },
1474
+ "min": {
1475
+ "description": "Minimum — `number` fields.",
1476
+ "type": "number"
1477
+ },
1478
+ "max": {
1479
+ "description": "Maximum — `number` fields.",
1480
+ "type": "number"
1481
+ },
1482
+ "minSelections": {
1483
+ "description": "Minimum picks — `multiselect`.",
1484
+ "type": "integer",
1485
+ "minimum": 0,
1486
+ "maximum": 50
1487
+ },
1488
+ "maxSelections": {
1489
+ "description": "Maximum picks — `multiselect`.",
1490
+ "type": "integer",
1491
+ "minimum": 1,
1492
+ "maximum": 50
1493
+ }
1494
+ },
1495
+ "additionalProperties": {}
1496
+ },
1497
+ "allowOther": {
1498
+ "description": "`select`/`radio`/`multiselect` — allow a free-text 'Other' answer.",
1499
+ "type": "boolean"
1500
+ },
1501
+ "validationHint": {
1502
+ "description": "Small helper line under the field.",
1503
+ "type": "string",
1504
+ "maxLength": 280
1505
+ }
1506
+ },
1507
+ "required": [
1508
+ "name",
1509
+ "label",
1510
+ "type",
1511
+ "required"
1512
+ ],
1513
+ "additionalProperties": {}
1514
+ }
1515
+ },
1516
+ "submitLabel": {
1517
+ "description": "Submit button label (default 'Start chat').",
1518
+ "type": "string",
1519
+ "maxLength": 60
1520
+ },
1521
+ "skippable": {
1522
+ "default": false,
1523
+ "description": "Show a Skip control to dismiss the whole form.",
1524
+ "type": "boolean"
1525
+ }
1526
+ },
1527
+ "required": [
1528
+ "enabled",
1529
+ "fields",
1530
+ "skippable"
1531
+ ],
1532
+ "additionalProperties": {},
1533
+ "description": "Pre-chat intake form — a blocking lead/sales-capture gate of typed, validated fields. The same field shape powers the AI ask-input tool. Off by default.",
1534
+ "examples": [
1535
+ {
1536
+ "enabled": false
1537
+ },
1538
+ {
1539
+ "enabled": true,
1540
+ "title": "Before we start",
1541
+ "description": "Tell us who you are so we can help faster.",
1542
+ "submitLabel": "Start chat",
1543
+ "fields": [
1544
+ {
1545
+ "name": "name",
1546
+ "label": "Your name",
1547
+ "type": "text",
1548
+ "required": true
1549
+ },
1550
+ {
1551
+ "name": "email",
1552
+ "label": "Work email",
1553
+ "type": "email",
1554
+ "required": true
1555
+ },
1556
+ {
1557
+ "name": "phone",
1558
+ "label": "Phone",
1559
+ "type": "tel",
1560
+ "required": false
1561
+ },
1562
+ {
1563
+ "name": "topic",
1564
+ "label": "What can we help with?",
1565
+ "type": "select",
1566
+ "required": true,
1567
+ "options": [
1568
+ {
1569
+ "value": "sales",
1570
+ "label": "Talk to sales"
1571
+ },
1572
+ {
1573
+ "value": "support",
1574
+ "label": "Get support"
1575
+ }
1576
+ ]
1577
+ }
1578
+ ]
1579
+ }
1580
+ ]
1581
+ },
1340
1582
  "modules": {
1341
1583
  "maxItems": 4,
1342
1584
  "type": "array",
@@ -2708,11 +2950,17 @@
2708
2950
  }
2709
2951
  ]
2710
2952
  }
2953
+ },
2954
+ "humanInLoop": {
2955
+ "default": true,
2956
+ "description": "Render human-in-the-loop tool UI — the inline ask-input form + approve/reject controls for gated tools. `true` (default) shows them; `false` suppresses the UI (the wire still carries the signals).",
2957
+ "type": "boolean"
2711
2958
  }
2712
2959
  },
2713
2960
  "required": [
2714
2961
  "files",
2715
- "voice"
2962
+ "voice",
2963
+ "humanInLoop"
2716
2964
  ],
2717
2965
  "additionalProperties": {},
2718
2966
  "description": "Capability flags — file upload, voice mode, and the tools the assistant may invoke.",
@@ -2734,6 +2982,231 @@
2734
2982
  }
2735
2983
  ]
2736
2984
  },
2985
+ "intake": {
2986
+ "type": "object",
2987
+ "properties": {
2988
+ "enabled": {
2989
+ "default": false,
2990
+ "description": "Turn the pre-chat intake gate on. Off by default.",
2991
+ "type": "boolean"
2992
+ },
2993
+ "title": {
2994
+ "description": "Form heading (e.g. 'Before we start').",
2995
+ "type": "string",
2996
+ "maxLength": 120
2997
+ },
2998
+ "description": {
2999
+ "description": "Sub-heading under the title.",
3000
+ "type": "string",
3001
+ "maxLength": 500
3002
+ },
3003
+ "fields": {
3004
+ "default": [],
3005
+ "description": "The questions to ask, in order. The gate is only active when there is ≥1 field.",
3006
+ "maxItems": 20,
3007
+ "type": "array",
3008
+ "items": {
3009
+ "type": "object",
3010
+ "properties": {
3011
+ "name": {
3012
+ "type": "string",
3013
+ "minLength": 1,
3014
+ "maxLength": 80,
3015
+ "description": "Stable key the answer is recorded under (e.g. `email`). Sent to the agent as captured context."
3016
+ },
3017
+ "label": {
3018
+ "type": "string",
3019
+ "minLength": 1,
3020
+ "maxLength": 200,
3021
+ "description": "Visible field label."
3022
+ },
3023
+ "type": {
3024
+ "type": "string",
3025
+ "enum": [
3026
+ "text",
3027
+ "email",
3028
+ "tel",
3029
+ "url",
3030
+ "number",
3031
+ "textarea",
3032
+ "select",
3033
+ "radio",
3034
+ "checkbox",
3035
+ "multiselect"
3036
+ ],
3037
+ "description": "Field renderer + built-in validation (`email`/`tel`/`url`/`number` are checked)."
3038
+ },
3039
+ "placeholder": {
3040
+ "type": "string",
3041
+ "maxLength": 200
3042
+ },
3043
+ "required": {
3044
+ "default": true,
3045
+ "description": "Must be answered to submit. Set `false` to allow skipping.",
3046
+ "type": "boolean"
3047
+ },
3048
+ "defaultValue": {
3049
+ "description": "Pre-filled value (comma-join for `multiselect`).",
3050
+ "type": "string",
3051
+ "maxLength": 2000
3052
+ },
3053
+ "options": {
3054
+ "description": "Choices for `select` / `radio` / `multiselect`.",
3055
+ "maxItems": 50,
3056
+ "type": "array",
3057
+ "items": {
3058
+ "type": "object",
3059
+ "properties": {
3060
+ "value": {
3061
+ "type": "string",
3062
+ "minLength": 1,
3063
+ "maxLength": 200,
3064
+ "description": "The value recorded when this choice is picked."
3065
+ },
3066
+ "label": {
3067
+ "description": "Display text; falls back to `value`.",
3068
+ "type": "string",
3069
+ "minLength": 1,
3070
+ "maxLength": 200
3071
+ },
3072
+ "description": {
3073
+ "description": "Optional sub-label under the choice.",
3074
+ "type": "string",
3075
+ "maxLength": 280
3076
+ }
3077
+ },
3078
+ "required": [
3079
+ "value"
3080
+ ],
3081
+ "additionalProperties": {}
3082
+ }
3083
+ },
3084
+ "validation": {
3085
+ "type": "object",
3086
+ "properties": {
3087
+ "pattern": {
3088
+ "description": "Regex source string — text-like fields (e.g. `^\\d{5}$`).",
3089
+ "type": "string",
3090
+ "maxLength": 500
3091
+ },
3092
+ "minLength": {
3093
+ "type": "integer",
3094
+ "minimum": 0,
3095
+ "maximum": 10000
3096
+ },
3097
+ "maxLength": {
3098
+ "type": "integer",
3099
+ "minimum": 1,
3100
+ "maximum": 10000
3101
+ },
3102
+ "min": {
3103
+ "description": "Minimum — `number` fields.",
3104
+ "type": "number"
3105
+ },
3106
+ "max": {
3107
+ "description": "Maximum — `number` fields.",
3108
+ "type": "number"
3109
+ },
3110
+ "minSelections": {
3111
+ "description": "Minimum picks — `multiselect`.",
3112
+ "type": "integer",
3113
+ "minimum": 0,
3114
+ "maximum": 50
3115
+ },
3116
+ "maxSelections": {
3117
+ "description": "Maximum picks — `multiselect`.",
3118
+ "type": "integer",
3119
+ "minimum": 1,
3120
+ "maximum": 50
3121
+ }
3122
+ },
3123
+ "additionalProperties": {}
3124
+ },
3125
+ "allowOther": {
3126
+ "description": "`select`/`radio`/`multiselect` — allow a free-text 'Other' answer.",
3127
+ "type": "boolean"
3128
+ },
3129
+ "validationHint": {
3130
+ "description": "Small helper line under the field.",
3131
+ "type": "string",
3132
+ "maxLength": 280
3133
+ }
3134
+ },
3135
+ "required": [
3136
+ "name",
3137
+ "label",
3138
+ "type",
3139
+ "required"
3140
+ ],
3141
+ "additionalProperties": {}
3142
+ }
3143
+ },
3144
+ "submitLabel": {
3145
+ "description": "Submit button label (default 'Start chat').",
3146
+ "type": "string",
3147
+ "maxLength": 60
3148
+ },
3149
+ "skippable": {
3150
+ "default": false,
3151
+ "description": "Show a Skip control to dismiss the whole form.",
3152
+ "type": "boolean"
3153
+ }
3154
+ },
3155
+ "required": [
3156
+ "enabled",
3157
+ "fields",
3158
+ "skippable"
3159
+ ],
3160
+ "additionalProperties": {},
3161
+ "description": "Pre-chat intake form — a blocking lead/sales-capture gate of typed, validated fields. The same field shape powers the AI ask-input tool. Off by default.",
3162
+ "examples": [
3163
+ {
3164
+ "enabled": false
3165
+ },
3166
+ {
3167
+ "enabled": true,
3168
+ "title": "Before we start",
3169
+ "description": "Tell us who you are so we can help faster.",
3170
+ "submitLabel": "Start chat",
3171
+ "fields": [
3172
+ {
3173
+ "name": "name",
3174
+ "label": "Your name",
3175
+ "type": "text",
3176
+ "required": true
3177
+ },
3178
+ {
3179
+ "name": "email",
3180
+ "label": "Work email",
3181
+ "type": "email",
3182
+ "required": true
3183
+ },
3184
+ {
3185
+ "name": "phone",
3186
+ "label": "Phone",
3187
+ "type": "tel",
3188
+ "required": false
3189
+ },
3190
+ {
3191
+ "name": "topic",
3192
+ "label": "What can we help with?",
3193
+ "type": "select",
3194
+ "required": true,
3195
+ "options": [
3196
+ {
3197
+ "value": "sales",
3198
+ "label": "Talk to sales"
3199
+ },
3200
+ {
3201
+ "value": "support",
3202
+ "label": "Get support"
3203
+ }
3204
+ ]
3205
+ }
3206
+ ]
3207
+ }
3208
+ ]
3209
+ },
2737
3210
  "modules": {
2738
3211
  "maxItems": 4,
2739
3212
  "type": "array",