@axiom-lattice/core 2.1.42 → 2.1.44
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/dist/index.d.mts +55 -8
- package/dist/index.d.ts +55 -8
- package/dist/index.js +181 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +182 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2253,21 +2253,44 @@ interface ThreadQueueConfig {
|
|
|
2253
2253
|
}
|
|
2254
2254
|
interface PendingMessage {
|
|
2255
2255
|
id: string;
|
|
2256
|
-
content:
|
|
2256
|
+
content: PendingMessageContent;
|
|
2257
2257
|
type: "human" | "system";
|
|
2258
2258
|
sequence: number;
|
|
2259
2259
|
createdAt: Date;
|
|
2260
2260
|
priority?: number;
|
|
2261
|
-
command?:
|
|
2261
|
+
command?: CommandParams<unknown>;
|
|
2262
2262
|
}
|
|
2263
|
+
interface PendingQueueMessageInput {
|
|
2264
|
+
message: string;
|
|
2265
|
+
id?: string;
|
|
2266
|
+
messages?: unknown[];
|
|
2267
|
+
[key: string]: unknown;
|
|
2268
|
+
}
|
|
2269
|
+
interface PendingQueueMessage {
|
|
2270
|
+
input: PendingQueueMessageInput;
|
|
2271
|
+
command?: CommandParams<unknown>;
|
|
2272
|
+
custom_run_config?: unknown;
|
|
2273
|
+
}
|
|
2274
|
+
interface HumanPendingMessageContent {
|
|
2275
|
+
id: string;
|
|
2276
|
+
message: string;
|
|
2277
|
+
queueMessage: PendingQueueMessage;
|
|
2278
|
+
}
|
|
2279
|
+
interface SystemPendingMessageContent {
|
|
2280
|
+
role: "system";
|
|
2281
|
+
content: string;
|
|
2282
|
+
metadata?: Record<string, unknown>;
|
|
2283
|
+
}
|
|
2284
|
+
type PendingMessageContent = HumanPendingMessageContent | SystemPendingMessageContent | string;
|
|
2263
2285
|
interface AddMessageParams {
|
|
2264
2286
|
threadId: string;
|
|
2265
2287
|
tenantId: string;
|
|
2266
2288
|
assistantId: string;
|
|
2267
|
-
content:
|
|
2289
|
+
content: PendingMessageContent;
|
|
2268
2290
|
type?: "human" | "system";
|
|
2269
2291
|
priority?: number;
|
|
2270
|
-
command?:
|
|
2292
|
+
command?: CommandParams<unknown>;
|
|
2293
|
+
id?: string;
|
|
2271
2294
|
}
|
|
2272
2295
|
interface ThreadInfo {
|
|
2273
2296
|
tenantId: string;
|
|
@@ -2280,7 +2303,7 @@ interface ThreadInfo {
|
|
|
2280
2303
|
*/
|
|
2281
2304
|
interface IMessageQueueStore {
|
|
2282
2305
|
addMessage(params: AddMessageParams): Promise<PendingMessage>;
|
|
2283
|
-
addMessageAtHead(threadId: string, content:
|
|
2306
|
+
addMessageAtHead(threadId: string, content: PendingMessageContent, type?: "human" | "system", id?: string, command?: CommandParams<unknown>): Promise<PendingMessage>;
|
|
2284
2307
|
getPendingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
2285
2308
|
getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
2286
2309
|
getQueueSize(threadId: string): Promise<number>;
|
|
@@ -2290,6 +2313,7 @@ interface IMessageQueueStore {
|
|
|
2290
2313
|
markProcessing(messageId: string): Promise<void>;
|
|
2291
2314
|
markCompleted(messageId: string): Promise<void>;
|
|
2292
2315
|
clearCompletedMessages(threadId: string): Promise<void>;
|
|
2316
|
+
resetProcessingToPending(threadId: string): Promise<number>;
|
|
2293
2317
|
}
|
|
2294
2318
|
/**
|
|
2295
2319
|
* Agent executor function type
|
|
@@ -2847,7 +2871,7 @@ declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
2847
2871
|
private generateId;
|
|
2848
2872
|
private getMessagesForThread;
|
|
2849
2873
|
addMessage(params: AddMessageParams): Promise<PendingMessage>;
|
|
2850
|
-
addMessageAtHead(threadId: string, content:
|
|
2874
|
+
addMessageAtHead(threadId: string, content: PendingMessageContent, type?: "human" | "system", id?: string, command?: CommandParams<unknown>): Promise<PendingMessage>;
|
|
2851
2875
|
getPendingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
2852
2876
|
getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
2853
2877
|
getQueueSize(threadId: string): Promise<number>;
|
|
@@ -2857,6 +2881,7 @@ declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
2857
2881
|
markProcessing(messageId: string): Promise<void>;
|
|
2858
2882
|
markCompleted(messageId: string): Promise<void>;
|
|
2859
2883
|
clearCompletedMessages(threadId: string): Promise<void>;
|
|
2884
|
+
resetProcessingToPending(threadId: string): Promise<number>;
|
|
2860
2885
|
}
|
|
2861
2886
|
|
|
2862
2887
|
/**
|
|
@@ -4926,6 +4951,7 @@ interface ThreadState {
|
|
|
4926
4951
|
interface QueueMessage {
|
|
4927
4952
|
input: {
|
|
4928
4953
|
message: string;
|
|
4954
|
+
id?: string;
|
|
4929
4955
|
};
|
|
4930
4956
|
command?: CommandParams<any>;
|
|
4931
4957
|
custom_run_config?: any;
|
|
@@ -5007,6 +5033,7 @@ declare class Agent {
|
|
|
5007
5033
|
queueMode: ThreadQueueConfig;
|
|
5008
5034
|
private isWaitingForQueueEnd;
|
|
5009
5035
|
constructor({ assistant_id, thread_id, tenant_id, workspace_id, project_id, custom_run_config, }: AgentThreadInterface);
|
|
5036
|
+
private getHumanPendingContent;
|
|
5010
5037
|
/**
|
|
5011
5038
|
* Initialize with message queue store
|
|
5012
5039
|
*/
|
|
@@ -5048,9 +5075,9 @@ declare class Agent {
|
|
|
5048
5075
|
}>;
|
|
5049
5076
|
/**
|
|
5050
5077
|
* Start queue processor if not already running
|
|
5051
|
-
*
|
|
5078
|
+
* Public method to allow external triggering (e.g., from recovery)
|
|
5052
5079
|
*/
|
|
5053
|
-
|
|
5080
|
+
startQueueProcessorIfNeeded(): Promise<void>;
|
|
5054
5081
|
/**
|
|
5055
5082
|
* Remove pending message
|
|
5056
5083
|
*/
|
|
@@ -5067,6 +5094,12 @@ declare class Agent {
|
|
|
5067
5094
|
}[]>;
|
|
5068
5095
|
get_draw_graph(): Promise<string>;
|
|
5069
5096
|
getRunStatus(): Promise<ThreadStatus>;
|
|
5097
|
+
/**
|
|
5098
|
+
* Resume task processing after server restart
|
|
5099
|
+
* Resets any stuck processing messages to pending and starts queue processing
|
|
5100
|
+
* Note: Does not rely on LangGraph state as it may be stale after crash/restart
|
|
5101
|
+
*/
|
|
5102
|
+
resumeTask(): Promise<void>;
|
|
5070
5103
|
/**
|
|
5071
5104
|
* Abort the current agent execution
|
|
5072
5105
|
* This will cancel any ongoing invoke or stream operations
|
|
@@ -5129,6 +5162,20 @@ declare class AgentInstanceManager {
|
|
|
5129
5162
|
* Clear all agent instances (use with caution)
|
|
5130
5163
|
*/
|
|
5131
5164
|
clearAll(): void;
|
|
5165
|
+
/**
|
|
5166
|
+
* Restore agent instances for threads with pending messages after server restart
|
|
5167
|
+
* Queries the message queue store for threads with pending/processing messages
|
|
5168
|
+
* and recreates agent instances to resume processing
|
|
5169
|
+
*/
|
|
5170
|
+
restore(): Promise<{
|
|
5171
|
+
restored: number;
|
|
5172
|
+
errors: number;
|
|
5173
|
+
}>;
|
|
5174
|
+
/**
|
|
5175
|
+
* Restore a single thread
|
|
5176
|
+
* Delegates actual recovery logic to Agent.resumeTask()
|
|
5177
|
+
*/
|
|
5178
|
+
private restoreThread;
|
|
5132
5179
|
}
|
|
5133
5180
|
declare const agentInstanceManager: AgentInstanceManager;
|
|
5134
5181
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2253,21 +2253,44 @@ interface ThreadQueueConfig {
|
|
|
2253
2253
|
}
|
|
2254
2254
|
interface PendingMessage {
|
|
2255
2255
|
id: string;
|
|
2256
|
-
content:
|
|
2256
|
+
content: PendingMessageContent;
|
|
2257
2257
|
type: "human" | "system";
|
|
2258
2258
|
sequence: number;
|
|
2259
2259
|
createdAt: Date;
|
|
2260
2260
|
priority?: number;
|
|
2261
|
-
command?:
|
|
2261
|
+
command?: CommandParams<unknown>;
|
|
2262
2262
|
}
|
|
2263
|
+
interface PendingQueueMessageInput {
|
|
2264
|
+
message: string;
|
|
2265
|
+
id?: string;
|
|
2266
|
+
messages?: unknown[];
|
|
2267
|
+
[key: string]: unknown;
|
|
2268
|
+
}
|
|
2269
|
+
interface PendingQueueMessage {
|
|
2270
|
+
input: PendingQueueMessageInput;
|
|
2271
|
+
command?: CommandParams<unknown>;
|
|
2272
|
+
custom_run_config?: unknown;
|
|
2273
|
+
}
|
|
2274
|
+
interface HumanPendingMessageContent {
|
|
2275
|
+
id: string;
|
|
2276
|
+
message: string;
|
|
2277
|
+
queueMessage: PendingQueueMessage;
|
|
2278
|
+
}
|
|
2279
|
+
interface SystemPendingMessageContent {
|
|
2280
|
+
role: "system";
|
|
2281
|
+
content: string;
|
|
2282
|
+
metadata?: Record<string, unknown>;
|
|
2283
|
+
}
|
|
2284
|
+
type PendingMessageContent = HumanPendingMessageContent | SystemPendingMessageContent | string;
|
|
2263
2285
|
interface AddMessageParams {
|
|
2264
2286
|
threadId: string;
|
|
2265
2287
|
tenantId: string;
|
|
2266
2288
|
assistantId: string;
|
|
2267
|
-
content:
|
|
2289
|
+
content: PendingMessageContent;
|
|
2268
2290
|
type?: "human" | "system";
|
|
2269
2291
|
priority?: number;
|
|
2270
|
-
command?:
|
|
2292
|
+
command?: CommandParams<unknown>;
|
|
2293
|
+
id?: string;
|
|
2271
2294
|
}
|
|
2272
2295
|
interface ThreadInfo {
|
|
2273
2296
|
tenantId: string;
|
|
@@ -2280,7 +2303,7 @@ interface ThreadInfo {
|
|
|
2280
2303
|
*/
|
|
2281
2304
|
interface IMessageQueueStore {
|
|
2282
2305
|
addMessage(params: AddMessageParams): Promise<PendingMessage>;
|
|
2283
|
-
addMessageAtHead(threadId: string, content:
|
|
2306
|
+
addMessageAtHead(threadId: string, content: PendingMessageContent, type?: "human" | "system", id?: string, command?: CommandParams<unknown>): Promise<PendingMessage>;
|
|
2284
2307
|
getPendingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
2285
2308
|
getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
2286
2309
|
getQueueSize(threadId: string): Promise<number>;
|
|
@@ -2290,6 +2313,7 @@ interface IMessageQueueStore {
|
|
|
2290
2313
|
markProcessing(messageId: string): Promise<void>;
|
|
2291
2314
|
markCompleted(messageId: string): Promise<void>;
|
|
2292
2315
|
clearCompletedMessages(threadId: string): Promise<void>;
|
|
2316
|
+
resetProcessingToPending(threadId: string): Promise<number>;
|
|
2293
2317
|
}
|
|
2294
2318
|
/**
|
|
2295
2319
|
* Agent executor function type
|
|
@@ -2847,7 +2871,7 @@ declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
2847
2871
|
private generateId;
|
|
2848
2872
|
private getMessagesForThread;
|
|
2849
2873
|
addMessage(params: AddMessageParams): Promise<PendingMessage>;
|
|
2850
|
-
addMessageAtHead(threadId: string, content:
|
|
2874
|
+
addMessageAtHead(threadId: string, content: PendingMessageContent, type?: "human" | "system", id?: string, command?: CommandParams<unknown>): Promise<PendingMessage>;
|
|
2851
2875
|
getPendingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
2852
2876
|
getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
2853
2877
|
getQueueSize(threadId: string): Promise<number>;
|
|
@@ -2857,6 +2881,7 @@ declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
2857
2881
|
markProcessing(messageId: string): Promise<void>;
|
|
2858
2882
|
markCompleted(messageId: string): Promise<void>;
|
|
2859
2883
|
clearCompletedMessages(threadId: string): Promise<void>;
|
|
2884
|
+
resetProcessingToPending(threadId: string): Promise<number>;
|
|
2860
2885
|
}
|
|
2861
2886
|
|
|
2862
2887
|
/**
|
|
@@ -4926,6 +4951,7 @@ interface ThreadState {
|
|
|
4926
4951
|
interface QueueMessage {
|
|
4927
4952
|
input: {
|
|
4928
4953
|
message: string;
|
|
4954
|
+
id?: string;
|
|
4929
4955
|
};
|
|
4930
4956
|
command?: CommandParams<any>;
|
|
4931
4957
|
custom_run_config?: any;
|
|
@@ -5007,6 +5033,7 @@ declare class Agent {
|
|
|
5007
5033
|
queueMode: ThreadQueueConfig;
|
|
5008
5034
|
private isWaitingForQueueEnd;
|
|
5009
5035
|
constructor({ assistant_id, thread_id, tenant_id, workspace_id, project_id, custom_run_config, }: AgentThreadInterface);
|
|
5036
|
+
private getHumanPendingContent;
|
|
5010
5037
|
/**
|
|
5011
5038
|
* Initialize with message queue store
|
|
5012
5039
|
*/
|
|
@@ -5048,9 +5075,9 @@ declare class Agent {
|
|
|
5048
5075
|
}>;
|
|
5049
5076
|
/**
|
|
5050
5077
|
* Start queue processor if not already running
|
|
5051
|
-
*
|
|
5078
|
+
* Public method to allow external triggering (e.g., from recovery)
|
|
5052
5079
|
*/
|
|
5053
|
-
|
|
5080
|
+
startQueueProcessorIfNeeded(): Promise<void>;
|
|
5054
5081
|
/**
|
|
5055
5082
|
* Remove pending message
|
|
5056
5083
|
*/
|
|
@@ -5067,6 +5094,12 @@ declare class Agent {
|
|
|
5067
5094
|
}[]>;
|
|
5068
5095
|
get_draw_graph(): Promise<string>;
|
|
5069
5096
|
getRunStatus(): Promise<ThreadStatus>;
|
|
5097
|
+
/**
|
|
5098
|
+
* Resume task processing after server restart
|
|
5099
|
+
* Resets any stuck processing messages to pending and starts queue processing
|
|
5100
|
+
* Note: Does not rely on LangGraph state as it may be stale after crash/restart
|
|
5101
|
+
*/
|
|
5102
|
+
resumeTask(): Promise<void>;
|
|
5070
5103
|
/**
|
|
5071
5104
|
* Abort the current agent execution
|
|
5072
5105
|
* This will cancel any ongoing invoke or stream operations
|
|
@@ -5129,6 +5162,20 @@ declare class AgentInstanceManager {
|
|
|
5129
5162
|
* Clear all agent instances (use with caution)
|
|
5130
5163
|
*/
|
|
5131
5164
|
clearAll(): void;
|
|
5165
|
+
/**
|
|
5166
|
+
* Restore agent instances for threads with pending messages after server restart
|
|
5167
|
+
* Queries the message queue store for threads with pending/processing messages
|
|
5168
|
+
* and recreates agent instances to resume processing
|
|
5169
|
+
*/
|
|
5170
|
+
restore(): Promise<{
|
|
5171
|
+
restored: number;
|
|
5172
|
+
errors: number;
|
|
5173
|
+
}>;
|
|
5174
|
+
/**
|
|
5175
|
+
* Restore a single thread
|
|
5176
|
+
* Delegates actual recovery logic to Agent.resumeTask()
|
|
5177
|
+
*/
|
|
5178
|
+
private restoreThread;
|
|
5132
5179
|
}
|
|
5133
5180
|
declare const agentInstanceManager: AgentInstanceManager;
|
|
5134
5181
|
|