@inkeep/agents-core 0.2.1 → 0.3.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.
@@ -21,11 +21,44 @@ var projects = sqliteCore.sqliteTable(
21
21
  },
22
22
  (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.id] })]
23
23
  );
24
+ var agentGraph = sqliteCore.sqliteTable(
25
+ "agent_graph",
26
+ {
27
+ tenantId: sqliteCore.text("tenant_id").notNull(),
28
+ projectId: sqliteCore.text("project_id").notNull(),
29
+ id: sqliteCore.text("id").notNull(),
30
+ name: sqliteCore.text("name").notNull(),
31
+ description: sqliteCore.text("description"),
32
+ defaultAgentId: sqliteCore.text("default_agent_id"),
33
+ // Reference to shared context configuration for all agents in this graph
34
+ contextConfigId: sqliteCore.text("context_config_id"),
35
+ // add fk relationship
36
+ // Graph-level model settingsuration that can be inherited by agents
37
+ models: sqliteCore.text("models", { mode: "json" }).$type(),
38
+ // Status updates configuration for intelligent progress summaries
39
+ statusUpdates: sqliteCore.text("status_updates", { mode: "json" }).$type(),
40
+ // Graph-level prompt that can be used as additional context for agents
41
+ graphPrompt: sqliteCore.text("graph_prompt"),
42
+ // Graph-level stopWhen configuration that can be inherited by agents
43
+ stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
44
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
45
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
46
+ },
47
+ (table) => [
48
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
49
+ sqliteCore.foreignKey({
50
+ columns: [table.tenantId, table.projectId],
51
+ foreignColumns: [projects.tenantId, projects.id],
52
+ name: "agent_graph_project_fk"
53
+ }).onDelete("cascade")
54
+ ]
55
+ );
24
56
  var contextConfigs = sqliteCore.sqliteTable(
25
57
  "context_configs",
26
58
  {
27
59
  tenantId: sqliteCore.text("tenant_id").notNull(),
28
60
  projectId: sqliteCore.text("project_id").notNull(),
61
+ // Add graph level scoping
29
62
  id: sqliteCore.text("id").notNull(),
30
63
  name: sqliteCore.text("name").notNull(),
31
64
  description: sqliteCore.text("description").notNull(),
@@ -90,6 +123,7 @@ var agents = sqliteCore.sqliteTable(
90
123
  {
91
124
  tenantId: sqliteCore.text("tenant_id").notNull(),
92
125
  projectId: sqliteCore.text("project_id").notNull(),
126
+ graphId: sqliteCore.text("graph_id").notNull(),
93
127
  id: sqliteCore.text("id").notNull(),
94
128
  name: sqliteCore.text("name").notNull(),
95
129
  description: sqliteCore.text("description").notNull(),
@@ -104,11 +138,11 @@ var agents = sqliteCore.sqliteTable(
104
138
  updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
105
139
  },
106
140
  (table) => [
107
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
141
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
108
142
  sqliteCore.foreignKey({
109
- columns: [table.tenantId, table.projectId],
110
- foreignColumns: [projects.tenantId, projects.id],
111
- name: "agents_project_fk"
143
+ columns: [table.tenantId, table.projectId, table.graphId],
144
+ foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
145
+ name: "agents_graph_fk"
112
146
  }).onDelete("cascade")
113
147
  ]
114
148
  );
@@ -117,8 +151,8 @@ var agentRelations = sqliteCore.sqliteTable(
117
151
  {
118
152
  tenantId: sqliteCore.text("tenant_id").notNull(),
119
153
  projectId: sqliteCore.text("project_id").notNull(),
120
- id: sqliteCore.text("id").notNull(),
121
154
  graphId: sqliteCore.text("graph_id").notNull(),
155
+ id: sqliteCore.text("id").notNull(),
122
156
  sourceAgentId: sqliteCore.text("source_agent_id").notNull(),
123
157
  // For internal relationships
124
158
  targetAgentId: sqliteCore.text("target_agent_id"),
@@ -130,11 +164,11 @@ var agentRelations = sqliteCore.sqliteTable(
130
164
  updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
131
165
  },
132
166
  (table) => [
133
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
167
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
134
168
  sqliteCore.foreignKey({
135
- columns: [table.tenantId, table.projectId],
136
- foreignColumns: [projects.tenantId, projects.id],
137
- name: "agent_relations_project_fk"
169
+ columns: [table.tenantId, table.projectId, table.graphId],
170
+ foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
171
+ name: "agent_relations_graph_fk"
138
172
  }).onDelete("cascade")
139
173
  ]
140
174
  );
@@ -143,6 +177,7 @@ var externalAgents = sqliteCore.sqliteTable(
143
177
  {
144
178
  tenantId: sqliteCore.text("tenant_id").notNull(),
145
179
  projectId: sqliteCore.text("project_id").notNull(),
180
+ graphId: sqliteCore.text("graph_id").notNull(),
146
181
  id: sqliteCore.text("id").notNull(),
147
182
  name: sqliteCore.text("name").notNull(),
148
183
  description: sqliteCore.text("description").notNull(),
@@ -154,11 +189,11 @@ var externalAgents = sqliteCore.sqliteTable(
154
189
  updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
155
190
  },
156
191
  (table) => [
157
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
192
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
158
193
  sqliteCore.foreignKey({
159
- columns: [table.tenantId, table.projectId],
160
- foreignColumns: [projects.tenantId, projects.id],
161
- name: "external_agents_project_fk"
194
+ columns: [table.tenantId, table.projectId, table.graphId],
195
+ foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
196
+ name: "external_agents_graph_fk"
162
197
  }).onDelete("cascade"),
163
198
  sqliteCore.foreignKey({
164
199
  columns: [table.tenantId, table.projectId, table.credentialReferenceId],
@@ -171,37 +206,6 @@ var externalAgents = sqliteCore.sqliteTable(
171
206
  }).onDelete("set null")
172
207
  ]
173
208
  );
174
- var agentGraph = sqliteCore.sqliteTable(
175
- "agent_graph",
176
- {
177
- tenantId: sqliteCore.text("tenant_id").notNull(),
178
- projectId: sqliteCore.text("project_id").notNull(),
179
- id: sqliteCore.text("id").notNull(),
180
- name: sqliteCore.text("name").notNull(),
181
- description: sqliteCore.text("description"),
182
- defaultAgentId: sqliteCore.text("default_agent_id").notNull(),
183
- // Reference to shared context configuration for all agents in this graph
184
- contextConfigId: sqliteCore.text("context_config_id"),
185
- // Graph-level model settingsuration that can be inherited by agents
186
- models: sqliteCore.text("models", { mode: "json" }).$type(),
187
- // Status updates configuration for intelligent progress summaries
188
- statusUpdates: sqliteCore.text("status_updates", { mode: "json" }).$type(),
189
- // Graph-level prompt that can be used as additional context for agents
190
- graphPrompt: sqliteCore.text("graph_prompt"),
191
- // Graph-level stopWhen configuration that can be inherited by agents
192
- stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
193
- createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
194
- updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
195
- },
196
- (table) => [
197
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
198
- sqliteCore.foreignKey({
199
- columns: [table.tenantId, table.projectId],
200
- foreignColumns: [projects.tenantId, projects.id],
201
- name: "agent_graph_project_fk"
202
- }).onDelete("cascade")
203
- ]
204
- );
205
209
  var tasks = sqliteCore.sqliteTable(
206
210
  "tasks",
207
211
  {
@@ -272,23 +276,18 @@ var agentDataComponents = sqliteCore.sqliteTable(
272
276
  {
273
277
  tenantId: sqliteCore.text("tenant_id").notNull(),
274
278
  projectId: sqliteCore.text("project_id").notNull(),
275
- id: sqliteCore.text("id").notNull(),
279
+ graphId: sqliteCore.text("graph_id").notNull(),
276
280
  agentId: sqliteCore.text("agent_id").notNull(),
281
+ id: sqliteCore.text("id").notNull(),
277
282
  dataComponentId: sqliteCore.text("data_component_id").notNull(),
278
283
  createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
279
284
  },
280
285
  (table) => [
281
286
  sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
282
- // Foreign key constraint to projects table
283
- sqliteCore.foreignKey({
284
- columns: [table.tenantId, table.projectId],
285
- foreignColumns: [projects.tenantId, projects.id],
286
- name: "agent_data_components_project_fk"
287
- }).onDelete("cascade"),
288
- // Foreign key constraint to agents table
287
+ // Foreign key constraint to agents table (ensures graph and project exist via cascade)
289
288
  sqliteCore.foreignKey({
290
- columns: [table.tenantId, table.projectId, table.agentId],
291
- foreignColumns: [agents.tenantId, agents.projectId, agents.id],
289
+ columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
290
+ foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
292
291
  name: "agent_data_components_agent_fk"
293
292
  }).onDelete("cascade"),
294
293
  // Foreign key constraint to data_components table
@@ -326,23 +325,20 @@ var agentArtifactComponents = sqliteCore.sqliteTable(
326
325
  {
327
326
  tenantId: sqliteCore.text("tenant_id").notNull(),
328
327
  projectId: sqliteCore.text("project_id").notNull(),
329
- id: sqliteCore.text("id").notNull(),
328
+ graphId: sqliteCore.text("graph_id").notNull(),
330
329
  agentId: sqliteCore.text("agent_id").notNull(),
330
+ id: sqliteCore.text("id").notNull(),
331
331
  artifactComponentId: sqliteCore.text("artifact_component_id").notNull(),
332
332
  createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
333
333
  },
334
334
  (table) => [
335
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
336
- // Foreign key constraint to projects table
337
- sqliteCore.foreignKey({
338
- columns: [table.tenantId, table.projectId],
339
- foreignColumns: [projects.tenantId, projects.id],
340
- name: "agent_artifact_components_project_fk"
341
- }).onDelete("cascade"),
342
- // Foreign key constraint to agents table
335
+ sqliteCore.primaryKey({
336
+ columns: [table.tenantId, table.projectId, table.graphId, table.agentId, table.id]
337
+ }),
338
+ // Foreign key constraint to agents table (ensures graph and project exist via cascade)
343
339
  sqliteCore.foreignKey({
344
- columns: [table.tenantId, table.projectId, table.agentId],
345
- foreignColumns: [agents.tenantId, agents.projectId, agents.id],
340
+ columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
341
+ foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
346
342
  name: "agent_artifact_components_agent_fk"
347
343
  }).onDelete("cascade"),
348
344
  // Foreign key constraint to artifact_components table
@@ -396,25 +392,20 @@ var agentToolRelations = sqliteCore.sqliteTable(
396
392
  {
397
393
  tenantId: sqliteCore.text("tenant_id").notNull(),
398
394
  projectId: sqliteCore.text("project_id").notNull(),
399
- id: sqliteCore.text("id").notNull(),
395
+ graphId: sqliteCore.text("graph_id").notNull(),
400
396
  agentId: sqliteCore.text("agent_id").notNull(),
397
+ id: sqliteCore.text("id").notNull(),
401
398
  toolId: sqliteCore.text("tool_id").notNull(),
402
399
  selectedTools: sqliteCore.blob("selected_tools", { mode: "json" }).$type(),
403
400
  createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
404
401
  updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
405
402
  },
406
403
  (table) => [
407
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
408
- // Foreign key constraint to projects table
404
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
405
+ // Foreign key constraint to agents table (which includes project and graph scope)
409
406
  sqliteCore.foreignKey({
410
- columns: [table.tenantId, table.projectId],
411
- foreignColumns: [projects.tenantId, projects.id],
412
- name: "agent_tool_relations_project_fk"
413
- }).onDelete("cascade"),
414
- // Foreign key constraint to agents table
415
- sqliteCore.foreignKey({
416
- columns: [table.tenantId, table.projectId, table.agentId],
417
- foreignColumns: [agents.tenantId, agents.projectId, agents.id],
407
+ columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
408
+ foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
418
409
  name: "agent_tool_relations_agent_fk"
419
410
  }).onDelete("cascade"),
420
411
  // Foreign key constraint to tools table
@@ -621,7 +612,9 @@ var tasksRelations = drizzleOrm.relations(tasks, ({ one, many }) => ({
621
612
  references: [agents.id]
622
613
  }),
623
614
  // A task can have many messages associated with it
624
- messages: many(messages)
615
+ messages: many(messages),
616
+ // A task can have many ledger artifacts
617
+ ledgerArtifacts: many(ledgerArtifacts)
625
618
  }));
626
619
  var projectsRelations = drizzleOrm.relations(projects, ({ many }) => ({
627
620
  // A project can have many agents
@@ -637,7 +630,15 @@ var projectsRelations = drizzleOrm.relations(projects, ({ many }) => ({
637
630
  // A project can have many conversations
638
631
  conversations: many(conversations),
639
632
  // A project can have many tasks
640
- tasks: many(tasks)
633
+ tasks: many(tasks),
634
+ // A project can have many data components
635
+ dataComponents: many(dataComponents),
636
+ // A project can have many artifact components
637
+ artifactComponents: many(artifactComponents),
638
+ // A project can have many ledger artifacts
639
+ ledgerArtifacts: many(ledgerArtifacts),
640
+ // A project can have many credential references
641
+ credentialReferences: many(credentialReferences)
641
642
  }));
642
643
  var taskRelationsRelations = drizzleOrm.relations(taskRelations, ({ one }) => ({
643
644
  // Each relation has one parent task
@@ -699,7 +700,11 @@ var agentsRelations = drizzleOrm.relations(agents, ({ many, one }) => ({
699
700
  associatedMessages: many(messages, {
700
701
  relationName: "associatedAgent"
701
702
  }),
702
- toolRelations: many(agentToolRelations)
703
+ toolRelations: many(agentToolRelations),
704
+ // Data component relations
705
+ dataComponentRelations: many(agentDataComponents),
706
+ // Artifact component relations
707
+ artifactComponentRelations: many(agentArtifactComponents)
703
708
  }));
704
709
  var agentGraphRelations = drizzleOrm.relations(agentGraph, ({ one }) => ({
705
710
  // An agent graph belongs to one project
@@ -707,7 +712,7 @@ var agentGraphRelations = drizzleOrm.relations(agentGraph, ({ one }) => ({
707
712
  fields: [agentGraph.tenantId, agentGraph.projectId],
708
713
  references: [projects.tenantId, projects.id]
709
714
  }),
710
- // An agent graph belongs to one default agent
715
+ // An agent graph may have one default agent (optional)
711
716
  defaultAgent: one(agents, {
712
717
  fields: [agentGraph.defaultAgentId],
713
718
  references: [agents.id]
@@ -855,6 +860,39 @@ var agentArtifactComponentsRelations = drizzleOrm.relations(agentArtifactCompone
855
860
  references: [artifactComponents.id]
856
861
  })
857
862
  }));
863
+ var dataComponentsRelations = drizzleOrm.relations(dataComponents, ({ many, one }) => ({
864
+ // A data component belongs to one project
865
+ project: one(projects, {
866
+ fields: [dataComponents.tenantId, dataComponents.projectId],
867
+ references: [projects.tenantId, projects.id]
868
+ }),
869
+ // A data component can be associated with many agents
870
+ agentRelations: many(agentDataComponents)
871
+ }));
872
+ var agentDataComponentsRelations = drizzleOrm.relations(agentDataComponents, ({ one }) => ({
873
+ // An agent-data component relation belongs to one agent
874
+ agent: one(agents, {
875
+ fields: [agentDataComponents.agentId],
876
+ references: [agents.id]
877
+ }),
878
+ // An agent-data component relation belongs to one data component
879
+ dataComponent: one(dataComponents, {
880
+ fields: [agentDataComponents.dataComponentId],
881
+ references: [dataComponents.id]
882
+ })
883
+ }));
884
+ var ledgerArtifactsRelations = drizzleOrm.relations(ledgerArtifacts, ({ one }) => ({
885
+ // A ledger artifact belongs to one project
886
+ project: one(projects, {
887
+ fields: [ledgerArtifacts.tenantId, ledgerArtifacts.projectId],
888
+ references: [projects.tenantId, projects.id]
889
+ }),
890
+ // A ledger artifact may be associated with one task
891
+ task: one(tasks, {
892
+ fields: [ledgerArtifacts.taskId],
893
+ references: [tasks.id]
894
+ })
895
+ }));
858
896
  var agentRelationsRelations = drizzleOrm.relations(agentRelations, ({ one }) => ({
859
897
  // An agent relation belongs to one graph
860
898
  graph: one(agentGraph, {
@@ -883,6 +921,7 @@ var agentRelationsRelations = drizzleOrm.relations(agentRelations, ({ one }) =>
883
921
  exports.agentArtifactComponents = agentArtifactComponents;
884
922
  exports.agentArtifactComponentsRelations = agentArtifactComponentsRelations;
885
923
  exports.agentDataComponents = agentDataComponents;
924
+ exports.agentDataComponentsRelations = agentDataComponentsRelations;
886
925
  exports.agentGraph = agentGraph;
887
926
  exports.agentGraphRelations = agentGraphRelations;
888
927
  exports.agentRelations = agentRelations;
@@ -904,10 +943,12 @@ exports.conversationsRelations = conversationsRelations;
904
943
  exports.credentialReferences = credentialReferences;
905
944
  exports.credentialReferencesRelations = credentialReferencesRelations;
906
945
  exports.dataComponents = dataComponents;
946
+ exports.dataComponentsRelations = dataComponentsRelations;
907
947
  exports.externalAgents = externalAgents;
908
948
  exports.externalAgentsRelations = externalAgentsRelations;
909
949
  exports.ledgerArtifacts = ledgerArtifacts;
910
950
  exports.ledgerArtifactsContextIdIdx = ledgerArtifactsContextIdIdx;
951
+ exports.ledgerArtifactsRelations = ledgerArtifactsRelations;
911
952
  exports.ledgerArtifactsTaskContextNameUnique = ledgerArtifactsTaskContextNameUnique;
912
953
  exports.ledgerArtifactsTaskIdIdx = ledgerArtifactsTaskIdIdx;
913
954
  exports.messages = messages;
package/dist/db/schema.js CHANGED
@@ -1 +1 @@
1
- export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from '../chunk-MXQKLGQK.js';
1
+ export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from '../chunk-LFWFXR4O.js';