@axiom-lattice/gateway 2.1.19 → 2.1.21

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.
@@ -1,4 +1,5 @@
1
1
  import { FastifyInstance } from "fastify";
2
+ import { ScheduledTaskStatus } from "@axiom-lattice/protocols";
2
3
  import * as assistantController from "../controllers/assistant";
3
4
  import * as runController from "../controllers/run";
4
5
  import * as memoryController from "../controllers/memory";
@@ -9,6 +10,7 @@ import * as schedulesController from "../controllers/schedules";
9
10
  import * as configController from "../controllers/config";
10
11
  import * as modelsController from "../controllers/models";
11
12
  import * as healthController from "../controllers/health";
13
+ import * as skillsController from "../controllers/skills";
12
14
  import {
13
15
  createRunSchema,
14
16
  getAllMemoryItemsSchema,
@@ -200,7 +202,11 @@ export const registerLatticeRoutes = (app: FastifyInstance): void => {
200
202
  // Schedule routes for viewing scheduled tasks by thread
201
203
  app.get<{
202
204
  Params: { assistantId: string; threadId: string };
203
- Querystring: { status?: string; limit?: string; offset?: string };
205
+ Querystring: {
206
+ status?: ScheduledTaskStatus;
207
+ limit?: string;
208
+ offset?: string;
209
+ };
204
210
  }>(
205
211
  "/api/assistants/:assistantId/threads/:threadId/schedules",
206
212
  schedulesController.getThreadSchedules
@@ -225,4 +231,58 @@ export const registerLatticeRoutes = (app: FastifyInstance): void => {
225
231
  app.post<{
226
232
  Params: { taskId: string };
227
233
  }>("/api/schedules/:taskId/resume", schedulesController.resumeScheduledTask);
234
+
235
+ // Skills CRUD routes
236
+ app.get("/api/skills", skillsController.getSkillList);
237
+
238
+ app.get<{
239
+ Params: { id: string };
240
+ }>(
241
+ "/api/skills/:id",
242
+ skillsController.getSkill
243
+ );
244
+
245
+ app.post<{
246
+ Body: any;
247
+ }>(
248
+ "/api/skills",
249
+ skillsController.createSkill
250
+ );
251
+
252
+ app.put<{
253
+ Params: { id: string };
254
+ Body: any;
255
+ }>(
256
+ "/api/skills/:id",
257
+ skillsController.updateSkill
258
+ );
259
+
260
+ app.delete<{
261
+ Params: { id: string };
262
+ }>(
263
+ "/api/skills/:id",
264
+ skillsController.deleteSkill
265
+ );
266
+
267
+ // Skills search and filter routes
268
+ app.get<{
269
+ Querystring: { key: string; value: string };
270
+ }>(
271
+ "/api/skills/search/metadata",
272
+ skillsController.searchSkillsByMetadata
273
+ );
274
+
275
+ app.get<{
276
+ Querystring: { compatibility: string };
277
+ }>(
278
+ "/api/skills/filter/compatibility",
279
+ skillsController.filterSkillsByCompatibility
280
+ );
281
+
282
+ app.get<{
283
+ Querystring: { license: string };
284
+ }>(
285
+ "/api/skills/filter/license",
286
+ skillsController.filterSkillsByLicense
287
+ );
228
288
  };
@@ -352,3 +352,456 @@ export const getHealthSchema: FastifySchema = {
352
352
  },
353
353
  },
354
354
  };
355
+
356
+ // Skills Schemas
357
+ export const getSkillListSchema: FastifySchema = {
358
+ description: "Get list of all skills",
359
+ tags: ["Skills"],
360
+ summary: "Get Skill List",
361
+ response: {
362
+ 200: {
363
+ type: "object",
364
+ properties: {
365
+ success: { type: "boolean" },
366
+ message: { type: "string" },
367
+ data: {
368
+ type: "object",
369
+ properties: {
370
+ records: {
371
+ type: "array",
372
+ items: { type: "object" },
373
+ },
374
+ total: { type: "number" },
375
+ },
376
+ },
377
+ },
378
+ },
379
+ 500: {
380
+ type: "object",
381
+ properties: {
382
+ success: { type: "boolean" },
383
+ message: { type: "string" },
384
+ data: {
385
+ type: "object",
386
+ properties: {
387
+ records: {
388
+ type: "array",
389
+ items: { type: "object" },
390
+ },
391
+ total: { type: "number" },
392
+ },
393
+ },
394
+ },
395
+ },
396
+ },
397
+ };
398
+
399
+ export const getSkillSchema: FastifySchema = {
400
+ description: "Get a single skill by ID",
401
+ tags: ["Skills"],
402
+ summary: "Get Skill",
403
+ params: {
404
+ type: "object",
405
+ properties: {
406
+ id: { type: "string", description: "Skill ID" },
407
+ },
408
+ required: ["id"],
409
+ },
410
+ response: {
411
+ 200: {
412
+ type: "object",
413
+ properties: {
414
+ success: { type: "boolean" },
415
+ message: { type: "string" },
416
+ data: { type: "object" },
417
+ },
418
+ },
419
+ 404: {
420
+ type: "object",
421
+ properties: {
422
+ success: { type: "boolean" },
423
+ message: { type: "string" },
424
+ },
425
+ },
426
+ 500: {
427
+ type: "object",
428
+ properties: {
429
+ success: { type: "boolean" },
430
+ message: { type: "string" },
431
+ },
432
+ },
433
+ },
434
+ };
435
+
436
+ export const createSkillSchema: FastifySchema = {
437
+ description: "Create a new skill",
438
+ tags: ["Skills"],
439
+ summary: "Create Skill",
440
+ body: {
441
+ type: "object",
442
+ properties: {
443
+ id: {
444
+ type: "string",
445
+ description: "Skill ID (optional, defaults to name if not provided; must equal name, name is used for path addressing)"
446
+ },
447
+ name: {
448
+ type: "string",
449
+ description: "Skill name (1-64 chars, lowercase alphanumeric with single hyphens, pattern: ^[a-z0-9]+(-[a-z0-9]+)*$)",
450
+ pattern: "^[a-z0-9]+(-[a-z0-9]+)*$",
451
+ minLength: 1,
452
+ maxLength: 64
453
+ },
454
+ description: { type: "string", description: "Skill description" },
455
+ license: { type: "string", description: "License information" },
456
+ compatibility: { type: "string", description: "Compatibility information" },
457
+ metadata: {
458
+ type: "object",
459
+ additionalProperties: { type: "string" },
460
+ description: "Additional metadata",
461
+ },
462
+ content: { type: "string", description: "Skill detailed content (markdown)" },
463
+ subSkills: {
464
+ type: "array",
465
+ items: { type: "string" },
466
+ description: "Array of sub-skill names (hierarchical structure)",
467
+ },
468
+ },
469
+ required: ["name", "description"],
470
+ },
471
+ response: {
472
+ 201: {
473
+ type: "object",
474
+ properties: {
475
+ success: { type: "boolean" },
476
+ message: { type: "string" },
477
+ data: { type: "object" },
478
+ },
479
+ },
480
+ 400: {
481
+ type: "object",
482
+ properties: {
483
+ success: { type: "boolean" },
484
+ message: { type: "string" },
485
+ },
486
+ },
487
+ 409: {
488
+ type: "object",
489
+ properties: {
490
+ success: { type: "boolean" },
491
+ message: { type: "string" },
492
+ },
493
+ },
494
+ 500: {
495
+ type: "object",
496
+ properties: {
497
+ success: { type: "boolean" },
498
+ message: { type: "string" },
499
+ },
500
+ },
501
+ },
502
+ };
503
+
504
+ export const updateSkillSchema: FastifySchema = {
505
+ description: "Update an existing skill",
506
+ tags: ["Skills"],
507
+ summary: "Update Skill",
508
+ params: {
509
+ type: "object",
510
+ properties: {
511
+ id: { type: "string", description: "Skill ID" },
512
+ },
513
+ required: ["id"],
514
+ },
515
+ body: {
516
+ type: "object",
517
+ properties: {
518
+ name: {
519
+ type: "string",
520
+ description: "Skill name (1-64 chars, lowercase alphanumeric with single hyphens, pattern: ^[a-z0-9]+(-[a-z0-9]+)*$)",
521
+ pattern: "^[a-z0-9]+(-[a-z0-9]+)*$",
522
+ minLength: 1,
523
+ maxLength: 64
524
+ },
525
+ description: { type: "string", description: "Skill description" },
526
+ license: { type: "string", description: "License information" },
527
+ compatibility: { type: "string", description: "Compatibility information" },
528
+ metadata: {
529
+ type: "object",
530
+ additionalProperties: { type: "string" },
531
+ description: "Additional metadata",
532
+ },
533
+ content: { type: "string", description: "Skill detailed content (markdown)" },
534
+ subSkills: {
535
+ type: "array",
536
+ items: { type: "string" },
537
+ description: "Array of sub-skill names (hierarchical structure)",
538
+ },
539
+ },
540
+ },
541
+ response: {
542
+ 200: {
543
+ type: "object",
544
+ properties: {
545
+ success: { type: "boolean" },
546
+ message: { type: "string" },
547
+ data: { type: "object" },
548
+ },
549
+ },
550
+ 400: {
551
+ type: "object",
552
+ properties: {
553
+ success: { type: "boolean" },
554
+ message: { type: "string" },
555
+ },
556
+ },
557
+ 404: {
558
+ type: "object",
559
+ properties: {
560
+ success: { type: "boolean" },
561
+ message: { type: "string" },
562
+ },
563
+ },
564
+ 500: {
565
+ type: "object",
566
+ properties: {
567
+ success: { type: "boolean" },
568
+ message: { type: "string" },
569
+ },
570
+ },
571
+ },
572
+ };
573
+
574
+ export const deleteSkillSchema: FastifySchema = {
575
+ description: "Delete a skill by ID",
576
+ tags: ["Skills"],
577
+ summary: "Delete Skill",
578
+ params: {
579
+ type: "object",
580
+ properties: {
581
+ id: { type: "string", description: "Skill ID" },
582
+ },
583
+ required: ["id"],
584
+ },
585
+ response: {
586
+ 200: {
587
+ type: "object",
588
+ properties: {
589
+ success: { type: "boolean" },
590
+ message: { type: "string" },
591
+ },
592
+ },
593
+ 404: {
594
+ type: "object",
595
+ properties: {
596
+ success: { type: "boolean" },
597
+ message: { type: "string" },
598
+ },
599
+ },
600
+ 500: {
601
+ type: "object",
602
+ properties: {
603
+ success: { type: "boolean" },
604
+ message: { type: "string" },
605
+ },
606
+ },
607
+ },
608
+ };
609
+
610
+ export const searchSkillsByMetadataSchema: FastifySchema = {
611
+ description: "Search skills by metadata",
612
+ tags: ["Skills"],
613
+ summary: "Search Skills by Metadata",
614
+ querystring: {
615
+ type: "object",
616
+ properties: {
617
+ key: { type: "string", description: "Metadata key" },
618
+ value: { type: "string", description: "Metadata value" },
619
+ },
620
+ required: ["key", "value"],
621
+ },
622
+ response: {
623
+ 200: {
624
+ type: "object",
625
+ properties: {
626
+ success: { type: "boolean" },
627
+ message: { type: "string" },
628
+ data: {
629
+ type: "object",
630
+ properties: {
631
+ records: {
632
+ type: "array",
633
+ items: { type: "object" },
634
+ },
635
+ total: { type: "number" },
636
+ },
637
+ },
638
+ },
639
+ },
640
+ 400: {
641
+ type: "object",
642
+ properties: {
643
+ success: { type: "boolean" },
644
+ message: { type: "string" },
645
+ data: {
646
+ type: "object",
647
+ properties: {
648
+ records: {
649
+ type: "array",
650
+ items: { type: "object" },
651
+ },
652
+ total: { type: "number" },
653
+ },
654
+ },
655
+ },
656
+ },
657
+ 500: {
658
+ type: "object",
659
+ properties: {
660
+ success: { type: "boolean" },
661
+ message: { type: "string" },
662
+ data: {
663
+ type: "object",
664
+ properties: {
665
+ records: {
666
+ type: "array",
667
+ items: { type: "object" },
668
+ },
669
+ total: { type: "number" },
670
+ },
671
+ },
672
+ },
673
+ },
674
+ },
675
+ };
676
+
677
+ export const filterSkillsByCompatibilitySchema: FastifySchema = {
678
+ description: "Filter skills by compatibility",
679
+ tags: ["Skills"],
680
+ summary: "Filter Skills by Compatibility",
681
+ querystring: {
682
+ type: "object",
683
+ properties: {
684
+ compatibility: { type: "string", description: "Compatibility string" },
685
+ },
686
+ required: ["compatibility"],
687
+ },
688
+ response: {
689
+ 200: {
690
+ type: "object",
691
+ properties: {
692
+ success: { type: "boolean" },
693
+ message: { type: "string" },
694
+ data: {
695
+ type: "object",
696
+ properties: {
697
+ records: {
698
+ type: "array",
699
+ items: { type: "object" },
700
+ },
701
+ total: { type: "number" },
702
+ },
703
+ },
704
+ },
705
+ },
706
+ 400: {
707
+ type: "object",
708
+ properties: {
709
+ success: { type: "boolean" },
710
+ message: { type: "string" },
711
+ data: {
712
+ type: "object",
713
+ properties: {
714
+ records: {
715
+ type: "array",
716
+ items: { type: "object" },
717
+ },
718
+ total: { type: "number" },
719
+ },
720
+ },
721
+ },
722
+ },
723
+ 500: {
724
+ type: "object",
725
+ properties: {
726
+ success: { type: "boolean" },
727
+ message: { type: "string" },
728
+ data: {
729
+ type: "object",
730
+ properties: {
731
+ records: {
732
+ type: "array",
733
+ items: { type: "object" },
734
+ },
735
+ total: { type: "number" },
736
+ },
737
+ },
738
+ },
739
+ },
740
+ },
741
+ };
742
+
743
+ export const filterSkillsByLicenseSchema: FastifySchema = {
744
+ description: "Filter skills by license",
745
+ tags: ["Skills"],
746
+ summary: "Filter Skills by License",
747
+ querystring: {
748
+ type: "object",
749
+ properties: {
750
+ license: { type: "string", description: "License string" },
751
+ },
752
+ required: ["license"],
753
+ },
754
+ response: {
755
+ 200: {
756
+ type: "object",
757
+ properties: {
758
+ success: { type: "boolean" },
759
+ message: { type: "string" },
760
+ data: {
761
+ type: "object",
762
+ properties: {
763
+ records: {
764
+ type: "array",
765
+ items: { type: "object" },
766
+ },
767
+ total: { type: "number" },
768
+ },
769
+ },
770
+ },
771
+ },
772
+ 400: {
773
+ type: "object",
774
+ properties: {
775
+ success: { type: "boolean" },
776
+ message: { type: "string" },
777
+ data: {
778
+ type: "object",
779
+ properties: {
780
+ records: {
781
+ type: "array",
782
+ items: { type: "object" },
783
+ },
784
+ total: { type: "number" },
785
+ },
786
+ },
787
+ },
788
+ },
789
+ 500: {
790
+ type: "object",
791
+ properties: {
792
+ success: { type: "boolean" },
793
+ message: { type: "string" },
794
+ data: {
795
+ type: "object",
796
+ properties: {
797
+ records: {
798
+ type: "array",
799
+ items: { type: "object" },
800
+ },
801
+ total: { type: "number" },
802
+ },
803
+ },
804
+ },
805
+ },
806
+ },
807
+ };