@arbium/enterprise-agent-connect-client 0.1.1 → 0.1.2-dev.d2aa5ca

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type AppLive } from "./steps.js";
2
- import type { Agent, CheckOutcome, Connection, Connector, Limits, SiteAccess, TeamsTriggerInput } from "./types.js";
2
+ import type { Agent, CheckOutcome, Connection, Connector, EventSubscriptionInput, EventTriggerInput, Limits, SiteAccess, TeamsTriggerInput } from "./types.js";
3
3
  export * from "./steps.js";
4
4
  export type * from "./types.js";
5
5
  /** A refusal the admin should read (4xx with an `error`): bad input, a failed connection
@@ -280,6 +280,7 @@ export declare function createClient(options: ClientOptions): {
280
280
  type: "header";
281
281
  header: string;
282
282
  value: string;
283
+ prefix?: string;
283
284
  } | {
284
285
  type: "bearer";
285
286
  token: string;
@@ -292,6 +293,14 @@ export declare function createClient(options: ClientOptions): {
292
293
  tokenUrl: string;
293
294
  clientId: string;
294
295
  clientSecret: string;
296
+ scope?: string;
297
+ } | {
298
+ type: "query";
299
+ param: string;
300
+ value: string;
301
+ };
302
+ headers: {
303
+ [key: string]: string;
295
304
  };
296
305
  tools: {
297
306
  name: string;
@@ -300,10 +309,15 @@ export declare function createClient(options: ClientOptions): {
300
309
  path: string;
301
310
  params: {
302
311
  [key: string]: {
303
- type: "string" | "number" | "integer" | "boolean";
312
+ type: "string" | "number" | "integer" | "boolean" | "array";
304
313
  description: string;
305
314
  in: "path" | "query" | "body";
315
+ name?: string;
306
316
  required: boolean;
317
+ default?: (string | number | boolean) | (string | number | boolean)[];
318
+ enum?: (string | number | boolean)[];
319
+ items?: "string" | "number" | "integer" | "boolean";
320
+ join?: string;
307
321
  limit?: string;
308
322
  };
309
323
  };
@@ -312,9 +326,300 @@ export declare function createClient(options: ClientOptions): {
312
326
  field: string;
313
327
  limit: string;
314
328
  }[];
329
+ result?: {
330
+ items?: string;
331
+ fields?: string[];
332
+ };
333
+ paging?: {
334
+ param: string;
335
+ body: string;
336
+ } | {
337
+ param: string;
338
+ header: string;
339
+ } | {
340
+ param: string;
341
+ link: true;
342
+ };
315
343
  }[];
316
344
  allowInsecureHttp: boolean;
317
345
  };
346
+ soap?: {
347
+ endpoint: string;
348
+ version: "1.1" | "1.2";
349
+ namespaces: {
350
+ [key: string]: string;
351
+ };
352
+ auth?: {
353
+ type: "header";
354
+ header: string;
355
+ value: string;
356
+ prefix?: string;
357
+ } | {
358
+ type: "bearer";
359
+ token: string;
360
+ } | {
361
+ type: "basic";
362
+ username: string;
363
+ password: string;
364
+ };
365
+ wsSecurity?: {
366
+ username: string;
367
+ password: string;
368
+ digest: boolean;
369
+ };
370
+ verify?: {
371
+ tool: string;
372
+ args: {
373
+ [key: string]: string | number | boolean;
374
+ };
375
+ show: string;
376
+ };
377
+ tools: {
378
+ name: string;
379
+ description: string;
380
+ operation: string;
381
+ soapAction?: string;
382
+ body: string;
383
+ params: {
384
+ [key: string]: {
385
+ type: "string" | "number" | "integer" | "boolean";
386
+ description: string;
387
+ required: boolean;
388
+ limit?: string;
389
+ };
390
+ };
391
+ result?: string;
392
+ fields?: string[];
393
+ readOnly: boolean;
394
+ destructive: boolean;
395
+ answerLimits: {
396
+ field: string;
397
+ limit: string;
398
+ }[];
399
+ }[];
400
+ allowInsecureHttp: boolean;
401
+ };
402
+ odata?: {
403
+ serviceRoot: string;
404
+ version: "2" | "4";
405
+ auth: {
406
+ type: "header";
407
+ header: string;
408
+ value: string;
409
+ prefix?: string;
410
+ } | {
411
+ type: "bearer";
412
+ token: string;
413
+ } | {
414
+ type: "basic";
415
+ username: string;
416
+ password: string;
417
+ } | {
418
+ type: "oauth2";
419
+ tokenUrl: string;
420
+ clientId: string;
421
+ clientSecret: string;
422
+ scope?: string;
423
+ } | {
424
+ type: "query";
425
+ param: string;
426
+ value: string;
427
+ };
428
+ headers: {
429
+ [key: string]: string;
430
+ };
431
+ csrf: boolean;
432
+ paging: "skip" | "server";
433
+ tools: {
434
+ name: string;
435
+ description: string;
436
+ kind: "list" | "get" | "create" | "update" | "function" | "action";
437
+ entitySet?: string;
438
+ function?: string;
439
+ key: {
440
+ [key: string]: {
441
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
442
+ description: string;
443
+ property?: string;
444
+ required?: boolean;
445
+ limit?: string;
446
+ };
447
+ };
448
+ filters: {
449
+ [key: string]: {
450
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
451
+ description: string;
452
+ property?: string;
453
+ required?: boolean;
454
+ limit?: string;
455
+ op: "eq" | "ne" | "gt" | "ge" | "lt" | "le" | "contains" | "startswith";
456
+ };
457
+ };
458
+ fields: {
459
+ [key: string]: {
460
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
461
+ description: string;
462
+ property?: string;
463
+ required?: boolean;
464
+ limit?: string;
465
+ };
466
+ };
467
+ params: {
468
+ [key: string]: {
469
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
470
+ description: string;
471
+ property?: string;
472
+ required?: boolean;
473
+ limit?: string;
474
+ };
475
+ };
476
+ select: string[];
477
+ orderBy?: string;
478
+ top: number;
479
+ destructive: boolean;
480
+ answerLimits: {
481
+ field: string;
482
+ limit: string;
483
+ }[];
484
+ }[];
485
+ allowInsecureHttp: boolean;
486
+ };
487
+ sql?: {
488
+ engine: "postgres" | "sqlserver" | "mysql" | "oracle";
489
+ host: string;
490
+ port?: number;
491
+ database: string;
492
+ auth: {
493
+ user: string;
494
+ password: string;
495
+ };
496
+ tls: "verify" | "insecure" | "off";
497
+ timeoutSeconds: number;
498
+ maxRows: number;
499
+ tools: {
500
+ name: string;
501
+ description: string;
502
+ sql: string;
503
+ params: {
504
+ [key: string]: {
505
+ type: "string" | "number" | "integer" | "boolean";
506
+ description: string;
507
+ required: boolean;
508
+ limit?: string;
509
+ };
510
+ };
511
+ write: boolean;
512
+ destructive: boolean;
513
+ answerLimits: {
514
+ column: string;
515
+ limit: string;
516
+ }[];
517
+ }[];
518
+ };
519
+ events?: {
520
+ types: {
521
+ id: string;
522
+ label: string;
523
+ }[];
524
+ fields: {
525
+ [key: string]: string;
526
+ };
527
+ limits: {
528
+ [key: string]: string;
529
+ };
530
+ webhook?: {
531
+ verify: {
532
+ type: "hmac-sha256";
533
+ header: string;
534
+ prefix: string;
535
+ } | {
536
+ type: "token";
537
+ header: string;
538
+ } | {
539
+ type: "none";
540
+ };
541
+ allowInsecure: boolean;
542
+ type: {
543
+ field: string;
544
+ } | {
545
+ header: string;
546
+ };
547
+ deliveryId?: {
548
+ field: string;
549
+ } | {
550
+ header: string;
551
+ };
552
+ timestamp?: {
553
+ at: {
554
+ field: string;
555
+ } | {
556
+ header: string;
557
+ };
558
+ unit: "s" | "ms" | "iso";
559
+ toleranceSeconds: number;
560
+ };
561
+ setup: {
562
+ title: string;
563
+ body: string;
564
+ link?: {
565
+ label: string;
566
+ href: string;
567
+ };
568
+ copy?: string[];
569
+ shell?: "bash" | "powershell";
570
+ permissions?: boolean;
571
+ certificate?: boolean;
572
+ click?: string[];
573
+ clickUnavailable?: true;
574
+ siteRole?: "read" | "write";
575
+ agentCheck?: boolean;
576
+ confirm?: string;
577
+ live?: string;
578
+ settings?: {
579
+ id: string;
580
+ label: string;
581
+ help?: string;
582
+ placeholder?: string;
583
+ pattern: string;
584
+ }[];
585
+ option?: {
586
+ field: string;
587
+ value: string;
588
+ };
589
+ }[];
590
+ register?: {
591
+ method: "GET" | "POST" | "PUT";
592
+ path: string;
593
+ body?: unknown;
594
+ location: string;
595
+ };
596
+ };
597
+ self?: {
598
+ request: {
599
+ method: "GET" | "POST" | "PUT";
600
+ path: string;
601
+ body?: unknown;
602
+ };
603
+ id: string;
604
+ fields: string[];
605
+ };
606
+ poll?: {
607
+ request: {
608
+ method: "GET" | "POST" | "PUT";
609
+ path: string;
610
+ body?: unknown;
611
+ };
612
+ filter?: string;
613
+ items: string;
614
+ wrap?: string;
615
+ cursor: string;
616
+ deliveryId: string[];
617
+ types: {
618
+ type: string;
619
+ same?: [string, string];
620
+ }[];
621
+ };
622
+ };
318
623
  }[]>;
319
624
  providers: () => Promise<{
320
625
  id: string;
@@ -811,6 +1116,136 @@ export declare function createClient(options: ClientOptions): {
811
1116
  finishedAt: string | null;
812
1117
  replyTokenAt: string;
813
1118
  }[]>;
1119
+ eventSubscriptions: (o: string) => Promise<{
1120
+ id: string;
1121
+ connectorId: string;
1122
+ source: "webhook" | "poll";
1123
+ filter: string;
1124
+ intervalSeconds: number;
1125
+ cursor: string | null;
1126
+ polledAt: string | null;
1127
+ lastError: string | null;
1128
+ registered: string | null;
1129
+ url: string | null;
1130
+ createdBy: string;
1131
+ createdAt: string;
1132
+ }[]>;
1133
+ subscribeEvents: (o: string, body: EventSubscriptionInput) => Promise<{
1134
+ subscription: import("./schema.js").components["schemas"]["EventSubscription"];
1135
+ secret: string | null;
1136
+ setup: {
1137
+ title: string;
1138
+ body: string;
1139
+ link?: {
1140
+ label: string;
1141
+ href: string;
1142
+ };
1143
+ copy?: string[];
1144
+ shell?: "bash" | "powershell";
1145
+ permissions?: boolean;
1146
+ certificate?: boolean;
1147
+ click?: string[];
1148
+ clickUnavailable?: true;
1149
+ siteRole?: "read" | "write";
1150
+ agentCheck?: boolean;
1151
+ confirm?: string;
1152
+ live?: string;
1153
+ settings?: {
1154
+ id: string;
1155
+ label: string;
1156
+ help?: string;
1157
+ placeholder?: string;
1158
+ pattern: string;
1159
+ }[];
1160
+ option?: {
1161
+ field: string;
1162
+ value: string;
1163
+ };
1164
+ }[];
1165
+ registration: {
1166
+ ok: boolean;
1167
+ message: string;
1168
+ } | null;
1169
+ }>;
1170
+ rotateEventSecret: (o: string, id: string, by: string) => Promise<{
1171
+ subscription: import("./schema.js").components["schemas"]["EventSubscription"];
1172
+ secret: string;
1173
+ }>;
1174
+ unsubscribeEvents: (o: string, id: string, by: string) => Promise<void>;
1175
+ eventTriggers: (o: string, id: string) => Promise<{
1176
+ id: string;
1177
+ agentId: string;
1178
+ connectorId: string;
1179
+ enabled: boolean;
1180
+ eventTypes: string[];
1181
+ conditions: ({
1182
+ field: string;
1183
+ in: string[];
1184
+ } | {
1185
+ field: string;
1186
+ notIn: string[];
1187
+ })[];
1188
+ prompt: string;
1189
+ runner: string;
1190
+ settings: {
1191
+ [key: string]: unknown;
1192
+ };
1193
+ hasSigningSecret: boolean;
1194
+ managedAgentId: string | null;
1195
+ environmentId: string | null;
1196
+ vaultIds: string[];
1197
+ budgetCents: number;
1198
+ maxRunsPerHour: number;
1199
+ maxCentsPerDay: number;
1200
+ maxConcurrent: number;
1201
+ updatedBy: string | null;
1202
+ updatedAt: string;
1203
+ }[]>;
1204
+ setEventTrigger: (o: string, id: string, a: string, body: EventTriggerInput) => Promise<{
1205
+ id: string;
1206
+ agentId: string;
1207
+ connectorId: string;
1208
+ enabled: boolean;
1209
+ eventTypes: string[];
1210
+ conditions: ({
1211
+ field: string;
1212
+ in: string[];
1213
+ } | {
1214
+ field: string;
1215
+ notIn: string[];
1216
+ })[];
1217
+ prompt: string;
1218
+ runner: string;
1219
+ settings: {
1220
+ [key: string]: unknown;
1221
+ };
1222
+ hasSigningSecret: boolean;
1223
+ managedAgentId: string | null;
1224
+ environmentId: string | null;
1225
+ vaultIds: string[];
1226
+ budgetCents: number;
1227
+ maxRunsPerHour: number;
1228
+ maxCentsPerDay: number;
1229
+ maxConcurrent: number;
1230
+ updatedBy: string | null;
1231
+ updatedAt: string;
1232
+ }>;
1233
+ removeEventTrigger: (o: string, id: string, a: string, by: string) => Promise<void>;
1234
+ eventRuns: (o: string, id: string, limit?: number) => Promise<{
1235
+ id: string;
1236
+ agentId: string;
1237
+ triggerId: string;
1238
+ connectorId: string;
1239
+ eventType: string;
1240
+ deliveryId: string;
1241
+ runner: string;
1242
+ sessionId: string | null;
1243
+ state: "starting" | "running" | "ended" | "failed";
1244
+ error: string | null;
1245
+ costCents: number | null;
1246
+ startedAt: string;
1247
+ finishedAt: string | null;
1248
+ }[]>;
814
1249
  claudeKey: (o: string) => Promise<{
815
1250
  set: false;
816
1251
  } | {
package/lib/index.js CHANGED
@@ -140,6 +140,18 @@ export function createClient(options) {
140
140
  teamsTrigger: (o, id) => maybe(`${agent(o, id)}/teams-trigger`),
141
141
  setTeamsTrigger: (o, id, body) => call("PUT", `${agent(o, id)}/teams-trigger`, body),
142
142
  teamsRuns: (o, id, limit = 20) => call("GET", `${agent(o, id)}/teams-runs?limit=${limit}`),
143
+ // App events that start agents (docs/triggers.md). A webhook's secret is in the answer to
144
+ // subscribeEvents and rotateEventSecret only.
145
+ eventSubscriptions: (o) => call("GET", `${org(o)}/event-subscriptions`),
146
+ subscribeEvents: (o, body) => call("POST", `${org(o)}/event-subscriptions`, body),
147
+ rotateEventSecret: (o, id, by) => call("POST", `${org(o)}/event-subscriptions/${seg(id)}/secret`, {
148
+ by,
149
+ }),
150
+ unsubscribeEvents: (o, id, by) => call("DELETE", `${org(o)}/event-subscriptions/${seg(id)}`, { by }),
151
+ eventTriggers: (o, id) => call("GET", `${agent(o, id)}/event-triggers`),
152
+ setEventTrigger: (o, id, a, body) => call("PUT", `${agent(o, id)}/event-triggers/${seg(a)}`, body),
153
+ removeEventTrigger: (o, id, a, by) => call("DELETE", `${agent(o, id)}/event-triggers/${seg(a)}`, { by }),
154
+ eventRuns: (o, id, limit = 20) => call("GET", `${agent(o, id)}/event-runs?limit=${limit}`),
143
155
  // The organization's Claude API key: write-only, shown by its last four characters.
144
156
  claudeKey: (o) => call("GET", `${org(o)}/claude-key`),
145
157
  setClaudeKey: (o, apiKey, by) => call("PUT", `${org(o)}/claude-key`, { apiKey, by }),