@axiom-lattice/protocols 2.1.7 → 2.1.8
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +250 -42
- package/dist/index.d.ts +250 -42
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AgentLatticeProtocol.ts +16 -0
- package/src/ScheduleLatticeProtocol.ts +331 -52
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/protocols@2.1.
|
|
2
|
+
> @axiom-lattice/protocols@2.1.8 build /home/runner/work/agentic/agentic/packages/protocols
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in 44ms
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m2.11 KB[39m
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m11.38 KB[39m
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m2.87 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m19.75 KB[39m
|
|
16
13
|
[32mESM[39m ⚡️ Build success in 45ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.js [22m[32m4.28 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m20.52 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 47ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 2410ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m28.62 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m28.62 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -126,6 +126,16 @@ declare enum AgentType {
|
|
|
126
126
|
PLAN_EXECUTE = "plan_execute",
|
|
127
127
|
SEQUENTIAL = "sequential"
|
|
128
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Runtime configuration that will be injected into LangGraphRunnableConfig.configurable
|
|
131
|
+
* Tools can access these values via config.configurable.runConfig
|
|
132
|
+
*/
|
|
133
|
+
interface AgentRunConfig {
|
|
134
|
+
/** Database key for SQL tools (registered via sqlDatabaseManager) */
|
|
135
|
+
databaseKey?: string;
|
|
136
|
+
/** Any additional runtime configuration */
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}
|
|
129
139
|
/**
|
|
130
140
|
* Base agent configuration shared by all agent types
|
|
131
141
|
*/
|
|
@@ -136,6 +146,11 @@ interface BaseAgentConfig {
|
|
|
136
146
|
prompt: string;
|
|
137
147
|
schema?: ZodObject<any, any, any, any, any>;
|
|
138
148
|
modelKey?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Runtime configuration to inject into tool execution context
|
|
151
|
+
* Will be available in tools via config.configurable.runConfig
|
|
152
|
+
*/
|
|
153
|
+
runConfig?: AgentRunConfig;
|
|
139
154
|
}
|
|
140
155
|
/**
|
|
141
156
|
* REACT agent configuration
|
|
@@ -367,14 +382,36 @@ interface QueueLatticeProtocol extends BaseLatticeProtocol<QueueConfig, QueueCli
|
|
|
367
382
|
/**
|
|
368
383
|
* ScheduleLatticeProtocol
|
|
369
384
|
*
|
|
370
|
-
* Schedule Lattice protocol for delayed task execution management
|
|
385
|
+
* Schedule Lattice protocol for delayed and recurring task execution management
|
|
386
|
+
* Supports persistence and recovery after service restart
|
|
387
|
+
* Supports both one-time delayed tasks and cron-style recurring tasks
|
|
371
388
|
*/
|
|
372
389
|
|
|
373
390
|
/**
|
|
374
391
|
* Schedule service type enumeration
|
|
375
392
|
*/
|
|
376
393
|
declare enum ScheduleType {
|
|
377
|
-
MEMORY = "memory"
|
|
394
|
+
MEMORY = "memory",
|
|
395
|
+
POSTGRES = "postgres",
|
|
396
|
+
REDIS = "redis"
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Schedule execution type - one-time or recurring
|
|
400
|
+
*/
|
|
401
|
+
declare enum ScheduleExecutionType {
|
|
402
|
+
ONCE = "once",// Execute once at specified time
|
|
403
|
+
CRON = "cron"
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Task status enumeration
|
|
407
|
+
*/
|
|
408
|
+
declare enum ScheduledTaskStatus {
|
|
409
|
+
PENDING = "pending",// Waiting to be executed
|
|
410
|
+
RUNNING = "running",// Currently executing
|
|
411
|
+
COMPLETED = "completed",// Successfully completed (for ONCE type)
|
|
412
|
+
FAILED = "failed",// Execution failed
|
|
413
|
+
CANCELLED = "cancelled",// Manually cancelled
|
|
414
|
+
PAUSED = "paused"
|
|
378
415
|
}
|
|
379
416
|
/**
|
|
380
417
|
* Schedule configuration interface
|
|
@@ -383,77 +420,248 @@ interface ScheduleConfig {
|
|
|
383
420
|
name: string;
|
|
384
421
|
description: string;
|
|
385
422
|
type: ScheduleType;
|
|
423
|
+
storage?: ScheduleStorage;
|
|
386
424
|
options?: Record<string, any>;
|
|
387
425
|
}
|
|
388
426
|
/**
|
|
389
|
-
* Scheduled task
|
|
427
|
+
* Scheduled task definition - fully serializable
|
|
428
|
+
* Supports both one-time and cron-style recurring tasks
|
|
390
429
|
*/
|
|
391
|
-
interface
|
|
430
|
+
interface ScheduledTaskDefinition {
|
|
392
431
|
taskId: string;
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
432
|
+
taskType: string;
|
|
433
|
+
payload: Record<string, any>;
|
|
434
|
+
assistantId?: string;
|
|
435
|
+
threadId?: string;
|
|
436
|
+
executionType: ScheduleExecutionType;
|
|
437
|
+
executeAt?: number;
|
|
438
|
+
delayMs?: number;
|
|
439
|
+
cronExpression?: string;
|
|
440
|
+
timezone?: string;
|
|
441
|
+
nextRunAt?: number;
|
|
442
|
+
lastRunAt?: number;
|
|
443
|
+
status: ScheduledTaskStatus;
|
|
444
|
+
runCount: number;
|
|
445
|
+
maxRuns?: number;
|
|
446
|
+
retryCount: number;
|
|
447
|
+
maxRetries: number;
|
|
448
|
+
lastError?: string;
|
|
449
|
+
createdAt: number;
|
|
450
|
+
updatedAt: number;
|
|
451
|
+
expiresAt?: number;
|
|
452
|
+
metadata?: Record<string, any>;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Task handler function type
|
|
456
|
+
*/
|
|
457
|
+
type TaskHandler = (payload: Record<string, any>, taskInfo: ScheduledTaskDefinition) => void | Promise<void>;
|
|
458
|
+
/**
|
|
459
|
+
* Options for scheduling a one-time task
|
|
460
|
+
*/
|
|
461
|
+
interface ScheduleOnceOptions {
|
|
462
|
+
executeAt?: number;
|
|
463
|
+
delayMs?: number;
|
|
464
|
+
maxRetries?: number;
|
|
465
|
+
assistantId?: string;
|
|
466
|
+
threadId?: string;
|
|
467
|
+
metadata?: Record<string, any>;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Options for scheduling a cron task
|
|
471
|
+
*/
|
|
472
|
+
interface ScheduleCronOptions {
|
|
473
|
+
cronExpression: string;
|
|
474
|
+
timezone?: string;
|
|
475
|
+
maxRuns?: number;
|
|
476
|
+
expiresAt?: number;
|
|
477
|
+
maxRetries?: number;
|
|
478
|
+
assistantId?: string;
|
|
479
|
+
threadId?: string;
|
|
480
|
+
metadata?: Record<string, any>;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Schedule storage interface for persistence
|
|
484
|
+
*/
|
|
485
|
+
interface ScheduleStorage {
|
|
486
|
+
/**
|
|
487
|
+
* Save a new task
|
|
488
|
+
*/
|
|
489
|
+
save(task: ScheduledTaskDefinition): Promise<void>;
|
|
490
|
+
/**
|
|
491
|
+
* Get task by ID
|
|
492
|
+
*/
|
|
493
|
+
get(taskId: string): Promise<ScheduledTaskDefinition | null>;
|
|
494
|
+
/**
|
|
495
|
+
* Update task
|
|
496
|
+
*/
|
|
497
|
+
update(taskId: string, updates: Partial<ScheduledTaskDefinition>): Promise<void>;
|
|
498
|
+
/**
|
|
499
|
+
* Delete task
|
|
500
|
+
*/
|
|
501
|
+
delete(taskId: string): Promise<void>;
|
|
502
|
+
/**
|
|
503
|
+
* Get all pending/active tasks (for recovery)
|
|
504
|
+
* Returns tasks with status: PENDING or PAUSED
|
|
505
|
+
*/
|
|
506
|
+
getActiveTasks(): Promise<ScheduledTaskDefinition[]>;
|
|
507
|
+
/**
|
|
508
|
+
* Get tasks by type
|
|
509
|
+
*/
|
|
510
|
+
getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;
|
|
511
|
+
/**
|
|
512
|
+
* Get tasks by status
|
|
513
|
+
*/
|
|
514
|
+
getTasksByStatus(status: ScheduledTaskStatus): Promise<ScheduledTaskDefinition[]>;
|
|
515
|
+
/**
|
|
516
|
+
* Get tasks by execution type
|
|
517
|
+
*/
|
|
518
|
+
getTasksByExecutionType(executionType: ScheduleExecutionType): Promise<ScheduledTaskDefinition[]>;
|
|
519
|
+
/**
|
|
520
|
+
* Get tasks by assistant ID
|
|
521
|
+
*/
|
|
522
|
+
getTasksByAssistantId(assistantId: string): Promise<ScheduledTaskDefinition[]>;
|
|
523
|
+
/**
|
|
524
|
+
* Get tasks by thread ID
|
|
525
|
+
*/
|
|
526
|
+
getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;
|
|
527
|
+
/**
|
|
528
|
+
* Get all tasks (with optional filters)
|
|
529
|
+
*/
|
|
530
|
+
getAllTasks(filters?: {
|
|
531
|
+
status?: ScheduledTaskStatus;
|
|
532
|
+
executionType?: ScheduleExecutionType;
|
|
533
|
+
taskType?: string;
|
|
534
|
+
assistantId?: string;
|
|
535
|
+
threadId?: string;
|
|
536
|
+
limit?: number;
|
|
537
|
+
offset?: number;
|
|
538
|
+
}): Promise<ScheduledTaskDefinition[]>;
|
|
539
|
+
/**
|
|
540
|
+
* Count tasks (with optional filters)
|
|
541
|
+
*/
|
|
542
|
+
countTasks(filters?: {
|
|
543
|
+
status?: ScheduledTaskStatus;
|
|
544
|
+
executionType?: ScheduleExecutionType;
|
|
545
|
+
taskType?: string;
|
|
546
|
+
assistantId?: string;
|
|
547
|
+
threadId?: string;
|
|
548
|
+
}): Promise<number>;
|
|
549
|
+
/**
|
|
550
|
+
* Delete completed/cancelled tasks older than specified time
|
|
551
|
+
* Useful for cleanup
|
|
552
|
+
*/
|
|
553
|
+
deleteOldTasks(olderThanMs: number): Promise<number>;
|
|
396
554
|
}
|
|
397
555
|
/**
|
|
398
556
|
* Schedule client interface
|
|
399
557
|
*/
|
|
400
558
|
interface ScheduleClient {
|
|
401
559
|
/**
|
|
402
|
-
* Register a
|
|
403
|
-
*
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
560
|
+
* Register a handler for a task type
|
|
561
|
+
* Must be called before scheduling tasks of this type
|
|
562
|
+
*/
|
|
563
|
+
registerHandler(taskType: string, handler: TaskHandler): void;
|
|
564
|
+
/**
|
|
565
|
+
* Unregister a handler
|
|
566
|
+
*/
|
|
567
|
+
unregisterHandler(taskType: string): boolean;
|
|
568
|
+
/**
|
|
569
|
+
* Check if a handler is registered
|
|
407
570
|
*/
|
|
408
|
-
|
|
571
|
+
hasHandler(taskType: string): boolean;
|
|
409
572
|
/**
|
|
410
|
-
*
|
|
411
|
-
* @param taskId - The task identifier to cancel
|
|
412
|
-
* @returns true if task was found and cancelled, false otherwise
|
|
573
|
+
* Get all registered handler types
|
|
413
574
|
*/
|
|
414
|
-
|
|
575
|
+
getHandlerTypes(): string[];
|
|
415
576
|
/**
|
|
416
|
-
*
|
|
417
|
-
* @param taskId -
|
|
577
|
+
* Schedule a one-time task
|
|
578
|
+
* @param taskId - Unique identifier for the task
|
|
579
|
+
* @param taskType - Type of task (must have a registered handler)
|
|
580
|
+
* @param payload - Data to pass to the handler (must be JSON-serializable)
|
|
581
|
+
* @param options - Execution options (executeAt or delayMs required)
|
|
582
|
+
*/
|
|
583
|
+
scheduleOnce(taskId: string, taskType: string, payload: Record<string, any>, options: ScheduleOnceOptions): Promise<boolean>;
|
|
584
|
+
/**
|
|
585
|
+
* Schedule a recurring cron task
|
|
586
|
+
* @param taskId - Unique identifier for the task
|
|
587
|
+
* @param taskType - Type of task (must have a registered handler)
|
|
588
|
+
* @param payload - Data to pass to the handler (must be JSON-serializable)
|
|
589
|
+
* @param options - Cron options (cronExpression required)
|
|
418
590
|
*/
|
|
419
|
-
|
|
591
|
+
scheduleCron(taskId: string, taskType: string, payload: Record<string, any>, options: ScheduleCronOptions): Promise<boolean>;
|
|
420
592
|
/**
|
|
421
|
-
*
|
|
422
|
-
* @param taskId - The task identifier
|
|
423
|
-
* @returns Remaining time in ms, or -1 if task not found
|
|
593
|
+
* Cancel a scheduled task
|
|
424
594
|
*/
|
|
425
|
-
|
|
595
|
+
cancel(taskId: string): Promise<boolean>;
|
|
426
596
|
/**
|
|
427
|
-
*
|
|
597
|
+
* Pause a cron task (only for CRON type)
|
|
428
598
|
*/
|
|
429
|
-
|
|
599
|
+
pause(taskId: string): Promise<boolean>;
|
|
430
600
|
/**
|
|
431
|
-
*
|
|
601
|
+
* Resume a paused cron task (only for CRON type)
|
|
432
602
|
*/
|
|
433
|
-
|
|
603
|
+
resume(taskId: string): Promise<boolean>;
|
|
434
604
|
/**
|
|
435
|
-
*
|
|
605
|
+
* Check if a task exists
|
|
436
606
|
*/
|
|
437
|
-
|
|
607
|
+
has(taskId: string): Promise<boolean>;
|
|
438
608
|
/**
|
|
439
609
|
* Get task information
|
|
440
|
-
* @param taskId - The task identifier
|
|
441
|
-
* @returns Task info or null if not found
|
|
442
610
|
*/
|
|
443
|
-
|
|
611
|
+
getTask(taskId: string): Promise<ScheduledTaskDefinition | null>;
|
|
612
|
+
/**
|
|
613
|
+
* Get remaining time until next execution
|
|
614
|
+
* Returns -1 if task not found or already executed
|
|
615
|
+
*/
|
|
616
|
+
getRemainingTime(taskId: string): Promise<number>;
|
|
617
|
+
/**
|
|
618
|
+
* Get count of active tasks (pending + paused)
|
|
619
|
+
*/
|
|
620
|
+
getActiveTaskCount(): Promise<number>;
|
|
621
|
+
/**
|
|
622
|
+
* Get all active task IDs
|
|
623
|
+
*/
|
|
624
|
+
getActiveTaskIds(): Promise<string[]>;
|
|
625
|
+
/**
|
|
626
|
+
* Cancel all active tasks
|
|
627
|
+
*/
|
|
628
|
+
cancelAll(): Promise<void>;
|
|
629
|
+
/**
|
|
630
|
+
* Restore active tasks from storage (call on service startup)
|
|
631
|
+
* Re-schedules all pending tasks with their remaining time
|
|
632
|
+
* Re-schedules all cron tasks for their next run
|
|
633
|
+
* @returns Number of tasks restored
|
|
634
|
+
*/
|
|
635
|
+
restore(): Promise<number>;
|
|
636
|
+
/**
|
|
637
|
+
* Set the storage backend
|
|
638
|
+
*/
|
|
639
|
+
setStorage(storage: ScheduleStorage): void;
|
|
640
|
+
/**
|
|
641
|
+
* Get current storage backend
|
|
642
|
+
*/
|
|
643
|
+
getStorage(): ScheduleStorage | null;
|
|
444
644
|
}
|
|
445
645
|
/**
|
|
446
646
|
* Schedule Lattice protocol interface
|
|
447
647
|
*/
|
|
448
648
|
interface ScheduleLatticeProtocol extends BaseLatticeProtocol<ScheduleConfig, ScheduleClient> {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
649
|
+
registerHandler: (taskType: string, handler: TaskHandler) => void;
|
|
650
|
+
unregisterHandler: (taskType: string) => boolean;
|
|
651
|
+
hasHandler: (taskType: string) => boolean;
|
|
652
|
+
getHandlerTypes: () => string[];
|
|
653
|
+
scheduleOnce: (taskId: string, taskType: string, payload: Record<string, any>, options: ScheduleOnceOptions) => Promise<boolean>;
|
|
654
|
+
scheduleCron: (taskId: string, taskType: string, payload: Record<string, any>, options: ScheduleCronOptions) => Promise<boolean>;
|
|
655
|
+
cancel: (taskId: string) => Promise<boolean>;
|
|
656
|
+
pause: (taskId: string) => Promise<boolean>;
|
|
657
|
+
resume: (taskId: string) => Promise<boolean>;
|
|
658
|
+
has: (taskId: string) => Promise<boolean>;
|
|
659
|
+
getTask: (taskId: string) => Promise<ScheduledTaskDefinition | null>;
|
|
660
|
+
getRemainingTime: (taskId: string) => Promise<number>;
|
|
661
|
+
getActiveTaskCount: () => Promise<number>;
|
|
662
|
+
getActiveTaskIds: () => Promise<string[]>;
|
|
663
|
+
cancelAll: () => Promise<void>;
|
|
664
|
+
restore: () => Promise<number>;
|
|
457
665
|
}
|
|
458
666
|
|
|
459
667
|
/**
|
|
@@ -865,4 +1073,4 @@ type Timestamp = number;
|
|
|
865
1073
|
*/
|
|
866
1074
|
type Callback<T = any, R = void> = (data: T) => R | Promise<R>;
|
|
867
1075
|
|
|
868
|
-
export { type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, AgentType, type Assistant, type AssistantMessage, type AssistantStore, type BaseLatticeProtocol, type BaseMessage, type Callback, type CreateAssistantRequest, type CreateThreadRequest, type DeepAgentConfig, type DeveloperMessage, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type FilterCondition, type GraphBuildOptions, type ID, type InterruptMessage, type LLMConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type Message, type MessageChunk, type ModelLatticeProtocol, type PaginatedResult, type PaginationParams, type PlanExecuteAgentConfig, type QueryParams, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type Result, type ScheduleClient, type ScheduleConfig, type ScheduleLatticeProtocol, ScheduleType, type
|
|
1076
|
+
export { type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, type AgentRunConfig, AgentType, type Assistant, type AssistantMessage, type AssistantStore, type BaseLatticeProtocol, type BaseMessage, type Callback, type CreateAssistantRequest, type CreateThreadRequest, type DeepAgentConfig, type DeveloperMessage, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type FilterCondition, type GraphBuildOptions, type ID, type InterruptMessage, type LLMConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type Message, type MessageChunk, type ModelLatticeProtocol, type PaginatedResult, type PaginationParams, type PlanExecuteAgentConfig, type QueryParams, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type Result, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SequentialAgentConfig, type SystemMessage, type TaskHandler, type Thread, type ThreadStore, type Timestamp, type ToolCall, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UserMessage, type VectorStoreConfig, type VectorStoreLatticeProtocol, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isDeepAgentConfig };
|