@okrlinkhub/agent-factory 0.2.4 → 0.2.5

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 (37) hide show
  1. package/README.md +32 -0
  2. package/dist/client/index.d.ts +145 -3
  3. package/dist/client/index.d.ts.map +1 -1
  4. package/dist/client/index.js +192 -0
  5. package/dist/client/index.js.map +1 -1
  6. package/dist/component/_generated/api.d.ts +2 -0
  7. package/dist/component/_generated/api.d.ts.map +1 -1
  8. package/dist/component/_generated/api.js.map +1 -1
  9. package/dist/component/_generated/component.d.ts +456 -4
  10. package/dist/component/_generated/component.d.ts.map +1 -1
  11. package/dist/component/lib.d.ts +1 -0
  12. package/dist/component/lib.d.ts.map +1 -1
  13. package/dist/component/lib.js +1 -0
  14. package/dist/component/lib.js.map +1 -1
  15. package/dist/component/pushing.d.ts +226 -0
  16. package/dist/component/pushing.d.ts.map +1 -0
  17. package/dist/component/pushing.js +954 -0
  18. package/dist/component/pushing.js.map +1 -0
  19. package/dist/component/queue.d.ts +8 -7
  20. package/dist/component/queue.d.ts.map +1 -1
  21. package/dist/component/queue.js +20 -1
  22. package/dist/component/queue.js.map +1 -1
  23. package/dist/component/scheduler.d.ts +5 -5
  24. package/dist/component/schema.d.ts +258 -8
  25. package/dist/component/schema.d.ts.map +1 -1
  26. package/dist/component/schema.js +103 -0
  27. package/dist/component/schema.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/client/index.test.ts +29 -19
  30. package/src/client/index.ts +209 -0
  31. package/src/component/_generated/api.ts +2 -0
  32. package/src/component/_generated/component.ts +448 -4
  33. package/src/component/lib.test.ts +98 -0
  34. package/src/component/lib.ts +17 -0
  35. package/src/component/pushing.ts +1111 -0
  36. package/src/component/queue.ts +27 -1
  37. package/src/component/schema.ts +137 -0
@@ -224,15 +224,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
224
224
  configureAgent: FunctionReference<"mutation", "internal", {
225
225
  agentKey: string;
226
226
  bridgeConfig?: {
227
+ appBaseUrlMapJsonSecretRef?: string;
227
228
  appKey?: string;
228
229
  baseUrl?: string;
229
230
  enabled: boolean;
230
- appBaseUrlMapJsonSecretRef?: string;
231
231
  serviceId?: string;
232
232
  serviceKeySecretRef?: string;
233
233
  };
234
234
  clientMd?: string;
235
235
  enabled: boolean;
236
+ providerUserId?: string;
236
237
  secretsRef: Array<string>;
237
238
  skills: Array<string>;
238
239
  soulMd: string;
@@ -283,6 +284,74 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
283
284
  telegramUserId: null | string;
284
285
  usedAt: null | number;
285
286
  }, Name>;
287
+ createPushJobCustom: FunctionReference<"mutation", "internal", {
288
+ companyId: string;
289
+ consumerUserId: string;
290
+ enabled?: boolean;
291
+ nowMs?: number;
292
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
293
+ schedule: {
294
+ kind: "manual";
295
+ } | {
296
+ kind: "daily";
297
+ time: string;
298
+ } | {
299
+ kind: "weekly";
300
+ time: string;
301
+ weekday: number;
302
+ } | {
303
+ dayOfMonth: number | "last";
304
+ kind: "monthly";
305
+ time: string;
306
+ };
307
+ text: string;
308
+ timezone: string;
309
+ title: string;
310
+ }, string, Name>;
311
+ createPushJobFromTemplate: FunctionReference<"mutation", "internal", {
312
+ companyId: string;
313
+ consumerUserId: string;
314
+ enabled?: boolean;
315
+ nowMs?: number;
316
+ schedule?: {
317
+ kind: "manual";
318
+ } | {
319
+ kind: "daily";
320
+ time: string;
321
+ } | {
322
+ kind: "weekly";
323
+ time: string;
324
+ weekday: number;
325
+ } | {
326
+ dayOfMonth: number | "last";
327
+ kind: "monthly";
328
+ time: string;
329
+ };
330
+ templateId: string;
331
+ timezone: string;
332
+ }, string, Name>;
333
+ createPushTemplate: FunctionReference<"mutation", "internal", {
334
+ actorUserId: string;
335
+ companyId: string;
336
+ enabled?: boolean;
337
+ nowMs?: number;
338
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
339
+ suggestedTimes: Array<{
340
+ kind: "daily";
341
+ time: string;
342
+ } | {
343
+ kind: "weekly";
344
+ time: string;
345
+ weekday: number;
346
+ } | {
347
+ dayOfMonth: number | "last";
348
+ kind: "monthly";
349
+ time: string;
350
+ }>;
351
+ templateKey: string;
352
+ text: string;
353
+ title: string;
354
+ }, string, Name>;
286
355
  deleteFlyVolume: FunctionReference<"action", "internal", {
287
356
  appName: string;
288
357
  flyApiToken?: string;
@@ -292,6 +361,21 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
292
361
  ok: boolean;
293
362
  status: number;
294
363
  }, Name>;
364
+ deletePushJob: FunctionReference<"mutation", "internal", {
365
+ jobId: string;
366
+ }, boolean, Name>;
367
+ deletePushTemplate: FunctionReference<"mutation", "internal", {
368
+ templateId: string;
369
+ }, boolean, Name>;
370
+ dispatchDuePushJobs: FunctionReference<"mutation", "internal", {
371
+ limit?: number;
372
+ nowMs?: number;
373
+ }, {
374
+ enqueued: number;
375
+ failed: number;
376
+ scanned: number;
377
+ skipped: number;
378
+ }, Name>;
295
379
  enqueue: FunctionReference<"mutation", "internal", {
296
380
  agentKey: string;
297
381
  conversationId: string;
@@ -348,9 +432,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
348
432
  }, null | {
349
433
  agentKey: string;
350
434
  bridgeRuntimeConfig: null | {
435
+ appBaseUrlMapJson: null | string;
351
436
  appKey: null | string;
352
437
  baseUrl: null | string;
353
- appBaseUrlMapJson: null | string;
354
438
  serviceId: null | string;
355
439
  serviceKey: null | string;
356
440
  serviceKeySecretRef: null | string;
@@ -424,6 +508,79 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
424
508
  secretRef: string;
425
509
  version: number;
426
510
  }, Name>;
511
+ listPushDispatchesByJob: FunctionReference<"query", "internal", {
512
+ jobId: string;
513
+ limit?: number;
514
+ }, Array<{
515
+ _id: string;
516
+ createdAt: number;
517
+ error: null | string;
518
+ runKey: string;
519
+ scheduledFor: number;
520
+ status: "enqueued" | "skipped" | "failed";
521
+ }>, Name>;
522
+ listPushJobsForUser: FunctionReference<"query", "internal", {
523
+ consumerUserId: string;
524
+ includeDisabled?: boolean;
525
+ }, Array<{
526
+ _id: string;
527
+ agentKey: null | string;
528
+ companyId: string;
529
+ consumerUserId: string;
530
+ createdAt: number;
531
+ enabled: boolean;
532
+ lastRunAt: null | number;
533
+ lastRunKey: null | string;
534
+ nextRunAt: null | number;
535
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
536
+ schedule: {
537
+ kind: "manual";
538
+ } | {
539
+ kind: "daily";
540
+ time: string;
541
+ } | {
542
+ kind: "weekly";
543
+ time: string;
544
+ weekday: number;
545
+ } | {
546
+ dayOfMonth: number | "last";
547
+ kind: "monthly";
548
+ time: string;
549
+ };
550
+ sourceTemplateId: null | string;
551
+ text: string;
552
+ timezone: string;
553
+ title: string;
554
+ updatedAt: number;
555
+ }>, Name>;
556
+ listPushTemplatesByCompany: FunctionReference<"query", "internal", {
557
+ companyId: string;
558
+ includeDisabled?: boolean;
559
+ }, Array<{
560
+ _id: string;
561
+ companyId: string;
562
+ createdAt: number;
563
+ createdBy: string;
564
+ enabled: boolean;
565
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
566
+ suggestedTimes: Array<{
567
+ kind: "daily";
568
+ time: string;
569
+ } | {
570
+ kind: "weekly";
571
+ time: string;
572
+ weekday: number;
573
+ } | {
574
+ dayOfMonth: number | "last";
575
+ kind: "monthly";
576
+ time: string;
577
+ }>;
578
+ templateKey: string;
579
+ text: string;
580
+ title: string;
581
+ updatedAt: number;
582
+ updatedBy: string;
583
+ }>, Name>;
427
584
  queueStats: FunctionReference<"query", "internal", {
428
585
  nowMs?: number;
429
586
  }, {
@@ -491,6 +648,74 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
491
648
  secretRef: string;
492
649
  version: null | number;
493
650
  }>, Name>;
651
+ sendBroadcastToAllActiveAgents: FunctionReference<"mutation", "internal", {
652
+ companyId: string;
653
+ nowMs?: number;
654
+ requestedBy: string;
655
+ text: string;
656
+ title: string;
657
+ }, {
658
+ broadcastId: string;
659
+ enqueued: number;
660
+ failed: number;
661
+ totalTargets: number;
662
+ }, Name>;
663
+ setPushJobEnabled: FunctionReference<"mutation", "internal", {
664
+ enabled: boolean;
665
+ jobId: string;
666
+ nowMs?: number;
667
+ }, boolean, Name>;
668
+ triggerPushJobNow: FunctionReference<"mutation", "internal", {
669
+ jobId: string;
670
+ nowMs?: number;
671
+ }, {
672
+ enqueuedMessageId: string;
673
+ runKey: string;
674
+ }, Name>;
675
+ updatePushJob: FunctionReference<"mutation", "internal", {
676
+ enabled?: boolean;
677
+ jobId: string;
678
+ nowMs?: number;
679
+ periodicity?: "manual" | "daily" | "weekly" | "monthly";
680
+ schedule?: {
681
+ kind: "manual";
682
+ } | {
683
+ kind: "daily";
684
+ time: string;
685
+ } | {
686
+ kind: "weekly";
687
+ time: string;
688
+ weekday: number;
689
+ } | {
690
+ dayOfMonth: number | "last";
691
+ kind: "monthly";
692
+ time: string;
693
+ };
694
+ text?: string;
695
+ timezone?: string;
696
+ title?: string;
697
+ }, boolean, Name>;
698
+ updatePushTemplate: FunctionReference<"mutation", "internal", {
699
+ actorUserId: string;
700
+ enabled?: boolean;
701
+ nowMs?: number;
702
+ periodicity?: "manual" | "daily" | "weekly" | "monthly";
703
+ suggestedTimes?: Array<{
704
+ kind: "daily";
705
+ time: string;
706
+ } | {
707
+ kind: "weekly";
708
+ time: string;
709
+ weekday: number;
710
+ } | {
711
+ dayOfMonth: number | "last";
712
+ kind: "monthly";
713
+ time: string;
714
+ }>;
715
+ templateId: string;
716
+ text?: string;
717
+ title?: string;
718
+ }, boolean, Name>;
494
719
  workerStats: FunctionReference<"query", "internal", {}, {
495
720
  activeCount: number;
496
721
  idleCount: number;
@@ -517,6 +742,232 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
517
742
  }, Name>;
518
743
  };
519
744
  };
745
+ pushing: {
746
+ createPushJobCustom: FunctionReference<"mutation", "internal", {
747
+ companyId: string;
748
+ consumerUserId: string;
749
+ enabled?: boolean;
750
+ nowMs?: number;
751
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
752
+ schedule: {
753
+ kind: "manual";
754
+ } | {
755
+ kind: "daily";
756
+ time: string;
757
+ } | {
758
+ kind: "weekly";
759
+ time: string;
760
+ weekday: number;
761
+ } | {
762
+ dayOfMonth: number | "last";
763
+ kind: "monthly";
764
+ time: string;
765
+ };
766
+ text: string;
767
+ timezone: string;
768
+ title: string;
769
+ }, string, Name>;
770
+ createPushJobFromTemplate: FunctionReference<"mutation", "internal", {
771
+ companyId: string;
772
+ consumerUserId: string;
773
+ enabled?: boolean;
774
+ nowMs?: number;
775
+ schedule?: {
776
+ kind: "manual";
777
+ } | {
778
+ kind: "daily";
779
+ time: string;
780
+ } | {
781
+ kind: "weekly";
782
+ time: string;
783
+ weekday: number;
784
+ } | {
785
+ dayOfMonth: number | "last";
786
+ kind: "monthly";
787
+ time: string;
788
+ };
789
+ templateId: string;
790
+ timezone: string;
791
+ }, string, Name>;
792
+ createPushTemplate: FunctionReference<"mutation", "internal", {
793
+ actorUserId: string;
794
+ companyId: string;
795
+ enabled?: boolean;
796
+ nowMs?: number;
797
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
798
+ suggestedTimes: Array<{
799
+ kind: "daily";
800
+ time: string;
801
+ } | {
802
+ kind: "weekly";
803
+ time: string;
804
+ weekday: number;
805
+ } | {
806
+ dayOfMonth: number | "last";
807
+ kind: "monthly";
808
+ time: string;
809
+ }>;
810
+ templateKey: string;
811
+ text: string;
812
+ title: string;
813
+ }, string, Name>;
814
+ deletePushJob: FunctionReference<"mutation", "internal", {
815
+ jobId: string;
816
+ }, boolean, Name>;
817
+ deletePushTemplate: FunctionReference<"mutation", "internal", {
818
+ templateId: string;
819
+ }, boolean, Name>;
820
+ dispatchDuePushJobs: FunctionReference<"mutation", "internal", {
821
+ limit?: number;
822
+ nowMs?: number;
823
+ }, {
824
+ enqueued: number;
825
+ failed: number;
826
+ scanned: number;
827
+ skipped: number;
828
+ }, Name>;
829
+ listPushDispatchesByJob: FunctionReference<"query", "internal", {
830
+ jobId: string;
831
+ limit?: number;
832
+ }, Array<{
833
+ _id: string;
834
+ createdAt: number;
835
+ error: null | string;
836
+ runKey: string;
837
+ scheduledFor: number;
838
+ status: "enqueued" | "skipped" | "failed";
839
+ }>, Name>;
840
+ listPushJobsForUser: FunctionReference<"query", "internal", {
841
+ consumerUserId: string;
842
+ includeDisabled?: boolean;
843
+ }, Array<{
844
+ _id: string;
845
+ agentKey: null | string;
846
+ companyId: string;
847
+ consumerUserId: string;
848
+ createdAt: number;
849
+ enabled: boolean;
850
+ lastRunAt: null | number;
851
+ lastRunKey: null | string;
852
+ nextRunAt: null | number;
853
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
854
+ schedule: {
855
+ kind: "manual";
856
+ } | {
857
+ kind: "daily";
858
+ time: string;
859
+ } | {
860
+ kind: "weekly";
861
+ time: string;
862
+ weekday: number;
863
+ } | {
864
+ dayOfMonth: number | "last";
865
+ kind: "monthly";
866
+ time: string;
867
+ };
868
+ sourceTemplateId: null | string;
869
+ text: string;
870
+ timezone: string;
871
+ title: string;
872
+ updatedAt: number;
873
+ }>, Name>;
874
+ listPushTemplatesByCompany: FunctionReference<"query", "internal", {
875
+ companyId: string;
876
+ includeDisabled?: boolean;
877
+ }, Array<{
878
+ _id: string;
879
+ companyId: string;
880
+ createdAt: number;
881
+ createdBy: string;
882
+ enabled: boolean;
883
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
884
+ suggestedTimes: Array<{
885
+ kind: "daily";
886
+ time: string;
887
+ } | {
888
+ kind: "weekly";
889
+ time: string;
890
+ weekday: number;
891
+ } | {
892
+ dayOfMonth: number | "last";
893
+ kind: "monthly";
894
+ time: string;
895
+ }>;
896
+ templateKey: string;
897
+ text: string;
898
+ title: string;
899
+ updatedAt: number;
900
+ updatedBy: string;
901
+ }>, Name>;
902
+ sendBroadcastToAllActiveAgents: FunctionReference<"mutation", "internal", {
903
+ companyId: string;
904
+ nowMs?: number;
905
+ requestedBy: string;
906
+ text: string;
907
+ title: string;
908
+ }, {
909
+ broadcastId: string;
910
+ enqueued: number;
911
+ failed: number;
912
+ totalTargets: number;
913
+ }, Name>;
914
+ setPushJobEnabled: FunctionReference<"mutation", "internal", {
915
+ enabled: boolean;
916
+ jobId: string;
917
+ nowMs?: number;
918
+ }, boolean, Name>;
919
+ triggerPushJobNow: FunctionReference<"mutation", "internal", {
920
+ jobId: string;
921
+ nowMs?: number;
922
+ }, {
923
+ enqueuedMessageId: string;
924
+ runKey: string;
925
+ }, Name>;
926
+ updatePushJob: FunctionReference<"mutation", "internal", {
927
+ enabled?: boolean;
928
+ jobId: string;
929
+ nowMs?: number;
930
+ periodicity?: "manual" | "daily" | "weekly" | "monthly";
931
+ schedule?: {
932
+ kind: "manual";
933
+ } | {
934
+ kind: "daily";
935
+ time: string;
936
+ } | {
937
+ kind: "weekly";
938
+ time: string;
939
+ weekday: number;
940
+ } | {
941
+ dayOfMonth: number | "last";
942
+ kind: "monthly";
943
+ time: string;
944
+ };
945
+ text?: string;
946
+ timezone?: string;
947
+ title?: string;
948
+ }, boolean, Name>;
949
+ updatePushTemplate: FunctionReference<"mutation", "internal", {
950
+ actorUserId: string;
951
+ enabled?: boolean;
952
+ nowMs?: number;
953
+ periodicity?: "manual" | "daily" | "weekly" | "monthly";
954
+ suggestedTimes?: Array<{
955
+ kind: "daily";
956
+ time: string;
957
+ } | {
958
+ kind: "weekly";
959
+ time: string;
960
+ weekday: number;
961
+ } | {
962
+ dayOfMonth: number | "last";
963
+ kind: "monthly";
964
+ time: string;
965
+ }>;
966
+ templateId: string;
967
+ text?: string;
968
+ title?: string;
969
+ }, boolean, Name>;
970
+ };
520
971
  queue: {
521
972
  appendConversationMessages: FunctionReference<"mutation", "internal", {
522
973
  conversationId: string;
@@ -639,9 +1090,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
639
1090
  }, null | {
640
1091
  agentKey: string;
641
1092
  bridgeRuntimeConfig: null | {
1093
+ appBaseUrlMapJson: null | string;
642
1094
  appKey: null | string;
643
1095
  baseUrl: null | string;
644
- appBaseUrlMapJson: null | string;
645
1096
  serviceId: null | string;
646
1097
  serviceKey: null | string;
647
1098
  serviceKeySecretRef: null | string;
@@ -771,15 +1222,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
771
1222
  upsertAgentProfile: FunctionReference<"mutation", "internal", {
772
1223
  agentKey: string;
773
1224
  bridgeConfig?: {
1225
+ appBaseUrlMapJsonSecretRef?: string;
774
1226
  appKey?: string;
775
1227
  baseUrl?: string;
776
1228
  enabled: boolean;
777
- appBaseUrlMapJsonSecretRef?: string;
778
1229
  serviceId?: string;
779
1230
  serviceKeySecretRef?: string;
780
1231
  };
781
1232
  clientMd?: string;
782
1233
  enabled: boolean;
1234
+ providerUserId?: string;
783
1235
  secretsRef: Array<string>;
784
1236
  skills: Array<string>;
785
1237
  soulMd: string;