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

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
@@ -115,6 +115,7 @@ export declare function createClient(options: ClientOptions): {
115
115
  field: string;
116
116
  value: string;
117
117
  };
118
+ capabilities?: string[];
118
119
  }[];
119
120
  afterConnect: {
120
121
  title: string;
@@ -144,6 +145,7 @@ export declare function createClient(options: ClientOptions): {
144
145
  field: string;
145
146
  value: string;
146
147
  };
148
+ capabilities?: string[];
147
149
  }[];
148
150
  fields: {
149
151
  id: string;
@@ -161,6 +163,7 @@ export declare function createClient(options: ClientOptions): {
161
163
  field: string;
162
164
  value: string;
163
165
  };
166
+ optional: boolean;
164
167
  }[];
165
168
  capabilities: {
166
169
  id: string;
@@ -244,6 +247,7 @@ export declare function createClient(options: ClientOptions): {
244
247
  path: string;
245
248
  label: string;
246
249
  show: string;
250
+ name?: string;
247
251
  match?: {
248
252
  [key: string]: string | number | boolean;
249
253
  };
@@ -261,6 +265,7 @@ export declare function createClient(options: ClientOptions): {
261
265
  path: string;
262
266
  label: string;
263
267
  show: string;
268
+ name?: string;
264
269
  match?: {
265
270
  [key: string]: string | number | boolean;
266
271
  };
@@ -280,6 +285,7 @@ export declare function createClient(options: ClientOptions): {
280
285
  type: "header";
281
286
  header: string;
282
287
  value: string;
288
+ prefix?: string;
283
289
  } | {
284
290
  type: "bearer";
285
291
  token: string;
@@ -292,6 +298,14 @@ export declare function createClient(options: ClientOptions): {
292
298
  tokenUrl: string;
293
299
  clientId: string;
294
300
  clientSecret: string;
301
+ scope?: string;
302
+ } | {
303
+ type: "query";
304
+ param: string;
305
+ value: string;
306
+ };
307
+ headers: {
308
+ [key: string]: string;
295
309
  };
296
310
  tools: {
297
311
  name: string;
@@ -300,13 +314,173 @@ export declare function createClient(options: ClientOptions): {
300
314
  path: string;
301
315
  params: {
302
316
  [key: string]: {
303
- type: "string" | "number" | "integer" | "boolean";
317
+ type: "string" | "number" | "integer" | "boolean" | "array";
304
318
  description: string;
305
319
  in: "path" | "query" | "body";
320
+ name?: string;
306
321
  required: boolean;
322
+ default?: (string | number | boolean) | (string | number | boolean)[];
323
+ enum?: (string | number | boolean)[];
324
+ items?: "string" | "number" | "integer" | "boolean";
325
+ join?: string;
326
+ limit?: string;
327
+ };
328
+ };
329
+ destructive: boolean;
330
+ answerLimits: {
331
+ field: string;
332
+ limit: string;
333
+ }[];
334
+ result?: {
335
+ items?: string;
336
+ fields?: string[];
337
+ };
338
+ paging?: {
339
+ param: string;
340
+ body: string;
341
+ } | {
342
+ param: string;
343
+ header: string;
344
+ } | {
345
+ param: string;
346
+ link: true;
347
+ };
348
+ }[];
349
+ allowInsecureHttp: boolean;
350
+ };
351
+ soap?: {
352
+ endpoint: string;
353
+ version: "1.1" | "1.2";
354
+ namespaces: {
355
+ [key: string]: string;
356
+ };
357
+ auth?: {
358
+ type: "header";
359
+ header: string;
360
+ value: string;
361
+ prefix?: string;
362
+ } | {
363
+ type: "bearer";
364
+ token: string;
365
+ } | {
366
+ type: "basic";
367
+ username: string;
368
+ password: string;
369
+ };
370
+ wsSecurity?: {
371
+ username: string;
372
+ password: string;
373
+ digest: boolean;
374
+ };
375
+ verify?: {
376
+ tool: string;
377
+ args: {
378
+ [key: string]: string | number | boolean;
379
+ };
380
+ show: string;
381
+ };
382
+ tools: {
383
+ name: string;
384
+ description: string;
385
+ operation: string;
386
+ soapAction?: string;
387
+ body: string;
388
+ params: {
389
+ [key: string]: {
390
+ type: "string" | "number" | "integer" | "boolean";
391
+ description: string;
392
+ required: boolean;
393
+ limit?: string;
394
+ };
395
+ };
396
+ result?: string;
397
+ fields?: string[];
398
+ readOnly: boolean;
399
+ destructive: boolean;
400
+ answerLimits: {
401
+ field: string;
402
+ limit: string;
403
+ }[];
404
+ }[];
405
+ allowInsecureHttp: boolean;
406
+ };
407
+ odata?: {
408
+ serviceRoot: string;
409
+ version: "2" | "4";
410
+ auth: {
411
+ type: "header";
412
+ header: string;
413
+ value: string;
414
+ prefix?: string;
415
+ } | {
416
+ type: "bearer";
417
+ token: string;
418
+ } | {
419
+ type: "basic";
420
+ username: string;
421
+ password: string;
422
+ } | {
423
+ type: "oauth2";
424
+ tokenUrl: string;
425
+ clientId: string;
426
+ clientSecret: string;
427
+ scope?: string;
428
+ } | {
429
+ type: "query";
430
+ param: string;
431
+ value: string;
432
+ };
433
+ headers: {
434
+ [key: string]: string;
435
+ };
436
+ csrf: boolean;
437
+ paging: "skip" | "server";
438
+ tools: {
439
+ name: string;
440
+ description: string;
441
+ kind: "list" | "get" | "create" | "update" | "function" | "action";
442
+ entitySet?: string;
443
+ function?: string;
444
+ key: {
445
+ [key: string]: {
446
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
447
+ description: string;
448
+ property?: string;
449
+ required?: boolean;
307
450
  limit?: string;
308
451
  };
309
452
  };
453
+ filters: {
454
+ [key: string]: {
455
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
456
+ description: string;
457
+ property?: string;
458
+ required?: boolean;
459
+ limit?: string;
460
+ op: "eq" | "ne" | "gt" | "ge" | "lt" | "le" | "contains" | "startswith";
461
+ };
462
+ };
463
+ fields: {
464
+ [key: string]: {
465
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
466
+ description: string;
467
+ property?: string;
468
+ required?: boolean;
469
+ limit?: string;
470
+ };
471
+ };
472
+ params: {
473
+ [key: string]: {
474
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
475
+ description: string;
476
+ property?: string;
477
+ required?: boolean;
478
+ limit?: string;
479
+ };
480
+ };
481
+ select: string[];
482
+ orderBy?: string;
483
+ top: number;
310
484
  destructive: boolean;
311
485
  answerLimits: {
312
486
  field: string;
@@ -315,6 +489,142 @@ export declare function createClient(options: ClientOptions): {
315
489
  }[];
316
490
  allowInsecureHttp: boolean;
317
491
  };
492
+ sql?: {
493
+ engine: "postgres" | "sqlserver" | "mysql" | "oracle";
494
+ host: string;
495
+ port?: number;
496
+ database: string;
497
+ auth: {
498
+ user: string;
499
+ password: string;
500
+ };
501
+ tls: "verify" | "insecure" | "off";
502
+ timeoutSeconds: number;
503
+ maxRows: number;
504
+ tools: {
505
+ name: string;
506
+ description: string;
507
+ sql: string;
508
+ params: {
509
+ [key: string]: {
510
+ type: "string" | "number" | "integer" | "boolean";
511
+ description: string;
512
+ required: boolean;
513
+ limit?: string;
514
+ };
515
+ };
516
+ write: boolean;
517
+ destructive: boolean;
518
+ answerLimits: {
519
+ column: string;
520
+ limit: string;
521
+ }[];
522
+ }[];
523
+ };
524
+ events?: {
525
+ types: {
526
+ id: string;
527
+ label: string;
528
+ }[];
529
+ fields: {
530
+ [key: string]: string;
531
+ };
532
+ limits: {
533
+ [key: string]: string;
534
+ };
535
+ webhook?: {
536
+ verify: {
537
+ type: "hmac-sha256";
538
+ header: string;
539
+ prefix: string;
540
+ } | {
541
+ type: "token";
542
+ header: string;
543
+ } | {
544
+ type: "none";
545
+ };
546
+ allowInsecure: boolean;
547
+ type: {
548
+ field: string;
549
+ } | {
550
+ header: string;
551
+ };
552
+ deliveryId?: {
553
+ field: string;
554
+ } | {
555
+ header: string;
556
+ };
557
+ timestamp?: {
558
+ at: {
559
+ field: string;
560
+ } | {
561
+ header: string;
562
+ };
563
+ unit: "s" | "ms" | "iso";
564
+ toleranceSeconds: number;
565
+ };
566
+ setup: {
567
+ title: string;
568
+ body: string;
569
+ link?: {
570
+ label: string;
571
+ href: string;
572
+ };
573
+ copy?: string[];
574
+ shell?: "bash" | "powershell";
575
+ permissions?: boolean;
576
+ certificate?: boolean;
577
+ click?: string[];
578
+ clickUnavailable?: true;
579
+ siteRole?: "read" | "write";
580
+ agentCheck?: boolean;
581
+ confirm?: string;
582
+ live?: string;
583
+ settings?: {
584
+ id: string;
585
+ label: string;
586
+ help?: string;
587
+ placeholder?: string;
588
+ pattern: string;
589
+ }[];
590
+ option?: {
591
+ field: string;
592
+ value: string;
593
+ };
594
+ }[];
595
+ register?: {
596
+ method: "GET" | "POST" | "PUT";
597
+ path: string;
598
+ body?: unknown;
599
+ location: string;
600
+ };
601
+ };
602
+ self?: {
603
+ request: {
604
+ method: "GET" | "POST" | "PUT";
605
+ path: string;
606
+ body?: unknown;
607
+ };
608
+ id: string;
609
+ fields: string[];
610
+ };
611
+ poll?: {
612
+ request: {
613
+ method: "GET" | "POST" | "PUT";
614
+ path: string;
615
+ body?: unknown;
616
+ };
617
+ filter?: string;
618
+ items: string;
619
+ wrap?: string;
620
+ cursor: string;
621
+ deliveryId: string[];
622
+ types: {
623
+ type: string;
624
+ same?: [string, string];
625
+ }[];
626
+ };
627
+ };
318
628
  }[]>;
319
629
  providers: () => Promise<{
320
630
  id: string;
@@ -811,6 +1121,136 @@ export declare function createClient(options: ClientOptions): {
811
1121
  finishedAt: string | null;
812
1122
  replyTokenAt: string;
813
1123
  }[]>;
1124
+ eventSubscriptions: (o: string) => Promise<{
1125
+ id: string;
1126
+ connectorId: string;
1127
+ source: "webhook" | "poll";
1128
+ filter: string;
1129
+ intervalSeconds: number;
1130
+ cursor: string | null;
1131
+ polledAt: string | null;
1132
+ lastError: string | null;
1133
+ registered: string | null;
1134
+ url: string | null;
1135
+ createdBy: string;
1136
+ createdAt: string;
1137
+ }[]>;
1138
+ subscribeEvents: (o: string, body: EventSubscriptionInput) => Promise<{
1139
+ subscription: import("./schema.js").components["schemas"]["EventSubscription"];
1140
+ secret: string | null;
1141
+ setup: {
1142
+ title: string;
1143
+ body: string;
1144
+ link?: {
1145
+ label: string;
1146
+ href: string;
1147
+ };
1148
+ copy?: string[];
1149
+ shell?: "bash" | "powershell";
1150
+ permissions?: boolean;
1151
+ certificate?: boolean;
1152
+ click?: string[];
1153
+ clickUnavailable?: true;
1154
+ siteRole?: "read" | "write";
1155
+ agentCheck?: boolean;
1156
+ confirm?: string;
1157
+ live?: string;
1158
+ settings?: {
1159
+ id: string;
1160
+ label: string;
1161
+ help?: string;
1162
+ placeholder?: string;
1163
+ pattern: string;
1164
+ }[];
1165
+ option?: {
1166
+ field: string;
1167
+ value: string;
1168
+ };
1169
+ }[];
1170
+ registration: {
1171
+ ok: boolean;
1172
+ message: string;
1173
+ } | null;
1174
+ }>;
1175
+ rotateEventSecret: (o: string, id: string, by: string) => Promise<{
1176
+ subscription: import("./schema.js").components["schemas"]["EventSubscription"];
1177
+ secret: string;
1178
+ }>;
1179
+ unsubscribeEvents: (o: string, id: string, by: string) => Promise<void>;
1180
+ eventTriggers: (o: string, id: string) => Promise<{
1181
+ id: string;
1182
+ agentId: string;
1183
+ connectorId: string;
1184
+ enabled: boolean;
1185
+ eventTypes: string[];
1186
+ conditions: ({
1187
+ field: string;
1188
+ in: string[];
1189
+ } | {
1190
+ field: string;
1191
+ notIn: string[];
1192
+ })[];
1193
+ prompt: string;
1194
+ runner: string;
1195
+ settings: {
1196
+ [key: string]: unknown;
1197
+ };
1198
+ hasSigningSecret: boolean;
1199
+ managedAgentId: string | null;
1200
+ environmentId: string | null;
1201
+ vaultIds: string[];
1202
+ budgetCents: number;
1203
+ maxRunsPerHour: number;
1204
+ maxCentsPerDay: number;
1205
+ maxConcurrent: number;
1206
+ updatedBy: string | null;
1207
+ updatedAt: string;
1208
+ }[]>;
1209
+ setEventTrigger: (o: string, id: string, a: string, body: EventTriggerInput) => Promise<{
1210
+ id: string;
1211
+ agentId: string;
1212
+ connectorId: string;
1213
+ enabled: boolean;
1214
+ eventTypes: string[];
1215
+ conditions: ({
1216
+ field: string;
1217
+ in: string[];
1218
+ } | {
1219
+ field: string;
1220
+ notIn: string[];
1221
+ })[];
1222
+ prompt: string;
1223
+ runner: string;
1224
+ settings: {
1225
+ [key: string]: unknown;
1226
+ };
1227
+ hasSigningSecret: boolean;
1228
+ managedAgentId: string | null;
1229
+ environmentId: string | null;
1230
+ vaultIds: string[];
1231
+ budgetCents: number;
1232
+ maxRunsPerHour: number;
1233
+ maxCentsPerDay: number;
1234
+ maxConcurrent: number;
1235
+ updatedBy: string | null;
1236
+ updatedAt: string;
1237
+ }>;
1238
+ removeEventTrigger: (o: string, id: string, a: string, by: string) => Promise<void>;
1239
+ eventRuns: (o: string, id: string, limit?: number) => Promise<{
1240
+ id: string;
1241
+ agentId: string;
1242
+ triggerId: string;
1243
+ connectorId: string;
1244
+ eventType: string;
1245
+ deliveryId: string;
1246
+ runner: string;
1247
+ sessionId: string | null;
1248
+ state: "starting" | "running" | "ended" | "failed";
1249
+ error: string | null;
1250
+ costCents: number | null;
1251
+ startedAt: string;
1252
+ finishedAt: string | null;
1253
+ }[]>;
814
1254
  claudeKey: (o: string) => Promise<{
815
1255
  set: false;
816
1256
  } | {
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 }),
@@ -185,7 +197,7 @@ export function createClient(options) {
185
197
  async appStates(o, connectors, connections) {
186
198
  const apps = connectors.map((connector) => {
187
199
  const connection = connections.find((c) => c.connectorId === connector.id) ?? null;
188
- const liveSteps = chosenSteps(connector, [...connector.setup, ...connector.afterConnect], connection?.config ?? {}).filter((s) => s.live);
200
+ const liveSteps = chosenSteps(connector, [...connector.setup, ...connector.afterConnect], connection?.config ?? {}, connection?.capabilities ?? []).filter((s) => s.live);
189
201
  return { connector, connection, liveSteps };
190
202
  });
191
203
  const liveSteps = apps.flatMap((a) => a.liveSteps);