@onbox/cli 0.3.1 → 0.4.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.
Files changed (2) hide show
  1. package/dist/onbox.js +1901 -698
  2. package/package.json +1 -1
package/dist/onbox.js CHANGED
@@ -441,7 +441,85 @@ function boolFlag(parsed, name) {
441
441
  // src/arguments.ts
442
442
  import { readFileSync as readFileSync4 } from "fs";
443
443
 
444
- // ../../packages/openapi/dist/chunk-U4WLFL2S.mjs
444
+ // ../../packages/openapi/dist/chunk-2SQMN3BE.mjs
445
+ var BRAIN_PUBLIC_API_ROUTES = [
446
+ // Files
447
+ { method: "POST", path: "/v1/brain/build", tool: "build_brain" },
448
+ {
449
+ method: "GET",
450
+ path: "/v1/brain/{scope}/files",
451
+ tool: "list_brain_files",
452
+ params: { scope: { arg: "scope" } }
453
+ },
454
+ {
455
+ method: "GET",
456
+ path: "/v1/brain/{scope}/files/get",
457
+ tool: "read_brain_files",
458
+ params: { scope: { arg: "scope" } }
459
+ },
460
+ {
461
+ method: "GET",
462
+ path: "/v1/brain/{scope}/files/{path...}",
463
+ tool: "read_brain_files",
464
+ params: { scope: { arg: "scope" }, path: { arg: "paths", list: true } },
465
+ pick: { from: "files", by: "path", param: "path" }
466
+ },
467
+ {
468
+ method: "POST",
469
+ path: "/v1/brain/{scope}/changes",
470
+ tool: "write_brain_files",
471
+ params: { scope: { arg: "scope" } }
472
+ },
473
+ { method: "GET", path: "/v1/brain/proposals", tool: "list_brain_proposals" },
474
+ {
475
+ method: "GET",
476
+ path: "/v1/brain/proposals/{proposalId}",
477
+ tool: "list_brain_proposals",
478
+ summary: "Get a Brain Proposal",
479
+ params: { proposalId: { arg: "proposalId" } },
480
+ pick: { from: "proposals", by: "id", param: "proposalId" }
481
+ },
482
+ { method: "POST", path: "/v1/brain/proposals/accept", tool: "accept_brain_proposals" },
483
+ {
484
+ method: "POST",
485
+ path: "/v1/brain/proposals/{proposalId}/accept",
486
+ tool: "accept_brain_proposals",
487
+ params: {
488
+ proposalId: { arg: "proposals", itemKey: "proposalId", itemFields: ["reviewedHeadSha"] }
489
+ }
490
+ },
491
+ { method: "POST", path: "/v1/brain/proposals/decline", tool: "decline_brain_proposals" },
492
+ {
493
+ method: "POST",
494
+ path: "/v1/brain/proposals/{proposalId}/decline",
495
+ tool: "decline_brain_proposals",
496
+ params: { proposalId: { arg: "proposalIds", list: true } }
497
+ },
498
+ // Brain gaps: customer problems Onbox struggled with (the Dream's store)
499
+ { method: "GET", path: "/v1/brain/gaps", tool: "list_brain_gaps" },
500
+ {
501
+ method: "GET",
502
+ path: "/v1/brain/gaps/{gapId}",
503
+ tool: "list_brain_gaps",
504
+ summary: "Get a Brain Gap",
505
+ params: { gapId: { arg: "gapId" } },
506
+ // The tool answers this one gap or 404s; an uppercase id would not match by value.
507
+ pick: { from: "gaps" }
508
+ },
509
+ { method: "POST", path: "/v1/brain/gaps", tool: "create_brain_gap" },
510
+ {
511
+ method: "PATCH",
512
+ path: "/v1/brain/gaps/{gapId}",
513
+ tool: "update_brain_gap",
514
+ params: { gapId: { arg: "gapId" } }
515
+ },
516
+ {
517
+ method: "POST",
518
+ path: "/v1/brain/gaps/{gapId}/conversations",
519
+ tool: "record_brain_gap_conversations",
520
+ params: { gapId: { arg: "gapId" } }
521
+ }
522
+ ];
445
523
  var AGENT_RUN_TRACE_MAX_PAGE_BYTES = 1e6;
446
524
  var conversationIds = { arg: "conversationIds", list: true };
447
525
  var conversationPick = { from: "conversations", param: "conversationId" };
@@ -449,7 +527,6 @@ var PUBLIC_API_ROUTES = [
449
527
  // Account
450
528
  { method: "GET", path: "/v1/account/status", tool: "get_account_status" },
451
529
  { method: "GET", path: "/v1/account/billing", tool: "get_billing" },
452
- { method: "PATCH", path: "/v1/account/billing", tool: "update_billing" },
453
530
  { method: "PATCH", path: "/v1/organisation", tool: "update_organisation" },
454
531
  { method: "POST", path: "/v1/support/requests", tool: "contact_onbox_support" },
455
532
  // My inbox
@@ -776,58 +853,8 @@ var PUBLIC_API_ROUTES = [
776
853
  tool: "test_integration",
777
854
  params: { integration: { arg: "id", slugArg: "slug" } }
778
855
  },
779
- // Brain
780
- { method: "POST", path: "/v1/brain/build", tool: "build_brain" },
781
- {
782
- method: "GET",
783
- path: "/v1/brain/{scope}/files",
784
- tool: "list_brain_files",
785
- params: { scope: { arg: "scope" } }
786
- },
787
- {
788
- method: "GET",
789
- path: "/v1/brain/{scope}/files/get",
790
- tool: "read_brain_files",
791
- params: { scope: { arg: "scope" } }
792
- },
793
- {
794
- method: "GET",
795
- path: "/v1/brain/{scope}/files/{path...}",
796
- tool: "read_brain_files",
797
- params: { scope: { arg: "scope" }, path: { arg: "paths", list: true } },
798
- pick: { from: "files", by: "path", param: "path" }
799
- },
800
- {
801
- method: "POST",
802
- path: "/v1/brain/{scope}/changes",
803
- tool: "write_brain_files",
804
- params: { scope: { arg: "scope" } }
805
- },
806
- { method: "GET", path: "/v1/brain/proposals", tool: "list_brain_proposals" },
807
- {
808
- method: "GET",
809
- path: "/v1/brain/proposals/{proposalId}",
810
- tool: "list_brain_proposals",
811
- summary: "Get a Brain Proposal",
812
- params: { proposalId: { arg: "proposalId" } },
813
- pick: { from: "proposals", by: "id", param: "proposalId" }
814
- },
815
- { method: "POST", path: "/v1/brain/proposals/accept", tool: "accept_brain_proposals" },
816
- {
817
- method: "POST",
818
- path: "/v1/brain/proposals/{proposalId}/accept",
819
- tool: "accept_brain_proposals",
820
- params: {
821
- proposalId: { arg: "proposals", itemKey: "proposalId", itemFields: ["reviewedHeadSha"] }
822
- }
823
- },
824
- { method: "POST", path: "/v1/brain/proposals/decline", tool: "decline_brain_proposals" },
825
- {
826
- method: "POST",
827
- path: "/v1/brain/proposals/{proposalId}/decline",
828
- tool: "decline_brain_proposals",
829
- params: { proposalId: { arg: "proposalIds", list: true } }
830
- },
856
+ // Brain, its proposals and its gaps
857
+ ...BRAIN_PUBLIC_API_ROUTES,
831
858
  // Tests of the Onbox agent
832
859
  { method: "GET", path: "/v1/tests", tool: "list_tests" },
833
860
  { method: "POST", path: "/v1/tests", tool: "create_test" },
@@ -864,6 +891,27 @@ var PUBLIC_API_ROUTES = [
864
891
  path: "/v1/calendar/invitations/{eventId}/response",
865
892
  tool: "respond_to_invitation",
866
893
  params: { eventId: { arg: "eventId" } }
894
+ },
895
+ // Webhook endpoints
896
+ { method: "GET", path: "/v1/webhook-endpoints", tool: "list_webhook_endpoints" },
897
+ { method: "POST", path: "/v1/webhook-endpoints", tool: "create_webhook_endpoint" },
898
+ {
899
+ method: "PATCH",
900
+ path: "/v1/webhook-endpoints/{endpoint}",
901
+ tool: "update_webhook_endpoint",
902
+ params: { endpoint: { arg: "endpoint" } }
903
+ },
904
+ {
905
+ method: "DELETE",
906
+ path: "/v1/webhook-endpoints/{endpoint}",
907
+ tool: "delete_webhook_endpoint",
908
+ params: { endpoint: { arg: "endpoint" } }
909
+ },
910
+ {
911
+ method: "GET",
912
+ path: "/v1/webhook-endpoints/{endpoint}/deliveries",
913
+ tool: "list_webhook_deliveries",
914
+ params: { endpoint: { arg: "endpoint" } }
867
915
  }
868
916
  ];
869
917
  function publicApiReadsQuery(method) {
@@ -949,6 +997,9 @@ var openapi_default = {
949
997
  },
950
998
  {
951
999
  name: "calendar"
1000
+ },
1001
+ {
1002
+ name: "webhook-endpoints"
952
1003
  }
953
1004
  ],
954
1005
  paths: {
@@ -1053,7 +1104,7 @@ var openapi_default = {
1053
1104
  operationId: "get_billing",
1054
1105
  tags: ["account"],
1055
1106
  summary: "Get Billing",
1056
- description: "See the organisation's billing: whether the agent can work, the plans (price, conversations included, free trial), its plan's status, trial end or renewal and usage, the prepaid balance and this month's credit spent; for an admin with a subscription, the Stripe portal link. Read only: start a plan or add credit with update_billing. Never state a price beyond what it returns.",
1107
+ description: "See the organisation's billing status: whether the agent can work and why not, its plan's status, trial end or renewal and conversations used, the prepaid balance and this month's credit spent. Read only. Starting a plan, adding credit and payment settings happen on the billing page: give the person webUrl as is when the agent cannot work or they ask to change billing. Never state a price.",
1057
1108
  security: [
1058
1109
  {
1059
1110
  bearerAuth: []
@@ -1142,162 +1193,6 @@ var openapi_default = {
1142
1193
  }
1143
1194
  }
1144
1195
  }
1145
- },
1146
- patch: {
1147
- operationId: "update_billing",
1148
- tags: ["account"],
1149
- summary: "Update Billing",
1150
- description: "Start a plan, add prepaid credit, or manage it. Read plans, prices and settings with get_billing first, ask the person before calling, and give them every link as is. plan returns the Stripe Checkout link starting its free trial: the card is entered there, nothing is charged until the trial ends, and the trial starts when they come back; if a plan is running, it returns the Plans page, where a switch happens. topUp (at least 10) returns a Checkout link for credit used past the plan. automaticRefill turns refill on, off or changes its amounts; turning it on returns a Stripe link to save the card and agree to automatic charges. lowCreditAlert sets the balance below which admins get an email. Admins only.\n\nAdmins only: a member is refused.",
1151
- security: [
1152
- {
1153
- bearerAuth: []
1154
- }
1155
- ],
1156
- "x-onbox-tool": "update_billing",
1157
- "x-onbox-scope": "write",
1158
- "x-onbox-destructive": true,
1159
- requestBody: {
1160
- required: false,
1161
- content: {
1162
- "application/json": {
1163
- schema: {
1164
- type: "object",
1165
- properties: {
1166
- plan: {
1167
- type: "string",
1168
- enum: ["STARTER", "PRO", "BUSINESS"]
1169
- },
1170
- currency: {
1171
- description: "Of every amount; before a first payment, the one you quoted",
1172
- type: "string",
1173
- enum: ["usd", "eur", "gbp"]
1174
- },
1175
- topUp: {
1176
- type: "number",
1177
- minimum: 10,
1178
- maximum: 1e3
1179
- },
1180
- automaticRefill: {
1181
- description: "Charges the saved card when credit runs low. First time: pass all three amounts. Changes and turning it off apply at once",
1182
- type: "object",
1183
- properties: {
1184
- enabled: {
1185
- type: "boolean"
1186
- },
1187
- below: {
1188
- description: "Refill below this balance",
1189
- type: "number",
1190
- minimum: 0,
1191
- exclusiveMinimum: true
1192
- },
1193
- topUpTo: {
1194
- description: "Refill up to this, at least 10 above below",
1195
- type: "number",
1196
- minimum: 0,
1197
- exclusiveMinimum: true
1198
- },
1199
- monthlyMax: {
1200
- description: "Most charged per calendar month, more than one refill",
1201
- type: "number",
1202
- minimum: 0,
1203
- exclusiveMinimum: true
1204
- }
1205
- },
1206
- required: ["enabled"],
1207
- additionalProperties: false
1208
- },
1209
- lowCreditAlert: {
1210
- type: "number",
1211
- minimum: 0,
1212
- exclusiveMinimum: true,
1213
- maximum: 1e6
1214
- }
1215
- },
1216
- additionalProperties: false
1217
- }
1218
- }
1219
- }
1220
- },
1221
- responses: {
1222
- "200": {
1223
- description: "The tool's result.",
1224
- content: {
1225
- "application/json": {
1226
- schema: {}
1227
- }
1228
- }
1229
- },
1230
- "400": {
1231
- description: "The arguments are invalid.",
1232
- content: {
1233
- "application/json": {
1234
- schema: {
1235
- $ref: "#/components/schemas/Error"
1236
- }
1237
- }
1238
- }
1239
- },
1240
- "401": {
1241
- description: "No valid credential.",
1242
- content: {
1243
- "application/json": {
1244
- schema: {
1245
- $ref: "#/components/schemas/Error"
1246
- }
1247
- }
1248
- }
1249
- },
1250
- "403": {
1251
- description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
1252
- content: {
1253
- "application/json": {
1254
- schema: {
1255
- $ref: "#/components/schemas/Error"
1256
- }
1257
- }
1258
- }
1259
- },
1260
- "404": {
1261
- description: "The thing the arguments name does not exist, or the caller cannot see it.",
1262
- content: {
1263
- "application/json": {
1264
- schema: {
1265
- $ref: "#/components/schemas/Error"
1266
- }
1267
- }
1268
- }
1269
- },
1270
- "409": {
1271
- description: "The account is not ready for this call; the message names the step.",
1272
- content: {
1273
- "application/json": {
1274
- schema: {
1275
- $ref: "#/components/schemas/Error"
1276
- }
1277
- }
1278
- }
1279
- },
1280
- "422": {
1281
- description: "The tool understood the request and refused it; the message says why.",
1282
- content: {
1283
- "application/json": {
1284
- schema: {
1285
- $ref: "#/components/schemas/Error"
1286
- }
1287
- }
1288
- }
1289
- },
1290
- "500": {
1291
- description: "Unexpected error.",
1292
- content: {
1293
- "application/json": {
1294
- schema: {
1295
- $ref: "#/components/schemas/Error"
1296
- }
1297
- }
1298
- }
1299
- }
1300
- }
1301
1196
  }
1302
1197
  },
1303
1198
  "/v1/organisation": {
@@ -10008,7 +9903,7 @@ Admins only: a member is refused.`,
10008
9903
  operationId: "test_integration",
10009
9904
  tags: ["integrations"],
10010
9905
  summary: "Test an Integration",
10011
- description: "Test a connected integration, catalog or custom, by id or slug, with the account the Onbox agent uses for you, and store the result as its lastTest. Without operation it runs one fixed check: an MCP server lists its tools, an API gets one read endpoint, PostgreSQL runs SELECT 1. Custom OpenAPI only: operation names one GET operation of that admin-connected API, as list_integrations lists it, with arguments for its path and query; Onbox sends that GET with and without the secret and compares (verified, note). Any other method is refused: it never writes. Run the checks yourself; never ask the person to run a command. Testing a custom integration is for admins.",
9906
+ description: "Test a connected integration, catalog or custom, by id or slug, with the account the Onbox agent uses for you, and store the result as its lastTest. It runs one fixed check: an MCP server lists its tools, an API gets one read endpoint, PostgreSQL runs SELECT 1. For a custom OpenAPI integration, verified and note say whether the check showed the secret works. Run the checks yourself; never ask the person to run a command. Testing a custom integration is for admins.",
10012
9907
  security: [
10013
9908
  {
10014
9909
  bearerAuth: []
@@ -10028,42 +9923,6 @@ Admins only: a member is refused.`,
10028
9923
  }
10029
9924
  }
10030
9925
  ],
10031
- requestBody: {
10032
- required: false,
10033
- content: {
10034
- "application/json": {
10035
- schema: {
10036
- type: "object",
10037
- properties: {
10038
- operation: {
10039
- description: "Custom OpenAPI only: a GET operation needing the secret, by name; Onbox calls it with and without the secret and compares. Never a write",
10040
- type: "string",
10041
- minLength: 1,
10042
- maxLength: 200
10043
- },
10044
- arguments: {
10045
- description: "Its path and query parameters, for a record you know exists",
10046
- type: "object",
10047
- additionalProperties: {
10048
- anyOf: [
10049
- {
10050
- type: "string"
10051
- },
10052
- {
10053
- type: "number"
10054
- },
10055
- {
10056
- type: "boolean"
10057
- }
10058
- ]
10059
- }
10060
- }
10061
- },
10062
- additionalProperties: false
10063
- }
10064
- }
10065
- }
10066
- },
10067
9926
  responses: {
10068
9927
  "200": {
10069
9928
  description: "The tool's result.",
@@ -11510,20 +11369,68 @@ Admins only: a member is refused.`,
11510
11369
  }
11511
11370
  }
11512
11371
  },
11513
- "/v1/tests": {
11372
+ "/v1/brain/gaps": {
11514
11373
  get: {
11515
- operationId: "list_tests",
11516
- tags: ["tests"],
11517
- summary: "List Tests",
11518
- description: "List the tests of the Onbox agent: expected outcomes, notes, latest result, webUrl, and whether a person confirmed each. A failure of an unconfirmed test questions the test first. Admins only.\n\nAdmins only: a member is refused.",
11374
+ operationId: "list_brain_gaps",
11375
+ tags: ["brain"],
11376
+ summary: "List Brain Gaps",
11377
+ description: "List the brain gaps of your organisation: customer problems Onbox struggled with, in the customer's words, each with its scope, status, last review and how many conversations were first seen struggling in each window (default 30 and 90 days; sinceReview counts those after the last review). Pass gapId for one gap with its recent conversations you can read and their signals. Merged gaps are left out unless includeMerged.",
11519
11378
  security: [
11520
11379
  {
11521
11380
  bearerAuth: []
11522
11381
  }
11523
11382
  ],
11524
- "x-onbox-tool": "list_tests",
11383
+ "x-onbox-tool": "list_brain_gaps",
11525
11384
  "x-onbox-scope": "read",
11526
11385
  "x-onbox-destructive": false,
11386
+ parameters: [
11387
+ {
11388
+ name: "status",
11389
+ in: "query",
11390
+ required: false,
11391
+ description: "Only gaps in this state.",
11392
+ schema: {
11393
+ type: "string",
11394
+ enum: ["open", "in_review", "reviewed"]
11395
+ }
11396
+ },
11397
+ {
11398
+ name: "gapId",
11399
+ in: "query",
11400
+ required: false,
11401
+ description: "One gap, merged or not, with its conversations first seen inside the longest window, newest first, each with its signals.",
11402
+ schema: {
11403
+ type: "string",
11404
+ format: "uuid",
11405
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
11406
+ }
11407
+ },
11408
+ {
11409
+ name: "windowDays",
11410
+ in: "query",
11411
+ required: false,
11412
+ description: "Windows to count conversations in, in days. Default 30 and 90.",
11413
+ schema: {
11414
+ minItems: 1,
11415
+ maxItems: 4,
11416
+ type: "array",
11417
+ items: {
11418
+ type: "integer",
11419
+ minimum: 1,
11420
+ maximum: 365
11421
+ }
11422
+ }
11423
+ },
11424
+ {
11425
+ name: "includeMerged",
11426
+ in: "query",
11427
+ required: false,
11428
+ description: "Also list gaps merged into another one. Default false.",
11429
+ schema: {
11430
+ type: "boolean"
11431
+ }
11432
+ }
11433
+ ],
11527
11434
  responses: {
11528
11435
  "200": {
11529
11436
  description: "The tool's result.",
@@ -11606,16 +11513,16 @@ Admins only: a member is refused.`,
11606
11513
  }
11607
11514
  },
11608
11515
  post: {
11609
- operationId: "create_test",
11610
- tags: ["tests"],
11611
- summary: "Create Test",
11612
- description: "Create a test of the Onbox agent: a conversation and what the agent must do with it. Copy one (fromConversationId, triggerMessageId) or describe one (customer, conversation). expectedOutcomes are judged one by one, so write checkable statements. Nothing a test does leaves Onbox. Next: run_tests, get_test_results, then the person confirms with update_test. Admins only.\n\nAdmins only: a member is refused.",
11516
+ operationId: "create_brain_gap",
11517
+ tags: ["brain"],
11518
+ summary: "Create a Brain Gap",
11519
+ description: "Create a brain gap: one customer problem Onbox struggled with, titled in the customer's words, with a scope of what is in and out. Group by what the customer says, not by cause. Create one only when no open gap fits (list_brain_gaps first), then file its conversations with record_brain_gap_conversations. The Dream and organisation admins only.",
11613
11520
  security: [
11614
11521
  {
11615
11522
  bearerAuth: []
11616
11523
  }
11617
11524
  ],
11618
- "x-onbox-tool": "create_test",
11525
+ "x-onbox-tool": "create_brain_gap",
11619
11526
  "x-onbox-scope": "write",
11620
11527
  "x-onbox-destructive": false,
11621
11528
  requestBody: {
@@ -11625,116 +11532,20 @@ Admins only: a member is refused.`,
11625
11532
  schema: {
11626
11533
  type: "object",
11627
11534
  properties: {
11628
- name: {
11535
+ title: {
11629
11536
  type: "string",
11630
11537
  minLength: 1,
11631
- maxLength: 120
11632
- },
11633
- inbox: {
11634
- type: "string",
11635
- description: "A shared inbox address, from list_inboxes"
11636
- },
11637
- channel: {
11638
- description: "Default email",
11639
- type: "string",
11640
- enum: ["email", "chat"]
11641
- },
11642
- fromConversationId: {
11643
- description: "Copy this conversation",
11644
- type: "string"
11645
- },
11646
- triggerMessageId: {
11647
- description: "The customer message the agent starts on",
11648
- type: "string"
11649
- },
11650
- customer: {
11651
- type: "object",
11652
- properties: {
11653
- name: {
11654
- type: "string"
11655
- },
11656
- address: {
11657
- type: "string",
11658
- description: "Email address, or a visitor id on chat"
11659
- }
11660
- },
11661
- required: ["address"]
11662
- },
11663
- conversation: {
11664
- description: "Oldest first, starting with a message",
11665
- minItems: 1,
11666
- maxItems: 50,
11667
- type: "array",
11668
- items: {
11669
- type: "object",
11670
- properties: {
11671
- type: {
11672
- type: "string",
11673
- enum: ["customer_message", "team_message", "comment"]
11674
- },
11675
- body: {
11676
- type: "string",
11677
- minLength: 1,
11678
- maxLength: 2e4
11679
- },
11680
- subject: {
11681
- description: "Email only",
11682
- type: "string",
11683
- maxLength: 300
11684
- },
11685
- authorEmail: {
11686
- description: "Comment: the teammate who wrote it",
11687
- type: "string"
11688
- },
11689
- at: {
11690
- description: "ISO time; default: one minute apart, up to now",
11691
- type: "string"
11692
- }
11693
- },
11694
- required: ["type", "body"]
11695
- }
11696
- },
11697
- startsAt: {
11698
- description: "Index the agent starts on, default last; later ones are customer follow-ups",
11699
- type: "integer",
11700
- minimum: 0,
11701
- maximum: 9007199254740991
11702
- },
11703
- scenario: {
11704
- description: "The situation, in a sentence or two",
11705
- type: "string",
11706
- maxLength: 400
11707
- },
11708
- expectedOutcomes: {
11709
- minItems: 1,
11710
- maxItems: 20,
11711
- type: "array",
11712
- items: {
11713
- type: "string",
11714
- minLength: 1,
11715
- maxLength: 1e3
11716
- },
11717
- description: "Checkable statements"
11538
+ maxLength: 200,
11539
+ description: `The problem in the customer's words, e.g. "A show or movie is missing".`
11718
11540
  },
11719
- notes: {
11720
- description: "Facts the simulated tools answer from",
11541
+ scope: {
11721
11542
  type: "string",
11722
- maxLength: 2e4
11723
- },
11724
- simulatedTools: {
11725
- description: "Slugs from list_integrations",
11726
- maxItems: 20,
11727
- type: "array",
11728
- items: {
11729
- type: "string"
11730
- }
11731
- },
11732
- assignee: {
11733
- description: '"agent" or a member email',
11734
- type: "string"
11543
+ minLength: 1,
11544
+ maxLength: 1e3,
11545
+ description: "Two or three lines: what is in the gap and what is out."
11735
11546
  }
11736
11547
  },
11737
- required: ["name", "inbox", "expectedOutcomes"]
11548
+ required: ["title", "scope"]
11738
11549
  }
11739
11550
  }
11740
11551
  }
@@ -11821,184 +11632,65 @@ Admins only: a member is refused.`,
11821
11632
  }
11822
11633
  }
11823
11634
  },
11824
- "/v1/tests/{testId}": {
11825
- patch: {
11826
- operationId: "update_test",
11827
- tags: ["tests"],
11828
- summary: "Edit Test",
11829
- description: "Change a test's name, scenario, expectedOutcomes, notes, simulatedTools or assignee; values replace the current ones. confirmed: true only when the person read a real result and agrees: ask them. Changing outcomes or notes unconfirms it. Admins only.\n\nAdmins only: a member is refused.",
11635
+ "/v1/brain/gaps/{gapId}": {
11636
+ get: {
11637
+ operationId: "list_brain_gaps__get_brain_gaps_by_gapId",
11638
+ tags: ["brain"],
11639
+ summary: "Get a Brain Gap",
11640
+ description: "List the brain gaps of your organisation: customer problems Onbox struggled with, in the customer's words, each with its scope, status, last review and how many conversations were first seen struggling in each window (default 30 and 90 days; sinceReview counts those after the last review). Pass gapId for one gap with its recent conversations you can read and their signals. Merged gaps are left out unless includeMerged.\n\nReturns the one element the tool's result holds for this path, not the whole list or map.",
11830
11641
  security: [
11831
11642
  {
11832
11643
  bearerAuth: []
11833
11644
  }
11834
11645
  ],
11835
- "x-onbox-tool": "update_test",
11836
- "x-onbox-scope": "write",
11837
- "x-onbox-destructive": true,
11646
+ "x-onbox-tool": "list_brain_gaps",
11647
+ "x-onbox-scope": "read",
11648
+ "x-onbox-destructive": false,
11838
11649
  parameters: [
11839
11650
  {
11840
- name: "testId",
11651
+ name: "gapId",
11841
11652
  in: "path",
11842
11653
  required: true,
11654
+ description: "One gap, merged or not, with its conversations first seen inside the longest window, newest first, each with its signals.",
11843
11655
  schema: {
11844
- type: "string"
11845
- }
11846
- }
11847
- ],
11848
- requestBody: {
11849
- required: false,
11850
- content: {
11851
- "application/json": {
11852
- schema: {
11853
- type: "object",
11854
- properties: {
11855
- name: {
11856
- type: "string",
11857
- minLength: 1,
11858
- maxLength: 120
11859
- },
11860
- scenario: {
11861
- nullable: true,
11862
- type: "string",
11863
- maxLength: 400
11864
- },
11865
- expectedOutcomes: {
11866
- minItems: 1,
11867
- maxItems: 20,
11868
- type: "array",
11869
- items: {
11870
- type: "string",
11871
- minLength: 1,
11872
- maxLength: 1e3
11873
- }
11874
- },
11875
- notes: {
11876
- nullable: true,
11877
- type: "string",
11878
- maxLength: 2e4
11879
- },
11880
- simulatedTools: {
11881
- maxItems: 20,
11882
- type: "array",
11883
- items: {
11884
- type: "string"
11885
- }
11886
- },
11887
- assignee: {
11888
- description: '"agent", an email, or null',
11889
- nullable: true,
11890
- type: "string"
11891
- },
11892
- confirmed: {
11893
- type: "boolean"
11894
- }
11895
- }
11896
- }
11656
+ type: "string",
11657
+ format: "uuid",
11658
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
11897
11659
  }
11898
- }
11899
- },
11900
- responses: {
11901
- "200": {
11902
- description: "The tool's result.",
11903
- content: {
11904
- "application/json": {
11905
- schema: {}
11906
- }
11660
+ },
11661
+ {
11662
+ name: "status",
11663
+ in: "query",
11664
+ required: false,
11665
+ description: "Only gaps in this state.",
11666
+ schema: {
11667
+ type: "string",
11668
+ enum: ["open", "in_review", "reviewed"]
11907
11669
  }
11908
11670
  },
11909
- "400": {
11910
- description: "The arguments are invalid.",
11911
- content: {
11912
- "application/json": {
11913
- schema: {
11914
- $ref: "#/components/schemas/Error"
11915
- }
11916
- }
11917
- }
11918
- },
11919
- "401": {
11920
- description: "No valid credential.",
11921
- content: {
11922
- "application/json": {
11923
- schema: {
11924
- $ref: "#/components/schemas/Error"
11925
- }
11926
- }
11927
- }
11928
- },
11929
- "403": {
11930
- description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
11931
- content: {
11932
- "application/json": {
11933
- schema: {
11934
- $ref: "#/components/schemas/Error"
11935
- }
11936
- }
11937
- }
11938
- },
11939
- "404": {
11940
- description: "The thing the arguments name does not exist, or the caller cannot see it.",
11941
- content: {
11942
- "application/json": {
11943
- schema: {
11944
- $ref: "#/components/schemas/Error"
11945
- }
11946
- }
11947
- }
11948
- },
11949
- "409": {
11950
- description: "The account is not ready for this call; the message names the step.",
11951
- content: {
11952
- "application/json": {
11953
- schema: {
11954
- $ref: "#/components/schemas/Error"
11955
- }
11956
- }
11957
- }
11958
- },
11959
- "422": {
11960
- description: "The tool understood the request and refused it; the message says why.",
11961
- content: {
11962
- "application/json": {
11963
- schema: {
11964
- $ref: "#/components/schemas/Error"
11965
- }
11671
+ {
11672
+ name: "windowDays",
11673
+ in: "query",
11674
+ required: false,
11675
+ description: "Windows to count conversations in, in days. Default 30 and 90.",
11676
+ schema: {
11677
+ minItems: 1,
11678
+ maxItems: 4,
11679
+ type: "array",
11680
+ items: {
11681
+ type: "integer",
11682
+ minimum: 1,
11683
+ maximum: 365
11966
11684
  }
11967
11685
  }
11968
11686
  },
11969
- "500": {
11970
- description: "Unexpected error.",
11971
- content: {
11972
- "application/json": {
11973
- schema: {
11974
- $ref: "#/components/schemas/Error"
11975
- }
11976
- }
11977
- }
11978
- }
11979
- }
11980
- },
11981
- delete: {
11982
- operationId: "delete_test",
11983
- tags: ["tests"],
11984
- summary: "Delete Test",
11985
- description: "Delete a test of the Onbox agent that the person named. Its past results stay in get_test_results. Admins only.\n\nAdmins only: a member is refused.",
11986
- security: [
11987
- {
11988
- bearerAuth: []
11989
- }
11990
- ],
11991
- "x-onbox-tool": "delete_test",
11992
- "x-onbox-scope": "write",
11993
- "x-onbox-destructive": true,
11994
- parameters: [
11995
11687
  {
11996
- name: "testId",
11997
- in: "path",
11998
- required: true,
11999
- description: "From list_tests",
11688
+ name: "includeMerged",
11689
+ in: "query",
11690
+ required: false,
11691
+ description: "Also list gaps merged into another one. Default false.",
12000
11692
  schema: {
12001
- type: "string"
11693
+ type: "boolean"
12002
11694
  }
12003
11695
  }
12004
11696
  ],
@@ -12082,22 +11774,33 @@ Admins only: a member is refused.`,
12082
11774
  }
12083
11775
  }
12084
11776
  }
12085
- }
12086
- },
12087
- "/v1/tests/run": {
12088
- post: {
12089
- operationId: "run_tests",
12090
- tags: ["tests"],
12091
- summary: "Run Tests",
12092
- description: "Run tests of the Onbox agent, all or testIds, each `runs` times. The real agent works on a copy of each conversation; nothing leaves Onbox. Attempts spend the organisation's credit: run what the person asked for. Returns a batchId; read get_test_results after a minute. Admins only.\n\nAdmins only: a member is refused.",
11777
+ },
11778
+ patch: {
11779
+ operationId: "update_brain_gap",
11780
+ tags: ["brain"],
11781
+ summary: "Update a Brain Gap",
11782
+ description: "Update a brain gap: its title, scope, status (open, in_review, reviewed), the improvement its last review opened, or merge it into another gap that is the same problem (its conversations move there). A merged gap cannot be changed again. The Dream and organisation admins only.",
12093
11783
  security: [
12094
11784
  {
12095
11785
  bearerAuth: []
12096
11786
  }
12097
11787
  ],
12098
- "x-onbox-tool": "run_tests",
11788
+ "x-onbox-tool": "update_brain_gap",
12099
11789
  "x-onbox-scope": "write",
12100
- "x-onbox-destructive": false,
11790
+ "x-onbox-destructive": true,
11791
+ parameters: [
11792
+ {
11793
+ name: "gapId",
11794
+ in: "path",
11795
+ required: true,
11796
+ description: "From list_brain_gaps.",
11797
+ schema: {
11798
+ type: "string",
11799
+ format: "uuid",
11800
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
11801
+ }
11802
+ }
11803
+ ],
12101
11804
  requestBody: {
12102
11805
  required: false,
12103
11806
  content: {
@@ -12105,20 +11808,34 @@ Admins only: a member is refused.`,
12105
11808
  schema: {
12106
11809
  type: "object",
12107
11810
  properties: {
12108
- testIds: {
12109
- description: "From list_tests; default every test",
12110
- minItems: 1,
12111
- maxItems: 50,
12112
- type: "array",
12113
- items: {
12114
- type: "string"
12115
- }
11811
+ title: {
11812
+ type: "string",
11813
+ minLength: 1,
11814
+ maxLength: 200,
11815
+ description: `The problem in the customer's words, e.g. "A show or movie is missing".`
12116
11816
  },
12117
- runs: {
12118
- description: "Attempts per test, default 1",
12119
- type: "integer",
12120
- minimum: 1,
12121
- maximum: 5
11817
+ scope: {
11818
+ type: "string",
11819
+ minLength: 1,
11820
+ maxLength: 1e3,
11821
+ description: "Two or three lines: what is in the gap and what is out."
11822
+ },
11823
+ status: {
11824
+ description: "in_review once a review card is open; reviewed once it is decided (sets reviewedAt).",
11825
+ type: "string",
11826
+ enum: ["open", "in_review", "reviewed"]
11827
+ },
11828
+ improvementId: {
11829
+ description: "The brain proposal the last review opened.",
11830
+ nullable: true,
11831
+ type: "string",
11832
+ minLength: 1
11833
+ },
11834
+ mergeIntoId: {
11835
+ description: "The same problem as that gap: its conversations move there and this gap only points to it.",
11836
+ type: "string",
11837
+ format: "uuid",
11838
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
12122
11839
  }
12123
11840
  }
12124
11841
  }
@@ -12207,27 +11924,30 @@ Admins only: a member is refused.`,
12207
11924
  }
12208
11925
  }
12209
11926
  },
12210
- "/v1/tests/{testId}/run": {
11927
+ "/v1/brain/gaps/{gapId}/conversations": {
12211
11928
  post: {
12212
- operationId: "run_tests__post_tests_by_testId_run",
12213
- tags: ["tests"],
12214
- summary: "Run Tests",
12215
- description: "Run tests of the Onbox agent, all or testIds, each `runs` times. The real agent works on a copy of each conversation; nothing leaves Onbox. Attempts spend the organisation's credit: run what the person asked for. Returns a batchId; read get_test_results after a minute. Admins only.\n\nAdmins only: a member is refused.",
11929
+ operationId: "record_brain_gap_conversations",
11930
+ tags: ["brain"],
11931
+ summary: "Record Conversations Under a Brain Gap",
11932
+ description: "File conversations where Onbox struggled under a brain gap, each with when the struggle was first seen and its signals (kind, and the id of the feedback row that showed it). Safe to repeat: a conversation already filed keeps its earliest firstSeenAt and gains only new signals, so it never counts twice. Up to 100 per call. The Dream and organisation admins only.",
12216
11933
  security: [
12217
11934
  {
12218
11935
  bearerAuth: []
12219
11936
  }
12220
11937
  ],
12221
- "x-onbox-tool": "run_tests",
11938
+ "x-onbox-tool": "record_brain_gap_conversations",
12222
11939
  "x-onbox-scope": "write",
12223
11940
  "x-onbox-destructive": false,
12224
11941
  parameters: [
12225
11942
  {
12226
- name: "testId",
11943
+ name: "gapId",
12227
11944
  in: "path",
12228
11945
  required: true,
11946
+ description: "From list_brain_gaps or create_brain_gap.",
12229
11947
  schema: {
12230
- type: "string"
11948
+ type: "string",
11949
+ format: "uuid",
11950
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
12231
11951
  }
12232
11952
  }
12233
11953
  ],
@@ -12238,13 +11958,56 @@ Admins only: a member is refused.`,
12238
11958
  schema: {
12239
11959
  type: "object",
12240
11960
  properties: {
12241
- runs: {
12242
- description: "Attempts per test, default 1",
12243
- type: "integer",
12244
- minimum: 1,
12245
- maximum: 5
11961
+ conversations: {
11962
+ minItems: 1,
11963
+ maxItems: 100,
11964
+ type: "array",
11965
+ items: {
11966
+ type: "object",
11967
+ properties: {
11968
+ conversationId: {
11969
+ type: "string",
11970
+ minLength: 1
11971
+ },
11972
+ firstSeenAt: {
11973
+ type: "string",
11974
+ format: "date-time",
11975
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
11976
+ description: "The first struggle on the conversation, ISO 8601."
11977
+ },
11978
+ signals: {
11979
+ minItems: 1,
11980
+ maxItems: 50,
11981
+ type: "array",
11982
+ items: {
11983
+ type: "object",
11984
+ properties: {
11985
+ kind: {
11986
+ type: "string",
11987
+ enum: [
11988
+ "correction",
11989
+ "draft_edit",
11990
+ "rating",
11991
+ "comment",
11992
+ "blocked",
11993
+ "escalation",
11994
+ "refusal"
11995
+ ]
11996
+ },
11997
+ feedbackId: {
11998
+ type: "string",
11999
+ minLength: 1
12000
+ }
12001
+ },
12002
+ required: ["kind", "feedbackId"]
12003
+ }
12004
+ }
12005
+ },
12006
+ required: ["conversationId", "firstSeenAt", "signals"]
12007
+ }
12246
12008
  }
12247
- }
12009
+ },
12010
+ required: ["conversations"]
12248
12011
  }
12249
12012
  }
12250
12013
  }
@@ -12331,77 +12094,20 @@ Admins only: a member is refused.`,
12331
12094
  }
12332
12095
  }
12333
12096
  },
12334
- "/v1/tests/results": {
12097
+ "/v1/tests": {
12335
12098
  get: {
12336
- operationId: "get_test_results",
12099
+ operationId: "list_tests",
12337
12100
  tags: ["tests"],
12338
- summary: "Read Test Results",
12339
- description: "Read test attempts, newest first, by batchId, testId, result or cause: the verdict per expected outcome with quoted evidence, agent runs (get_agent_run_trace), tool calls, guard decisions, pending actions, reply sent or held, webUrl. Causes: AGENT missed an outcome; SETUP, add the missing facts to notes; EXPECTATION, reword the outcome; ONBOX, run again. Read again while any is not DONE. Admins only.\n\nAdmins only: a member is refused.",
12101
+ summary: "List Tests",
12102
+ description: "List the tests of the Onbox agent: expected outcomes, notes, latest result, webUrl, and whether a person confirmed each. A failure of an unconfirmed test questions the test first. Admins only.\n\nAdmins only: a member is refused.",
12340
12103
  security: [
12341
12104
  {
12342
12105
  bearerAuth: []
12343
12106
  }
12344
12107
  ],
12345
- "x-onbox-tool": "get_test_results",
12108
+ "x-onbox-tool": "list_tests",
12346
12109
  "x-onbox-scope": "read",
12347
12110
  "x-onbox-destructive": false,
12348
- parameters: [
12349
- {
12350
- name: "batchId",
12351
- in: "query",
12352
- required: false,
12353
- description: "From run_tests",
12354
- schema: {
12355
- type: "string"
12356
- }
12357
- },
12358
- {
12359
- name: "testId",
12360
- in: "query",
12361
- required: false,
12362
- schema: {
12363
- type: "string"
12364
- }
12365
- },
12366
- {
12367
- name: "result",
12368
- in: "query",
12369
- required: false,
12370
- schema: {
12371
- type: "string",
12372
- enum: ["PASSED", "FAILED"]
12373
- }
12374
- },
12375
- {
12376
- name: "cause",
12377
- in: "query",
12378
- required: false,
12379
- schema: {
12380
- type: "string",
12381
- enum: ["AGENT", "SETUP", "EXPECTATION", "ONBOX"]
12382
- }
12383
- },
12384
- {
12385
- name: "limit",
12386
- in: "query",
12387
- required: false,
12388
- description: "Default 20",
12389
- schema: {
12390
- type: "integer",
12391
- minimum: 1,
12392
- maximum: 50
12393
- }
12394
- },
12395
- {
12396
- name: "cursor",
12397
- in: "query",
12398
- required: false,
12399
- description: "nextCursor",
12400
- schema: {
12401
- type: "string"
12402
- }
12403
- }
12404
- ],
12405
12111
  responses: {
12406
12112
  "200": {
12407
12113
  description: "The tool's result.",
@@ -12482,76 +12188,1568 @@ Admins only: a member is refused.`,
12482
12188
  }
12483
12189
  }
12484
12190
  }
12485
- }
12486
- },
12487
- "/v1/tests/{testId}/results": {
12488
- get: {
12489
- operationId: "get_test_results__get_tests_by_testId_results",
12191
+ },
12192
+ post: {
12193
+ operationId: "create_test",
12490
12194
  tags: ["tests"],
12491
- summary: "Read a Test's Results",
12195
+ summary: "Create Test",
12196
+ description: "Create a test of the Onbox agent: a conversation and what the agent must do with it. Copy one (fromConversationId, triggerMessageId) or describe one (customer, conversation). expectedOutcomes are judged one by one, so write checkable statements. Nothing a test does leaves Onbox. Next: run_tests, get_test_results, then the person confirms with update_test. Admins only.\n\nAdmins only: a member is refused.",
12197
+ security: [
12198
+ {
12199
+ bearerAuth: []
12200
+ }
12201
+ ],
12202
+ "x-onbox-tool": "create_test",
12203
+ "x-onbox-scope": "write",
12204
+ "x-onbox-destructive": false,
12205
+ requestBody: {
12206
+ required: false,
12207
+ content: {
12208
+ "application/json": {
12209
+ schema: {
12210
+ type: "object",
12211
+ properties: {
12212
+ name: {
12213
+ type: "string",
12214
+ minLength: 1,
12215
+ maxLength: 120
12216
+ },
12217
+ inbox: {
12218
+ type: "string",
12219
+ description: "A shared inbox address, from list_inboxes"
12220
+ },
12221
+ channel: {
12222
+ description: "Default email",
12223
+ type: "string",
12224
+ enum: ["email", "chat"]
12225
+ },
12226
+ fromConversationId: {
12227
+ description: "Copy this conversation",
12228
+ type: "string"
12229
+ },
12230
+ triggerMessageId: {
12231
+ description: "The customer message the agent starts on",
12232
+ type: "string"
12233
+ },
12234
+ customer: {
12235
+ type: "object",
12236
+ properties: {
12237
+ name: {
12238
+ type: "string"
12239
+ },
12240
+ address: {
12241
+ type: "string",
12242
+ description: "Email address, or a visitor id on chat"
12243
+ }
12244
+ },
12245
+ required: ["address"]
12246
+ },
12247
+ conversation: {
12248
+ description: "Oldest first, starting with a message",
12249
+ minItems: 1,
12250
+ maxItems: 50,
12251
+ type: "array",
12252
+ items: {
12253
+ type: "object",
12254
+ properties: {
12255
+ type: {
12256
+ type: "string",
12257
+ enum: ["customer_message", "team_message", "comment"]
12258
+ },
12259
+ body: {
12260
+ type: "string",
12261
+ minLength: 1,
12262
+ maxLength: 2e4
12263
+ },
12264
+ subject: {
12265
+ description: "Email only",
12266
+ type: "string",
12267
+ maxLength: 300
12268
+ },
12269
+ authorEmail: {
12270
+ description: "Comment: the teammate who wrote it",
12271
+ type: "string"
12272
+ },
12273
+ at: {
12274
+ description: "ISO time; default: one minute apart, up to now",
12275
+ type: "string"
12276
+ }
12277
+ },
12278
+ required: ["type", "body"]
12279
+ }
12280
+ },
12281
+ startsAt: {
12282
+ description: "Index the agent starts on, default last; later ones are customer follow-ups",
12283
+ type: "integer",
12284
+ minimum: 0,
12285
+ maximum: 9007199254740991
12286
+ },
12287
+ scenario: {
12288
+ description: "The situation, in a sentence or two",
12289
+ type: "string",
12290
+ maxLength: 400
12291
+ },
12292
+ expectedOutcomes: {
12293
+ minItems: 1,
12294
+ maxItems: 20,
12295
+ type: "array",
12296
+ items: {
12297
+ type: "string",
12298
+ minLength: 1,
12299
+ maxLength: 1e3
12300
+ },
12301
+ description: "Checkable statements"
12302
+ },
12303
+ notes: {
12304
+ description: "Facts the simulated tools answer from",
12305
+ type: "string",
12306
+ maxLength: 2e4
12307
+ },
12308
+ simulatedTools: {
12309
+ description: "Slugs from list_integrations",
12310
+ maxItems: 20,
12311
+ type: "array",
12312
+ items: {
12313
+ type: "string"
12314
+ }
12315
+ },
12316
+ assignee: {
12317
+ description: '"agent" or a member email',
12318
+ type: "string"
12319
+ }
12320
+ },
12321
+ required: ["name", "inbox", "expectedOutcomes"]
12322
+ }
12323
+ }
12324
+ }
12325
+ },
12326
+ responses: {
12327
+ "200": {
12328
+ description: "The tool's result.",
12329
+ content: {
12330
+ "application/json": {
12331
+ schema: {}
12332
+ }
12333
+ }
12334
+ },
12335
+ "400": {
12336
+ description: "The arguments are invalid.",
12337
+ content: {
12338
+ "application/json": {
12339
+ schema: {
12340
+ $ref: "#/components/schemas/Error"
12341
+ }
12342
+ }
12343
+ }
12344
+ },
12345
+ "401": {
12346
+ description: "No valid credential.",
12347
+ content: {
12348
+ "application/json": {
12349
+ schema: {
12350
+ $ref: "#/components/schemas/Error"
12351
+ }
12352
+ }
12353
+ }
12354
+ },
12355
+ "403": {
12356
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
12357
+ content: {
12358
+ "application/json": {
12359
+ schema: {
12360
+ $ref: "#/components/schemas/Error"
12361
+ }
12362
+ }
12363
+ }
12364
+ },
12365
+ "404": {
12366
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
12367
+ content: {
12368
+ "application/json": {
12369
+ schema: {
12370
+ $ref: "#/components/schemas/Error"
12371
+ }
12372
+ }
12373
+ }
12374
+ },
12375
+ "409": {
12376
+ description: "The account is not ready for this call; the message names the step.",
12377
+ content: {
12378
+ "application/json": {
12379
+ schema: {
12380
+ $ref: "#/components/schemas/Error"
12381
+ }
12382
+ }
12383
+ }
12384
+ },
12385
+ "422": {
12386
+ description: "The tool understood the request and refused it; the message says why.",
12387
+ content: {
12388
+ "application/json": {
12389
+ schema: {
12390
+ $ref: "#/components/schemas/Error"
12391
+ }
12392
+ }
12393
+ }
12394
+ },
12395
+ "500": {
12396
+ description: "Unexpected error.",
12397
+ content: {
12398
+ "application/json": {
12399
+ schema: {
12400
+ $ref: "#/components/schemas/Error"
12401
+ }
12402
+ }
12403
+ }
12404
+ }
12405
+ }
12406
+ }
12407
+ },
12408
+ "/v1/tests/{testId}": {
12409
+ patch: {
12410
+ operationId: "update_test",
12411
+ tags: ["tests"],
12412
+ summary: "Edit Test",
12413
+ description: "Change a test's name, scenario, expectedOutcomes, notes, simulatedTools or assignee; values replace the current ones. confirmed: true only when the person read a real result and agrees: ask them. Changing outcomes or notes unconfirms it. Admins only.\n\nAdmins only: a member is refused.",
12414
+ security: [
12415
+ {
12416
+ bearerAuth: []
12417
+ }
12418
+ ],
12419
+ "x-onbox-tool": "update_test",
12420
+ "x-onbox-scope": "write",
12421
+ "x-onbox-destructive": true,
12422
+ parameters: [
12423
+ {
12424
+ name: "testId",
12425
+ in: "path",
12426
+ required: true,
12427
+ schema: {
12428
+ type: "string"
12429
+ }
12430
+ }
12431
+ ],
12432
+ requestBody: {
12433
+ required: false,
12434
+ content: {
12435
+ "application/json": {
12436
+ schema: {
12437
+ type: "object",
12438
+ properties: {
12439
+ name: {
12440
+ type: "string",
12441
+ minLength: 1,
12442
+ maxLength: 120
12443
+ },
12444
+ scenario: {
12445
+ nullable: true,
12446
+ type: "string",
12447
+ maxLength: 400
12448
+ },
12449
+ expectedOutcomes: {
12450
+ minItems: 1,
12451
+ maxItems: 20,
12452
+ type: "array",
12453
+ items: {
12454
+ type: "string",
12455
+ minLength: 1,
12456
+ maxLength: 1e3
12457
+ }
12458
+ },
12459
+ notes: {
12460
+ nullable: true,
12461
+ type: "string",
12462
+ maxLength: 2e4
12463
+ },
12464
+ simulatedTools: {
12465
+ maxItems: 20,
12466
+ type: "array",
12467
+ items: {
12468
+ type: "string"
12469
+ }
12470
+ },
12471
+ assignee: {
12472
+ description: '"agent", an email, or null',
12473
+ nullable: true,
12474
+ type: "string"
12475
+ },
12476
+ confirmed: {
12477
+ type: "boolean"
12478
+ }
12479
+ }
12480
+ }
12481
+ }
12482
+ }
12483
+ },
12484
+ responses: {
12485
+ "200": {
12486
+ description: "The tool's result.",
12487
+ content: {
12488
+ "application/json": {
12489
+ schema: {}
12490
+ }
12491
+ }
12492
+ },
12493
+ "400": {
12494
+ description: "The arguments are invalid.",
12495
+ content: {
12496
+ "application/json": {
12497
+ schema: {
12498
+ $ref: "#/components/schemas/Error"
12499
+ }
12500
+ }
12501
+ }
12502
+ },
12503
+ "401": {
12504
+ description: "No valid credential.",
12505
+ content: {
12506
+ "application/json": {
12507
+ schema: {
12508
+ $ref: "#/components/schemas/Error"
12509
+ }
12510
+ }
12511
+ }
12512
+ },
12513
+ "403": {
12514
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
12515
+ content: {
12516
+ "application/json": {
12517
+ schema: {
12518
+ $ref: "#/components/schemas/Error"
12519
+ }
12520
+ }
12521
+ }
12522
+ },
12523
+ "404": {
12524
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
12525
+ content: {
12526
+ "application/json": {
12527
+ schema: {
12528
+ $ref: "#/components/schemas/Error"
12529
+ }
12530
+ }
12531
+ }
12532
+ },
12533
+ "409": {
12534
+ description: "The account is not ready for this call; the message names the step.",
12535
+ content: {
12536
+ "application/json": {
12537
+ schema: {
12538
+ $ref: "#/components/schemas/Error"
12539
+ }
12540
+ }
12541
+ }
12542
+ },
12543
+ "422": {
12544
+ description: "The tool understood the request and refused it; the message says why.",
12545
+ content: {
12546
+ "application/json": {
12547
+ schema: {
12548
+ $ref: "#/components/schemas/Error"
12549
+ }
12550
+ }
12551
+ }
12552
+ },
12553
+ "500": {
12554
+ description: "Unexpected error.",
12555
+ content: {
12556
+ "application/json": {
12557
+ schema: {
12558
+ $ref: "#/components/schemas/Error"
12559
+ }
12560
+ }
12561
+ }
12562
+ }
12563
+ }
12564
+ },
12565
+ delete: {
12566
+ operationId: "delete_test",
12567
+ tags: ["tests"],
12568
+ summary: "Delete Test",
12569
+ description: "Delete a test of the Onbox agent that the person named. Its past results stay in get_test_results. Admins only.\n\nAdmins only: a member is refused.",
12570
+ security: [
12571
+ {
12572
+ bearerAuth: []
12573
+ }
12574
+ ],
12575
+ "x-onbox-tool": "delete_test",
12576
+ "x-onbox-scope": "write",
12577
+ "x-onbox-destructive": true,
12578
+ parameters: [
12579
+ {
12580
+ name: "testId",
12581
+ in: "path",
12582
+ required: true,
12583
+ description: "From list_tests",
12584
+ schema: {
12585
+ type: "string"
12586
+ }
12587
+ }
12588
+ ],
12589
+ responses: {
12590
+ "200": {
12591
+ description: "The tool's result.",
12592
+ content: {
12593
+ "application/json": {
12594
+ schema: {}
12595
+ }
12596
+ }
12597
+ },
12598
+ "400": {
12599
+ description: "The arguments are invalid.",
12600
+ content: {
12601
+ "application/json": {
12602
+ schema: {
12603
+ $ref: "#/components/schemas/Error"
12604
+ }
12605
+ }
12606
+ }
12607
+ },
12608
+ "401": {
12609
+ description: "No valid credential.",
12610
+ content: {
12611
+ "application/json": {
12612
+ schema: {
12613
+ $ref: "#/components/schemas/Error"
12614
+ }
12615
+ }
12616
+ }
12617
+ },
12618
+ "403": {
12619
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
12620
+ content: {
12621
+ "application/json": {
12622
+ schema: {
12623
+ $ref: "#/components/schemas/Error"
12624
+ }
12625
+ }
12626
+ }
12627
+ },
12628
+ "404": {
12629
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
12630
+ content: {
12631
+ "application/json": {
12632
+ schema: {
12633
+ $ref: "#/components/schemas/Error"
12634
+ }
12635
+ }
12636
+ }
12637
+ },
12638
+ "409": {
12639
+ description: "The account is not ready for this call; the message names the step.",
12640
+ content: {
12641
+ "application/json": {
12642
+ schema: {
12643
+ $ref: "#/components/schemas/Error"
12644
+ }
12645
+ }
12646
+ }
12647
+ },
12648
+ "422": {
12649
+ description: "The tool understood the request and refused it; the message says why.",
12650
+ content: {
12651
+ "application/json": {
12652
+ schema: {
12653
+ $ref: "#/components/schemas/Error"
12654
+ }
12655
+ }
12656
+ }
12657
+ },
12658
+ "500": {
12659
+ description: "Unexpected error.",
12660
+ content: {
12661
+ "application/json": {
12662
+ schema: {
12663
+ $ref: "#/components/schemas/Error"
12664
+ }
12665
+ }
12666
+ }
12667
+ }
12668
+ }
12669
+ }
12670
+ },
12671
+ "/v1/tests/run": {
12672
+ post: {
12673
+ operationId: "run_tests",
12674
+ tags: ["tests"],
12675
+ summary: "Run Tests",
12676
+ description: "Run tests of the Onbox agent, all or testIds, each `runs` times. The real agent works on a copy of each conversation; nothing leaves Onbox. Attempts spend the organisation's credit: run what the person asked for. Returns a batchId; read get_test_results after a minute. Admins only.\n\nAdmins only: a member is refused.",
12677
+ security: [
12678
+ {
12679
+ bearerAuth: []
12680
+ }
12681
+ ],
12682
+ "x-onbox-tool": "run_tests",
12683
+ "x-onbox-scope": "write",
12684
+ "x-onbox-destructive": false,
12685
+ requestBody: {
12686
+ required: false,
12687
+ content: {
12688
+ "application/json": {
12689
+ schema: {
12690
+ type: "object",
12691
+ properties: {
12692
+ testIds: {
12693
+ description: "From list_tests; default every test",
12694
+ minItems: 1,
12695
+ maxItems: 50,
12696
+ type: "array",
12697
+ items: {
12698
+ type: "string"
12699
+ }
12700
+ },
12701
+ runs: {
12702
+ description: "Attempts per test, default 1",
12703
+ type: "integer",
12704
+ minimum: 1,
12705
+ maximum: 5
12706
+ }
12707
+ }
12708
+ }
12709
+ }
12710
+ }
12711
+ },
12712
+ responses: {
12713
+ "200": {
12714
+ description: "The tool's result.",
12715
+ content: {
12716
+ "application/json": {
12717
+ schema: {}
12718
+ }
12719
+ }
12720
+ },
12721
+ "400": {
12722
+ description: "The arguments are invalid.",
12723
+ content: {
12724
+ "application/json": {
12725
+ schema: {
12726
+ $ref: "#/components/schemas/Error"
12727
+ }
12728
+ }
12729
+ }
12730
+ },
12731
+ "401": {
12732
+ description: "No valid credential.",
12733
+ content: {
12734
+ "application/json": {
12735
+ schema: {
12736
+ $ref: "#/components/schemas/Error"
12737
+ }
12738
+ }
12739
+ }
12740
+ },
12741
+ "403": {
12742
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
12743
+ content: {
12744
+ "application/json": {
12745
+ schema: {
12746
+ $ref: "#/components/schemas/Error"
12747
+ }
12748
+ }
12749
+ }
12750
+ },
12751
+ "404": {
12752
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
12753
+ content: {
12754
+ "application/json": {
12755
+ schema: {
12756
+ $ref: "#/components/schemas/Error"
12757
+ }
12758
+ }
12759
+ }
12760
+ },
12761
+ "409": {
12762
+ description: "The account is not ready for this call; the message names the step.",
12763
+ content: {
12764
+ "application/json": {
12765
+ schema: {
12766
+ $ref: "#/components/schemas/Error"
12767
+ }
12768
+ }
12769
+ }
12770
+ },
12771
+ "422": {
12772
+ description: "The tool understood the request and refused it; the message says why.",
12773
+ content: {
12774
+ "application/json": {
12775
+ schema: {
12776
+ $ref: "#/components/schemas/Error"
12777
+ }
12778
+ }
12779
+ }
12780
+ },
12781
+ "500": {
12782
+ description: "Unexpected error.",
12783
+ content: {
12784
+ "application/json": {
12785
+ schema: {
12786
+ $ref: "#/components/schemas/Error"
12787
+ }
12788
+ }
12789
+ }
12790
+ }
12791
+ }
12792
+ }
12793
+ },
12794
+ "/v1/tests/{testId}/run": {
12795
+ post: {
12796
+ operationId: "run_tests__post_tests_by_testId_run",
12797
+ tags: ["tests"],
12798
+ summary: "Run Tests",
12799
+ description: "Run tests of the Onbox agent, all or testIds, each `runs` times. The real agent works on a copy of each conversation; nothing leaves Onbox. Attempts spend the organisation's credit: run what the person asked for. Returns a batchId; read get_test_results after a minute. Admins only.\n\nAdmins only: a member is refused.",
12800
+ security: [
12801
+ {
12802
+ bearerAuth: []
12803
+ }
12804
+ ],
12805
+ "x-onbox-tool": "run_tests",
12806
+ "x-onbox-scope": "write",
12807
+ "x-onbox-destructive": false,
12808
+ parameters: [
12809
+ {
12810
+ name: "testId",
12811
+ in: "path",
12812
+ required: true,
12813
+ schema: {
12814
+ type: "string"
12815
+ }
12816
+ }
12817
+ ],
12818
+ requestBody: {
12819
+ required: false,
12820
+ content: {
12821
+ "application/json": {
12822
+ schema: {
12823
+ type: "object",
12824
+ properties: {
12825
+ runs: {
12826
+ description: "Attempts per test, default 1",
12827
+ type: "integer",
12828
+ minimum: 1,
12829
+ maximum: 5
12830
+ }
12831
+ }
12832
+ }
12833
+ }
12834
+ }
12835
+ },
12836
+ responses: {
12837
+ "200": {
12838
+ description: "The tool's result.",
12839
+ content: {
12840
+ "application/json": {
12841
+ schema: {}
12842
+ }
12843
+ }
12844
+ },
12845
+ "400": {
12846
+ description: "The arguments are invalid.",
12847
+ content: {
12848
+ "application/json": {
12849
+ schema: {
12850
+ $ref: "#/components/schemas/Error"
12851
+ }
12852
+ }
12853
+ }
12854
+ },
12855
+ "401": {
12856
+ description: "No valid credential.",
12857
+ content: {
12858
+ "application/json": {
12859
+ schema: {
12860
+ $ref: "#/components/schemas/Error"
12861
+ }
12862
+ }
12863
+ }
12864
+ },
12865
+ "403": {
12866
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
12867
+ content: {
12868
+ "application/json": {
12869
+ schema: {
12870
+ $ref: "#/components/schemas/Error"
12871
+ }
12872
+ }
12873
+ }
12874
+ },
12875
+ "404": {
12876
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
12877
+ content: {
12878
+ "application/json": {
12879
+ schema: {
12880
+ $ref: "#/components/schemas/Error"
12881
+ }
12882
+ }
12883
+ }
12884
+ },
12885
+ "409": {
12886
+ description: "The account is not ready for this call; the message names the step.",
12887
+ content: {
12888
+ "application/json": {
12889
+ schema: {
12890
+ $ref: "#/components/schemas/Error"
12891
+ }
12892
+ }
12893
+ }
12894
+ },
12895
+ "422": {
12896
+ description: "The tool understood the request and refused it; the message says why.",
12897
+ content: {
12898
+ "application/json": {
12899
+ schema: {
12900
+ $ref: "#/components/schemas/Error"
12901
+ }
12902
+ }
12903
+ }
12904
+ },
12905
+ "500": {
12906
+ description: "Unexpected error.",
12907
+ content: {
12908
+ "application/json": {
12909
+ schema: {
12910
+ $ref: "#/components/schemas/Error"
12911
+ }
12912
+ }
12913
+ }
12914
+ }
12915
+ }
12916
+ }
12917
+ },
12918
+ "/v1/tests/results": {
12919
+ get: {
12920
+ operationId: "get_test_results",
12921
+ tags: ["tests"],
12922
+ summary: "Read Test Results",
12923
+ description: "Read test attempts, newest first, by batchId, testId, result or cause: the verdict per expected outcome with quoted evidence, agent runs (get_agent_run_trace), tool calls, guard decisions, pending actions, reply sent or held, webUrl. Causes: AGENT missed an outcome; SETUP, add the missing facts to notes; EXPECTATION, reword the outcome; ONBOX, run again. Read again while any is not DONE. Admins only.\n\nAdmins only: a member is refused.",
12924
+ security: [
12925
+ {
12926
+ bearerAuth: []
12927
+ }
12928
+ ],
12929
+ "x-onbox-tool": "get_test_results",
12930
+ "x-onbox-scope": "read",
12931
+ "x-onbox-destructive": false,
12932
+ parameters: [
12933
+ {
12934
+ name: "batchId",
12935
+ in: "query",
12936
+ required: false,
12937
+ description: "From run_tests",
12938
+ schema: {
12939
+ type: "string"
12940
+ }
12941
+ },
12942
+ {
12943
+ name: "testId",
12944
+ in: "query",
12945
+ required: false,
12946
+ schema: {
12947
+ type: "string"
12948
+ }
12949
+ },
12950
+ {
12951
+ name: "result",
12952
+ in: "query",
12953
+ required: false,
12954
+ schema: {
12955
+ type: "string",
12956
+ enum: ["PASSED", "FAILED"]
12957
+ }
12958
+ },
12959
+ {
12960
+ name: "cause",
12961
+ in: "query",
12962
+ required: false,
12963
+ schema: {
12964
+ type: "string",
12965
+ enum: ["AGENT", "SETUP", "EXPECTATION", "ONBOX"]
12966
+ }
12967
+ },
12968
+ {
12969
+ name: "limit",
12970
+ in: "query",
12971
+ required: false,
12972
+ description: "Default 20",
12973
+ schema: {
12974
+ type: "integer",
12975
+ minimum: 1,
12976
+ maximum: 50
12977
+ }
12978
+ },
12979
+ {
12980
+ name: "cursor",
12981
+ in: "query",
12982
+ required: false,
12983
+ description: "nextCursor",
12984
+ schema: {
12985
+ type: "string"
12986
+ }
12987
+ }
12988
+ ],
12989
+ responses: {
12990
+ "200": {
12991
+ description: "The tool's result.",
12992
+ content: {
12993
+ "application/json": {
12994
+ schema: {}
12995
+ }
12996
+ }
12997
+ },
12998
+ "400": {
12999
+ description: "The arguments are invalid.",
13000
+ content: {
13001
+ "application/json": {
13002
+ schema: {
13003
+ $ref: "#/components/schemas/Error"
13004
+ }
13005
+ }
13006
+ }
13007
+ },
13008
+ "401": {
13009
+ description: "No valid credential.",
13010
+ content: {
13011
+ "application/json": {
13012
+ schema: {
13013
+ $ref: "#/components/schemas/Error"
13014
+ }
13015
+ }
13016
+ }
13017
+ },
13018
+ "403": {
13019
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
13020
+ content: {
13021
+ "application/json": {
13022
+ schema: {
13023
+ $ref: "#/components/schemas/Error"
13024
+ }
13025
+ }
13026
+ }
13027
+ },
13028
+ "404": {
13029
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
13030
+ content: {
13031
+ "application/json": {
13032
+ schema: {
13033
+ $ref: "#/components/schemas/Error"
13034
+ }
13035
+ }
13036
+ }
13037
+ },
13038
+ "409": {
13039
+ description: "The account is not ready for this call; the message names the step.",
13040
+ content: {
13041
+ "application/json": {
13042
+ schema: {
13043
+ $ref: "#/components/schemas/Error"
13044
+ }
13045
+ }
13046
+ }
13047
+ },
13048
+ "422": {
13049
+ description: "The tool understood the request and refused it; the message says why.",
13050
+ content: {
13051
+ "application/json": {
13052
+ schema: {
13053
+ $ref: "#/components/schemas/Error"
13054
+ }
13055
+ }
13056
+ }
13057
+ },
13058
+ "500": {
13059
+ description: "Unexpected error.",
13060
+ content: {
13061
+ "application/json": {
13062
+ schema: {
13063
+ $ref: "#/components/schemas/Error"
13064
+ }
13065
+ }
13066
+ }
13067
+ }
13068
+ }
13069
+ }
13070
+ },
13071
+ "/v1/tests/{testId}/results": {
13072
+ get: {
13073
+ operationId: "get_test_results__get_tests_by_testId_results",
13074
+ tags: ["tests"],
13075
+ summary: "Read a Test's Results",
12492
13076
  description: "Read test attempts, newest first, by batchId, testId, result or cause: the verdict per expected outcome with quoted evidence, agent runs (get_agent_run_trace), tool calls, guard decisions, pending actions, reply sent or held, webUrl. Causes: AGENT missed an outcome; SETUP, add the missing facts to notes; EXPECTATION, reword the outcome; ONBOX, run again. Read again while any is not DONE. Admins only.\n\nAdmins only: a member is refused.",
12493
13077
  security: [
12494
13078
  {
12495
13079
  bearerAuth: []
12496
13080
  }
12497
13081
  ],
12498
- "x-onbox-tool": "get_test_results",
12499
- "x-onbox-scope": "read",
12500
- "x-onbox-destructive": false,
13082
+ "x-onbox-tool": "get_test_results",
13083
+ "x-onbox-scope": "read",
13084
+ "x-onbox-destructive": false,
13085
+ parameters: [
13086
+ {
13087
+ name: "testId",
13088
+ in: "path",
13089
+ required: true,
13090
+ schema: {
13091
+ type: "string"
13092
+ }
13093
+ },
13094
+ {
13095
+ name: "batchId",
13096
+ in: "query",
13097
+ required: false,
13098
+ description: "From run_tests",
13099
+ schema: {
13100
+ type: "string"
13101
+ }
13102
+ },
13103
+ {
13104
+ name: "result",
13105
+ in: "query",
13106
+ required: false,
13107
+ schema: {
13108
+ type: "string",
13109
+ enum: ["PASSED", "FAILED"]
13110
+ }
13111
+ },
13112
+ {
13113
+ name: "cause",
13114
+ in: "query",
13115
+ required: false,
13116
+ schema: {
13117
+ type: "string",
13118
+ enum: ["AGENT", "SETUP", "EXPECTATION", "ONBOX"]
13119
+ }
13120
+ },
13121
+ {
13122
+ name: "limit",
13123
+ in: "query",
13124
+ required: false,
13125
+ description: "Default 20",
13126
+ schema: {
13127
+ type: "integer",
13128
+ minimum: 1,
13129
+ maximum: 50
13130
+ }
13131
+ },
13132
+ {
13133
+ name: "cursor",
13134
+ in: "query",
13135
+ required: false,
13136
+ description: "nextCursor",
13137
+ schema: {
13138
+ type: "string"
13139
+ }
13140
+ }
13141
+ ],
13142
+ responses: {
13143
+ "200": {
13144
+ description: "The tool's result.",
13145
+ content: {
13146
+ "application/json": {
13147
+ schema: {}
13148
+ }
13149
+ }
13150
+ },
13151
+ "400": {
13152
+ description: "The arguments are invalid.",
13153
+ content: {
13154
+ "application/json": {
13155
+ schema: {
13156
+ $ref: "#/components/schemas/Error"
13157
+ }
13158
+ }
13159
+ }
13160
+ },
13161
+ "401": {
13162
+ description: "No valid credential.",
13163
+ content: {
13164
+ "application/json": {
13165
+ schema: {
13166
+ $ref: "#/components/schemas/Error"
13167
+ }
13168
+ }
13169
+ }
13170
+ },
13171
+ "403": {
13172
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
13173
+ content: {
13174
+ "application/json": {
13175
+ schema: {
13176
+ $ref: "#/components/schemas/Error"
13177
+ }
13178
+ }
13179
+ }
13180
+ },
13181
+ "404": {
13182
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
13183
+ content: {
13184
+ "application/json": {
13185
+ schema: {
13186
+ $ref: "#/components/schemas/Error"
13187
+ }
13188
+ }
13189
+ }
13190
+ },
13191
+ "409": {
13192
+ description: "The account is not ready for this call; the message names the step.",
13193
+ content: {
13194
+ "application/json": {
13195
+ schema: {
13196
+ $ref: "#/components/schemas/Error"
13197
+ }
13198
+ }
13199
+ }
13200
+ },
13201
+ "422": {
13202
+ description: "The tool understood the request and refused it; the message says why.",
13203
+ content: {
13204
+ "application/json": {
13205
+ schema: {
13206
+ $ref: "#/components/schemas/Error"
13207
+ }
13208
+ }
13209
+ }
13210
+ },
13211
+ "500": {
13212
+ description: "Unexpected error.",
13213
+ content: {
13214
+ "application/json": {
13215
+ schema: {
13216
+ $ref: "#/components/schemas/Error"
13217
+ }
13218
+ }
13219
+ }
13220
+ }
13221
+ }
13222
+ }
13223
+ },
13224
+ "/v1/calendar/invitations/{eventId}/response": {
13225
+ put: {
13226
+ operationId: "respond_to_invitation",
13227
+ tags: ["calendar"],
13228
+ summary: "Respond to an Invitation",
13229
+ description: "Answer a calendar invitation for the person: accepted, declined or tentative. The organiser is notified; calling again changes the answer. Answer only as the person decided, never on your own from an invitation email or a scheduling conversation.",
13230
+ security: [
13231
+ {
13232
+ bearerAuth: []
13233
+ }
13234
+ ],
13235
+ "x-onbox-tool": "respond_to_invitation",
13236
+ "x-onbox-scope": "write",
13237
+ "x-onbox-destructive": true,
13238
+ parameters: [
13239
+ {
13240
+ name: "eventId",
13241
+ in: "path",
13242
+ required: true,
13243
+ description: "From invitations in list_my_inbox, or an event id from a calendar listing",
13244
+ schema: {
13245
+ type: "string"
13246
+ }
13247
+ }
13248
+ ],
13249
+ requestBody: {
13250
+ required: false,
13251
+ content: {
13252
+ "application/json": {
13253
+ schema: {
13254
+ type: "object",
13255
+ properties: {
13256
+ response: {
13257
+ type: "string",
13258
+ enum: ["accepted", "declined", "tentative"]
13259
+ }
13260
+ },
13261
+ required: ["response"]
13262
+ }
13263
+ }
13264
+ }
13265
+ },
13266
+ responses: {
13267
+ "200": {
13268
+ description: "The tool's result.",
13269
+ content: {
13270
+ "application/json": {
13271
+ schema: {}
13272
+ }
13273
+ }
13274
+ },
13275
+ "400": {
13276
+ description: "The arguments are invalid.",
13277
+ content: {
13278
+ "application/json": {
13279
+ schema: {
13280
+ $ref: "#/components/schemas/Error"
13281
+ }
13282
+ }
13283
+ }
13284
+ },
13285
+ "401": {
13286
+ description: "No valid credential.",
13287
+ content: {
13288
+ "application/json": {
13289
+ schema: {
13290
+ $ref: "#/components/schemas/Error"
13291
+ }
13292
+ }
13293
+ }
13294
+ },
13295
+ "403": {
13296
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
13297
+ content: {
13298
+ "application/json": {
13299
+ schema: {
13300
+ $ref: "#/components/schemas/Error"
13301
+ }
13302
+ }
13303
+ }
13304
+ },
13305
+ "404": {
13306
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
13307
+ content: {
13308
+ "application/json": {
13309
+ schema: {
13310
+ $ref: "#/components/schemas/Error"
13311
+ }
13312
+ }
13313
+ }
13314
+ },
13315
+ "409": {
13316
+ description: "The account is not ready for this call; the message names the step.",
13317
+ content: {
13318
+ "application/json": {
13319
+ schema: {
13320
+ $ref: "#/components/schemas/Error"
13321
+ }
13322
+ }
13323
+ }
13324
+ },
13325
+ "422": {
13326
+ description: "The tool understood the request and refused it; the message says why.",
13327
+ content: {
13328
+ "application/json": {
13329
+ schema: {
13330
+ $ref: "#/components/schemas/Error"
13331
+ }
13332
+ }
13333
+ }
13334
+ },
13335
+ "500": {
13336
+ description: "Unexpected error.",
13337
+ content: {
13338
+ "application/json": {
13339
+ schema: {
13340
+ $ref: "#/components/schemas/Error"
13341
+ }
13342
+ }
13343
+ }
13344
+ }
13345
+ }
13346
+ }
13347
+ },
13348
+ "/v1/webhook-endpoints": {
13349
+ get: {
13350
+ operationId: "list_webhook_endpoints",
13351
+ tags: ["webhook-endpoints"],
13352
+ summary: "List Webhook Endpoints",
13353
+ description: "List the webhook endpoints of the organisation: the URLs outside systems (Linear, GitHub, your own tools) post events to, how each is verified, and whether its secret is set. Secrets are never returned. Admins only.\n\nAdmins only: a member is refused.",
13354
+ security: [
13355
+ {
13356
+ bearerAuth: []
13357
+ }
13358
+ ],
13359
+ "x-onbox-tool": "list_webhook_endpoints",
13360
+ "x-onbox-scope": "read",
13361
+ "x-onbox-destructive": false,
13362
+ responses: {
13363
+ "200": {
13364
+ description: "The tool's result.",
13365
+ content: {
13366
+ "application/json": {
13367
+ schema: {}
13368
+ }
13369
+ }
13370
+ },
13371
+ "400": {
13372
+ description: "The arguments are invalid.",
13373
+ content: {
13374
+ "application/json": {
13375
+ schema: {
13376
+ $ref: "#/components/schemas/Error"
13377
+ }
13378
+ }
13379
+ }
13380
+ },
13381
+ "401": {
13382
+ description: "No valid credential.",
13383
+ content: {
13384
+ "application/json": {
13385
+ schema: {
13386
+ $ref: "#/components/schemas/Error"
13387
+ }
13388
+ }
13389
+ }
13390
+ },
13391
+ "403": {
13392
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
13393
+ content: {
13394
+ "application/json": {
13395
+ schema: {
13396
+ $ref: "#/components/schemas/Error"
13397
+ }
13398
+ }
13399
+ }
13400
+ },
13401
+ "404": {
13402
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
13403
+ content: {
13404
+ "application/json": {
13405
+ schema: {
13406
+ $ref: "#/components/schemas/Error"
13407
+ }
13408
+ }
13409
+ }
13410
+ },
13411
+ "409": {
13412
+ description: "The account is not ready for this call; the message names the step.",
13413
+ content: {
13414
+ "application/json": {
13415
+ schema: {
13416
+ $ref: "#/components/schemas/Error"
13417
+ }
13418
+ }
13419
+ }
13420
+ },
13421
+ "422": {
13422
+ description: "The tool understood the request and refused it; the message says why.",
13423
+ content: {
13424
+ "application/json": {
13425
+ schema: {
13426
+ $ref: "#/components/schemas/Error"
13427
+ }
13428
+ }
13429
+ }
13430
+ },
13431
+ "500": {
13432
+ description: "Unexpected error.",
13433
+ content: {
13434
+ "application/json": {
13435
+ schema: {
13436
+ $ref: "#/components/schemas/Error"
13437
+ }
13438
+ }
13439
+ }
13440
+ }
13441
+ }
13442
+ },
13443
+ post: {
13444
+ operationId: "create_webhook_endpoint",
13445
+ tags: ["webhook-endpoints"],
13446
+ summary: "Create a Webhook Endpoint",
13447
+ description: "Create a webhook endpoint and get its URL. Point the outside system at that URL yourself: Onbox does not register anything there. Deliveries are refused until the secret is set; pass it now, or later with update_webhook_endpoint when the outside system generates it (Linear does). Check what arrives with list_webhook_deliveries. Admins only.\n\nAdmins only: a member is refused.",
13448
+ security: [
13449
+ {
13450
+ bearerAuth: []
13451
+ }
13452
+ ],
13453
+ "x-onbox-tool": "create_webhook_endpoint",
13454
+ "x-onbox-scope": "write",
13455
+ "x-onbox-destructive": false,
13456
+ requestBody: {
13457
+ required: false,
13458
+ content: {
13459
+ "application/json": {
13460
+ schema: {
13461
+ type: "object",
13462
+ properties: {
13463
+ slug: {
13464
+ type: "string",
13465
+ description: "A short name for the source, unique in the organisation: lower-case letters, digits and hyphens, e.g. linear. It cannot be changed later"
13466
+ },
13467
+ scheme: {
13468
+ type: "string",
13469
+ enum: ["linear", "github", "hmac_sha256"],
13470
+ description: "How deliveries are signed. linear and github fix the headers and the event type. hmac_sha256 is a hex HMAC SHA-256 of the raw body in a header you name"
13471
+ },
13472
+ secret: {
13473
+ type: "string",
13474
+ description: "The signing secret, 8 to 512 characters. Onbox stores it and never returns it. Linear generates it when you create the webhook there; for GitHub you choose it"
13475
+ },
13476
+ signatureHeader: {
13477
+ description: "hmac_sha256 only, required: the header that carries the signature",
13478
+ nullable: true,
13479
+ type: "string"
13480
+ },
13481
+ deliveryIdHeader: {
13482
+ description: "hmac_sha256 only: the header that carries a unique delivery ID. Without it, two deliveries with the same body count as one",
13483
+ nullable: true,
13484
+ type: "string"
13485
+ },
13486
+ eventTypeHeader: {
13487
+ description: "hmac_sha256 only: the header that carries the event type",
13488
+ nullable: true,
13489
+ type: "string"
13490
+ },
13491
+ eventTypePath: {
13492
+ description: "hmac_sha256 only: a dot path to the event type in the body, e.g. event.type",
13493
+ nullable: true,
13494
+ type: "string"
13495
+ }
13496
+ },
13497
+ required: ["slug", "scheme"]
13498
+ }
13499
+ }
13500
+ }
13501
+ },
13502
+ responses: {
13503
+ "200": {
13504
+ description: "The tool's result.",
13505
+ content: {
13506
+ "application/json": {
13507
+ schema: {}
13508
+ }
13509
+ }
13510
+ },
13511
+ "400": {
13512
+ description: "The arguments are invalid.",
13513
+ content: {
13514
+ "application/json": {
13515
+ schema: {
13516
+ $ref: "#/components/schemas/Error"
13517
+ }
13518
+ }
13519
+ }
13520
+ },
13521
+ "401": {
13522
+ description: "No valid credential.",
13523
+ content: {
13524
+ "application/json": {
13525
+ schema: {
13526
+ $ref: "#/components/schemas/Error"
13527
+ }
13528
+ }
13529
+ }
13530
+ },
13531
+ "403": {
13532
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
13533
+ content: {
13534
+ "application/json": {
13535
+ schema: {
13536
+ $ref: "#/components/schemas/Error"
13537
+ }
13538
+ }
13539
+ }
13540
+ },
13541
+ "404": {
13542
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
13543
+ content: {
13544
+ "application/json": {
13545
+ schema: {
13546
+ $ref: "#/components/schemas/Error"
13547
+ }
13548
+ }
13549
+ }
13550
+ },
13551
+ "409": {
13552
+ description: "The account is not ready for this call; the message names the step.",
13553
+ content: {
13554
+ "application/json": {
13555
+ schema: {
13556
+ $ref: "#/components/schemas/Error"
13557
+ }
13558
+ }
13559
+ }
13560
+ },
13561
+ "422": {
13562
+ description: "The tool understood the request and refused it; the message says why.",
13563
+ content: {
13564
+ "application/json": {
13565
+ schema: {
13566
+ $ref: "#/components/schemas/Error"
13567
+ }
13568
+ }
13569
+ }
13570
+ },
13571
+ "500": {
13572
+ description: "Unexpected error.",
13573
+ content: {
13574
+ "application/json": {
13575
+ schema: {
13576
+ $ref: "#/components/schemas/Error"
13577
+ }
13578
+ }
13579
+ }
13580
+ }
13581
+ }
13582
+ }
13583
+ },
13584
+ "/v1/webhook-endpoints/{endpoint}": {
13585
+ patch: {
13586
+ operationId: "update_webhook_endpoint",
13587
+ tags: ["webhook-endpoints"],
13588
+ summary: "Update a Webhook Endpoint",
13589
+ description: "Change a webhook endpoint: set or replace its signing secret, switch it on or off, or change the headers of an hmac_sha256 endpoint. Replacing the secret takes effect at once, so deliveries signed with the old one are refused. Only the properties you pass change; null clears a header. The slug, the scheme and the URL don't change. Admins only.\n\nAdmins only: a member is refused.",
13590
+ security: [
13591
+ {
13592
+ bearerAuth: []
13593
+ }
13594
+ ],
13595
+ "x-onbox-tool": "update_webhook_endpoint",
13596
+ "x-onbox-scope": "write",
13597
+ "x-onbox-destructive": true,
12501
13598
  parameters: [
12502
13599
  {
12503
- name: "testId",
13600
+ name: "endpoint",
12504
13601
  in: "path",
12505
13602
  required: true,
13603
+ description: "The endpoint's ID or slug",
12506
13604
  schema: {
12507
- type: "string"
13605
+ type: "string",
13606
+ minLength: 1
13607
+ }
13608
+ }
13609
+ ],
13610
+ requestBody: {
13611
+ required: false,
13612
+ content: {
13613
+ "application/json": {
13614
+ schema: {
13615
+ type: "object",
13616
+ properties: {
13617
+ secret: {
13618
+ type: "string",
13619
+ description: "The signing secret, 8 to 512 characters. Onbox stores it and never returns it. Linear generates it when you create the webhook there; for GitHub you choose it"
13620
+ },
13621
+ enabled: {
13622
+ description: "false switches the URL off: deliveries get a 404 and nothing is stored",
13623
+ type: "boolean"
13624
+ },
13625
+ signatureHeader: {
13626
+ description: "hmac_sha256 only, required: the header that carries the signature",
13627
+ nullable: true,
13628
+ type: "string"
13629
+ },
13630
+ deliveryIdHeader: {
13631
+ description: "hmac_sha256 only: the header that carries a unique delivery ID. Without it, two deliveries with the same body count as one",
13632
+ nullable: true,
13633
+ type: "string"
13634
+ },
13635
+ eventTypeHeader: {
13636
+ description: "hmac_sha256 only: the header that carries the event type",
13637
+ nullable: true,
13638
+ type: "string"
13639
+ },
13640
+ eventTypePath: {
13641
+ description: "hmac_sha256 only: a dot path to the event type in the body, e.g. event.type",
13642
+ nullable: true,
13643
+ type: "string"
13644
+ }
13645
+ }
13646
+ }
13647
+ }
13648
+ }
13649
+ },
13650
+ responses: {
13651
+ "200": {
13652
+ description: "The tool's result.",
13653
+ content: {
13654
+ "application/json": {
13655
+ schema: {}
13656
+ }
12508
13657
  }
12509
13658
  },
12510
- {
12511
- name: "batchId",
12512
- in: "query",
12513
- required: false,
12514
- description: "From run_tests",
12515
- schema: {
12516
- type: "string"
13659
+ "400": {
13660
+ description: "The arguments are invalid.",
13661
+ content: {
13662
+ "application/json": {
13663
+ schema: {
13664
+ $ref: "#/components/schemas/Error"
13665
+ }
13666
+ }
12517
13667
  }
12518
13668
  },
12519
- {
12520
- name: "result",
12521
- in: "query",
12522
- required: false,
12523
- schema: {
12524
- type: "string",
12525
- enum: ["PASSED", "FAILED"]
13669
+ "401": {
13670
+ description: "No valid credential.",
13671
+ content: {
13672
+ "application/json": {
13673
+ schema: {
13674
+ $ref: "#/components/schemas/Error"
13675
+ }
13676
+ }
12526
13677
  }
12527
13678
  },
12528
- {
12529
- name: "cause",
12530
- in: "query",
12531
- required: false,
12532
- schema: {
12533
- type: "string",
12534
- enum: ["AGENT", "SETUP", "EXPECTATION", "ONBOX"]
13679
+ "403": {
13680
+ description: "The caller may not use this route (an admin-only tool, or a token without the scope the route needs: code insufficient_scope).",
13681
+ content: {
13682
+ "application/json": {
13683
+ schema: {
13684
+ $ref: "#/components/schemas/Error"
13685
+ }
13686
+ }
12535
13687
  }
12536
13688
  },
12537
- {
12538
- name: "limit",
12539
- in: "query",
12540
- required: false,
12541
- description: "Default 20",
12542
- schema: {
12543
- type: "integer",
12544
- minimum: 1,
12545
- maximum: 50
13689
+ "404": {
13690
+ description: "The thing the arguments name does not exist, or the caller cannot see it.",
13691
+ content: {
13692
+ "application/json": {
13693
+ schema: {
13694
+ $ref: "#/components/schemas/Error"
13695
+ }
13696
+ }
13697
+ }
13698
+ },
13699
+ "409": {
13700
+ description: "The account is not ready for this call; the message names the step.",
13701
+ content: {
13702
+ "application/json": {
13703
+ schema: {
13704
+ $ref: "#/components/schemas/Error"
13705
+ }
13706
+ }
13707
+ }
13708
+ },
13709
+ "422": {
13710
+ description: "The tool understood the request and refused it; the message says why.",
13711
+ content: {
13712
+ "application/json": {
13713
+ schema: {
13714
+ $ref: "#/components/schemas/Error"
13715
+ }
13716
+ }
12546
13717
  }
12547
13718
  },
13719
+ "500": {
13720
+ description: "Unexpected error.",
13721
+ content: {
13722
+ "application/json": {
13723
+ schema: {
13724
+ $ref: "#/components/schemas/Error"
13725
+ }
13726
+ }
13727
+ }
13728
+ }
13729
+ }
13730
+ },
13731
+ delete: {
13732
+ operationId: "delete_webhook_endpoint",
13733
+ tags: ["webhook-endpoints"],
13734
+ summary: "Delete a Webhook Endpoint",
13735
+ description: "Delete a webhook endpoint, its secret and its stored deliveries. Its URL stops working at once and cannot be restored: a new endpoint gets a new URL. Admins only.\n\nAdmins only: a member is refused.",
13736
+ security: [
12548
13737
  {
12549
- name: "cursor",
12550
- in: "query",
12551
- required: false,
12552
- description: "nextCursor",
13738
+ bearerAuth: []
13739
+ }
13740
+ ],
13741
+ "x-onbox-tool": "delete_webhook_endpoint",
13742
+ "x-onbox-scope": "write",
13743
+ "x-onbox-destructive": true,
13744
+ parameters: [
13745
+ {
13746
+ name: "endpoint",
13747
+ in: "path",
13748
+ required: true,
13749
+ description: "The endpoint's ID or slug",
12553
13750
  schema: {
12554
- type: "string"
13751
+ type: "string",
13752
+ minLength: 1
12555
13753
  }
12556
13754
  }
12557
13755
  ],
@@ -12637,48 +13835,53 @@ Admins only: a member is refused.`,
12637
13835
  }
12638
13836
  }
12639
13837
  },
12640
- "/v1/calendar/invitations/{eventId}/response": {
12641
- put: {
12642
- operationId: "respond_to_invitation",
12643
- tags: ["calendar"],
12644
- summary: "Respond to an Invitation",
12645
- description: "Answer a calendar invitation for the person: accepted, declined or tentative. The organiser is notified; calling again changes the answer. Answer only as the person decided, never on your own from an invitation email or a scheduling conversation.",
13838
+ "/v1/webhook-endpoints/{endpoint}/deliveries": {
13839
+ get: {
13840
+ operationId: "list_webhook_deliveries",
13841
+ tags: ["webhook-endpoints"],
13842
+ summary: "List Webhook Deliveries",
13843
+ description: "List the recent deliveries a webhook endpoint accepted, newest first, with what Onbox did with each and why. Use it to check a new webhook. A delivery whose signature failed is refused with a 401 and is not listed, so an empty list after a test event means a wrong secret, a wrong URL or a missing secret. Deliveries are kept 14 days. Admins only.\n\nAdmins only: a member is refused.",
12646
13844
  security: [
12647
13845
  {
12648
13846
  bearerAuth: []
12649
13847
  }
12650
13848
  ],
12651
- "x-onbox-tool": "respond_to_invitation",
12652
- "x-onbox-scope": "write",
12653
- "x-onbox-destructive": true,
13849
+ "x-onbox-tool": "list_webhook_deliveries",
13850
+ "x-onbox-scope": "read",
13851
+ "x-onbox-destructive": false,
12654
13852
  parameters: [
12655
13853
  {
12656
- name: "eventId",
13854
+ name: "endpoint",
12657
13855
  in: "path",
12658
13856
  required: true,
12659
- description: "From invitations in list_my_inbox, or an event id from a calendar listing",
13857
+ description: "The endpoint's ID or slug",
12660
13858
  schema: {
12661
- type: "string"
13859
+ type: "string",
13860
+ minLength: 1
12662
13861
  }
12663
- }
12664
- ],
12665
- requestBody: {
12666
- required: false,
12667
- content: {
12668
- "application/json": {
12669
- schema: {
12670
- type: "object",
12671
- properties: {
12672
- response: {
12673
- type: "string",
12674
- enum: ["accepted", "declined", "tentative"]
12675
- }
12676
- },
12677
- required: ["response"]
12678
- }
13862
+ },
13863
+ {
13864
+ name: "status",
13865
+ in: "query",
13866
+ required: false,
13867
+ description: "Only deliveries in this state",
13868
+ schema: {
13869
+ type: "string",
13870
+ enum: ["received", "dispatched", "skipped", "failed"]
13871
+ }
13872
+ },
13873
+ {
13874
+ name: "limit",
13875
+ in: "query",
13876
+ required: false,
13877
+ description: "Default 25, newest first",
13878
+ schema: {
13879
+ type: "integer",
13880
+ minimum: 1,
13881
+ maximum: 100
12679
13882
  }
12680
13883
  }
12681
- },
13884
+ ],
12682
13885
  responses: {
12683
13886
  "200": {
12684
13887
  description: "The tool's result.",
@@ -13597,7 +14800,7 @@ function callbackPage(ok) {
13597
14800
  // package.json
13598
14801
  var package_default = {
13599
14802
  name: "@onbox/cli",
13600
- version: "0.3.1",
14803
+ version: "0.4.0",
13601
14804
  description: "The onbox command line: the Onbox public API (/v1) from a terminal.",
13602
14805
  keywords: [
13603
14806
  "onbox",