saico 2.9.0 → 2.9.1

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.
Files changed (3) hide show
  1. package/README.md +9 -7
  2. package/package.json +1 -1
  3. package/saico.js +14 -11
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Saico - Hierarchical AI Conversation Orchestrator
1
+ # Saico - Simple AI-Agent Conversation Orchestrator
2
2
 
3
3
  Saico is a Node.js library for building AI agents with hierarchical conversations, automatic context aggregation, and enterprise-grade tool calling. It manages nested task trees where each node can have its own message queue, system prompt, tools, and state — and the library automatically assembles the full payload sent to the LLM by walking the tree.
4
4
 
@@ -210,7 +210,7 @@ new Saico({
210
210
  // Storage
211
211
  redis: true, // Set false to skip Redis proxy
212
212
  key: 'custom-redis-key',
213
- store: 'my-table', // Table name for instance persistence (closeSession/rehydrate)
213
+ store: 'my-table', // Table name for instance persistence (store/closeSession/restore)
214
214
  dynamodb: { // DynamoDB config (creates instance-level adapter)
215
215
  region: 'us-east-1',
216
216
  credentials: { accessKeyId: '...', secretAccessKey: '...' },
@@ -258,10 +258,11 @@ agent.getSessionInfo();
258
258
  // userData, uptime
259
259
  // }
260
260
 
261
- await agent.closeSession(); // prepareForStorage + save to registered backend, cancels task
261
+ await agent.store(); // save to registered backend independently
262
+ await agent.closeSession(); // store + cancel task
262
263
 
263
264
  // Restore from registered backend
264
- const restored = await Saico.rehydrate(agent.id, { store: 'sessions' });
265
+ const restored = await Saico.restore(agent.id, { store: 'sessions' });
265
266
  ```
266
267
 
267
268
  ## Database Access
@@ -312,8 +313,9 @@ const json = await agent.serialize();
312
313
  const restored = await Saico.deserialize(json);
313
314
 
314
315
  // Durable persistence (uses registered backend + opt.store table name)
315
- await agent.closeSession();
316
- const restored2 = await Saico.rehydrate(agent.id, { store: 'sessions' });
316
+ await agent.store(); // save independently
317
+ await agent.closeSession(); // store + cancel task
318
+ const restored2 = await Saico.restore(agent.id, { store: 'sessions' });
317
319
  ```
318
320
 
319
321
  `prepareForStorage()` automatically picks up all non-underscore properties (id, name, prompt, userData, sessionConfig, tm_create, isolate, etc.) and produces compressed chat_history for the msgs Q.
@@ -405,7 +407,7 @@ saico/
405
407
  npm test
406
408
  ```
407
409
 
408
- 300 tests covering Saico lifecycle, msgs Q ownership, spawn/spawnAndRun, task hierarchy, message handling, tool calls, DB adapters, async serialization, prepareForStorage, backend registration, persistence (closeSession/rehydrate via registered backend), storage integration, and full hierarchy flows.
410
+ 300 tests covering Saico lifecycle, msgs Q ownership, spawn/spawnAndRun, task hierarchy, message handling, tool calls, DB adapters, async serialization, prepareForStorage, backend registration, persistence (store/closeSession/restore via registered backend), storage integration, and full hierarchy flows.
409
411
 
410
412
  ## Requirements
411
413
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saico",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "main": "index.js",
5
5
  "type": "commonjs",
6
6
  "description": "Hierarchical AI Conversation Orchestrator - Task hierarchy with conversation contexts",
package/saico.js CHANGED
@@ -501,19 +501,22 @@ class Saico {
501
501
  }
502
502
 
503
503
  /**
504
- * Close the session — save state to registered backend, cancel task.
504
+ * Save instance state to registered backend under _storeName.
505
+ */
506
+ async store() {
507
+ if (!this._storeName) return;
508
+ const backend = Saico.getBackend();
509
+ if (!backend) return;
510
+ const data = await this.prepareForStorage();
511
+ await backend.put(data, this._storeName);
512
+ }
513
+
514
+ /**
515
+ * Close the session — cancel task. Call store() first if persistence needed.
505
516
  */
506
517
  async closeSession() {
507
518
  if (!this._task) return;
508
-
509
- if (this._storeName && this.msgs) {
510
- const backend = Saico.getBackend();
511
- if (backend) {
512
- const data = await this.prepareForStorage();
513
- await backend.put(data, this._storeName);
514
- }
515
- }
516
-
519
+ await this.store();
517
520
  this._task._ecancel();
518
521
  }
519
522
 
@@ -718,7 +721,7 @@ class Saico {
718
721
  * @param {Object} opt - Options (store: table name, backend, functions, states, etc.)
719
722
  * @returns {Promise<Saico|null>}
720
723
  */
721
- static async rehydrate(id, opt = {}) {
724
+ static async restore(id, opt = {}) {
722
725
  const backend = opt.backend || Saico.getBackend();
723
726
  if (!backend)
724
727
  throw new Error('No backend registered. Call Saico.registerBackend() first.');