@axiom-lattice/protocols 2.1.7 → 2.1.9-hotfix.0

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