@axiom-lattice/core 2.1.11 → 2.1.12

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.mjs CHANGED
@@ -574,30 +574,17 @@ registerToolLattice(
574
574
  topic = "general",
575
575
  includeRawContent = false
576
576
  }, config) => {
577
- console.log("[DEBUG][internet_search] Starting search with params:", {
578
- query,
579
- maxResults,
580
- topic,
581
- includeRawContent
582
- });
583
- console.log("[DEBUG][internet_search] Creating TavilySearch instance...");
584
577
  const tavilySearch = new TavilySearch({
585
578
  maxResults,
586
579
  tavilyApiKey: process.env.TAVILY_API_KEY,
587
580
  includeRawContent,
588
581
  topic
589
582
  });
590
- console.log("[DEBUG][internet_search] Invoking search for query:", query);
591
583
  const tavilyResponse = await tavilySearch.invoke({ query });
592
- console.log(
593
- "[DEBUG][internet_search] Search completed. Results count:",
594
- tavilyResponse.results?.length ?? 0
595
- );
596
584
  const result = genUICard("Internet Search:" + query, "generic_data_table", {
597
585
  dataSource: tavilyResponse.results
598
586
  });
599
- console.log("[DEBUG][internet_search] Returning UI card result");
600
- return result;
587
+ return JSON.stringify(tavilyResponse.results);
601
588
  }
602
589
  );
603
590
 
@@ -2137,7 +2124,6 @@ function createTaskTool(options) {
2137
2124
  input: { ...subagentState, message: description }
2138
2125
  });
2139
2126
  const result = workerResult.finalState?.values;
2140
- console.log("workerResult", workerResult);
2141
2127
  if (!config.toolCall?.id) {
2142
2128
  throw new Error("Tool call ID is required for subagent invocation");
2143
2129
  }
@@ -3240,6 +3226,498 @@ var getChunkBuffer = (key) => ChunkBufferLatticeManager.getInstance().get(key);
3240
3226
  var registerChunkBuffer = (key, buffer) => ChunkBufferLatticeManager.getInstance().register(key, buffer);
3241
3227
  var hasChunkBuffer = (key) => ChunkBufferLatticeManager.getInstance().has(key);
3242
3228
 
3229
+ // src/store_lattice/InMemoryThreadStore.ts
3230
+ var InMemoryThreadStore = class {
3231
+ constructor() {
3232
+ // Map<assistantId, Map<threadId, Thread>>
3233
+ this.threads = /* @__PURE__ */ new Map();
3234
+ }
3235
+ /**
3236
+ * Get all threads for a specific assistant
3237
+ */
3238
+ async getThreadsByAssistantId(assistantId) {
3239
+ const assistantThreads = this.threads.get(assistantId);
3240
+ if (!assistantThreads) {
3241
+ return [];
3242
+ }
3243
+ return Array.from(assistantThreads.values());
3244
+ }
3245
+ /**
3246
+ * Get a thread by ID for a specific assistant
3247
+ */
3248
+ async getThreadById(assistantId, threadId) {
3249
+ const assistantThreads = this.threads.get(assistantId);
3250
+ if (!assistantThreads) {
3251
+ return void 0;
3252
+ }
3253
+ return assistantThreads.get(threadId);
3254
+ }
3255
+ /**
3256
+ * Create a new thread for an assistant
3257
+ */
3258
+ async createThread(assistantId, threadId, data) {
3259
+ const now = /* @__PURE__ */ new Date();
3260
+ const thread = {
3261
+ id: threadId,
3262
+ assistantId,
3263
+ metadata: data.metadata || {},
3264
+ createdAt: now,
3265
+ updatedAt: now
3266
+ };
3267
+ if (!this.threads.has(assistantId)) {
3268
+ this.threads.set(assistantId, /* @__PURE__ */ new Map());
3269
+ }
3270
+ const assistantThreads = this.threads.get(assistantId);
3271
+ assistantThreads.set(threadId, thread);
3272
+ return thread;
3273
+ }
3274
+ /**
3275
+ * Update an existing thread
3276
+ */
3277
+ async updateThread(assistantId, threadId, updates) {
3278
+ const assistantThreads = this.threads.get(assistantId);
3279
+ if (!assistantThreads) {
3280
+ return null;
3281
+ }
3282
+ const existing = assistantThreads.get(threadId);
3283
+ if (!existing) {
3284
+ return null;
3285
+ }
3286
+ const updated = {
3287
+ ...existing,
3288
+ metadata: {
3289
+ ...existing.metadata,
3290
+ ...updates.metadata || {}
3291
+ },
3292
+ updatedAt: /* @__PURE__ */ new Date()
3293
+ };
3294
+ assistantThreads.set(threadId, updated);
3295
+ return updated;
3296
+ }
3297
+ /**
3298
+ * Delete a thread by ID
3299
+ */
3300
+ async deleteThread(assistantId, threadId) {
3301
+ const assistantThreads = this.threads.get(assistantId);
3302
+ if (!assistantThreads) {
3303
+ return false;
3304
+ }
3305
+ return assistantThreads.delete(threadId);
3306
+ }
3307
+ /**
3308
+ * Check if thread exists
3309
+ */
3310
+ async hasThread(assistantId, threadId) {
3311
+ const assistantThreads = this.threads.get(assistantId);
3312
+ if (!assistantThreads) {
3313
+ return false;
3314
+ }
3315
+ return assistantThreads.has(threadId);
3316
+ }
3317
+ /**
3318
+ * Clear all threads (useful for testing)
3319
+ */
3320
+ clear() {
3321
+ this.threads.clear();
3322
+ }
3323
+ /**
3324
+ * Get all threads for all assistants (useful for debugging)
3325
+ */
3326
+ getAllThreads() {
3327
+ const allThreads = [];
3328
+ for (const assistantThreads of this.threads.values()) {
3329
+ allThreads.push(...Array.from(assistantThreads.values()));
3330
+ }
3331
+ return allThreads;
3332
+ }
3333
+ };
3334
+
3335
+ // src/store_lattice/InMemoryAssistantStore.ts
3336
+ var InMemoryAssistantStore = class {
3337
+ constructor() {
3338
+ this.assistants = /* @__PURE__ */ new Map();
3339
+ }
3340
+ /**
3341
+ * Get all assistants
3342
+ */
3343
+ async getAllAssistants() {
3344
+ return Array.from(this.assistants.values());
3345
+ }
3346
+ /**
3347
+ * Get assistant by ID
3348
+ */
3349
+ async getAssistantById(id) {
3350
+ return this.assistants.get(id) || null;
3351
+ }
3352
+ /**
3353
+ * Create a new assistant
3354
+ */
3355
+ async createAssistant(id, data) {
3356
+ const now = /* @__PURE__ */ new Date();
3357
+ const assistant = {
3358
+ id,
3359
+ name: data.name,
3360
+ description: data.description,
3361
+ graphDefinition: data.graphDefinition,
3362
+ createdAt: now,
3363
+ updatedAt: now
3364
+ };
3365
+ this.assistants.set(id, assistant);
3366
+ return assistant;
3367
+ }
3368
+ /**
3369
+ * Update an existing assistant
3370
+ */
3371
+ async updateAssistant(id, updates) {
3372
+ const existing = this.assistants.get(id);
3373
+ if (!existing) {
3374
+ return null;
3375
+ }
3376
+ const updated = {
3377
+ ...existing,
3378
+ ...updates,
3379
+ updatedAt: /* @__PURE__ */ new Date()
3380
+ };
3381
+ this.assistants.set(id, updated);
3382
+ return updated;
3383
+ }
3384
+ /**
3385
+ * Delete an assistant by ID
3386
+ */
3387
+ async deleteAssistant(id) {
3388
+ return this.assistants.delete(id);
3389
+ }
3390
+ /**
3391
+ * Check if assistant exists
3392
+ */
3393
+ async hasAssistant(id) {
3394
+ return this.assistants.has(id);
3395
+ }
3396
+ /**
3397
+ * Clear all assistants (useful for testing)
3398
+ */
3399
+ clear() {
3400
+ this.assistants.clear();
3401
+ }
3402
+ };
3403
+
3404
+ // src/store_lattice/StoreLatticeManager.ts
3405
+ var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager {
3406
+ /**
3407
+ * Get StoreLatticeManager singleton instance
3408
+ */
3409
+ static getInstance() {
3410
+ if (!_StoreLatticeManager._instance) {
3411
+ _StoreLatticeManager._instance = new _StoreLatticeManager();
3412
+ }
3413
+ return _StoreLatticeManager._instance;
3414
+ }
3415
+ /**
3416
+ * Get Lattice type prefix
3417
+ */
3418
+ getLatticeType() {
3419
+ return "stores";
3420
+ }
3421
+ /**
3422
+ * Generate composite key from key and type
3423
+ * @param key Lattice key name
3424
+ * @param type Store type
3425
+ * @returns Composite key string
3426
+ */
3427
+ getCompositeKey(key, type) {
3428
+ return `${key}:${type}`;
3429
+ }
3430
+ /**
3431
+ * Register store Lattice with type safety
3432
+ * Uses composite key (key + type) as unique identifier
3433
+ * @param key Lattice key name
3434
+ * @param type Store type (e.g., "thread")
3435
+ * @param store Store implementation instance matching the type
3436
+ */
3437
+ registerLattice(key, type, store) {
3438
+ const storeLattice = {
3439
+ key,
3440
+ type,
3441
+ store
3442
+ };
3443
+ const compositeKey = this.getCompositeKey(key, type);
3444
+ this.register(compositeKey, storeLattice);
3445
+ }
3446
+ /**
3447
+ * Get StoreLattice with type safety
3448
+ * Uses composite key (key + type) to retrieve the store
3449
+ * @param key Lattice key name
3450
+ * @param type Expected store type for type checking
3451
+ * @returns StoreLattice with typed store
3452
+ */
3453
+ getStoreLattice(key, type) {
3454
+ const compositeKey = this.getCompositeKey(key, type);
3455
+ const storeLattice = this.get(compositeKey);
3456
+ if (!storeLattice) {
3457
+ throw new Error(`StoreLattice ${key}:${type} not found`);
3458
+ }
3459
+ if (storeLattice.type !== type) {
3460
+ throw new Error(
3461
+ `StoreLattice ${key}:${type} has type "${storeLattice.type}", expected "${type}"`
3462
+ );
3463
+ }
3464
+ return storeLattice;
3465
+ }
3466
+ /**
3467
+ * Get StoreLattice without type checking (for backward compatibility)
3468
+ * @param key Lattice key name
3469
+ * @param type Store type
3470
+ * @returns StoreLattice (type may be unknown)
3471
+ */
3472
+ getStoreLatticeUnsafe(key, type) {
3473
+ const compositeKey = this.getCompositeKey(key, type);
3474
+ const storeLattice = this.get(compositeKey);
3475
+ if (!storeLattice) {
3476
+ throw new Error(`StoreLattice ${key}:${type} not found`);
3477
+ }
3478
+ return storeLattice;
3479
+ }
3480
+ /**
3481
+ * Get all Lattices
3482
+ */
3483
+ getAllLattices() {
3484
+ return this.getAll();
3485
+ }
3486
+ /**
3487
+ * Check if Lattice exists
3488
+ * Uses composite key (key + type) to check existence
3489
+ * @param key Lattice key name
3490
+ * @param type Store type
3491
+ */
3492
+ hasLattice(key, type) {
3493
+ const compositeKey = this.getCompositeKey(key, type);
3494
+ return this.has(compositeKey);
3495
+ }
3496
+ /**
3497
+ * Remove Lattice
3498
+ * Uses composite key (key + type) to remove the store
3499
+ * @param key Lattice key name
3500
+ * @param type Store type
3501
+ */
3502
+ removeLattice(key, type) {
3503
+ const compositeKey = this.getCompositeKey(key, type);
3504
+ return this.remove(compositeKey);
3505
+ }
3506
+ /**
3507
+ * Clear all Lattices
3508
+ */
3509
+ clearLattices() {
3510
+ this.clear();
3511
+ }
3512
+ /**
3513
+ * Get Lattice count
3514
+ */
3515
+ getLatticeCount() {
3516
+ return this.count();
3517
+ }
3518
+ /**
3519
+ * Get Lattice key list
3520
+ */
3521
+ getLatticeKeys() {
3522
+ return this.keys();
3523
+ }
3524
+ };
3525
+ var storeLatticeManager = StoreLatticeManager.getInstance();
3526
+ var registerStoreLattice = (key, type, store) => storeLatticeManager.registerLattice(key, type, store);
3527
+ var getStoreLattice = (key, type) => storeLatticeManager.getStoreLattice(key, type);
3528
+ var defaultThreadStore = new InMemoryThreadStore();
3529
+ var defaultAssistantStore = new InMemoryAssistantStore();
3530
+ storeLatticeManager.registerLattice("default", "thread", defaultThreadStore);
3531
+ storeLatticeManager.registerLattice(
3532
+ "default",
3533
+ "assistant",
3534
+ defaultAssistantStore
3535
+ );
3536
+
3537
+ // src/embeddings_lattice/EmbeddingsLatticeManager.ts
3538
+ var EmbeddingsLatticeManager = class _EmbeddingsLatticeManager extends BaseLatticeManager {
3539
+ /**
3540
+ * Get EmbeddingsLatticeManager singleton instance
3541
+ */
3542
+ static getInstance() {
3543
+ if (!_EmbeddingsLatticeManager._instance) {
3544
+ _EmbeddingsLatticeManager._instance = new _EmbeddingsLatticeManager();
3545
+ }
3546
+ return _EmbeddingsLatticeManager._instance;
3547
+ }
3548
+ /**
3549
+ * Get Lattice type prefix
3550
+ */
3551
+ getLatticeType() {
3552
+ return "embeddings";
3553
+ }
3554
+ /**
3555
+ * Register embeddings Lattice
3556
+ * @param key Lattice key name
3557
+ * @param embeddings Embeddings instance
3558
+ */
3559
+ registerLattice(key, embeddings) {
3560
+ const embeddingsLattice = {
3561
+ key,
3562
+ client: embeddings
3563
+ };
3564
+ this.register(key, embeddingsLattice);
3565
+ }
3566
+ /**
3567
+ * Get EmbeddingsLattice
3568
+ * @param key Lattice key name
3569
+ */
3570
+ getEmbeddingsLattice(key) {
3571
+ const embeddingsLattice = this.get(key);
3572
+ if (!embeddingsLattice) {
3573
+ throw new Error(`EmbeddingsLattice ${key} not found`);
3574
+ }
3575
+ return embeddingsLattice;
3576
+ }
3577
+ /**
3578
+ * Get all Lattices
3579
+ */
3580
+ getAllLattices() {
3581
+ return this.getAll();
3582
+ }
3583
+ /**
3584
+ * Check if Lattice exists
3585
+ * @param key Lattice key name
3586
+ */
3587
+ hasLattice(key) {
3588
+ return this.has(key);
3589
+ }
3590
+ /**
3591
+ * Remove Lattice
3592
+ * @param key Lattice key name
3593
+ */
3594
+ removeLattice(key) {
3595
+ return this.remove(key);
3596
+ }
3597
+ /**
3598
+ * Clear all Lattices
3599
+ */
3600
+ clearLattices() {
3601
+ this.clear();
3602
+ }
3603
+ /**
3604
+ * Get Lattice count
3605
+ */
3606
+ getLatticeCount() {
3607
+ return this.count();
3608
+ }
3609
+ /**
3610
+ * Get Lattice key list
3611
+ */
3612
+ getLatticeKeys() {
3613
+ return this.keys();
3614
+ }
3615
+ /**
3616
+ * Get embeddings client
3617
+ * @param key Lattice key name
3618
+ */
3619
+ getEmbeddingsClient(key) {
3620
+ const embeddingsLattice = this.getEmbeddingsLattice(key);
3621
+ return embeddingsLattice.client;
3622
+ }
3623
+ };
3624
+ var embeddingsLatticeManager = EmbeddingsLatticeManager.getInstance();
3625
+ var registerEmbeddingsLattice = (key, embeddings) => embeddingsLatticeManager.registerLattice(key, embeddings);
3626
+ var getEmbeddingsLattice = (key) => embeddingsLatticeManager.getEmbeddingsLattice(key);
3627
+ var getEmbeddingsClient = (key) => embeddingsLatticeManager.getEmbeddingsClient(key);
3628
+
3629
+ // src/vectorstore_lattice/VectorStoreLatticeManager.ts
3630
+ var VectorStoreLatticeManager = class _VectorStoreLatticeManager extends BaseLatticeManager {
3631
+ /**
3632
+ * Get VectorStoreLatticeManager singleton instance
3633
+ */
3634
+ static getInstance() {
3635
+ if (!_VectorStoreLatticeManager._instance) {
3636
+ _VectorStoreLatticeManager._instance = new _VectorStoreLatticeManager();
3637
+ }
3638
+ return _VectorStoreLatticeManager._instance;
3639
+ }
3640
+ /**
3641
+ * Get Lattice type prefix
3642
+ */
3643
+ getLatticeType() {
3644
+ return "vectorstores";
3645
+ }
3646
+ /**
3647
+ * Register vector store Lattice
3648
+ * @param key Lattice key name
3649
+ * @param vectorStore VectorStore instance
3650
+ */
3651
+ registerLattice(key, vectorStore) {
3652
+ const vectorStoreLattice = {
3653
+ key,
3654
+ client: vectorStore
3655
+ };
3656
+ this.register(key, vectorStoreLattice);
3657
+ }
3658
+ /**
3659
+ * Get VectorStoreLattice
3660
+ * @param key Lattice key name
3661
+ */
3662
+ getVectorStoreLattice(key) {
3663
+ const vectorStoreLattice = this.get(key);
3664
+ if (!vectorStoreLattice) {
3665
+ throw new Error(`VectorStoreLattice ${key} not found`);
3666
+ }
3667
+ return vectorStoreLattice;
3668
+ }
3669
+ /**
3670
+ * Get all Lattices
3671
+ */
3672
+ getAllLattices() {
3673
+ return this.getAll();
3674
+ }
3675
+ /**
3676
+ * Check if Lattice exists
3677
+ * @param key Lattice key name
3678
+ */
3679
+ hasLattice(key) {
3680
+ return this.has(key);
3681
+ }
3682
+ /**
3683
+ * Remove Lattice
3684
+ * @param key Lattice key name
3685
+ */
3686
+ removeLattice(key) {
3687
+ return this.remove(key);
3688
+ }
3689
+ /**
3690
+ * Clear all Lattices
3691
+ */
3692
+ clearLattices() {
3693
+ this.clear();
3694
+ }
3695
+ /**
3696
+ * Get Lattice count
3697
+ */
3698
+ getLatticeCount() {
3699
+ return this.count();
3700
+ }
3701
+ /**
3702
+ * Get Lattice key list
3703
+ */
3704
+ getLatticeKeys() {
3705
+ return this.keys();
3706
+ }
3707
+ /**
3708
+ * Get vector store client
3709
+ * @param key Lattice key name
3710
+ */
3711
+ getVectorStoreClient(key) {
3712
+ const vectorStoreLattice = this.getVectorStoreLattice(key);
3713
+ return vectorStoreLattice.client;
3714
+ }
3715
+ };
3716
+ var vectorStoreLatticeManager = VectorStoreLatticeManager.getInstance();
3717
+ var registerVectorStoreLattice = (key, vectorStore) => vectorStoreLatticeManager.registerLattice(key, vectorStore);
3718
+ var getVectorStoreLattice = (key) => vectorStoreLatticeManager.getVectorStoreLattice(key);
3719
+ var getVectorStoreClient = (key) => vectorStoreLatticeManager.getVectorStoreClient(key);
3720
+
3243
3721
  // src/index.ts
3244
3722
  import * as Protocols from "@axiom-lattice/protocols";
3245
3723
  export {
@@ -3250,17 +3728,23 @@ export {
3250
3728
  AgentType,
3251
3729
  ChunkBuffer,
3252
3730
  ChunkBufferLatticeManager,
3731
+ EmbeddingsLatticeManager,
3253
3732
  GraphBuildOptions,
3733
+ InMemoryAssistantStore,
3254
3734
  InMemoryChunkBuffer,
3735
+ InMemoryThreadStore,
3255
3736
  MemoryLatticeManager,
3256
3737
  MemoryQueueClient,
3257
3738
  MemoryType,
3258
3739
  ModelLatticeManager,
3259
3740
  Protocols,
3260
3741
  QueueLatticeManager,
3742
+ StoreLatticeManager,
3261
3743
  ThreadStatus,
3262
3744
  ToolLatticeManager,
3745
+ VectorStoreLatticeManager,
3263
3746
  agentLatticeManager,
3747
+ embeddingsLatticeManager,
3264
3748
  eventBus,
3265
3749
  event_bus_default as eventBusDefault,
3266
3750
  getAgentClient,
@@ -3270,11 +3754,16 @@ export {
3270
3754
  getAllToolDefinitions,
3271
3755
  getCheckpointSaver,
3272
3756
  getChunkBuffer,
3757
+ getEmbeddingsClient,
3758
+ getEmbeddingsLattice,
3273
3759
  getModelLattice,
3274
3760
  getQueueLattice,
3761
+ getStoreLattice,
3275
3762
  getToolClient,
3276
3763
  getToolDefinition,
3277
3764
  getToolLattice,
3765
+ getVectorStoreClient,
3766
+ getVectorStoreLattice,
3278
3767
  hasChunkBuffer,
3279
3768
  modelLatticeManager,
3280
3769
  queueLatticeManager,
@@ -3282,11 +3771,16 @@ export {
3282
3771
  registerAgentLattices,
3283
3772
  registerCheckpointSaver,
3284
3773
  registerChunkBuffer,
3774
+ registerEmbeddingsLattice,
3285
3775
  registerModelLattice,
3286
3776
  registerQueueLattice,
3777
+ registerStoreLattice,
3287
3778
  registerToolLattice,
3779
+ registerVectorStoreLattice,
3780
+ storeLatticeManager,
3288
3781
  toolLatticeManager,
3289
3782
  validateAgentInput,
3290
- validateToolInput
3783
+ validateToolInput,
3784
+ vectorStoreLatticeManager
3291
3785
  };
3292
3786
  //# sourceMappingURL=index.mjs.map