@axiom-lattice/gateway 2.1.3 → 2.1.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.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +65 -4
- package/dist/index.d.ts +65 -4
- package/dist/index.js +606 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +612 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/controllers/agent_task.ts +65 -0
- package/src/index.ts +30 -4
- package/src/routes/index.ts +11 -0
- package/src/schemas/index.ts +53 -0
- package/src/services/AgentManager.ts +25 -21
- package/src/services/agent_task_consumer.ts +325 -0
- package/src/services/queue_service.ts +32 -71
- package/src/services/queue_service_memory.ts +85 -0
- package/src/services/queue_service_redis.ts +116 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/gateway@2.1.
|
|
2
|
+
> @axiom-lattice/gateway@2.1.5 build /home/runner/work/agentic/agentic/packages/gateway
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --clean --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
[34mCLI[39m Cleaning output folder
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
13
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
17
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m42.42 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m83.92 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 115ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m40.47 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m83.85 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 116ms
|
|
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 22792ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.32 KB[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.32 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @axiom-lattice/gateway
|
|
2
2
|
|
|
3
|
+
## 2.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e26477f: fix redis connect issue
|
|
8
|
+
|
|
9
|
+
## 2.1.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- cf1e0fa: add agent task queue
|
|
14
|
+
- Updated dependencies [cf1e0fa]
|
|
15
|
+
- @axiom-lattice/core@2.1.3
|
|
16
|
+
|
|
3
17
|
## 2.1.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -45,15 +45,76 @@ declare const defaultSwaggerUiConfig: {
|
|
|
45
45
|
transformStaticCSP: (header: string) => string;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
type QueueServiceType = "memory" | "redis";
|
|
49
|
+
|
|
50
|
+
interface AgentTaskRequest {
|
|
51
|
+
assistant_id: string;
|
|
52
|
+
input: any;
|
|
53
|
+
thread_id: string;
|
|
54
|
+
"x-tenant-id": string;
|
|
55
|
+
command?: any;
|
|
56
|
+
callback_event?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Agent任务消费者
|
|
60
|
+
* 负责监听和执行Agent任务事件,同时从队列中消费任务
|
|
61
|
+
*/
|
|
62
|
+
declare class AgentTaskConsumer {
|
|
63
|
+
private isPolling;
|
|
64
|
+
private pollingInterval;
|
|
65
|
+
private pollingIntervalMs;
|
|
66
|
+
private maxConcurrentTasks;
|
|
67
|
+
private activeTasks;
|
|
68
|
+
private processing;
|
|
69
|
+
private immediateProcessingEnabled;
|
|
70
|
+
gatewayPort: number;
|
|
71
|
+
static agent_run_endpoint: string;
|
|
72
|
+
constructor(gatewayPort: number, pollingIntervalMs?: number);
|
|
73
|
+
/**
|
|
74
|
+
* 初始化事件监听和队列轮询
|
|
75
|
+
*/
|
|
76
|
+
private initialize;
|
|
77
|
+
/**
|
|
78
|
+
* 启动队列轮询
|
|
79
|
+
*/
|
|
80
|
+
startPollingQueue(): void;
|
|
81
|
+
/**
|
|
82
|
+
* 停止队列轮询
|
|
83
|
+
*/
|
|
84
|
+
stopPollingQueue(): void;
|
|
85
|
+
/**
|
|
86
|
+
* 处理单个任务并在完成后立即尝试处理下一个
|
|
87
|
+
*/
|
|
88
|
+
processNextTask(): Promise<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* 检查队列中是否有任务并处理
|
|
91
|
+
*/
|
|
92
|
+
checkQueueForTasks(): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* 从队列中消费任务
|
|
95
|
+
*/
|
|
96
|
+
consumeFromQueue(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* 处理通过事件触发的任务
|
|
99
|
+
*/
|
|
100
|
+
trigger_agent_task(taskRequest: AgentTaskRequest): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface LatticeGatewayConfig {
|
|
104
|
+
port?: number;
|
|
105
|
+
queueServiceConfig?: {
|
|
106
|
+
type: QueueServiceType;
|
|
107
|
+
defaultStartPollingQueue: boolean;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
48
110
|
declare const LatticeGateway: {
|
|
49
|
-
startAsHttpEndpoint: (
|
|
50
|
-
port: number;
|
|
51
|
-
}) => Promise<void>;
|
|
111
|
+
startAsHttpEndpoint: (config?: LatticeGatewayConfig) => Promise<void>;
|
|
52
112
|
configureSwagger: (app: fastify.FastifyInstance, customSwaggerConfig?: Partial<typeof defaultSwaggerConfig>, customSwaggerUiConfig?: Partial<typeof defaultSwaggerUiConfig>) => Promise<void>;
|
|
53
113
|
registerLatticeRoutes: (app: fastify.FastifyInstance) => void;
|
|
54
114
|
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>> & {
|
|
55
115
|
__linterBrands: "SafePromiseLike";
|
|
56
116
|
};
|
|
117
|
+
AgentTaskConsumer: typeof AgentTaskConsumer;
|
|
57
118
|
};
|
|
58
119
|
|
|
59
|
-
export { LatticeGateway };
|
|
120
|
+
export { LatticeGateway, type LatticeGatewayConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,15 +45,76 @@ declare const defaultSwaggerUiConfig: {
|
|
|
45
45
|
transformStaticCSP: (header: string) => string;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
type QueueServiceType = "memory" | "redis";
|
|
49
|
+
|
|
50
|
+
interface AgentTaskRequest {
|
|
51
|
+
assistant_id: string;
|
|
52
|
+
input: any;
|
|
53
|
+
thread_id: string;
|
|
54
|
+
"x-tenant-id": string;
|
|
55
|
+
command?: any;
|
|
56
|
+
callback_event?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Agent任务消费者
|
|
60
|
+
* 负责监听和执行Agent任务事件,同时从队列中消费任务
|
|
61
|
+
*/
|
|
62
|
+
declare class AgentTaskConsumer {
|
|
63
|
+
private isPolling;
|
|
64
|
+
private pollingInterval;
|
|
65
|
+
private pollingIntervalMs;
|
|
66
|
+
private maxConcurrentTasks;
|
|
67
|
+
private activeTasks;
|
|
68
|
+
private processing;
|
|
69
|
+
private immediateProcessingEnabled;
|
|
70
|
+
gatewayPort: number;
|
|
71
|
+
static agent_run_endpoint: string;
|
|
72
|
+
constructor(gatewayPort: number, pollingIntervalMs?: number);
|
|
73
|
+
/**
|
|
74
|
+
* 初始化事件监听和队列轮询
|
|
75
|
+
*/
|
|
76
|
+
private initialize;
|
|
77
|
+
/**
|
|
78
|
+
* 启动队列轮询
|
|
79
|
+
*/
|
|
80
|
+
startPollingQueue(): void;
|
|
81
|
+
/**
|
|
82
|
+
* 停止队列轮询
|
|
83
|
+
*/
|
|
84
|
+
stopPollingQueue(): void;
|
|
85
|
+
/**
|
|
86
|
+
* 处理单个任务并在完成后立即尝试处理下一个
|
|
87
|
+
*/
|
|
88
|
+
processNextTask(): Promise<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* 检查队列中是否有任务并处理
|
|
91
|
+
*/
|
|
92
|
+
checkQueueForTasks(): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* 从队列中消费任务
|
|
95
|
+
*/
|
|
96
|
+
consumeFromQueue(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* 处理通过事件触发的任务
|
|
99
|
+
*/
|
|
100
|
+
trigger_agent_task(taskRequest: AgentTaskRequest): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface LatticeGatewayConfig {
|
|
104
|
+
port?: number;
|
|
105
|
+
queueServiceConfig?: {
|
|
106
|
+
type: QueueServiceType;
|
|
107
|
+
defaultStartPollingQueue: boolean;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
48
110
|
declare const LatticeGateway: {
|
|
49
|
-
startAsHttpEndpoint: (
|
|
50
|
-
port: number;
|
|
51
|
-
}) => Promise<void>;
|
|
111
|
+
startAsHttpEndpoint: (config?: LatticeGatewayConfig) => Promise<void>;
|
|
52
112
|
configureSwagger: (app: fastify.FastifyInstance, customSwaggerConfig?: Partial<typeof defaultSwaggerConfig>, customSwaggerUiConfig?: Partial<typeof defaultSwaggerUiConfig>) => Promise<void>;
|
|
53
113
|
registerLatticeRoutes: (app: fastify.FastifyInstance) => void;
|
|
54
114
|
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>> & {
|
|
55
115
|
__linterBrands: "SafePromiseLike";
|
|
56
116
|
};
|
|
117
|
+
AgentTaskConsumer: typeof AgentTaskConsumer;
|
|
57
118
|
};
|
|
58
119
|
|
|
59
|
-
export { LatticeGateway };
|
|
120
|
+
export { LatticeGateway, type LatticeGatewayConfig };
|