@sonzai-labs/agents 1.0.8 → 1.0.9

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.cjs CHANGED
@@ -71,7 +71,7 @@ var HTTPClient = class {
71
71
  this.headers = {
72
72
  Authorization: `Bearer ${options.apiKey}`,
73
73
  "Content-Type": "application/json",
74
- "User-Agent": "sonzai-typescript/1.0.3"
74
+ "User-Agent": "sonzai-typescript/1.0.9"
75
75
  };
76
76
  this.timeout = options.timeout;
77
77
  this.maxRetries = options.maxRetries;
@@ -557,6 +557,41 @@ var Memory = class {
557
557
  }
558
558
  );
559
559
  }
560
+ /** Create a new fact for an agent. Facts are tagged source_type='manual'. */
561
+ async createFact(agentId, options) {
562
+ const body = {
563
+ content: options.content
564
+ };
565
+ if (options.userId) body.user_id = options.userId;
566
+ if (options.factType) body.fact_type = options.factType;
567
+ if (options.importance != null) body.importance = options.importance;
568
+ if (options.confidence != null) body.confidence = options.confidence;
569
+ if (options.entities) body.entities = options.entities;
570
+ if (options.nodeId) body.node_id = options.nodeId;
571
+ if (options.metadata) body.metadata = options.metadata;
572
+ return this.http.post(
573
+ `/api/v1/agents/${agentId}/memory/facts`,
574
+ body
575
+ );
576
+ }
577
+ /** Update an existing fact by ID. */
578
+ async updateFact(agentId, factId, options) {
579
+ const body = {};
580
+ if (options.content) body.content = options.content;
581
+ if (options.factType) body.fact_type = options.factType;
582
+ if (options.importance != null) body.importance = options.importance;
583
+ if (options.confidence != null) body.confidence = options.confidence;
584
+ if (options.entities) body.entities = options.entities;
585
+ if (options.metadata) body.metadata = options.metadata;
586
+ return this.http.put(
587
+ `/api/v1/agents/${agentId}/memory/facts/${factId}`,
588
+ body
589
+ );
590
+ }
591
+ /** Delete a fact by ID. */
592
+ async deleteFact(agentId, factId) {
593
+ await this.http.delete(`/api/v1/agents/${agentId}/memory/facts/${factId}`);
594
+ }
560
595
  /** Get the version history of a specific fact. */
561
596
  async getFactHistory(agentId, factId) {
562
597
  return this.http.get(`/api/v1/agents/${agentId}/memory/fact/${factId}/history`);
@@ -1393,6 +1428,43 @@ var Agents = class {
1393
1428
  instance_id: options.instanceId
1394
1429
  });
1395
1430
  }
1431
+ /** Create a habit for an agent. Set userId for a per-user habit. */
1432
+ async createHabit(agentId, options) {
1433
+ const body = {
1434
+ name: options.name
1435
+ };
1436
+ if (options.userId) body.user_id = options.userId;
1437
+ if (options.category) body.category = options.category;
1438
+ if (options.description) body.description = options.description;
1439
+ if (options.displayName) body.display_name = options.displayName;
1440
+ if (options.strength != null) body.strength = options.strength;
1441
+ return this.http.post(
1442
+ `/api/v1/agents/${agentId}/habits`,
1443
+ body
1444
+ );
1445
+ }
1446
+ /** Update an existing habit by name. */
1447
+ async updateHabit(agentId, habitName, options) {
1448
+ const body = {};
1449
+ if (options.userId) body.user_id = options.userId;
1450
+ if (options.category) body.category = options.category;
1451
+ if (options.description) body.description = options.description;
1452
+ if (options.displayName) body.display_name = options.displayName;
1453
+ if (options.strength != null) body.strength = options.strength;
1454
+ return this.http.put(
1455
+ `/api/v1/agents/${agentId}/habits/${encodeURIComponent(habitName)}`,
1456
+ body
1457
+ );
1458
+ }
1459
+ /** Delete a habit. Set userId for per-user habits. */
1460
+ async deleteHabit(agentId, habitName, options = {}) {
1461
+ const params = {};
1462
+ if (options.userId) params.user_id = options.userId;
1463
+ await this.http.delete(
1464
+ `/api/v1/agents/${agentId}/habits/${encodeURIComponent(habitName)}`,
1465
+ params
1466
+ );
1467
+ }
1396
1468
  async getGoals(agentId, options = {}) {
1397
1469
  return this.http.get(`/api/v1/agents/${agentId}/goals`, {
1398
1470
  user_id: options.userId,
@@ -1459,6 +1531,38 @@ var Agents = class {
1459
1531
  instance_id: options.instanceId
1460
1532
  });
1461
1533
  }
1534
+ /** Create a constellation node (lore) for an agent. */
1535
+ async createConstellationNode(agentId, options) {
1536
+ const body = {
1537
+ label: options.label
1538
+ };
1539
+ if (options.userId) body.user_id = options.userId;
1540
+ if (options.nodeType) body.node_type = options.nodeType;
1541
+ if (options.description) body.description = options.description;
1542
+ if (options.significance != null) body.significance = options.significance;
1543
+ return this.http.post(
1544
+ `/api/v1/agents/${agentId}/constellation/nodes`,
1545
+ body
1546
+ );
1547
+ }
1548
+ /** Update an existing constellation node. */
1549
+ async updateConstellationNode(agentId, nodeId, options) {
1550
+ const body = {};
1551
+ if (options.label) body.label = options.label;
1552
+ if (options.description) body.description = options.description;
1553
+ if (options.significance != null) body.significance = options.significance;
1554
+ if (options.nodeType) body.node_type = options.nodeType;
1555
+ return this.http.put(
1556
+ `/api/v1/agents/${agentId}/constellation/nodes/${nodeId}`,
1557
+ body
1558
+ );
1559
+ }
1560
+ /** Delete a constellation node. */
1561
+ async deleteConstellationNode(agentId, nodeId) {
1562
+ await this.http.delete(
1563
+ `/api/v1/agents/${agentId}/constellation/nodes/${nodeId}`
1564
+ );
1565
+ }
1462
1566
  /** Get breakthroughs for an agent. */
1463
1567
  async getBreakthroughs(agentId, options = {}) {
1464
1568
  return this.http.get(`/api/v1/agents/${agentId}/breakthroughs`, {