@breign/client 1.0.178 → 1.0.179

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.
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfWebhookTestResponseUio = instanceOfWebhookTestResponseUio;
17
+ exports.WebhookTestResponseUioFromJSON = WebhookTestResponseUioFromJSON;
18
+ exports.WebhookTestResponseUioFromJSONTyped = WebhookTestResponseUioFromJSONTyped;
19
+ exports.WebhookTestResponseUioToJSON = WebhookTestResponseUioToJSON;
20
+ exports.WebhookTestResponseUioToJSONTyped = WebhookTestResponseUioToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the WebhookTestResponseUio interface.
23
+ */
24
+ function instanceOfWebhookTestResponseUio(value) {
25
+ if (!('eventId' in value) || value['eventId'] === undefined)
26
+ return false;
27
+ return true;
28
+ }
29
+ function WebhookTestResponseUioFromJSON(json) {
30
+ return WebhookTestResponseUioFromJSONTyped(json, false);
31
+ }
32
+ function WebhookTestResponseUioFromJSONTyped(json, ignoreDiscriminator) {
33
+ if (json == null) {
34
+ return json;
35
+ }
36
+ return {
37
+ 'eventId': json['eventId'],
38
+ };
39
+ }
40
+ function WebhookTestResponseUioToJSON(json) {
41
+ return WebhookTestResponseUioToJSONTyped(json, false);
42
+ }
43
+ function WebhookTestResponseUioToJSONTyped(value, ignoreDiscriminator = false) {
44
+ if (value == null) {
45
+ return value;
46
+ }
47
+ return {
48
+ 'eventId': value['eventId'],
49
+ };
50
+ }
@@ -648,6 +648,12 @@ export * from './UserIdentifierRequestUio';
648
648
  export * from './UserIdentifierUio';
649
649
  export * from './UserLockRequestUio';
650
650
  export * from './UserUpdateRequestUio';
651
+ export * from './WebhookEndpointUio';
652
+ export * from './WebhookEndpointUpdateUio';
653
+ export * from './WebhookEventListUio';
654
+ export * from './WebhookEventUio';
655
+ export * from './WebhookTestRequestUio';
656
+ export * from './WebhookTestResponseUio';
651
657
  export * from './WorkspaceFileContentUio';
652
658
  export * from './WorkspaceFileEntryUio';
653
659
  export * from './WorkspaceFileWriteRequestUio';
@@ -666,6 +666,12 @@ __exportStar(require("./UserIdentifierRequestUio"), exports);
666
666
  __exportStar(require("./UserIdentifierUio"), exports);
667
667
  __exportStar(require("./UserLockRequestUio"), exports);
668
668
  __exportStar(require("./UserUpdateRequestUio"), exports);
669
+ __exportStar(require("./WebhookEndpointUio"), exports);
670
+ __exportStar(require("./WebhookEndpointUpdateUio"), exports);
671
+ __exportStar(require("./WebhookEventListUio"), exports);
672
+ __exportStar(require("./WebhookEventUio"), exports);
673
+ __exportStar(require("./WebhookTestRequestUio"), exports);
674
+ __exportStar(require("./WebhookTestResponseUio"), exports);
669
675
  __exportStar(require("./WorkspaceFileContentUio"), exports);
670
676
  __exportStar(require("./WorkspaceFileEntryUio"), exports);
671
677
  __exportStar(require("./WorkspaceFileWriteRequestUio"), exports);
package/dist/openapi.json CHANGED
@@ -3067,6 +3067,326 @@
3067
3067
  "tags" : [ "scheduledTasks" ]
3068
3068
  }
3069
3069
  },
3070
+ "/agents/{agentId}/scheduled-tasks/{taskId}/webhook" : {
3071
+ "get" : {
3072
+ "operationId" : "getScheduledTaskWebhook",
3073
+ "parameters" : [ {
3074
+ "description" : "ID of the agent",
3075
+ "in" : "path",
3076
+ "name" : "agentId",
3077
+ "required" : true,
3078
+ "schema" : {
3079
+ "format" : "uuid",
3080
+ "type" : "string"
3081
+ }
3082
+ }, {
3083
+ "description" : "ID of the scheduled task",
3084
+ "in" : "path",
3085
+ "name" : "taskId",
3086
+ "required" : true,
3087
+ "schema" : {
3088
+ "type" : "string"
3089
+ }
3090
+ } ],
3091
+ "responses" : {
3092
+ "200" : {
3093
+ "content" : {
3094
+ "application/json" : {
3095
+ "schema" : {
3096
+ "$ref" : "#/components/schemas/WebhookEndpoint"
3097
+ }
3098
+ }
3099
+ },
3100
+ "description" : "The webhook, without its secret"
3101
+ },
3102
+ "401" : {
3103
+ "description" : "Unauthorized"
3104
+ },
3105
+ "403" : {
3106
+ "description" : "Forbidden"
3107
+ },
3108
+ "404" : {
3109
+ "description" : "Task not found, or not triggered by a webhook"
3110
+ }
3111
+ },
3112
+ "summary" : "The webhook of an automation triggered by a webhook",
3113
+ "tags" : [ "scheduledTasks" ]
3114
+ },
3115
+ "patch" : {
3116
+ "operationId" : "updateScheduledTaskWebhook",
3117
+ "parameters" : [ {
3118
+ "description" : "ID of the agent",
3119
+ "in" : "path",
3120
+ "name" : "agentId",
3121
+ "required" : true,
3122
+ "schema" : {
3123
+ "format" : "uuid",
3124
+ "type" : "string"
3125
+ }
3126
+ }, {
3127
+ "description" : "ID of the scheduled task",
3128
+ "in" : "path",
3129
+ "name" : "taskId",
3130
+ "required" : true,
3131
+ "schema" : {
3132
+ "type" : "string"
3133
+ }
3134
+ } ],
3135
+ "requestBody" : {
3136
+ "content" : {
3137
+ "application/json" : {
3138
+ "schema" : {
3139
+ "$ref" : "#/components/schemas/WebhookEndpointUpdate"
3140
+ }
3141
+ }
3142
+ },
3143
+ "required" : true
3144
+ },
3145
+ "responses" : {
3146
+ "200" : {
3147
+ "content" : {
3148
+ "application/json" : {
3149
+ "schema" : {
3150
+ "$ref" : "#/components/schemas/WebhookEndpoint"
3151
+ }
3152
+ }
3153
+ },
3154
+ "description" : "The updated webhook"
3155
+ },
3156
+ "400" : {
3157
+ "description" : "Invalid body"
3158
+ },
3159
+ "401" : {
3160
+ "description" : "Unauthorized"
3161
+ },
3162
+ "403" : {
3163
+ "description" : "Forbidden (another service user requires an organization admin)"
3164
+ },
3165
+ "404" : {
3166
+ "description" : "Task not found, or not triggered by a webhook"
3167
+ },
3168
+ "422" : {
3169
+ "description" : "The service user is not a member of the organization"
3170
+ }
3171
+ },
3172
+ "summary" : "Disable the webhook or change its service user",
3173
+ "tags" : [ "scheduledTasks" ]
3174
+ }
3175
+ },
3176
+ "/agents/{agentId}/scheduled-tasks/{taskId}/webhook/rotate-secret" : {
3177
+ "post" : {
3178
+ "operationId" : "rotateScheduledTaskWebhookSecret",
3179
+ "parameters" : [ {
3180
+ "description" : "ID of the agent",
3181
+ "in" : "path",
3182
+ "name" : "agentId",
3183
+ "required" : true,
3184
+ "schema" : {
3185
+ "format" : "uuid",
3186
+ "type" : "string"
3187
+ }
3188
+ }, {
3189
+ "description" : "ID of the scheduled task",
3190
+ "in" : "path",
3191
+ "name" : "taskId",
3192
+ "required" : true,
3193
+ "schema" : {
3194
+ "type" : "string"
3195
+ }
3196
+ } ],
3197
+ "responses" : {
3198
+ "200" : {
3199
+ "content" : {
3200
+ "application/json" : {
3201
+ "schema" : {
3202
+ "$ref" : "#/components/schemas/WebhookEndpoint"
3203
+ }
3204
+ }
3205
+ },
3206
+ "description" : "The webhook, with its new secret (shown once)"
3207
+ },
3208
+ "401" : {
3209
+ "description" : "Unauthorized"
3210
+ },
3211
+ "403" : {
3212
+ "description" : "Forbidden"
3213
+ },
3214
+ "404" : {
3215
+ "description" : "Task not found, or not triggered by a webhook"
3216
+ }
3217
+ },
3218
+ "summary" : "Rotate the webhook secret (the old one stops working)",
3219
+ "tags" : [ "scheduledTasks" ]
3220
+ }
3221
+ },
3222
+ "/agents/{agentId}/scheduled-tasks/{taskId}/webhook/regenerate-url" : {
3223
+ "post" : {
3224
+ "operationId" : "regenerateScheduledTaskWebhookUrl",
3225
+ "parameters" : [ {
3226
+ "description" : "ID of the agent",
3227
+ "in" : "path",
3228
+ "name" : "agentId",
3229
+ "required" : true,
3230
+ "schema" : {
3231
+ "format" : "uuid",
3232
+ "type" : "string"
3233
+ }
3234
+ }, {
3235
+ "description" : "ID of the scheduled task",
3236
+ "in" : "path",
3237
+ "name" : "taskId",
3238
+ "required" : true,
3239
+ "schema" : {
3240
+ "type" : "string"
3241
+ }
3242
+ } ],
3243
+ "responses" : {
3244
+ "200" : {
3245
+ "content" : {
3246
+ "application/json" : {
3247
+ "schema" : {
3248
+ "$ref" : "#/components/schemas/WebhookEndpoint"
3249
+ }
3250
+ }
3251
+ },
3252
+ "description" : "The webhook at its new URL"
3253
+ },
3254
+ "401" : {
3255
+ "description" : "Unauthorized"
3256
+ },
3257
+ "403" : {
3258
+ "description" : "Forbidden"
3259
+ },
3260
+ "404" : {
3261
+ "description" : "Task not found, or not triggered by a webhook"
3262
+ }
3263
+ },
3264
+ "summary" : "Give the webhook a new URL (the old one answers 404)",
3265
+ "tags" : [ "scheduledTasks" ]
3266
+ }
3267
+ },
3268
+ "/agents/{agentId}/scheduled-tasks/{taskId}/webhook/events" : {
3269
+ "get" : {
3270
+ "operationId" : "listScheduledTaskWebhookEvents",
3271
+ "parameters" : [ {
3272
+ "description" : "ID of the agent",
3273
+ "in" : "path",
3274
+ "name" : "agentId",
3275
+ "required" : true,
3276
+ "schema" : {
3277
+ "format" : "uuid",
3278
+ "type" : "string"
3279
+ }
3280
+ }, {
3281
+ "description" : "ID of the scheduled task",
3282
+ "in" : "path",
3283
+ "name" : "taskId",
3284
+ "required" : true,
3285
+ "schema" : {
3286
+ "type" : "string"
3287
+ }
3288
+ }, {
3289
+ "in" : "query",
3290
+ "name" : "limit",
3291
+ "required" : false,
3292
+ "schema" : {
3293
+ "default" : 20,
3294
+ "maximum" : 100,
3295
+ "minimum" : 1,
3296
+ "type" : "integer"
3297
+ }
3298
+ } ],
3299
+ "responses" : {
3300
+ "200" : {
3301
+ "content" : {
3302
+ "application/json" : {
3303
+ "schema" : {
3304
+ "$ref" : "#/components/schemas/WebhookEventList"
3305
+ }
3306
+ }
3307
+ },
3308
+ "description" : "The latest calls, most recent first"
3309
+ },
3310
+ "401" : {
3311
+ "description" : "Unauthorized"
3312
+ },
3313
+ "403" : {
3314
+ "description" : "Forbidden"
3315
+ },
3316
+ "404" : {
3317
+ "description" : "Task not found, or not triggered by a webhook"
3318
+ }
3319
+ },
3320
+ "summary" : "The latest calls received on the webhook",
3321
+ "tags" : [ "scheduledTasks" ]
3322
+ }
3323
+ },
3324
+ "/agents/{agentId}/scheduled-tasks/{taskId}/webhook/test" : {
3325
+ "post" : {
3326
+ "description" : "The call goes through the same ingestion as a real one, and the agent runs for real.",
3327
+ "operationId" : "testScheduledTaskWebhook",
3328
+ "parameters" : [ {
3329
+ "description" : "ID of the agent",
3330
+ "in" : "path",
3331
+ "name" : "agentId",
3332
+ "required" : true,
3333
+ "schema" : {
3334
+ "format" : "uuid",
3335
+ "type" : "string"
3336
+ }
3337
+ }, {
3338
+ "description" : "ID of the scheduled task",
3339
+ "in" : "path",
3340
+ "name" : "taskId",
3341
+ "required" : true,
3342
+ "schema" : {
3343
+ "type" : "string"
3344
+ }
3345
+ } ],
3346
+ "requestBody" : {
3347
+ "content" : {
3348
+ "application/json" : {
3349
+ "schema" : {
3350
+ "$ref" : "#/components/schemas/WebhookTestRequest"
3351
+ }
3352
+ }
3353
+ },
3354
+ "required" : false
3355
+ },
3356
+ "responses" : {
3357
+ "202" : {
3358
+ "content" : {
3359
+ "application/json" : {
3360
+ "schema" : {
3361
+ "$ref" : "#/components/schemas/WebhookTestResponse"
3362
+ }
3363
+ }
3364
+ },
3365
+ "description" : "The test call is queued"
3366
+ },
3367
+ "400" : {
3368
+ "description" : "Invalid body"
3369
+ },
3370
+ "401" : {
3371
+ "description" : "Unauthorized"
3372
+ },
3373
+ "403" : {
3374
+ "description" : "Forbidden"
3375
+ },
3376
+ "404" : {
3377
+ "description" : "Task not found, or not triggered by a webhook"
3378
+ },
3379
+ "422" : {
3380
+ "description" : "The webhook or the automation is not active"
3381
+ },
3382
+ "429" : {
3383
+ "description" : "Too many calls this minute"
3384
+ }
3385
+ },
3386
+ "summary" : "Send a test call to the webhook, signed by the server",
3387
+ "tags" : [ "scheduledTasks" ]
3388
+ }
3389
+ },
3070
3390
  "/agents/{agentId}/apps" : {
3071
3391
  "get" : {
3072
3392
  "description" : "Get apps for agent id",
@@ -23440,12 +23760,15 @@
23440
23760
  "allOf" : [ {
23441
23761
  "$ref" : "#/components/schemas/TaskSchedule"
23442
23762
  } ],
23443
- "description" : "null for an automation triggered by an event.",
23763
+ "description" : "null for an automation triggered by an event or a webhook.",
23444
23764
  "nullable" : true
23445
23765
  },
23446
23766
  "trigger" : {
23447
23767
  "$ref" : "#/components/schemas/TaskTrigger"
23448
23768
  },
23769
+ "webhook" : {
23770
+ "$ref" : "#/components/schemas/WebhookEndpoint"
23771
+ },
23449
23772
  "cronExpression" : {
23450
23773
  "type" : "string"
23451
23774
  },
@@ -23547,10 +23870,14 @@
23547
23870
  "type" : "object"
23548
23871
  },
23549
23872
  "TaskTrigger" : {
23550
- "description" : "What starts the automation. `schedule` (default): its schedule. `event`: a mention of one of the bot accounts in GitLab, in the given kinds of objects and projects (empty: all projects; `groupe/projet` or `groupe/*`).",
23873
+ "description" : "What starts the automation. `schedule` (default): its schedule. `event`: a mention of one of the bot accounts in GitLab, in the given kinds of objects and projects (empty: all projects; `groupe/projet` or `groupe/*`). `webhook`: a call to its webhook (see `ScheduledTask.webhook`); the result goes to `callbackUrl`.",
23551
23874
  "properties" : {
23552
23875
  "type" : {
23553
- "enum" : [ "schedule", "event" ],
23876
+ "enum" : [ "schedule", "event", "webhook" ],
23877
+ "type" : "string"
23878
+ },
23879
+ "runAsUserId" : {
23880
+ "description" : "`webhook` only, on create or update: the member the conversations run as (default: the caller; another member requires an organization admin). Not stored on the task.",
23554
23881
  "type" : "string"
23555
23882
  },
23556
23883
  "source" : {
@@ -23584,7 +23911,7 @@
23584
23911
  "type" : "object"
23585
23912
  },
23586
23913
  "ScheduledTaskCreate" : {
23587
- "description" : "`schedule` is required unless `trigger.type` is `event` (then `mode` must be `recurring`).",
23914
+ "description" : "`schedule` is required unless `trigger.type` is `event` or `webhook` (then `mode` must be `recurring`). A `webhook` trigger creates the webhook, returned in `webhook` with its secret (shown once).",
23588
23915
  "properties" : {
23589
23916
  "message" : {
23590
23917
  "minLength" : 1,
@@ -23755,15 +24082,31 @@
23755
24082
  "type" : "object"
23756
24083
  },
23757
24084
  "ScheduledTaskRunTrigger" : {
23758
- "description" : "The GitLab mention that triggered a run.",
24085
+ "description" : "The external event that triggered a run: a GitLab mention (`source: gitlab`, GitLab fields set) or a webhook call (`source: webhook`: `thread`, `contentType`, `payload`).",
23759
24086
  "properties" : {
23760
24087
  "eventId" : {
23761
24088
  "type" : "string"
23762
24089
  },
23763
24090
  "source" : {
23764
- "enum" : [ "gitlab" ],
24091
+ "enum" : [ "gitlab", "webhook" ],
23765
24092
  "type" : "string"
23766
24093
  },
24094
+ "thread" : {
24095
+ "description" : "webhook only — the `X-Breign-Thread` of the call.",
24096
+ "nullable" : true,
24097
+ "type" : "string"
24098
+ },
24099
+ "contentType" : {
24100
+ "description" : "webhook only.",
24101
+ "type" : "string"
24102
+ },
24103
+ "payload" : {
24104
+ "description" : "webhook only — the body received (untrusted caller data), or its start as text."
24105
+ },
24106
+ "payloadTruncated" : {
24107
+ "description" : "webhook only.",
24108
+ "type" : "boolean"
24109
+ },
23767
24110
  "status" : {
23768
24111
  "$ref" : "#/components/schemas/ExternalEventStatus"
23769
24112
  },
@@ -23820,7 +24163,138 @@
23820
24163
  "type" : "string"
23821
24164
  }
23822
24165
  },
23823
- "required" : [ "author", "body", "botUsername", "conversationId", "eventId", "noteUrl", "projectPath", "receivedAt", "replyUrl", "routing", "source", "status", "targetIid", "targetTitle", "targetType", "targetUrl" ],
24166
+ "required" : [ "conversationId", "eventId", "receivedAt", "source", "status" ],
24167
+ "type" : "object"
24168
+ },
24169
+ "WebhookEndpoint" : {
24170
+ "description" : "The public address of an automation triggered by a webhook. Callers POST to `url` with `Authorization: Bearer <secret>`, or sign the raw body with HMAC-SHA256 (`X-Breign-Signature: sha256=<hex>`; with `X-Breign-Timestamp: <unix seconds>` the signature covers `<timestamp>.<body>`). Optional headers: `Idempotency-Key`, `X-Breign-Thread`.",
24171
+ "properties" : {
24172
+ "id" : {
24173
+ "type" : "string"
24174
+ },
24175
+ "url" : {
24176
+ "type" : "string"
24177
+ },
24178
+ "status" : {
24179
+ "enum" : [ "active", "disabled" ],
24180
+ "type" : "string"
24181
+ },
24182
+ "runAsUserId" : {
24183
+ "description" : "The organization member the conversations run as (user-scoped MCP tools, quotas, history).",
24184
+ "type" : "string"
24185
+ },
24186
+ "lastEventAt" : {
24187
+ "format" : "date-time",
24188
+ "nullable" : true,
24189
+ "type" : "string"
24190
+ },
24191
+ "createdAt" : {
24192
+ "format" : "date-time",
24193
+ "type" : "string"
24194
+ },
24195
+ "updatedAt" : {
24196
+ "format" : "date-time",
24197
+ "type" : "string"
24198
+ },
24199
+ "secret" : {
24200
+ "description" : "Only returned when the endpoint is created and after a rotation.",
24201
+ "type" : "string"
24202
+ }
24203
+ },
24204
+ "required" : [ "createdAt", "id", "lastEventAt", "runAsUserId", "status", "updatedAt", "url" ],
24205
+ "type" : "object"
24206
+ },
24207
+ "WebhookEndpointUpdate" : {
24208
+ "minProperties" : 1,
24209
+ "properties" : {
24210
+ "runAsUserId" : {
24211
+ "description" : "Another member than the caller requires an organization admin.",
24212
+ "type" : "string"
24213
+ },
24214
+ "status" : {
24215
+ "enum" : [ "active", "disabled" ],
24216
+ "type" : "string"
24217
+ }
24218
+ },
24219
+ "type" : "object"
24220
+ },
24221
+ "WebhookEventList" : {
24222
+ "properties" : {
24223
+ "events" : {
24224
+ "items" : {
24225
+ "$ref" : "#/components/schemas/WebhookEvent"
24226
+ },
24227
+ "type" : "array"
24228
+ }
24229
+ },
24230
+ "required" : [ "events" ],
24231
+ "type" : "object"
24232
+ },
24233
+ "WebhookEvent" : {
24234
+ "description" : "A call received on the webhook, and where it is in the queue.",
24235
+ "properties" : {
24236
+ "id" : {
24237
+ "type" : "string"
24238
+ },
24239
+ "status" : {
24240
+ "$ref" : "#/components/schemas/ExternalEventStatus"
24241
+ },
24242
+ "receivedAt" : {
24243
+ "format" : "date-time",
24244
+ "type" : "string"
24245
+ },
24246
+ "finishedAt" : {
24247
+ "format" : "date-time",
24248
+ "nullable" : true,
24249
+ "type" : "string"
24250
+ },
24251
+ "attempts" : {
24252
+ "type" : "integer"
24253
+ },
24254
+ "lastError" : {
24255
+ "nullable" : true,
24256
+ "type" : "string"
24257
+ },
24258
+ "thread" : {
24259
+ "nullable" : true,
24260
+ "type" : "string"
24261
+ },
24262
+ "contentType" : {
24263
+ "type" : "string"
24264
+ },
24265
+ "runId" : {
24266
+ "nullable" : true,
24267
+ "type" : "string"
24268
+ },
24269
+ "conversationId" : {
24270
+ "nullable" : true,
24271
+ "type" : "string"
24272
+ }
24273
+ },
24274
+ "required" : [ "attempts", "contentType", "conversationId", "finishedAt", "id", "lastError", "receivedAt", "runId", "status", "thread" ],
24275
+ "type" : "object"
24276
+ },
24277
+ "WebhookTestRequest" : {
24278
+ "properties" : {
24279
+ "body" : {
24280
+ "description" : "The JSON body of the test call (default `{\"test\": true}`)."
24281
+ },
24282
+ "thread" : {
24283
+ "description" : "Sent as `X-Breign-Thread`.",
24284
+ "maxLength" : 200,
24285
+ "type" : "string"
24286
+ }
24287
+ },
24288
+ "type" : "object"
24289
+ },
24290
+ "WebhookTestResponse" : {
24291
+ "properties" : {
24292
+ "eventId" : {
24293
+ "nullable" : true,
24294
+ "type" : "string"
24295
+ }
24296
+ },
24297
+ "required" : [ "eventId" ],
23824
24298
  "type" : "object"
23825
24299
  },
23826
24300
  "AppLight" : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breign/client",
3
- "version": "1.0.178",
3
+ "version": "1.0.179",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",