@inkeep/agents-core 0.0.0-dev-20260312173738 → 0.0.0-dev-20260312190837

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 (41) hide show
  1. package/dist/auth/auth-schema.d.ts +85 -85
  2. package/dist/auth/auth-validation-schemas.d.ts +135 -135
  3. package/dist/client-exports.d.ts +3 -3
  4. package/dist/data-access/index.d.ts +3 -1
  5. package/dist/data-access/index.js +3 -1
  6. package/dist/data-access/manage/agents.d.ts +16 -16
  7. package/dist/data-access/manage/artifactComponents.d.ts +10 -10
  8. package/dist/data-access/manage/audit-queries.d.ts +29 -0
  9. package/dist/data-access/manage/audit-queries.js +29 -0
  10. package/dist/data-access/manage/contextConfigs.d.ts +16 -16
  11. package/dist/data-access/manage/dataComponents.d.ts +4 -4
  12. package/dist/data-access/manage/functionTools.d.ts +12 -12
  13. package/dist/data-access/manage/skills.d.ts +14 -14
  14. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
  15. package/dist/data-access/manage/subAgentRelations.d.ts +18 -18
  16. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
  17. package/dist/data-access/manage/subAgents.d.ts +12 -12
  18. package/dist/data-access/manage/tools.d.ts +21 -21
  19. package/dist/data-access/manage/triggers.d.ts +2 -2
  20. package/dist/data-access/runtime/apiKeys.d.ts +16 -16
  21. package/dist/data-access/runtime/apps.d.ts +8 -8
  22. package/dist/data-access/runtime/audit-queries.d.ts +41 -0
  23. package/dist/data-access/runtime/audit-queries.js +37 -0
  24. package/dist/data-access/runtime/conversations.d.ts +27 -27
  25. package/dist/data-access/runtime/messages.d.ts +9 -9
  26. package/dist/data-access/runtime/tasks.d.ts +7 -7
  27. package/dist/data-reconciliation/audit.d.ts +6 -0
  28. package/dist/data-reconciliation/audit.js +37 -0
  29. package/dist/data-reconciliation/index.d.ts +4 -0
  30. package/dist/data-reconciliation/index.js +5 -0
  31. package/dist/data-reconciliation/reconcile.d.ts +6 -0
  32. package/dist/data-reconciliation/reconcile.js +58 -0
  33. package/dist/data-reconciliation/types.d.ts +116 -0
  34. package/dist/data-reconciliation/types.js +7 -0
  35. package/dist/db/manage/manage-schema.d.ts +453 -453
  36. package/dist/db/runtime/runtime-schema.d.ts +330 -330
  37. package/dist/index.d.ts +7 -1
  38. package/dist/index.js +6 -1
  39. package/dist/validation/dolt-schemas.d.ts +1 -1
  40. package/dist/validation/schemas.d.ts +1782 -1782
  41. package/package.json +1 -1
@@ -16,17 +16,17 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
16
16
  total: number;
17
17
  }>;
18
18
  declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
19
- metadata: ConversationMetadata | null;
20
19
  id: string;
21
20
  createdAt: string;
22
21
  updatedAt: string;
23
- userId: string | null;
24
- title: string | null;
25
- tenantId: string;
26
- projectId: string;
27
22
  agentId: string | null;
23
+ projectId: string;
24
+ tenantId: string;
25
+ title: string | null;
26
+ metadata: ConversationMetadata | null;
27
+ userId: string | null;
28
28
  ref: {
29
- type: "commit" | "tag" | "branch";
29
+ type: "tag" | "commit" | "branch";
30
30
  name: string;
31
31
  hash: string;
32
32
  } | null;
@@ -44,7 +44,7 @@ declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
44
44
  agentId: string | null;
45
45
  activeSubAgentId: string;
46
46
  ref: {
47
- type: "commit" | "tag" | "branch";
47
+ type: "tag" | "commit" | "branch";
48
48
  name: string;
49
49
  hash: string;
50
50
  } | null;
@@ -70,7 +70,7 @@ declare const updateConversationActiveSubAgent: (db: AgentsRunDatabaseClient) =>
70
70
  agentId: string | null;
71
71
  activeSubAgentId: string;
72
72
  ref: {
73
- type: "commit" | "tag" | "branch";
73
+ type: "tag" | "commit" | "branch";
74
74
  name: string;
75
75
  hash: string;
76
76
  } | null;
@@ -85,17 +85,17 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
85
85
  scopes: ProjectScopeConfig;
86
86
  conversationId: string;
87
87
  }) => Promise<{
88
- metadata: ConversationMetadata | null;
89
88
  id: string;
90
89
  createdAt: string;
91
90
  updatedAt: string;
92
- userId: string | null;
93
- title: string | null;
94
- tenantId: string;
95
- projectId: string;
96
91
  agentId: string | null;
92
+ projectId: string;
93
+ tenantId: string;
94
+ title: string | null;
95
+ metadata: ConversationMetadata | null;
96
+ userId: string | null;
97
97
  ref: {
98
- type: "commit" | "tag" | "branch";
98
+ type: "tag" | "commit" | "branch";
99
99
  name: string;
100
100
  hash: string;
101
101
  } | null;
@@ -108,7 +108,7 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
108
108
  tenantId: string;
109
109
  id: string;
110
110
  ref: {
111
- type: "commit" | "tag" | "branch";
111
+ type: "tag" | "commit" | "branch";
112
112
  name: string;
113
113
  hash: string;
114
114
  };
@@ -121,17 +121,17 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
121
121
  metadata?: ConversationMetadata | null | undefined;
122
122
  contextConfigId?: string | undefined;
123
123
  } | {
124
- metadata: ConversationMetadata | null;
125
124
  id: string;
126
125
  createdAt: string;
127
126
  updatedAt: string;
128
- userId: string | null;
129
- title: string | null;
130
- tenantId: string;
131
- projectId: string;
132
127
  agentId: string | null;
128
+ projectId: string;
129
+ tenantId: string;
130
+ title: string | null;
131
+ metadata: ConversationMetadata | null;
132
+ userId: string | null;
133
133
  ref: {
134
- type: "commit" | "tag" | "branch";
134
+ type: "tag" | "commit" | "branch";
135
135
  name: string;
136
136
  hash: string;
137
137
  } | null;
@@ -153,17 +153,17 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
153
153
  scopes: ProjectScopeConfig;
154
154
  conversationId: string;
155
155
  }) => Promise<{
156
- metadata: ConversationMetadata | null;
157
156
  id: string;
158
157
  createdAt: string;
159
158
  updatedAt: string;
160
- userId: string | null;
161
- title: string | null;
162
- tenantId: string;
163
- projectId: string;
164
159
  agentId: string | null;
160
+ projectId: string;
161
+ tenantId: string;
162
+ title: string | null;
163
+ metadata: ConversationMetadata | null;
164
+ userId: string | null;
165
165
  ref: {
166
- type: "commit" | "tag" | "branch";
166
+ type: "tag" | "commit" | "branch";
167
167
  name: string;
168
168
  hash: string;
169
169
  } | null;
@@ -10,14 +10,14 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
10
10
  scopes: ProjectScopeConfig;
11
11
  messageId: string;
12
12
  }) => Promise<{
13
- metadata: MessageMetadata | null;
14
13
  id: string;
15
14
  createdAt: string;
16
15
  updatedAt: string;
17
- role: string;
18
- tenantId: string;
19
16
  projectId: string;
17
+ tenantId: string;
18
+ metadata: MessageMetadata | null;
20
19
  content: MessageContent;
20
+ role: string;
21
21
  fromSubAgentId: string | null;
22
22
  toSubAgentId: string | null;
23
23
  fromExternalAgentId: string | null;
@@ -141,14 +141,14 @@ declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: {
141
141
  id: string;
142
142
  }[]>;
143
143
  declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageInsert) => Promise<{
144
- metadata: MessageMetadata | null;
145
144
  id: string;
146
145
  createdAt: string;
147
146
  updatedAt: string;
148
- role: string;
149
- tenantId: string;
150
147
  projectId: string;
148
+ tenantId: string;
149
+ metadata: MessageMetadata | null;
151
150
  content: MessageContent;
151
+ role: string;
152
152
  fromSubAgentId: string | null;
153
153
  toSubAgentId: string | null;
154
154
  fromExternalAgentId: string | null;
@@ -194,14 +194,14 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
194
194
  scopes: ProjectScopeConfig;
195
195
  messageId: string;
196
196
  }) => Promise<{
197
- metadata: MessageMetadata | null;
198
197
  id: string;
199
198
  createdAt: string;
200
199
  updatedAt: string;
201
- role: string;
202
- tenantId: string;
203
200
  projectId: string;
201
+ tenantId: string;
202
+ metadata: MessageMetadata | null;
204
203
  content: MessageContent;
204
+ role: string;
205
205
  fromSubAgentId: string | null;
206
206
  toSubAgentId: string | null;
207
207
  fromExternalAgentId: string | null;
@@ -6,21 +6,21 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
6
6
 
7
7
  //#region src/data-access/runtime/tasks.d.ts
8
8
  declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
9
- metadata: TaskMetadataConfig | null;
10
9
  id: string;
11
10
  createdAt: string;
12
11
  updatedAt: string;
13
- status: string;
14
- tenantId: string;
15
- projectId: string;
16
12
  agentId: string;
13
+ projectId: string;
14
+ tenantId: string;
15
+ metadata: TaskMetadataConfig | null;
16
+ status: string;
17
17
  subAgentId: string;
18
+ contextId: string;
18
19
  ref: {
19
- type: "commit" | "tag" | "branch";
20
+ type: "tag" | "commit" | "branch";
20
21
  name: string;
21
22
  hash: string;
22
23
  } | null;
23
- contextId: string;
24
24
  }>;
25
25
  declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
26
26
  id: string;
@@ -36,7 +36,7 @@ declare const updateTask: (db: AgentsRunDatabaseClient) => (params: {
36
36
  updatedAt: string;
37
37
  contextId: string;
38
38
  ref: {
39
- type: "commit" | "tag" | "branch";
39
+ type: "tag" | "commit" | "branch";
40
40
  name: string;
41
41
  hash: string;
42
42
  } | null;
@@ -0,0 +1,6 @@
1
+ import { AuditContext, AuditReport, EntityEffectRegistry } from "./types.js";
2
+
3
+ //#region src/data-reconciliation/audit.d.ts
4
+ declare function audit(registry: EntityEffectRegistry, ctx: AuditContext): Promise<AuditReport>;
5
+ //#endregion
6
+ export { audit };
@@ -0,0 +1,37 @@
1
+ //#region src/data-reconciliation/audit.ts
2
+ async function audit(registry, ctx) {
3
+ const report = {
4
+ entries: [],
5
+ checkedEntities: [],
6
+ skippedEntities: []
7
+ };
8
+ for (const [table, handlers] of Object.entries(registry)) {
9
+ if (!handlers?.check) {
10
+ report.skippedEntities.push(table);
11
+ continue;
12
+ }
13
+ report.checkedEntities.push(table);
14
+ try {
15
+ const result = await handlers.check(ctx);
16
+ report.entries.push({
17
+ table,
18
+ result
19
+ });
20
+ } catch (error) {
21
+ const errorMessage = error instanceof Error ? error.message : String(error);
22
+ ctx.logger.warn({
23
+ table,
24
+ error: errorMessage
25
+ }, `Audit check failed for entity: ${table}`);
26
+ report.entries.push({
27
+ table,
28
+ result: null,
29
+ error: error instanceof Error ? error.message : String(error)
30
+ });
31
+ }
32
+ }
33
+ return report;
34
+ }
35
+
36
+ //#endregion
37
+ export { audit };
@@ -0,0 +1,4 @@
1
+ import { AppliedEffect, AuditContext, AuditReport, EntityAuditEntry, EntityDiff, EntityEffectHandlers, EntityEffectRegistry, EntityOperation, EntityRowByTable, FailedEffect, OrphanedRuntimeRowsResult, ReconcileContext, ReconcileResult, ScheduledTriggerAuditResult, SkippedDiff, defineHandlers } from "./types.js";
2
+ import { audit } from "./audit.js";
3
+ import { reconcile } from "./reconcile.js";
4
+ export { AppliedEffect, AuditContext, AuditReport, EntityAuditEntry, EntityDiff, EntityEffectHandlers, EntityEffectRegistry, EntityOperation, EntityRowByTable, FailedEffect, OrphanedRuntimeRowsResult, ReconcileContext, ReconcileResult, ScheduledTriggerAuditResult, SkippedDiff, audit, defineHandlers, reconcile };
@@ -0,0 +1,5 @@
1
+ import { audit } from "./audit.js";
2
+ import { reconcile } from "./reconcile.js";
3
+ import { defineHandlers } from "./types.js";
4
+
5
+ export { audit, defineHandlers, reconcile };
@@ -0,0 +1,6 @@
1
+ import { EntityDiff, EntityEffectRegistry, ReconcileContext, ReconcileResult } from "./types.js";
2
+
3
+ //#region src/data-reconciliation/reconcile.d.ts
4
+ declare function reconcile(registry: EntityEffectRegistry, diffs: EntityDiff[], ctx: ReconcileContext): Promise<ReconcileResult>;
5
+ //#endregion
6
+ export { reconcile };
@@ -0,0 +1,58 @@
1
+ //#region src/data-reconciliation/reconcile.ts
2
+ async function reconcile(registry, diffs, ctx) {
3
+ const result = {
4
+ applied: [],
5
+ skipped: [],
6
+ failed: []
7
+ };
8
+ const operations = diffs.map(async (diff) => {
9
+ const handlers = registry[diff.table];
10
+ if (!handlers) {
11
+ result.skipped.push({
12
+ table: diff.table,
13
+ operation: diff.operation,
14
+ primaryKey: diff.primaryKey,
15
+ reason: "no registry entry"
16
+ });
17
+ return;
18
+ }
19
+ try {
20
+ if (diff.operation === "insert" && handlers.onCreated && diff.after) await handlers.onCreated(diff.after, ctx);
21
+ else if (diff.operation === "update" && handlers.onUpdated && diff.before && diff.after) await handlers.onUpdated(diff.before, diff.after, ctx);
22
+ else if (diff.operation === "delete" && handlers.onDeleted && diff.before) await handlers.onDeleted(diff.before, ctx);
23
+ else {
24
+ result.skipped.push({
25
+ table: diff.table,
26
+ operation: diff.operation,
27
+ primaryKey: diff.primaryKey,
28
+ reason: `no handler for ${diff.operation}`
29
+ });
30
+ return;
31
+ }
32
+ result.applied.push({
33
+ table: diff.table,
34
+ operation: diff.operation,
35
+ primaryKey: diff.primaryKey
36
+ });
37
+ } catch (error) {
38
+ const errorMessage = error instanceof Error ? error.message : String(error);
39
+ ctx.logger.error({
40
+ table: diff.table,
41
+ operation: diff.operation,
42
+ primaryKey: diff.primaryKey,
43
+ error: errorMessage
44
+ }, `Reconcile effect failed for ${diff.table}.${diff.operation}`);
45
+ result.failed.push({
46
+ table: diff.table,
47
+ operation: diff.operation,
48
+ primaryKey: diff.primaryKey,
49
+ error: errorMessage
50
+ });
51
+ }
52
+ });
53
+ await Promise.allSettled(operations);
54
+ return result;
55
+ }
56
+
57
+ //#endregion
58
+ export { reconcile };
@@ -0,0 +1,116 @@
1
+ import { PinoLogger } from "../utils/logger.js";
2
+ import { AgentsManageDatabaseClient } from "../db/manage/manage-client.js";
3
+ import { AgentsRunDatabaseClient } from "../db/runtime/runtime-client.js";
4
+ import { ScheduledTrigger } from "../validation/schemas.js";
5
+ import { AgentSelect, ContextConfigSelect, SubAgentSelect, ToolSelect } from "../types/entities.js";
6
+
7
+ //#region src/data-reconciliation/types.d.ts
8
+ type EntityRowByTable = {
9
+ scheduled_triggers: ScheduledTrigger;
10
+ tools: ToolSelect;
11
+ context_configs: ContextConfigSelect;
12
+ agent: AgentSelect;
13
+ sub_agents: SubAgentSelect;
14
+ };
15
+ type EntityOperation = 'insert' | 'update' | 'delete';
16
+ type EntityDiff<TTable extends keyof EntityRowByTable = keyof EntityRowByTable> = {
17
+ table: TTable;
18
+ operation: 'insert';
19
+ primaryKey: Record<string, string>;
20
+ before: null;
21
+ after: EntityRowByTable[TTable];
22
+ } | {
23
+ table: TTable;
24
+ operation: 'update';
25
+ primaryKey: Record<string, string>;
26
+ before: EntityRowByTable[TTable];
27
+ after: EntityRowByTable[TTable];
28
+ } | {
29
+ table: TTable;
30
+ operation: 'delete';
31
+ primaryKey: Record<string, string>;
32
+ before: EntityRowByTable[TTable];
33
+ after: null;
34
+ };
35
+ type EntityEffectHandlers<TTable extends keyof EntityRowByTable> = {
36
+ onCreated?: (after: EntityRowByTable[TTable], ctx: ReconcileContext) => Promise<void>;
37
+ onUpdated?: (before: EntityRowByTable[TTable], after: EntityRowByTable[TTable], ctx: ReconcileContext) => Promise<void>;
38
+ onDeleted?: (before: EntityRowByTable[TTable], ctx: ReconcileContext) => Promise<void>;
39
+ check?: (ctx: AuditContext) => Promise<unknown>;
40
+ };
41
+ type EntityEffectRegistry = { [K in keyof EntityRowByTable]?: EntityEffectHandlers<K> };
42
+ declare function defineHandlers<TTable extends keyof EntityRowByTable>(_table: TTable, handlers: EntityEffectHandlers<TTable>): EntityEffectHandlers<TTable>;
43
+ type ReconcileContext = {
44
+ manageDb: AgentsManageDatabaseClient;
45
+ runDb: AgentsRunDatabaseClient;
46
+ scopes: {
47
+ tenantId: string;
48
+ projectId: string;
49
+ };
50
+ fullBranchName: string;
51
+ logger: PinoLogger;
52
+ };
53
+ type AuditContext = ReconcileContext;
54
+ type AppliedEffect = {
55
+ table: string;
56
+ operation: EntityOperation;
57
+ primaryKey: Record<string, string>;
58
+ };
59
+ type FailedEffect = AppliedEffect & {
60
+ error: string;
61
+ };
62
+ type SkippedDiff = {
63
+ table: string;
64
+ operation: EntityOperation;
65
+ primaryKey: Record<string, string>;
66
+ reason: string;
67
+ };
68
+ type ReconcileResult = {
69
+ applied: AppliedEffect[];
70
+ skipped: SkippedDiff[];
71
+ failed: FailedEffect[];
72
+ };
73
+ type EntityAuditEntry<TResult = unknown> = {
74
+ table: string;
75
+ result: TResult;
76
+ error?: string;
77
+ };
78
+ type AuditReport = {
79
+ entries: EntityAuditEntry[];
80
+ checkedEntities: string[];
81
+ skippedEntities: string[];
82
+ };
83
+ type ScheduledTriggerAuditResult = {
84
+ missingWorkflows: Array<{
85
+ triggerId: string;
86
+ triggerName: string;
87
+ }>;
88
+ orphanedWorkflows: Array<{
89
+ workflowRunId: string;
90
+ scheduledTriggerId: string;
91
+ }>;
92
+ staleWorkflows: Array<{
93
+ triggerId: string;
94
+ triggerName: string;
95
+ workflowId: string;
96
+ }>;
97
+ deadWorkflows: Array<{
98
+ triggerId: string;
99
+ triggerName: string;
100
+ workflowRunId: string;
101
+ runStatus: string;
102
+ }>;
103
+ verificationFailures: Array<{
104
+ workflowRunId: string;
105
+ error: string;
106
+ }>;
107
+ };
108
+ type OrphanedRuntimeRowsResult = {
109
+ orphanedRows: Array<{
110
+ table: string;
111
+ id: string;
112
+ referencedEntityId: string;
113
+ }>;
114
+ };
115
+ //#endregion
116
+ export { AppliedEffect, AuditContext, AuditReport, EntityAuditEntry, EntityDiff, EntityEffectHandlers, EntityEffectRegistry, EntityOperation, EntityRowByTable, FailedEffect, OrphanedRuntimeRowsResult, ReconcileContext, ReconcileResult, ScheduledTriggerAuditResult, SkippedDiff, defineHandlers };
@@ -0,0 +1,7 @@
1
+ //#region src/data-reconciliation/types.ts
2
+ function defineHandlers(_table, handlers) {
3
+ return handlers;
4
+ }
5
+
6
+ //#endregion
7
+ export { defineHandlers };