@inkeep/agents-cli 0.10.1 → 0.11.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.
Files changed (2) hide show
  1. package/dist/index.js +81 -201
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1374,34 +1374,52 @@ import {
1374
1374
  text,
1375
1375
  unique
1376
1376
  } from "drizzle-orm/sqlite-core";
1377
- var projects, agentGraph, contextConfigs, contextCache, agents, agentRelations, externalAgents, tasks, taskRelations, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, tools, agentToolRelations, conversations, messages, ledgerArtifacts, apiKeys, credentialReferences, ledgerArtifactsTaskIdIdx, ledgerArtifactsToolCallIdIdx, ledgerArtifactsContextIdIdx, ledgerArtifactsTaskContextNameUnique, tasksRelations, projectsRelations, taskRelationsRelations, contextConfigsRelations, contextCacheRelations, agentsRelations, agentGraphRelations, externalAgentsRelations, apiKeysRelations, agentToolRelationsRelations, credentialReferencesRelations, toolsRelations, conversationsRelations, messagesRelations, artifactComponentsRelations, agentArtifactComponentsRelations, dataComponentsRelations, agentDataComponentsRelations, ledgerArtifactsRelations, agentRelationsRelations;
1377
+ var tenantScoped, projectScoped, graphScoped, agentScoped, uiProperties, timestamps, projects, agentGraph, contextConfigs, contextCache, agents, agentRelations, externalAgents, tasks, taskRelations, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, tools, agentToolRelations, conversations, messages, ledgerArtifacts, apiKeys, credentialReferences, tasksRelations, projectsRelations, taskRelationsRelations, contextConfigsRelations, contextCacheRelations, agentsRelations, agentGraphRelations, externalAgentsRelations, apiKeysRelations, agentToolRelationsRelations, credentialReferencesRelations, toolsRelations, conversationsRelations, messagesRelations, artifactComponentsRelations, agentArtifactComponentsRelations, dataComponentsRelations, agentDataComponentsRelations, ledgerArtifactsRelations, agentRelationsRelations;
1378
1378
  var init_schema = __esm({
1379
1379
  "../packages/agents-core/src/db/schema.ts"() {
1380
1380
  "use strict";
1381
1381
  init_esm_shims();
1382
+ tenantScoped = {
1383
+ tenantId: text("tenant_id").notNull(),
1384
+ id: text("id").notNull()
1385
+ };
1386
+ projectScoped = {
1387
+ ...tenantScoped,
1388
+ projectId: text("project_id").notNull()
1389
+ };
1390
+ graphScoped = {
1391
+ ...projectScoped,
1392
+ graphId: text("graph_id").notNull()
1393
+ };
1394
+ agentScoped = {
1395
+ ...graphScoped,
1396
+ agentId: text("agent_id").notNull()
1397
+ };
1398
+ uiProperties = {
1399
+ name: text("name").notNull(),
1400
+ description: text("description").notNull()
1401
+ };
1402
+ timestamps = {
1403
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1404
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1405
+ };
1382
1406
  projects = sqliteTable(
1383
1407
  "projects",
1384
1408
  {
1385
- tenantId: text("tenant_id").notNull(),
1386
- id: text("id").notNull(),
1387
- // This IS the project ID
1388
- name: text("name").notNull(),
1389
- description: text("description").notNull(),
1409
+ ...tenantScoped,
1410
+ ...uiProperties,
1390
1411
  // Project-level default model settings that can be inherited by graphs and agents
1391
1412
  models: text("models", { mode: "json" }).$type(),
1392
1413
  // Project-level stopWhen configuration that can be inherited by graphs and agents
1393
1414
  stopWhen: text("stop_when", { mode: "json" }).$type(),
1394
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1395
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1415
+ ...timestamps
1396
1416
  },
1397
1417
  (table) => [primaryKey({ columns: [table.tenantId, table.id] })]
1398
1418
  );
1399
1419
  agentGraph = sqliteTable(
1400
1420
  "agent_graph",
1401
1421
  {
1402
- tenantId: text("tenant_id").notNull(),
1403
- projectId: text("project_id").notNull(),
1404
- id: text("id").notNull(),
1422
+ ...projectScoped,
1405
1423
  name: text("name").notNull(),
1406
1424
  description: text("description"),
1407
1425
  defaultAgentId: text("default_agent_id"),
@@ -1416,8 +1434,7 @@ var init_schema = __esm({
1416
1434
  graphPrompt: text("graph_prompt"),
1417
1435
  // Graph-level stopWhen configuration that can be inherited by agents
1418
1436
  stopWhen: text("stop_when", { mode: "json" }).$type(),
1419
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1420
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1437
+ ...timestamps
1421
1438
  },
1422
1439
  (table) => [
1423
1440
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1431,19 +1448,14 @@ var init_schema = __esm({
1431
1448
  contextConfigs = sqliteTable(
1432
1449
  "context_configs",
1433
1450
  {
1434
- tenantId: text("tenant_id").notNull(),
1435
- projectId: text("project_id").notNull(),
1436
- // Add graph level scoping
1437
- id: text("id").notNull(),
1438
- name: text("name").notNull(),
1439
- description: text("description").notNull(),
1451
+ ...projectScoped,
1452
+ ...uiProperties,
1440
1453
  // Developer-defined Zod schema for validating incoming request context
1441
1454
  requestContextSchema: blob("request_context_schema", { mode: "json" }).$type(),
1442
1455
  // Stores serialized Zod schema
1443
1456
  // Object mapping template keys to fetch definitions that use request context data
1444
1457
  contextVariables: blob("context_variables", { mode: "json" }).$type(),
1445
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1446
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1458
+ ...timestamps
1447
1459
  },
1448
1460
  (table) => [
1449
1461
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1457,9 +1469,7 @@ var init_schema = __esm({
1457
1469
  contextCache = sqliteTable(
1458
1470
  "context_cache",
1459
1471
  {
1460
- tenantId: text("tenant_id").notNull(),
1461
- projectId: text("project_id").notNull(),
1462
- id: text("id").notNull(),
1472
+ ...projectScoped,
1463
1473
  // Always scoped to conversation for complete data isolation
1464
1474
  conversationId: text("conversation_id").notNull(),
1465
1475
  // Reference to the context config and specific fetch definition
@@ -1476,8 +1486,7 @@ var init_schema = __esm({
1476
1486
  fetchSource: text("fetch_source"),
1477
1487
  // URL or source identifier
1478
1488
  fetchDurationMs: integer("fetch_duration_ms"),
1479
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1480
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1489
+ ...timestamps
1481
1490
  },
1482
1491
  (table) => [
1483
1492
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1496,12 +1505,8 @@ var init_schema = __esm({
1496
1505
  agents = sqliteTable(
1497
1506
  "agents",
1498
1507
  {
1499
- tenantId: text("tenant_id").notNull(),
1500
- projectId: text("project_id").notNull(),
1501
- graphId: text("graph_id").notNull(),
1502
- id: text("id").notNull(),
1503
- name: text("name").notNull(),
1504
- description: text("description").notNull(),
1508
+ ...graphScoped,
1509
+ ...uiProperties,
1505
1510
  prompt: text("prompt").notNull(),
1506
1511
  conversationHistoryConfig: text("conversation_history_config", {
1507
1512
  mode: "json"
@@ -1509,8 +1514,7 @@ var init_schema = __esm({
1509
1514
  models: text("models", { mode: "json" }).$type(),
1510
1515
  // Agent-level stopWhen configuration (inherited from project)
1511
1516
  stopWhen: text("stop_when", { mode: "json" }).$type(),
1512
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1513
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1517
+ ...timestamps
1514
1518
  },
1515
1519
  (table) => [
1516
1520
  primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
@@ -1524,10 +1528,7 @@ var init_schema = __esm({
1524
1528
  agentRelations = sqliteTable(
1525
1529
  "agent_relations",
1526
1530
  {
1527
- tenantId: text("tenant_id").notNull(),
1528
- projectId: text("project_id").notNull(),
1529
- graphId: text("graph_id").notNull(),
1530
- id: text("id").notNull(),
1531
+ ...graphScoped,
1531
1532
  sourceAgentId: text("source_agent_id").notNull(),
1532
1533
  // For internal relationships
1533
1534
  targetAgentId: text("target_agent_id"),
@@ -1535,8 +1536,7 @@ var init_schema = __esm({
1535
1536
  externalAgentId: text("external_agent_id"),
1536
1537
  relationType: text("relation_type"),
1537
1538
  // 'transfer' | 'delegate'
1538
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1539
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1539
+ ...timestamps
1540
1540
  },
1541
1541
  (table) => [
1542
1542
  primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
@@ -1550,18 +1550,13 @@ var init_schema = __esm({
1550
1550
  externalAgents = sqliteTable(
1551
1551
  "external_agents",
1552
1552
  {
1553
- tenantId: text("tenant_id").notNull(),
1554
- projectId: text("project_id").notNull(),
1555
- graphId: text("graph_id").notNull(),
1556
- id: text("id").notNull(),
1557
- name: text("name").notNull(),
1558
- description: text("description").notNull(),
1553
+ ...graphScoped,
1554
+ ...uiProperties,
1559
1555
  baseUrl: text("base_url").notNull(),
1560
1556
  // A2A endpoint URL
1561
1557
  credentialReferenceId: text("credential_reference_id"),
1562
1558
  headers: blob("headers", { mode: "json" }).$type(),
1563
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1564
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1559
+ ...timestamps
1565
1560
  },
1566
1561
  (table) => [
1567
1562
  primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
@@ -1584,37 +1579,30 @@ var init_schema = __esm({
1584
1579
  tasks = sqliteTable(
1585
1580
  "tasks",
1586
1581
  {
1587
- tenantId: text("tenant_id").notNull(),
1588
- projectId: text("project_id").notNull(),
1589
- id: text("id").notNull(),
1582
+ ...agentScoped,
1590
1583
  contextId: text("context_id").notNull(),
1591
1584
  status: text("status").notNull(),
1592
1585
  metadata: blob("metadata", { mode: "json" }).$type(),
1593
- agentId: text("agent_id").notNull(),
1594
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1595
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1586
+ ...timestamps
1596
1587
  },
1597
1588
  (table) => [
1598
1589
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
1599
1590
  foreignKey({
1600
- columns: [table.tenantId, table.projectId],
1601
- foreignColumns: [projects.tenantId, projects.id],
1602
- name: "tasks_project_fk"
1591
+ columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
1592
+ foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
1593
+ name: "tasks_agent_fk"
1603
1594
  }).onDelete("cascade")
1604
1595
  ]
1605
1596
  );
1606
1597
  taskRelations = sqliteTable(
1607
1598
  "task_relations",
1608
1599
  {
1609
- tenantId: text("tenant_id").notNull(),
1610
- projectId: text("project_id").notNull(),
1611
- id: text("id").notNull(),
1600
+ ...projectScoped,
1612
1601
  parentTaskId: text("parent_task_id").notNull(),
1613
1602
  childTaskId: text("child_task_id").notNull(),
1614
1603
  relationType: text("relation_type").default("parent_child"),
1615
1604
  // Could be extended for other relation types
1616
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1617
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1605
+ ...timestamps
1618
1606
  },
1619
1607
  (table) => [
1620
1608
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1628,14 +1616,10 @@ var init_schema = __esm({
1628
1616
  dataComponents = sqliteTable(
1629
1617
  "data_components",
1630
1618
  {
1631
- tenantId: text("tenant_id").notNull(),
1632
- projectId: text("project_id").notNull(),
1633
- id: text("id").notNull(),
1634
- name: text("name").notNull(),
1635
- description: text("description").notNull(),
1619
+ ...projectScoped,
1620
+ ...uiProperties,
1636
1621
  props: blob("props", { mode: "json" }).$type(),
1637
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1638
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1622
+ ...timestamps
1639
1623
  },
1640
1624
  (table) => [
1641
1625
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1649,11 +1633,7 @@ var init_schema = __esm({
1649
1633
  agentDataComponents = sqliteTable(
1650
1634
  "agent_data_components",
1651
1635
  {
1652
- tenantId: text("tenant_id").notNull(),
1653
- projectId: text("project_id").notNull(),
1654
- graphId: text("graph_id").notNull(),
1655
- agentId: text("agent_id").notNull(),
1656
- id: text("id").notNull(),
1636
+ ...agentScoped,
1657
1637
  dataComponentId: text("data_component_id").notNull(),
1658
1638
  createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1659
1639
  },
@@ -1676,15 +1656,11 @@ var init_schema = __esm({
1676
1656
  artifactComponents = sqliteTable(
1677
1657
  "artifact_components",
1678
1658
  {
1679
- tenantId: text("tenant_id").notNull(),
1680
- projectId: text("project_id").notNull(),
1681
- id: text("id").notNull(),
1682
- name: text("name").notNull(),
1683
- description: text("description").notNull(),
1659
+ ...projectScoped,
1660
+ ...uiProperties,
1684
1661
  summaryProps: blob("summary_props", { mode: "json" }).$type(),
1685
1662
  fullProps: blob("full_props", { mode: "json" }).$type(),
1686
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1687
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1663
+ ...timestamps
1688
1664
  },
1689
1665
  (table) => [
1690
1666
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1698,11 +1674,7 @@ var init_schema = __esm({
1698
1674
  agentArtifactComponents = sqliteTable(
1699
1675
  "agent_artifact_components",
1700
1676
  {
1701
- tenantId: text("tenant_id").notNull(),
1702
- projectId: text("project_id").notNull(),
1703
- graphId: text("graph_id").notNull(),
1704
- agentId: text("agent_id").notNull(),
1705
- id: text("id").notNull(),
1677
+ ...agentScoped,
1706
1678
  artifactComponentId: text("artifact_component_id").notNull(),
1707
1679
  createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1708
1680
  },
@@ -1731,9 +1703,7 @@ var init_schema = __esm({
1731
1703
  tools = sqliteTable(
1732
1704
  "tools",
1733
1705
  {
1734
- tenantId: text("tenant_id").notNull(),
1735
- projectId: text("project_id").notNull(),
1736
- id: text("id").notNull(),
1706
+ ...projectScoped,
1737
1707
  name: text("name").notNull(),
1738
1708
  // Enhanced MCP configuration
1739
1709
  config: blob("config", { mode: "json" }).$type().notNull(),
@@ -1744,8 +1714,7 @@ var init_schema = __esm({
1744
1714
  // Server capabilities and status
1745
1715
  capabilities: blob("capabilities", { mode: "json" }).$type(),
1746
1716
  lastError: text("last_error"),
1747
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1748
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1717
+ ...timestamps
1749
1718
  },
1750
1719
  (table) => [
1751
1720
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1759,16 +1728,11 @@ var init_schema = __esm({
1759
1728
  agentToolRelations = sqliteTable(
1760
1729
  "agent_tool_relations",
1761
1730
  {
1762
- tenantId: text("tenant_id").notNull(),
1763
- projectId: text("project_id").notNull(),
1764
- graphId: text("graph_id").notNull(),
1765
- agentId: text("agent_id").notNull(),
1766
- id: text("id").notNull(),
1731
+ ...agentScoped,
1767
1732
  toolId: text("tool_id").notNull(),
1768
1733
  selectedTools: blob("selected_tools", { mode: "json" }).$type(),
1769
1734
  headers: blob("headers", { mode: "json" }).$type(),
1770
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1771
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1735
+ ...timestamps
1772
1736
  },
1773
1737
  (table) => [
1774
1738
  primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
@@ -1789,16 +1753,13 @@ var init_schema = __esm({
1789
1753
  conversations = sqliteTable(
1790
1754
  "conversations",
1791
1755
  {
1792
- tenantId: text("tenant_id").notNull(),
1793
- projectId: text("project_id").notNull(),
1794
- id: text("id").notNull(),
1756
+ ...projectScoped,
1795
1757
  userId: text("user_id"),
1796
1758
  activeAgentId: text("active_agent_id").notNull(),
1797
1759
  title: text("title"),
1798
1760
  lastContextResolution: text("last_context_resolution"),
1799
1761
  metadata: blob("metadata", { mode: "json" }).$type(),
1800
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1801
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1762
+ ...timestamps
1802
1763
  },
1803
1764
  (table) => [
1804
1765
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1812,9 +1773,7 @@ var init_schema = __esm({
1812
1773
  messages = sqliteTable(
1813
1774
  "messages",
1814
1775
  {
1815
- tenantId: text("tenant_id").notNull(),
1816
- projectId: text("project_id").notNull(),
1817
- id: text("id").notNull(),
1776
+ ...projectScoped,
1818
1777
  conversationId: text("conversation_id").notNull(),
1819
1778
  // Role mapping: user, agent, system (unified for both formats)
1820
1779
  role: text("role").notNull(),
@@ -1849,8 +1808,7 @@ var init_schema = __esm({
1849
1808
  // A2A session identifier
1850
1809
  // Metadata for extensions
1851
1810
  metadata: blob("metadata", { mode: "json" }).$type(),
1852
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1853
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1811
+ ...timestamps
1854
1812
  },
1855
1813
  (table) => [
1856
1814
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -1864,10 +1822,7 @@ var init_schema = __esm({
1864
1822
  ledgerArtifacts = sqliteTable(
1865
1823
  "ledger_artifacts",
1866
1824
  {
1867
- // Primary identifier (maps to `artifactId`)
1868
- tenantId: text("tenant_id").notNull(),
1869
- projectId: text("project_id").notNull(),
1870
- id: text("id").notNull(),
1825
+ ...projectScoped,
1871
1826
  // Links
1872
1827
  taskId: text("task_id").notNull(),
1873
1828
  toolCallId: text("tool_call_id"),
@@ -1885,9 +1840,7 @@ var init_schema = __esm({
1885
1840
  visibility: text("visibility").default("context"),
1886
1841
  allowedAgents: blob("allowed_agents", { mode: "json" }).$type(),
1887
1842
  derivedFrom: text("derived_from"),
1888
- // Timestamps
1889
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1890
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1843
+ ...timestamps
1891
1844
  },
1892
1845
  (table) => [
1893
1846
  primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
@@ -1895,16 +1848,21 @@ var init_schema = __esm({
1895
1848
  columns: [table.tenantId, table.projectId],
1896
1849
  foreignColumns: [projects.tenantId, projects.id],
1897
1850
  name: "ledger_artifacts_project_fk"
1898
- }).onDelete("cascade")
1851
+ }).onDelete("cascade"),
1852
+ index("ledger_artifacts_task_id_idx").on(table.taskId),
1853
+ index("ledger_artifacts_tool_call_id_idx").on(table.toolCallId),
1854
+ index("ledger_artifacts_context_id_idx").on(table.contextId),
1855
+ unique("ledger_artifacts_task_context_name_unique").on(
1856
+ table.taskId,
1857
+ table.contextId,
1858
+ table.name
1859
+ )
1899
1860
  ]
1900
1861
  );
1901
1862
  apiKeys = sqliteTable(
1902
1863
  "api_keys",
1903
1864
  {
1904
- id: text("id").primaryKey(),
1905
- tenantId: text("tenant_id").notNull(),
1906
- projectId: text("project_id").notNull(),
1907
- graphId: text("graph_id").notNull(),
1865
+ ...graphScoped,
1908
1866
  publicId: text("public_id").notNull().unique(),
1909
1867
  // Public ID for O(1) lookup (e.g., "abc123def456")
1910
1868
  keyHash: text("key_hash").notNull(),
@@ -1914,8 +1872,7 @@ var init_schema = __esm({
1914
1872
  name: text("name"),
1915
1873
  lastUsedAt: text("last_used_at"),
1916
1874
  expiresAt: text("expires_at"),
1917
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1918
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1875
+ ...timestamps
1919
1876
  },
1920
1877
  (t2) => [
1921
1878
  foreignKey({
@@ -1936,16 +1893,13 @@ var init_schema = __esm({
1936
1893
  credentialReferences = sqliteTable(
1937
1894
  "credential_references",
1938
1895
  {
1939
- tenantId: text("tenant_id").notNull(),
1940
- projectId: text("project_id").notNull(),
1941
- id: text("id").notNull(),
1896
+ ...projectScoped,
1942
1897
  type: text("type").notNull(),
1943
1898
  // Implementation type: 'keychain', 'nango', 'memory', etc.
1944
1899
  credentialStoreId: text("credential_store_id").notNull(),
1945
1900
  // Maps to framework.getCredentialStore(id)
1946
1901
  retrievalParams: blob("retrieval_params", { mode: "json" }).$type(),
1947
- createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
1948
- updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
1902
+ ...timestamps
1949
1903
  },
1950
1904
  (t2) => [
1951
1905
  primaryKey({ columns: [t2.tenantId, t2.projectId, t2.id] }),
@@ -1956,18 +1910,6 @@ var init_schema = __esm({
1956
1910
  }).onDelete("cascade")
1957
1911
  ]
1958
1912
  );
1959
- ledgerArtifactsTaskIdIdx = index("ledger_artifacts_task_id_idx").on(
1960
- ledgerArtifacts.taskId
1961
- );
1962
- ledgerArtifactsToolCallIdIdx = index("ledger_artifacts_tool_call_id_idx").on(
1963
- ledgerArtifacts.toolCallId
1964
- );
1965
- ledgerArtifactsContextIdIdx = index("ledger_artifacts_context_id_idx").on(
1966
- ledgerArtifacts.contextId
1967
- );
1968
- ledgerArtifactsTaskContextNameUnique = unique(
1969
- "ledger_artifacts_task_context_name_unique"
1970
- ).on(ledgerArtifacts.taskId, ledgerArtifacts.contextId, ledgerArtifacts.name);
1971
1913
  tasksRelations = relations(tasks, ({ one, many }) => ({
1972
1914
  // A task belongs to one project
1973
1915
  project: one(projects, {
@@ -1993,37 +1935,24 @@ var init_schema = __esm({
1993
1935
  ledgerArtifacts: many(ledgerArtifacts)
1994
1936
  }));
1995
1937
  projectsRelations = relations(projects, ({ many }) => ({
1996
- // A project can have many agents
1997
1938
  agents: many(agents),
1998
- // A project can have many agent graphs
1999
1939
  agentGraphs: many(agentGraph),
2000
- // A project can have many tools
2001
1940
  tools: many(tools),
2002
- // A project can have many context configs
2003
1941
  contextConfigs: many(contextConfigs),
2004
- // A project can have many external agents
2005
1942
  externalAgents: many(externalAgents),
2006
- // A project can have many conversations
2007
1943
  conversations: many(conversations),
2008
- // A project can have many tasks
2009
1944
  tasks: many(tasks),
2010
- // A project can have many data components
2011
1945
  dataComponents: many(dataComponents),
2012
- // A project can have many artifact components
2013
1946
  artifactComponents: many(artifactComponents),
2014
- // A project can have many ledger artifacts
2015
1947
  ledgerArtifacts: many(ledgerArtifacts),
2016
- // A project can have many credential references
2017
1948
  credentialReferences: many(credentialReferences)
2018
1949
  }));
2019
1950
  taskRelationsRelations = relations(taskRelations, ({ one }) => ({
2020
- // Each relation has one parent task
2021
1951
  parentTask: one(tasks, {
2022
1952
  fields: [taskRelations.parentTaskId],
2023
1953
  references: [tasks.id],
2024
1954
  relationName: "parentTask"
2025
1955
  }),
2026
- // Each relation has one child task
2027
1956
  childTask: one(tasks, {
2028
1957
  fields: [taskRelations.childTaskId],
2029
1958
  references: [tasks.id],
@@ -2031,107 +1960,85 @@ var init_schema = __esm({
2031
1960
  })
2032
1961
  }));
2033
1962
  contextConfigsRelations = relations(contextConfigs, ({ many, one }) => ({
2034
- // A context config belongs to one project
2035
1963
  project: one(projects, {
2036
1964
  fields: [contextConfigs.tenantId, contextConfigs.projectId],
2037
1965
  references: [projects.tenantId, projects.id]
2038
1966
  }),
2039
- // A context config can be used by many agent graphs
2040
1967
  graphs: many(agentGraph),
2041
- // A context config can have many cached entries
2042
1968
  cache: many(contextCache)
2043
1969
  }));
2044
1970
  contextCacheRelations = relations(contextCache, ({ one }) => ({
2045
- // Each cache entry belongs to one context config
2046
1971
  contextConfig: one(contextConfigs, {
2047
1972
  fields: [contextCache.contextConfigId],
2048
1973
  references: [contextConfigs.id]
2049
1974
  })
2050
1975
  }));
2051
1976
  agentsRelations = relations(agents, ({ many, one }) => ({
2052
- // A context config belongs to one project
2053
1977
  project: one(projects, {
2054
1978
  fields: [agents.tenantId, agents.projectId],
2055
1979
  references: [projects.tenantId, projects.id]
2056
1980
  }),
2057
- // An agent can have many tasks
2058
1981
  tasks: many(tasks),
2059
- // An agent can be the default agent for many graphs
2060
1982
  defaultForGraphs: many(agentGraph),
2061
- // Agent relation tracking
2062
1983
  sourceRelations: many(agentRelations, {
2063
1984
  relationName: "sourceRelations"
2064
1985
  }),
2065
1986
  targetRelations: many(agentRelations, {
2066
1987
  relationName: "targetRelations"
2067
1988
  }),
2068
- // Message tracking relations
2069
1989
  sentMessages: many(messages, {
2070
1990
  relationName: "sentMessages"
2071
1991
  }),
2072
1992
  receivedMessages: many(messages, {
2073
1993
  relationName: "receivedMessages"
2074
1994
  }),
2075
- // Legacy message association (consider deprecating)
2076
1995
  associatedMessages: many(messages, {
2077
1996
  relationName: "associatedAgent"
2078
1997
  }),
2079
1998
  toolRelations: many(agentToolRelations),
2080
- // Data component relations
2081
1999
  dataComponentRelations: many(agentDataComponents),
2082
- // Artifact component relations
2083
2000
  artifactComponentRelations: many(agentArtifactComponents)
2084
2001
  }));
2085
2002
  agentGraphRelations = relations(agentGraph, ({ one }) => ({
2086
- // An agent graph belongs to one project
2087
2003
  project: one(projects, {
2088
2004
  fields: [agentGraph.tenantId, agentGraph.projectId],
2089
2005
  references: [projects.tenantId, projects.id]
2090
2006
  }),
2091
- // An agent graph may have one default agent (optional)
2092
2007
  defaultAgent: one(agents, {
2093
2008
  fields: [agentGraph.defaultAgentId],
2094
2009
  references: [agents.id]
2095
2010
  }),
2096
- // An agent graph can reference one context config
2097
2011
  contextConfig: one(contextConfigs, {
2098
2012
  fields: [agentGraph.contextConfigId],
2099
2013
  references: [contextConfigs.id]
2100
2014
  })
2101
2015
  }));
2102
2016
  externalAgentsRelations = relations(externalAgents, ({ one, many }) => ({
2103
- // An external agent belongs to one project
2104
2017
  project: one(projects, {
2105
2018
  fields: [externalAgents.tenantId, externalAgents.projectId],
2106
2019
  references: [projects.tenantId, projects.id]
2107
2020
  }),
2108
- // An external agent can be referenced by many agent relations
2109
2021
  agentRelations: many(agentRelations),
2110
- // An external agent may have one credential reference
2111
2022
  credentialReference: one(credentialReferences, {
2112
2023
  fields: [externalAgents.credentialReferenceId],
2113
2024
  references: [credentialReferences.id]
2114
2025
  })
2115
2026
  }));
2116
2027
  apiKeysRelations = relations(apiKeys, ({ one }) => ({
2117
- // An API key belongs to one project
2118
2028
  project: one(projects, {
2119
2029
  fields: [apiKeys.tenantId, apiKeys.projectId],
2120
2030
  references: [projects.tenantId, projects.id]
2121
2031
  }),
2122
- // An API key belongs to one tenant and graph
2123
2032
  graph: one(agentGraph, {
2124
2033
  fields: [apiKeys.graphId],
2125
2034
  references: [agentGraph.id]
2126
2035
  })
2127
2036
  }));
2128
2037
  agentToolRelationsRelations = relations(agentToolRelations, ({ one }) => ({
2129
- // An agent-tool relation belongs to one agent
2130
2038
  agent: one(agents, {
2131
2039
  fields: [agentToolRelations.agentId],
2132
2040
  references: [agents.id]
2133
2041
  }),
2134
- // An agent-tool relation belongs to one tool
2135
2042
  tool: one(tools, {
2136
2043
  fields: [agentToolRelations.toolId],
2137
2044
  references: [tools.id]
@@ -2141,35 +2048,28 @@ var init_schema = __esm({
2141
2048
  tools: many(tools)
2142
2049
  }));
2143
2050
  toolsRelations = relations(tools, ({ one, many }) => ({
2144
- // A tool belongs to one project
2145
2051
  project: one(projects, {
2146
2052
  fields: [tools.tenantId, tools.projectId],
2147
2053
  references: [projects.tenantId, projects.id]
2148
2054
  }),
2149
- // A tool can be used by many agents through agent-tool relations
2150
2055
  agentRelations: many(agentToolRelations),
2151
- // A tool may have one credential reference
2152
2056
  credentialReference: one(credentialReferences, {
2153
2057
  fields: [tools.credentialReferenceId],
2154
2058
  references: [credentialReferences.id]
2155
2059
  })
2156
2060
  }));
2157
2061
  conversationsRelations = relations(conversations, ({ one, many }) => ({
2158
- // A conversation belongs to one project
2159
2062
  project: one(projects, {
2160
2063
  fields: [conversations.tenantId, conversations.projectId],
2161
2064
  references: [projects.tenantId, projects.id]
2162
2065
  }),
2163
- // A conversation has many messages
2164
2066
  messages: many(messages),
2165
- // A conversation has one active agent
2166
2067
  activeAgent: one(agents, {
2167
2068
  fields: [conversations.activeAgentId],
2168
2069
  references: [agents.id]
2169
2070
  })
2170
2071
  }));
2171
2072
  messagesRelations = relations(messages, ({ one, many }) => ({
2172
- // A message belongs to one conversation
2173
2073
  conversation: one(conversations, {
2174
2074
  fields: [messages.conversationId],
2175
2075
  references: [conversations.id]
@@ -2180,114 +2080,94 @@ var init_schema = __esm({
2180
2080
  references: [agents.id],
2181
2081
  relationName: "associatedAgent"
2182
2082
  }),
2183
- // Sender tracking relations
2184
2083
  fromAgent: one(agents, {
2185
2084
  fields: [messages.fromAgentId],
2186
2085
  references: [agents.id],
2187
2086
  relationName: "sentMessages"
2188
2087
  }),
2189
- // Recipient tracking relations
2190
2088
  toAgent: one(agents, {
2191
2089
  fields: [messages.toAgentId],
2192
2090
  references: [agents.id],
2193
2091
  relationName: "receivedMessages"
2194
2092
  }),
2195
- // External agent sender tracking relations
2196
2093
  fromExternalAgent: one(externalAgents, {
2197
2094
  fields: [messages.fromExternalAgentId],
2198
2095
  references: [externalAgents.id],
2199
2096
  relationName: "receivedExternalMessages"
2200
2097
  }),
2201
- // External agent recipient tracking relations
2202
2098
  toExternalAgent: one(externalAgents, {
2203
2099
  fields: [messages.toExternalAgentId],
2204
2100
  references: [externalAgents.id],
2205
2101
  relationName: "sentExternalMessages"
2206
2102
  }),
2207
- // A message may be associated with a task
2208
2103
  task: one(tasks, {
2209
2104
  fields: [messages.taskId],
2210
2105
  references: [tasks.id]
2211
2106
  }),
2212
- // A message may have a parent message (for threading)
2213
2107
  parentMessage: one(messages, {
2214
2108
  fields: [messages.parentMessageId],
2215
2109
  references: [messages.id],
2216
2110
  relationName: "parentChild"
2217
2111
  }),
2218
- // A message may have child messages
2219
2112
  childMessages: many(messages, {
2220
2113
  relationName: "parentChild"
2221
2114
  })
2222
2115
  }));
2223
2116
  artifactComponentsRelations = relations(artifactComponents, ({ many }) => ({
2224
- // An artifact component can be associated with many agents
2225
2117
  agentRelations: many(agentArtifactComponents)
2226
2118
  }));
2227
2119
  agentArtifactComponentsRelations = relations(agentArtifactComponents, ({ one }) => ({
2228
- // An agent-artifact component relation belongs to one agent
2229
2120
  agent: one(agents, {
2230
2121
  fields: [agentArtifactComponents.agentId],
2231
2122
  references: [agents.id]
2232
2123
  }),
2233
- // An agent-artifact component relation belongs to one artifact component
2234
2124
  artifactComponent: one(artifactComponents, {
2235
2125
  fields: [agentArtifactComponents.artifactComponentId],
2236
2126
  references: [artifactComponents.id]
2237
2127
  })
2238
2128
  }));
2239
2129
  dataComponentsRelations = relations(dataComponents, ({ many, one }) => ({
2240
- // A data component belongs to one project
2241
2130
  project: one(projects, {
2242
2131
  fields: [dataComponents.tenantId, dataComponents.projectId],
2243
2132
  references: [projects.tenantId, projects.id]
2244
2133
  }),
2245
- // A data component can be associated with many agents
2246
2134
  agentRelations: many(agentDataComponents)
2247
2135
  }));
2248
2136
  agentDataComponentsRelations = relations(agentDataComponents, ({ one }) => ({
2249
- // An agent-data component relation belongs to one agent
2250
2137
  agent: one(agents, {
2251
2138
  fields: [agentDataComponents.agentId],
2252
2139
  references: [agents.id]
2253
2140
  }),
2254
- // An agent-data component relation belongs to one data component
2255
2141
  dataComponent: one(dataComponents, {
2256
2142
  fields: [agentDataComponents.dataComponentId],
2257
2143
  references: [dataComponents.id]
2258
2144
  })
2259
2145
  }));
2260
2146
  ledgerArtifactsRelations = relations(ledgerArtifacts, ({ one }) => ({
2261
- // A ledger artifact belongs to one project
2262
2147
  project: one(projects, {
2263
2148
  fields: [ledgerArtifacts.tenantId, ledgerArtifacts.projectId],
2264
2149
  references: [projects.tenantId, projects.id]
2265
2150
  }),
2266
- // A ledger artifact may be associated with one task
2267
2151
  task: one(tasks, {
2268
2152
  fields: [ledgerArtifacts.taskId],
2269
2153
  references: [tasks.id]
2270
2154
  })
2271
2155
  }));
2272
2156
  agentRelationsRelations = relations(agentRelations, ({ one }) => ({
2273
- // An agent relation belongs to one graph
2274
2157
  graph: one(agentGraph, {
2275
2158
  fields: [agentRelations.graphId],
2276
2159
  references: [agentGraph.id]
2277
2160
  }),
2278
- // An agent relation has one source agent
2279
2161
  sourceAgent: one(agents, {
2280
2162
  fields: [agentRelations.sourceAgentId],
2281
2163
  references: [agents.id],
2282
2164
  relationName: "sourceRelations"
2283
2165
  }),
2284
- // An agent relation may have one target agent (for internal relations)
2285
2166
  targetAgent: one(agents, {
2286
2167
  fields: [agentRelations.targetAgentId],
2287
2168
  references: [agents.id],
2288
2169
  relationName: "targetRelations"
2289
2170
  }),
2290
- // An agent relation may have one external agent (for external relations)
2291
2171
  externalAgent: one(externalAgents, {
2292
2172
  fields: [agentRelations.externalAgentId],
2293
2173
  references: [externalAgents.id]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-cli",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "Inkeep CLI tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,8 +45,8 @@
45
45
  "recast": "^0.23.0",
46
46
  "ts-morph": "^26.0.0",
47
47
  "tsx": "^4.20.5",
48
- "@inkeep/agents-core": "^0.10.1",
49
- "@inkeep/agents-manage-ui": "^0.10.1"
48
+ "@inkeep/agents-core": "^0.11.0",
49
+ "@inkeep/agents-manage-ui": "^0.11.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/degit": "^2.8.6",