@axiom-lattice/gateway 1.0.29 → 1.0.30
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/.turbo/turbo-build.log +9 -9
- package/dist/index.d.mts +46 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.js +266 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +266 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
- package/src/index.ts +5 -3
- package/src/routes/index.ts +26 -3
- package/src/schemas/index.ts +196 -0
- package/src/swagger.ts +77 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
[34mCLI[39m Cleaning output folder
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m25.04 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m51.16 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 114ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m22.93 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m51.03 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 115ms
|
|
18
18
|
[34mDTS[39m Build start
|
|
19
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 5147ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.90 KB[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m1.90 KB[39m
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,55 @@
|
|
|
1
|
-
import * as fastify from 'fastify';
|
|
2
1
|
import * as http from 'http';
|
|
2
|
+
import * as fastify from 'fastify';
|
|
3
|
+
|
|
4
|
+
declare const defaultSwaggerConfig: {
|
|
5
|
+
openapi: {
|
|
6
|
+
openapi: string;
|
|
7
|
+
info: {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
version: string;
|
|
11
|
+
contact: {
|
|
12
|
+
name: string;
|
|
13
|
+
email: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
servers: {
|
|
17
|
+
url: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}[];
|
|
20
|
+
components: {
|
|
21
|
+
securitySchemes: {
|
|
22
|
+
bearerAuth: {
|
|
23
|
+
type: "http";
|
|
24
|
+
scheme: "bearer";
|
|
25
|
+
bearerFormat: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
security: {
|
|
30
|
+
bearerAuth: never[];
|
|
31
|
+
}[];
|
|
32
|
+
tags: {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare const defaultSwaggerUiConfig: {
|
|
39
|
+
routePrefix: string;
|
|
40
|
+
uiConfig: {
|
|
41
|
+
docExpansion: "full";
|
|
42
|
+
deepLinking: boolean;
|
|
43
|
+
};
|
|
44
|
+
staticCSP: boolean;
|
|
45
|
+
transformStaticCSP: (header: string) => string;
|
|
46
|
+
};
|
|
3
47
|
|
|
4
48
|
declare const LatticeGateway: {
|
|
5
49
|
startAsHttpEndpoint: ({ port }: {
|
|
6
50
|
port: number;
|
|
7
51
|
}) => Promise<void>;
|
|
52
|
+
configureSwagger: (app: fastify.FastifyInstance, customSwaggerConfig?: Partial<typeof defaultSwaggerConfig>, customSwaggerUiConfig?: Partial<typeof defaultSwaggerUiConfig>) => Promise<void>;
|
|
8
53
|
app: fastify.FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<fastify.FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
|
|
9
54
|
__linterBrands: "SafePromiseLike";
|
|
10
55
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,55 @@
|
|
|
1
|
-
import * as fastify from 'fastify';
|
|
2
1
|
import * as http from 'http';
|
|
2
|
+
import * as fastify from 'fastify';
|
|
3
|
+
|
|
4
|
+
declare const defaultSwaggerConfig: {
|
|
5
|
+
openapi: {
|
|
6
|
+
openapi: string;
|
|
7
|
+
info: {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
version: string;
|
|
11
|
+
contact: {
|
|
12
|
+
name: string;
|
|
13
|
+
email: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
servers: {
|
|
17
|
+
url: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}[];
|
|
20
|
+
components: {
|
|
21
|
+
securitySchemes: {
|
|
22
|
+
bearerAuth: {
|
|
23
|
+
type: "http";
|
|
24
|
+
scheme: "bearer";
|
|
25
|
+
bearerFormat: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
security: {
|
|
30
|
+
bearerAuth: never[];
|
|
31
|
+
}[];
|
|
32
|
+
tags: {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare const defaultSwaggerUiConfig: {
|
|
39
|
+
routePrefix: string;
|
|
40
|
+
uiConfig: {
|
|
41
|
+
docExpansion: "full";
|
|
42
|
+
deepLinking: boolean;
|
|
43
|
+
};
|
|
44
|
+
staticCSP: boolean;
|
|
45
|
+
transformStaticCSP: (header: string) => string;
|
|
46
|
+
};
|
|
3
47
|
|
|
4
48
|
declare const LatticeGateway: {
|
|
5
49
|
startAsHttpEndpoint: ({ port }: {
|
|
6
50
|
port: number;
|
|
7
51
|
}) => Promise<void>;
|
|
52
|
+
configureSwagger: (app: fastify.FastifyInstance, customSwaggerConfig?: Partial<typeof defaultSwaggerConfig>, customSwaggerUiConfig?: Partial<typeof defaultSwaggerUiConfig>) => Promise<void>;
|
|
8
53
|
app: fastify.FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<fastify.FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
|
|
9
54
|
__linterBrands: "SafePromiseLike";
|
|
10
55
|
};
|
package/dist/index.js
CHANGED
|
@@ -451,31 +451,230 @@ var getAgentGraph = async (request, reply) => {
|
|
|
451
451
|
}
|
|
452
452
|
};
|
|
453
453
|
|
|
454
|
+
// src/schemas/index.ts
|
|
455
|
+
var createRunSchema = {
|
|
456
|
+
description: "Create a new agent run",
|
|
457
|
+
tags: ["Runs"],
|
|
458
|
+
summary: "Create Agent Run",
|
|
459
|
+
body: {
|
|
460
|
+
type: "object",
|
|
461
|
+
properties: {
|
|
462
|
+
assistantId: { type: "string", description: "Assistant ID" },
|
|
463
|
+
threadId: { type: "string", description: "Thread ID" },
|
|
464
|
+
input: { type: "object", description: "Input data for the run" }
|
|
465
|
+
},
|
|
466
|
+
required: ["assistantId", "threadId"]
|
|
467
|
+
},
|
|
468
|
+
response: {
|
|
469
|
+
200: {
|
|
470
|
+
type: "object",
|
|
471
|
+
properties: {
|
|
472
|
+
success: { type: "boolean" },
|
|
473
|
+
data: { type: "object" }
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
400: {
|
|
477
|
+
type: "object",
|
|
478
|
+
properties: {
|
|
479
|
+
success: { type: "boolean" },
|
|
480
|
+
error: { type: "string" }
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
var getAllMemoryItemsSchema = {
|
|
486
|
+
description: "Get all memory items for an assistant thread",
|
|
487
|
+
tags: ["Memory"],
|
|
488
|
+
summary: "Get All Memory Items",
|
|
489
|
+
params: {
|
|
490
|
+
type: "object",
|
|
491
|
+
properties: {
|
|
492
|
+
assistantId: { type: "string", description: "Assistant ID" },
|
|
493
|
+
thread_id: { type: "string", description: "Thread ID" }
|
|
494
|
+
},
|
|
495
|
+
required: ["assistantId", "thread_id"]
|
|
496
|
+
},
|
|
497
|
+
response: {
|
|
498
|
+
200: {
|
|
499
|
+
type: "object",
|
|
500
|
+
properties: {
|
|
501
|
+
success: { type: "boolean" },
|
|
502
|
+
data: { type: "array", items: { type: "object" } }
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
var getAgentStateSchema = {
|
|
508
|
+
description: "Get agent state for an assistant thread",
|
|
509
|
+
tags: ["Memory"],
|
|
510
|
+
summary: "Get Agent State",
|
|
511
|
+
params: {
|
|
512
|
+
type: "object",
|
|
513
|
+
properties: {
|
|
514
|
+
assistantId: { type: "string", description: "Assistant ID" },
|
|
515
|
+
thread_id: { type: "string", description: "Thread ID" }
|
|
516
|
+
},
|
|
517
|
+
required: ["assistantId", "thread_id"]
|
|
518
|
+
},
|
|
519
|
+
response: {
|
|
520
|
+
200: {
|
|
521
|
+
type: "object",
|
|
522
|
+
properties: {
|
|
523
|
+
success: { type: "boolean" },
|
|
524
|
+
data: { type: "object" }
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
var getMemoryItemSchema = {
|
|
530
|
+
description: "Get a specific memory item by key",
|
|
531
|
+
tags: ["Memory"],
|
|
532
|
+
summary: "Get Memory Item",
|
|
533
|
+
params: {
|
|
534
|
+
type: "object",
|
|
535
|
+
properties: {
|
|
536
|
+
assistantId: { type: "string", description: "Assistant ID" },
|
|
537
|
+
key: { type: "string", description: "Memory key" }
|
|
538
|
+
},
|
|
539
|
+
required: ["assistantId", "key"]
|
|
540
|
+
},
|
|
541
|
+
response: {
|
|
542
|
+
200: {
|
|
543
|
+
type: "object",
|
|
544
|
+
properties: {
|
|
545
|
+
success: { type: "boolean" },
|
|
546
|
+
data: { type: "object" }
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
var setMemoryItemSchema = {
|
|
552
|
+
description: "Set or update a memory item",
|
|
553
|
+
tags: ["Memory"],
|
|
554
|
+
summary: "Set Memory Item",
|
|
555
|
+
params: {
|
|
556
|
+
type: "object",
|
|
557
|
+
properties: {
|
|
558
|
+
assistantId: { type: "string", description: "Assistant ID" },
|
|
559
|
+
key: { type: "string", description: "Memory key" }
|
|
560
|
+
},
|
|
561
|
+
required: ["assistantId", "key"]
|
|
562
|
+
},
|
|
563
|
+
body: {
|
|
564
|
+
type: "object",
|
|
565
|
+
description: "Memory item data"
|
|
566
|
+
},
|
|
567
|
+
response: {
|
|
568
|
+
200: {
|
|
569
|
+
type: "object",
|
|
570
|
+
properties: {
|
|
571
|
+
success: { type: "boolean" },
|
|
572
|
+
data: { type: "object" }
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
var deleteMemoryItemSchema = {
|
|
578
|
+
description: "Delete a specific memory item",
|
|
579
|
+
tags: ["Memory"],
|
|
580
|
+
summary: "Delete Memory Item",
|
|
581
|
+
params: {
|
|
582
|
+
type: "object",
|
|
583
|
+
properties: {
|
|
584
|
+
assistantId: { type: "string", description: "Assistant ID" },
|
|
585
|
+
key: { type: "string", description: "Memory key" }
|
|
586
|
+
},
|
|
587
|
+
required: ["assistantId", "key"]
|
|
588
|
+
},
|
|
589
|
+
response: {
|
|
590
|
+
200: {
|
|
591
|
+
type: "object",
|
|
592
|
+
properties: {
|
|
593
|
+
success: { type: "boolean" }
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
var clearMemorySchema = {
|
|
599
|
+
description: "Clear all memory items for an assistant",
|
|
600
|
+
tags: ["Memory"],
|
|
601
|
+
summary: "Clear Memory",
|
|
602
|
+
params: {
|
|
603
|
+
type: "object",
|
|
604
|
+
properties: {
|
|
605
|
+
assistantId: { type: "string", description: "Assistant ID" }
|
|
606
|
+
},
|
|
607
|
+
required: ["assistantId"]
|
|
608
|
+
},
|
|
609
|
+
response: {
|
|
610
|
+
200: {
|
|
611
|
+
type: "object",
|
|
612
|
+
properties: {
|
|
613
|
+
success: { type: "boolean" }
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
var getAgentGraphSchema = {
|
|
619
|
+
description: "Get agent graph visualization",
|
|
620
|
+
tags: ["Graph"],
|
|
621
|
+
summary: "Get Agent Graph",
|
|
622
|
+
params: {
|
|
623
|
+
type: "object",
|
|
624
|
+
properties: {
|
|
625
|
+
assistantId: { type: "string", description: "Assistant ID" }
|
|
626
|
+
},
|
|
627
|
+
required: ["assistantId"]
|
|
628
|
+
},
|
|
629
|
+
response: {
|
|
630
|
+
200: {
|
|
631
|
+
type: "object",
|
|
632
|
+
properties: {
|
|
633
|
+
success: { type: "boolean" },
|
|
634
|
+
data: { type: "object" }
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
|
|
454
640
|
// src/routes/index.ts
|
|
455
641
|
var registerRoutes = (app2) => {
|
|
456
|
-
app2.post("/api/runs", createRun);
|
|
642
|
+
app2.post("/api/runs", { schema: createRunSchema }, createRun);
|
|
457
643
|
app2.get(
|
|
458
644
|
"/api/assistants/:assistantId/:thread_id/memory",
|
|
645
|
+
{ schema: getAllMemoryItemsSchema },
|
|
459
646
|
getAllMemoryItems
|
|
460
647
|
);
|
|
461
648
|
app2.get(
|
|
462
649
|
"/api/assistants/:assistantId/:thread_id/state",
|
|
650
|
+
{ schema: getAgentStateSchema },
|
|
463
651
|
getAgentState
|
|
464
652
|
);
|
|
465
653
|
app2.get(
|
|
466
654
|
"/api/assistants/:assistantId/memory/:key",
|
|
655
|
+
{ schema: getMemoryItemSchema },
|
|
467
656
|
getMemoryItem
|
|
468
657
|
);
|
|
469
658
|
app2.put(
|
|
470
659
|
"/api/assistants/:assistantId/memory/:key",
|
|
660
|
+
{ schema: setMemoryItemSchema },
|
|
471
661
|
setMemoryItem
|
|
472
662
|
);
|
|
473
663
|
app2.delete(
|
|
474
664
|
"/api/assistants/:assistantId/memory/:key",
|
|
665
|
+
{ schema: deleteMemoryItemSchema },
|
|
475
666
|
deleteMemoryItem
|
|
476
667
|
);
|
|
477
|
-
app2.delete(
|
|
478
|
-
|
|
668
|
+
app2.delete(
|
|
669
|
+
"/api/assistants/:assistantId/memory",
|
|
670
|
+
{ schema: clearMemorySchema },
|
|
671
|
+
clearMemory
|
|
672
|
+
);
|
|
673
|
+
app2.get(
|
|
674
|
+
"/api/assistants/:assistantId/graph",
|
|
675
|
+
{ schema: getAgentGraphSchema },
|
|
676
|
+
getAgentGraph
|
|
677
|
+
);
|
|
479
678
|
};
|
|
480
679
|
|
|
481
680
|
// src/logger/Logger.ts
|
|
@@ -616,6 +815,68 @@ var Logger = class _Logger {
|
|
|
616
815
|
}
|
|
617
816
|
};
|
|
618
817
|
|
|
818
|
+
// src/swagger.ts
|
|
819
|
+
var import_swagger = __toESM(require("@fastify/swagger"));
|
|
820
|
+
var import_swagger_ui = __toESM(require("@fastify/swagger-ui"));
|
|
821
|
+
var defaultSwaggerConfig = {
|
|
822
|
+
openapi: {
|
|
823
|
+
openapi: "3.0.0",
|
|
824
|
+
info: {
|
|
825
|
+
title: "Axiom Lattice Gateway API",
|
|
826
|
+
description: "API Gateway for LangGraph agent-based applications",
|
|
827
|
+
version: "1.0.0",
|
|
828
|
+
contact: {
|
|
829
|
+
name: "Axiom Lattice Team",
|
|
830
|
+
email: "support@axiom-lattice.com"
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
servers: [
|
|
834
|
+
{
|
|
835
|
+
url: "http://localhost:4001",
|
|
836
|
+
description: "Development environment"
|
|
837
|
+
}
|
|
838
|
+
],
|
|
839
|
+
components: {
|
|
840
|
+
securitySchemes: {
|
|
841
|
+
bearerAuth: {
|
|
842
|
+
type: "http",
|
|
843
|
+
scheme: "bearer",
|
|
844
|
+
bearerFormat: "JWT"
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
security: [
|
|
849
|
+
{
|
|
850
|
+
bearerAuth: []
|
|
851
|
+
}
|
|
852
|
+
],
|
|
853
|
+
tags: [
|
|
854
|
+
{ name: "Runs", description: "Agent run management" },
|
|
855
|
+
{ name: "Memory", description: "Agent memory management" },
|
|
856
|
+
{ name: "Graph", description: "Agent graph visualization" },
|
|
857
|
+
{ name: "Health", description: "System health checks" }
|
|
858
|
+
]
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
var defaultSwaggerUiConfig = {
|
|
862
|
+
routePrefix: "/api-docs",
|
|
863
|
+
uiConfig: {
|
|
864
|
+
docExpansion: "full",
|
|
865
|
+
deepLinking: false
|
|
866
|
+
},
|
|
867
|
+
staticCSP: true,
|
|
868
|
+
transformStaticCSP: (header) => header
|
|
869
|
+
};
|
|
870
|
+
var configureSwagger = async (app2, customSwaggerConfig, customSwaggerUiConfig) => {
|
|
871
|
+
const swaggerConfig = { ...defaultSwaggerConfig, ...customSwaggerConfig };
|
|
872
|
+
const swaggerUiConfig = {
|
|
873
|
+
...defaultSwaggerUiConfig,
|
|
874
|
+
...customSwaggerUiConfig
|
|
875
|
+
};
|
|
876
|
+
await app2.register(import_swagger.default, swaggerConfig);
|
|
877
|
+
await app2.register(import_swagger_ui.default, swaggerUiConfig);
|
|
878
|
+
};
|
|
879
|
+
|
|
619
880
|
// src/index.ts
|
|
620
881
|
process.on("unhandledRejection", (reason, promise) => {
|
|
621
882
|
console.error("\u672A\u5904\u7406\u7684Promise\u62D2\u7EDD:", reason);
|
|
@@ -676,9 +937,9 @@ app.setErrorHandler((error, request, reply) => {
|
|
|
676
937
|
});
|
|
677
938
|
});
|
|
678
939
|
app.decorate("logger", logger);
|
|
679
|
-
registerRoutes(app);
|
|
680
940
|
var start = async ({ port }) => {
|
|
681
941
|
try {
|
|
942
|
+
registerRoutes(app);
|
|
682
943
|
const target_port = port || Number(process.env.PORT) || 4001;
|
|
683
944
|
await app.listen({ port: target_port, host: "0.0.0.0" });
|
|
684
945
|
logger.info(`Lattice Gateway is running on port: ${port}`);
|
|
@@ -689,6 +950,7 @@ var start = async ({ port }) => {
|
|
|
689
950
|
};
|
|
690
951
|
var LatticeGateway = {
|
|
691
952
|
startAsHttpEndpoint: start,
|
|
953
|
+
configureSwagger,
|
|
692
954
|
app
|
|
693
955
|
};
|
|
694
956
|
// Annotate the CommonJS export names for ESM import in node:
|