@axiom-lattice/protocols 2.1.5 → 2.1.7

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/protocols@2.1.5 build /home/runner/work/agentic/agentic/packages/protocols
2
+ > @axiom-lattice/protocols@2.1.7 build /home/runner/work/agentic/agentic/packages/protocols
3
3
  > tsup src/index.ts --format cjs,esm --dts --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,13 +8,13 @@
8
8
  CLI Target: es2020
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 3.57 KB
12
- CJS dist/index.js.map 10.43 KB
13
- CJS ⚡️ Build success in 42ms
14
- ESM dist/index.mjs 2.26 KB
15
- ESM dist/index.mjs.map 9.85 KB
16
- ESM ⚡️ Build success in 43ms
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
17
  DTS Build start
18
- DTS ⚡️ Build success in 2258ms
19
- DTS dist/index.d.ts 13.44 KB
20
- DTS dist/index.d.mts 13.44 KB
18
+ DTS ⚡️ Build success in 2322ms
19
+ DTS dist/index.d.ts 22.08 KB
20
+ DTS dist/index.d.mts 22.08 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @axiom-lattice/protocols
2
2
 
3
+ ## 2.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - e26be9a: publish web
8
+
9
+ ## 2.1.6
10
+
11
+ ### Patch Changes
12
+
13
+ - 7d8f3f5: enhance lattice
14
+
3
15
  ## 2.1.5
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -4,6 +4,9 @@ import { BaseChatModel } from '@langchain/core/language_models/chat_models';
4
4
  import { BaseMessage as BaseMessage$1 } from '@langchain/core/messages';
5
5
  import { ChatResult } from '@langchain/core/outputs';
6
6
  import { CompiledStateGraph } from '@langchain/langgraph';
7
+ import { Embeddings } from '@langchain/core/embeddings';
8
+ import { VectorStore } from '@langchain/core/vectorstores';
9
+ import { DocumentInterface } from '@langchain/core/documents';
7
10
 
8
11
  /**
9
12
  * BaseLatticeProtocol
@@ -257,55 +260,6 @@ interface MemoryLatticeProtocol extends BaseLatticeProtocol<MemoryConfig, Memory
257
260
  clear: () => Promise<void>;
258
261
  }
259
262
 
260
- /**
261
- * StorageLatticeProtocol
262
- *
263
- * 存储Lattice的协议,用于数据持久化和状态管理
264
- */
265
-
266
- /**
267
- * 存储类型枚举
268
- */
269
- declare enum StorageType {
270
- MEMORY = "memory",
271
- LOCAL = "local",
272
- DATABASE = "database",
273
- CLOUD = "cloud",
274
- DISTRIBUTED = "distributed"
275
- }
276
- /**
277
- * 存储配置接口
278
- */
279
- interface StorageConfig {
280
- name: string;
281
- description: string;
282
- type: StorageType;
283
- connectionString?: string;
284
- options?: Record<string, any>;
285
- }
286
- /**
287
- * 存储客户端接口
288
- */
289
- interface StorageClient {
290
- set: (key: string, value: any) => Promise<void>;
291
- get: (key: string) => Promise<any>;
292
- has: (key: string) => Promise<boolean>;
293
- delete: (key: string) => Promise<boolean>;
294
- clear: () => Promise<void>;
295
- transaction: <T>(operations: () => Promise<T>) => Promise<T>;
296
- }
297
- /**
298
- * 存储Lattice协议接口
299
- */
300
- interface StorageLatticeProtocol extends BaseLatticeProtocol<StorageConfig, StorageClient> {
301
- set: (key: string, value: any) => Promise<void>;
302
- get: (key: string) => Promise<any>;
303
- has: (key: string) => Promise<boolean>;
304
- delete: (key: string) => Promise<boolean>;
305
- clear: () => Promise<void>;
306
- transaction: <T>(operations: () => Promise<T>) => Promise<T>;
307
- }
308
-
309
263
  /**
310
264
  * UILatticeProtocol
311
265
  *
@@ -410,6 +364,154 @@ interface QueueLatticeProtocol extends BaseLatticeProtocol<QueueConfig, QueueCli
410
364
  }>;
411
365
  }
412
366
 
367
+ /**
368
+ * ScheduleLatticeProtocol
369
+ *
370
+ * Schedule Lattice protocol for delayed task execution management
371
+ */
372
+
373
+ /**
374
+ * Schedule service type enumeration
375
+ */
376
+ declare enum ScheduleType {
377
+ MEMORY = "memory"
378
+ }
379
+ /**
380
+ * Schedule configuration interface
381
+ */
382
+ interface ScheduleConfig {
383
+ name: string;
384
+ description: string;
385
+ type: ScheduleType;
386
+ options?: Record<string, any>;
387
+ }
388
+ /**
389
+ * Scheduled task information interface
390
+ */
391
+ interface ScheduledTaskInfo {
392
+ taskId: string;
393
+ scheduledAt: number;
394
+ timeoutMs: number;
395
+ remainingMs: number;
396
+ }
397
+ /**
398
+ * Schedule client interface
399
+ */
400
+ interface ScheduleClient {
401
+ /**
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
407
+ */
408
+ register: (taskId: string, callback: () => void | Promise<void>, timeoutMs: number) => boolean;
409
+ /**
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
413
+ */
414
+ cancel: (taskId: string) => boolean;
415
+ /**
416
+ * Check if a task is currently scheduled
417
+ * @param taskId - The task identifier to check
418
+ */
419
+ has: (taskId: string) => boolean;
420
+ /**
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
424
+ */
425
+ getRemainingTime: (taskId: string) => number;
426
+ /**
427
+ * Get the count of currently scheduled tasks
428
+ */
429
+ getTaskCount: () => number;
430
+ /**
431
+ * Get all scheduled task IDs
432
+ */
433
+ getTaskIds: () => string[];
434
+ /**
435
+ * Cancel all scheduled tasks
436
+ */
437
+ cancelAll: () => void;
438
+ /**
439
+ * Get task information
440
+ * @param taskId - The task identifier
441
+ * @returns Task info or null if not found
442
+ */
443
+ getTaskInfo?: (taskId: string) => ScheduledTaskInfo | null;
444
+ }
445
+ /**
446
+ * Schedule Lattice protocol interface
447
+ */
448
+ 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;
457
+ }
458
+
459
+ /**
460
+ * EmbeddingsLatticeProtocol
461
+ *
462
+ * Embeddings Lattice protocol for defining unified interface for embedding models
463
+ */
464
+
465
+ /**
466
+ * Embeddings configuration interface
467
+ */
468
+ interface EmbeddingsConfig {
469
+ name: string;
470
+ description?: string;
471
+ dimensions?: number;
472
+ maxChunkSize?: number;
473
+ }
474
+ /**
475
+ * Embeddings Lattice protocol interface
476
+ */
477
+ interface EmbeddingsLatticeProtocol extends BaseLatticeProtocol<EmbeddingsConfig, Embeddings> {
478
+ embedDocuments: (texts: string[]) => Promise<number[][]>;
479
+ embedQuery: (text: string) => Promise<number[]>;
480
+ }
481
+
482
+ /**
483
+ * VectorStoreLatticeProtocol
484
+ *
485
+ * VectorStore Lattice protocol for defining unified interface for vector store implementations
486
+ */
487
+
488
+ /**
489
+ * VectorStore configuration interface
490
+ */
491
+ interface VectorStoreConfig {
492
+ name: string;
493
+ description?: string;
494
+ type?: string;
495
+ config?: Record<string, any>;
496
+ }
497
+ /**
498
+ * VectorStore Lattice protocol interface
499
+ */
500
+ interface VectorStoreLatticeProtocol extends BaseLatticeProtocol<VectorStoreConfig, VectorStore> {
501
+ addVectors: (vectors: number[][], documents: DocumentInterface[], options?: Record<string, any>) => Promise<string[] | void>;
502
+ addDocuments: (documents: DocumentInterface[], options?: Record<string, any>) => Promise<string[] | void>;
503
+ delete: (params?: Record<string, any>) => Promise<void>;
504
+ similaritySearchVectorWithScore: (query: number[], k: number, filter?: VectorStore["FilterType"]) => Promise<[DocumentInterface, number][]>;
505
+ similaritySearch: (query: string, k?: number, filter?: VectorStore["FilterType"]) => Promise<DocumentInterface[]>;
506
+ similaritySearchWithScore: (query: string, k?: number, filter?: VectorStore["FilterType"]) => Promise<[DocumentInterface, number][]>;
507
+ maxMarginalRelevanceSearch?: (query: string, options: {
508
+ k: number;
509
+ fetchK?: number;
510
+ lambda?: number;
511
+ filter?: VectorStore["FilterType"];
512
+ }) => Promise<DocumentInterface[]>;
513
+ }
514
+
413
515
  /**
414
516
  * MessageProtocol
415
517
  *
@@ -513,6 +615,193 @@ interface MessageChunk {
513
615
  */
514
616
  type Message = UserMessage | AssistantMessage | SystemMessage | ToolMessage | DeveloperMessage;
515
617
 
618
+ /**
619
+ * ThreadStoreProtocol
620
+ *
621
+ * Thread store protocol definitions for the Axiom Lattice framework
622
+ * Provides standardized interfaces for thread management across all implementations
623
+ */
624
+ /**
625
+ * Thread type definition
626
+ */
627
+ interface Thread {
628
+ /**
629
+ * Thread identifier
630
+ */
631
+ id: string;
632
+ /**
633
+ * Assistant identifier this thread belongs to
634
+ */
635
+ assistantId: string;
636
+ /**
637
+ * Thread metadata
638
+ */
639
+ metadata?: Record<string, any>;
640
+ /**
641
+ * Thread creation timestamp
642
+ */
643
+ createdAt: Date;
644
+ /**
645
+ * Thread last update timestamp
646
+ */
647
+ updatedAt: Date;
648
+ }
649
+ /**
650
+ * Create thread request type
651
+ */
652
+ interface CreateThreadRequest {
653
+ /**
654
+ * Thread metadata
655
+ */
656
+ metadata?: Record<string, any>;
657
+ }
658
+ /**
659
+ * ThreadStore interface
660
+ * Provides CRUD operations for thread data
661
+ * All operations are scoped to an assistant ID
662
+ */
663
+ interface ThreadStore {
664
+ /**
665
+ * Get all threads for a specific assistant
666
+ * @param assistantId Assistant identifier
667
+ * @returns Array of threads for the assistant
668
+ */
669
+ getThreadsByAssistantId(assistantId: string): Promise<Thread[]>;
670
+ /**
671
+ * Get a thread by ID for a specific assistant
672
+ * @param assistantId Assistant identifier
673
+ * @param threadId Thread identifier
674
+ * @returns Thread if found, undefined otherwise
675
+ */
676
+ getThreadById(assistantId: string, threadId: string): Promise<Thread | undefined>;
677
+ /**
678
+ * Create a new thread for an assistant
679
+ * @param assistantId Assistant identifier
680
+ * @param threadId Thread identifier
681
+ * @param data Thread creation data
682
+ * @returns Created thread
683
+ */
684
+ createThread(assistantId: string, threadId: string, data: CreateThreadRequest): Promise<Thread>;
685
+ /**
686
+ * Update an existing thread
687
+ * @param assistantId Assistant identifier
688
+ * @param threadId Thread identifier
689
+ * @param updates Partial thread data to update
690
+ * @returns Updated thread if found, null otherwise
691
+ */
692
+ updateThread(assistantId: string, threadId: string, updates: Partial<CreateThreadRequest>): Promise<Thread | null>;
693
+ /**
694
+ * Delete a thread by ID
695
+ * @param assistantId Assistant identifier
696
+ * @param threadId Thread identifier
697
+ * @returns true if deleted, false otherwise
698
+ */
699
+ deleteThread(assistantId: string, threadId: string): Promise<boolean>;
700
+ /**
701
+ * Check if thread exists
702
+ * @param assistantId Assistant identifier
703
+ * @param threadId Thread identifier
704
+ * @returns true if thread exists, false otherwise
705
+ */
706
+ hasThread(assistantId: string, threadId: string): Promise<boolean>;
707
+ }
708
+
709
+ /**
710
+ * AssistantStoreProtocol
711
+ *
712
+ * Assistant store protocol definitions for the Axiom Lattice framework
713
+ * Provides standardized interfaces for assistant management across all implementations
714
+ */
715
+ /**
716
+ * Assistant type definition
717
+ */
718
+ interface Assistant {
719
+ /**
720
+ * Assistant identifier
721
+ */
722
+ id: string;
723
+ /**
724
+ * Assistant name
725
+ */
726
+ name: string;
727
+ /**
728
+ * Assistant description
729
+ */
730
+ description?: string;
731
+ /**
732
+ * Graph definition for the assistant
733
+ */
734
+ graphDefinition: any;
735
+ /**
736
+ * Assistant creation timestamp
737
+ */
738
+ createdAt: Date;
739
+ /**
740
+ * Assistant last update timestamp
741
+ */
742
+ updatedAt: Date;
743
+ }
744
+ /**
745
+ * Create assistant request type
746
+ */
747
+ interface CreateAssistantRequest {
748
+ /**
749
+ * Assistant name
750
+ */
751
+ name: string;
752
+ /**
753
+ * Assistant description
754
+ */
755
+ description?: string;
756
+ /**
757
+ * Graph definition for the assistant
758
+ */
759
+ graphDefinition: any;
760
+ }
761
+ /**
762
+ * AssistantStore interface
763
+ * Provides CRUD operations for assistant data
764
+ */
765
+ interface AssistantStore {
766
+ /**
767
+ * Get all assistants
768
+ * @returns Array of all assistants
769
+ */
770
+ getAllAssistants(): Promise<Assistant[]>;
771
+ /**
772
+ * Get assistant by ID
773
+ * @param id Assistant identifier
774
+ * @returns Assistant if found, undefined otherwise
775
+ */
776
+ getAssistantById(id: string): Promise<Assistant | null>;
777
+ /**
778
+ * Create a new assistant
779
+ * @param id Assistant identifier
780
+ * @param data Assistant creation data
781
+ * @returns Created assistant
782
+ */
783
+ createAssistant(id: string, data: CreateAssistantRequest): Promise<Assistant>;
784
+ /**
785
+ * Update an existing assistant
786
+ * @param id Assistant identifier
787
+ * @param updates Partial assistant data to update
788
+ * @returns Updated assistant if found, null otherwise
789
+ */
790
+ updateAssistant(id: string, updates: Partial<CreateAssistantRequest>): Promise<Assistant | null>;
791
+ /**
792
+ * Delete an assistant by ID
793
+ * @param id Assistant identifier
794
+ * @returns true if deleted, false otherwise
795
+ */
796
+ deleteAssistant(id: string): Promise<boolean>;
797
+ /**
798
+ * Check if assistant exists
799
+ * @param id Assistant identifier
800
+ * @returns true if assistant exists, false otherwise
801
+ */
802
+ hasAssistant(id: string): Promise<boolean>;
803
+ }
804
+
516
805
  /**
517
806
  * 通用类型定义
518
807
  *
@@ -576,4 +865,4 @@ type Timestamp = number;
576
865
  */
577
866
  type Callback<T = any, R = void> = (data: T) => R | Promise<R>;
578
867
 
579
- export { type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, AgentType, type AssistantMessage, type BaseLatticeProtocol, type BaseMessage, type Callback, type DeepAgentConfig, type DeveloperMessage, 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 SequentialAgentConfig, type StorageClient, type StorageConfig, type StorageLatticeProtocol, StorageType, type SystemMessage, type Timestamp, type ToolCall, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UserMessage, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isDeepAgentConfig };
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 };