@axiom-lattice/gateway 2.1.3 → 2.1.4

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,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/gateway@2.1.3 build /home/runner/work/agentic/agentic/packages/gateway
2
+ > @axiom-lattice/gateway@2.1.4 build /home/runner/work/agentic/agentic/packages/gateway
3
3
  > tsup src/index.ts --format cjs,esm --dts --clean --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,13 +9,13 @@
9
9
  CLI Cleaning output folder
10
10
  CJS Build start
11
11
  ESM Build start
12
- CJS dist/index.js 25.90 KB
13
- CJS dist/index.js.map 51.43 KB
14
- CJS ⚡️ Build success in 98ms
15
- ESM dist/index.mjs 23.82 KB
16
- ESM dist/index.mjs.map 51.35 KB
17
- ESM ⚡️ Build success in 97ms
12
+ ESM dist/index.mjs 39.83 KB
13
+ ESM dist/index.mjs.map 82.56 KB
14
+ ESM ⚡️ Build success in 117ms
15
+ CJS dist/index.js 41.78 KB
16
+ CJS dist/index.js.map 82.64 KB
17
+ CJS ⚡️ Build success in 119ms
18
18
  DTS Build start
19
- DTS ⚡️ Build success in 7834ms
20
- DTS dist/index.d.ts 1.97 KB
21
- DTS dist/index.d.mts 1.97 KB
19
+ DTS ⚡️ Build success in 9672ms
20
+ DTS dist/index.d.ts 3.32 KB
21
+ DTS dist/index.d.mts 3.32 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @axiom-lattice/gateway
2
2
 
3
+ ## 2.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - cf1e0fa: add agent task queue
8
+ - Updated dependencies [cf1e0fa]
9
+ - @axiom-lattice/core@2.1.3
10
+
3
11
  ## 2.1.3
4
12
 
5
13
  ### 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: ({ port }: {
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: ({ port }: {
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 };