@inkeep/agents-core 0.8.0 → 0.8.2
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/{chunk-P5LTXXFH.js → chunk-AX77SEE3.js} +1 -1
- package/dist/{chunk-VZ62ZJTI.js → chunk-GPGFF2K4.js} +1 -1
- package/dist/{chunk-E4ZLV4GU.js → chunk-URSDNK76.js} +9 -3
- package/dist/client-exports.cjs +7 -2
- package/dist/client-exports.d.cts +2 -2
- package/dist/client-exports.d.ts +2 -2
- package/dist/client-exports.js +2 -2
- package/dist/db/schema.cjs +8 -2
- package/dist/db/schema.d.cts +2 -2
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +195 -18
- package/dist/index.d.cts +22 -7
- package/dist/index.d.ts +22 -7
- package/dist/index.js +192 -23
- package/dist/{schema-BF9NpAv5.d.cts → schema-DnjptA-m.d.ts} +25 -4
- package/dist/{schema-78jVngGh.d.ts → schema-DwiRB4zS.d.cts} +25 -4
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{utility-CT2pq49U.d.cts → utility-C3eMTvpr.d.cts} +47 -4
- package/dist/{utility-CT2pq49U.d.ts → utility-C3eMTvpr.d.ts} +47 -4
- package/dist/validation/index.cjs +7 -2
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, credentialReferences, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-
|
|
1
|
+
import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, credentialReferences, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-URSDNK76.js';
|
|
2
2
|
import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-YFHT5M2R.js';
|
|
3
3
|
import { z } from '@hono/zod-openapi';
|
|
4
4
|
import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
|
|
@@ -38,6 +38,7 @@ __export(schema_exports, {
|
|
|
38
38
|
ledgerArtifactsRelations: () => ledgerArtifactsRelations,
|
|
39
39
|
ledgerArtifactsTaskContextNameUnique: () => ledgerArtifactsTaskContextNameUnique,
|
|
40
40
|
ledgerArtifactsTaskIdIdx: () => ledgerArtifactsTaskIdIdx,
|
|
41
|
+
ledgerArtifactsToolCallIdIdx: () => ledgerArtifactsToolCallIdIdx,
|
|
41
42
|
messages: () => messages,
|
|
42
43
|
messagesRelations: () => messagesRelations,
|
|
43
44
|
projects: () => projects,
|
|
@@ -539,7 +540,9 @@ var ledgerArtifacts = sqliteTable(
|
|
|
539
540
|
projectId: text("project_id").notNull(),
|
|
540
541
|
id: text("id").notNull(),
|
|
541
542
|
// Links
|
|
542
|
-
taskId: text("task_id"),
|
|
543
|
+
taskId: text("task_id").notNull(),
|
|
544
|
+
toolCallId: text("tool_call_id"),
|
|
545
|
+
// Added for traceability to the specific tool execution
|
|
543
546
|
contextId: text("context_id").notNull(),
|
|
544
547
|
// Core Artifact fields
|
|
545
548
|
type: text("type").notNull().default("source"),
|
|
@@ -558,7 +561,7 @@ var ledgerArtifacts = sqliteTable(
|
|
|
558
561
|
updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
559
562
|
},
|
|
560
563
|
(table) => [
|
|
561
|
-
primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
564
|
+
primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
|
|
562
565
|
foreignKey({
|
|
563
566
|
columns: [table.tenantId, table.projectId],
|
|
564
567
|
foreignColumns: [projects.tenantId, projects.id],
|
|
@@ -627,6 +630,9 @@ var credentialReferences = sqliteTable(
|
|
|
627
630
|
var ledgerArtifactsTaskIdIdx = index("ledger_artifacts_task_id_idx").on(
|
|
628
631
|
ledgerArtifacts.taskId
|
|
629
632
|
);
|
|
633
|
+
var ledgerArtifactsToolCallIdIdx = index("ledger_artifacts_tool_call_id_idx").on(
|
|
634
|
+
ledgerArtifacts.toolCallId
|
|
635
|
+
);
|
|
630
636
|
var ledgerArtifactsContextIdIdx = index("ledger_artifacts_context_id_idx").on(
|
|
631
637
|
ledgerArtifacts.contextId
|
|
632
638
|
);
|
|
@@ -959,4 +965,4 @@ var agentRelationsRelations = relations(agentRelations, ({ one }) => ({
|
|
|
959
965
|
})
|
|
960
966
|
}));
|
|
961
967
|
|
|
962
|
-
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, schema_exports, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations };
|
|
968
|
+
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, ledgerArtifactsToolCallIdIdx, messages, messagesRelations, projects, projectsRelations, schema_exports, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations };
|
package/dist/client-exports.cjs
CHANGED
|
@@ -514,7 +514,9 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
|
|
|
514
514
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
515
515
|
id: sqliteCore.text("id").notNull(),
|
|
516
516
|
// Links
|
|
517
|
-
taskId: sqliteCore.text("task_id"),
|
|
517
|
+
taskId: sqliteCore.text("task_id").notNull(),
|
|
518
|
+
toolCallId: sqliteCore.text("tool_call_id"),
|
|
519
|
+
// Added for traceability to the specific tool execution
|
|
518
520
|
contextId: sqliteCore.text("context_id").notNull(),
|
|
519
521
|
// Core Artifact fields
|
|
520
522
|
type: sqliteCore.text("type").notNull().default("source"),
|
|
@@ -533,7 +535,7 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
|
|
|
533
535
|
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
534
536
|
},
|
|
535
537
|
(table) => [
|
|
536
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
538
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
|
|
537
539
|
sqliteCore.foreignKey({
|
|
538
540
|
columns: [table.tenantId, table.projectId],
|
|
539
541
|
foreignColumns: [projects.tenantId, projects.id],
|
|
@@ -602,6 +604,9 @@ var credentialReferences = sqliteCore.sqliteTable(
|
|
|
602
604
|
sqliteCore.index("ledger_artifacts_task_id_idx").on(
|
|
603
605
|
ledgerArtifacts.taskId
|
|
604
606
|
);
|
|
607
|
+
sqliteCore.index("ledger_artifacts_tool_call_id_idx").on(
|
|
608
|
+
ledgerArtifacts.toolCallId
|
|
609
|
+
);
|
|
605
610
|
sqliteCore.index("ledger_artifacts_context_id_idx").on(
|
|
606
611
|
ledgerArtifacts.contextId
|
|
607
612
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { C as ConversationHistoryConfig, F as FullGraphAgentInsertSchema } from './utility-
|
|
3
|
-
export { c as AgentStopWhen, A as AgentStopWhenSchema, d as CredentialStoreType, b as GraphStopWhen, G as GraphStopWhenSchema, M as MCPTransportType, a as StopWhen, S as StopWhenSchema } from './utility-
|
|
2
|
+
import { C as ConversationHistoryConfig, F as FullGraphAgentInsertSchema } from './utility-C3eMTvpr.cjs';
|
|
3
|
+
export { c as AgentStopWhen, A as AgentStopWhenSchema, d as CredentialStoreType, b as GraphStopWhen, G as GraphStopWhenSchema, M as MCPTransportType, a as StopWhen, S as StopWhenSchema } from './utility-C3eMTvpr.cjs';
|
|
4
4
|
import 'drizzle-zod';
|
|
5
5
|
import 'drizzle-orm/sqlite-core';
|
|
6
6
|
import '@hono/zod-openapi';
|
package/dist/client-exports.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { C as ConversationHistoryConfig, F as FullGraphAgentInsertSchema } from './utility-
|
|
3
|
-
export { c as AgentStopWhen, A as AgentStopWhenSchema, d as CredentialStoreType, b as GraphStopWhen, G as GraphStopWhenSchema, M as MCPTransportType, a as StopWhen, S as StopWhenSchema } from './utility-
|
|
2
|
+
import { C as ConversationHistoryConfig, F as FullGraphAgentInsertSchema } from './utility-C3eMTvpr.js';
|
|
3
|
+
export { c as AgentStopWhen, A as AgentStopWhenSchema, d as CredentialStoreType, b as GraphStopWhen, G as GraphStopWhenSchema, M as MCPTransportType, a as StopWhen, S as StopWhenSchema } from './utility-C3eMTvpr.js';
|
|
4
4
|
import 'drizzle-zod';
|
|
5
5
|
import 'drizzle-orm/sqlite-core';
|
|
6
6
|
import '@hono/zod-openapi';
|
package/dist/client-exports.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FullGraphAgentInsertSchema } from './chunk-
|
|
2
|
-
export { AgentStopWhenSchema, GraphStopWhenSchema, StopWhenSchema } from './chunk-
|
|
1
|
+
import { FullGraphAgentInsertSchema } from './chunk-AX77SEE3.js';
|
|
2
|
+
export { AgentStopWhenSchema, GraphStopWhenSchema, StopWhenSchema } from './chunk-AX77SEE3.js';
|
|
3
3
|
import { CredentialStoreType } from './chunk-YFHT5M2R.js';
|
|
4
4
|
export { CredentialStoreType, MCPTransportType } from './chunk-YFHT5M2R.js';
|
|
5
5
|
import { z } from 'zod';
|
package/dist/db/schema.cjs
CHANGED
|
@@ -494,7 +494,9 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
|
|
|
494
494
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
495
495
|
id: sqliteCore.text("id").notNull(),
|
|
496
496
|
// Links
|
|
497
|
-
taskId: sqliteCore.text("task_id"),
|
|
497
|
+
taskId: sqliteCore.text("task_id").notNull(),
|
|
498
|
+
toolCallId: sqliteCore.text("tool_call_id"),
|
|
499
|
+
// Added for traceability to the specific tool execution
|
|
498
500
|
contextId: sqliteCore.text("context_id").notNull(),
|
|
499
501
|
// Core Artifact fields
|
|
500
502
|
type: sqliteCore.text("type").notNull().default("source"),
|
|
@@ -513,7 +515,7 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
|
|
|
513
515
|
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
514
516
|
},
|
|
515
517
|
(table) => [
|
|
516
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
518
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
|
|
517
519
|
sqliteCore.foreignKey({
|
|
518
520
|
columns: [table.tenantId, table.projectId],
|
|
519
521
|
foreignColumns: [projects.tenantId, projects.id],
|
|
@@ -582,6 +584,9 @@ var credentialReferences = sqliteCore.sqliteTable(
|
|
|
582
584
|
var ledgerArtifactsTaskIdIdx = sqliteCore.index("ledger_artifacts_task_id_idx").on(
|
|
583
585
|
ledgerArtifacts.taskId
|
|
584
586
|
);
|
|
587
|
+
var ledgerArtifactsToolCallIdIdx = sqliteCore.index("ledger_artifacts_tool_call_id_idx").on(
|
|
588
|
+
ledgerArtifacts.toolCallId
|
|
589
|
+
);
|
|
585
590
|
var ledgerArtifactsContextIdIdx = sqliteCore.index("ledger_artifacts_context_id_idx").on(
|
|
586
591
|
ledgerArtifacts.contextId
|
|
587
592
|
);
|
|
@@ -947,6 +952,7 @@ exports.ledgerArtifactsContextIdIdx = ledgerArtifactsContextIdIdx;
|
|
|
947
952
|
exports.ledgerArtifactsRelations = ledgerArtifactsRelations;
|
|
948
953
|
exports.ledgerArtifactsTaskContextNameUnique = ledgerArtifactsTaskContextNameUnique;
|
|
949
954
|
exports.ledgerArtifactsTaskIdIdx = ledgerArtifactsTaskIdIdx;
|
|
955
|
+
exports.ledgerArtifactsToolCallIdIdx = ledgerArtifactsToolCallIdIdx;
|
|
950
956
|
exports.messages = messages;
|
|
951
957
|
exports.messagesRelations = messagesRelations;
|
|
952
958
|
exports.projects = projects;
|
package/dist/db/schema.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
|
-
import '../utility-
|
|
4
|
-
export { k as agentArtifactComponents,
|
|
3
|
+
import '../utility-C3eMTvpr.cjs';
|
|
4
|
+
export { k as agentArtifactComponents, O as agentArtifactComponentsRelations, i as agentDataComponents, Q as agentDataComponentsRelations, a as agentGraph, F as agentGraphRelations, e as agentRelations, S as agentRelationsRelations, m as agentToolRelations, I as agentToolRelationsRelations, d as agents, E as agentsRelations, r as apiKeys, H as apiKeysRelations, j as artifactComponents, N as artifactComponentsRelations, b as contextCache, D as contextCacheRelations, c as contextConfigs, C as contextConfigsRelations, n as conversations, L as conversationsRelations, u as credentialReferences, J as credentialReferencesRelations, h as dataComponents, P as dataComponentsRelations, f as externalAgents, G as externalAgentsRelations, q as ledgerArtifacts, x as ledgerArtifactsContextIdIdx, R as ledgerArtifactsRelations, y as ledgerArtifactsTaskContextNameUnique, v as ledgerArtifactsTaskIdIdx, w as ledgerArtifactsToolCallIdIdx, o as messages, M as messagesRelations, p as projects, A as projectsRelations, g as taskRelations, B as taskRelationsRelations, t as tasks, z as tasksRelations, l as tools, K as toolsRelations } from '../schema-DwiRB4zS.cjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'drizzle-zod';
|
|
7
7
|
import '@hono/zod-openapi';
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
|
-
import '../utility-
|
|
4
|
-
export { k as agentArtifactComponents,
|
|
3
|
+
import '../utility-C3eMTvpr.js';
|
|
4
|
+
export { k as agentArtifactComponents, O as agentArtifactComponentsRelations, i as agentDataComponents, Q as agentDataComponentsRelations, a as agentGraph, F as agentGraphRelations, e as agentRelations, S as agentRelationsRelations, m as agentToolRelations, I as agentToolRelationsRelations, d as agents, E as agentsRelations, r as apiKeys, H as apiKeysRelations, j as artifactComponents, N as artifactComponentsRelations, b as contextCache, D as contextCacheRelations, c as contextConfigs, C as contextConfigsRelations, n as conversations, L as conversationsRelations, u as credentialReferences, J as credentialReferencesRelations, h as dataComponents, P as dataComponentsRelations, f as externalAgents, G as externalAgentsRelations, q as ledgerArtifacts, x as ledgerArtifactsContextIdIdx, R as ledgerArtifactsRelations, y as ledgerArtifactsTaskContextNameUnique, v as ledgerArtifactsTaskIdIdx, w as ledgerArtifactsToolCallIdIdx, o as messages, M as messagesRelations, p as projects, A as projectsRelations, g as taskRelations, B as taskRelationsRelations, t as tasks, z as tasksRelations, l as tools, K as toolsRelations } from '../schema-DnjptA-m.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'drizzle-zod';
|
|
7
7
|
import '@hono/zod-openapi';
|
package/dist/db/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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-
|
|
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, ledgerArtifactsToolCallIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from '../chunk-URSDNK76.js';
|
package/dist/index.cjs
CHANGED
|
@@ -244,6 +244,7 @@ __export(schema_exports, {
|
|
|
244
244
|
ledgerArtifactsRelations: () => ledgerArtifactsRelations,
|
|
245
245
|
ledgerArtifactsTaskContextNameUnique: () => ledgerArtifactsTaskContextNameUnique,
|
|
246
246
|
ledgerArtifactsTaskIdIdx: () => ledgerArtifactsTaskIdIdx,
|
|
247
|
+
ledgerArtifactsToolCallIdIdx: () => ledgerArtifactsToolCallIdIdx,
|
|
247
248
|
messages: () => messages,
|
|
248
249
|
messagesRelations: () => messagesRelations,
|
|
249
250
|
projects: () => projects,
|
|
@@ -745,7 +746,9 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
|
|
|
745
746
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
746
747
|
id: sqliteCore.text("id").notNull(),
|
|
747
748
|
// Links
|
|
748
|
-
taskId: sqliteCore.text("task_id"),
|
|
749
|
+
taskId: sqliteCore.text("task_id").notNull(),
|
|
750
|
+
toolCallId: sqliteCore.text("tool_call_id"),
|
|
751
|
+
// Added for traceability to the specific tool execution
|
|
749
752
|
contextId: sqliteCore.text("context_id").notNull(),
|
|
750
753
|
// Core Artifact fields
|
|
751
754
|
type: sqliteCore.text("type").notNull().default("source"),
|
|
@@ -764,7 +767,7 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
|
|
|
764
767
|
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
765
768
|
},
|
|
766
769
|
(table) => [
|
|
767
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
770
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
|
|
768
771
|
sqliteCore.foreignKey({
|
|
769
772
|
columns: [table.tenantId, table.projectId],
|
|
770
773
|
foreignColumns: [projects.tenantId, projects.id],
|
|
@@ -833,6 +836,9 @@ var credentialReferences = sqliteCore.sqliteTable(
|
|
|
833
836
|
var ledgerArtifactsTaskIdIdx = sqliteCore.index("ledger_artifacts_task_id_idx").on(
|
|
834
837
|
ledgerArtifacts.taskId
|
|
835
838
|
);
|
|
839
|
+
var ledgerArtifactsToolCallIdIdx = sqliteCore.index("ledger_artifacts_tool_call_id_idx").on(
|
|
840
|
+
ledgerArtifacts.toolCallId
|
|
841
|
+
);
|
|
836
842
|
var ledgerArtifactsContextIdIdx = sqliteCore.index("ledger_artifacts_context_id_idx").on(
|
|
837
843
|
ledgerArtifacts.contextId
|
|
838
844
|
);
|
|
@@ -6986,38 +6992,200 @@ var deleteFullGraph = (db, logger12 = defaultLogger) => async (params) => {
|
|
|
6986
6992
|
throw error;
|
|
6987
6993
|
}
|
|
6988
6994
|
};
|
|
6995
|
+
function validateArtifactData(artifact, index2) {
|
|
6996
|
+
if (!artifact.artifactId?.trim()) {
|
|
6997
|
+
throw new Error(`Artifact at index ${index2} missing required artifactId`);
|
|
6998
|
+
}
|
|
6999
|
+
if (artifact.parts) {
|
|
7000
|
+
try {
|
|
7001
|
+
JSON.stringify(artifact.parts);
|
|
7002
|
+
} catch (error) {
|
|
7003
|
+
throw new Error(
|
|
7004
|
+
`Artifact ${artifact.artifactId} has invalid parts data: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
7005
|
+
);
|
|
7006
|
+
}
|
|
7007
|
+
}
|
|
7008
|
+
if (artifact.metadata) {
|
|
7009
|
+
try {
|
|
7010
|
+
JSON.stringify(artifact.metadata);
|
|
7011
|
+
} catch (error) {
|
|
7012
|
+
throw new Error(
|
|
7013
|
+
`Artifact ${artifact.artifactId} has invalid metadata: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
7014
|
+
);
|
|
7015
|
+
}
|
|
7016
|
+
}
|
|
7017
|
+
}
|
|
7018
|
+
function determineMimeTypes(artifact) {
|
|
7019
|
+
if (artifact.parts && artifact.parts.length > 0) {
|
|
7020
|
+
const kinds = /* @__PURE__ */ new Set();
|
|
7021
|
+
for (const part of artifact.parts) {
|
|
7022
|
+
if (part.kind) {
|
|
7023
|
+
kinds.add(part.kind);
|
|
7024
|
+
}
|
|
7025
|
+
}
|
|
7026
|
+
if (kinds.size > 0) {
|
|
7027
|
+
return Array.from(kinds);
|
|
7028
|
+
}
|
|
7029
|
+
}
|
|
7030
|
+
if (artifact.type?.toLowerCase().includes("document")) {
|
|
7031
|
+
return ["text"];
|
|
7032
|
+
}
|
|
7033
|
+
if (artifact.type?.toLowerCase().includes("image")) {
|
|
7034
|
+
return ["image"];
|
|
7035
|
+
}
|
|
7036
|
+
if (artifact.type?.toLowerCase().includes("code")) {
|
|
7037
|
+
return ["text"];
|
|
7038
|
+
}
|
|
7039
|
+
return ["data"];
|
|
7040
|
+
}
|
|
7041
|
+
function sanitizeArtifactForDatabase(artifact) {
|
|
7042
|
+
return {
|
|
7043
|
+
...artifact,
|
|
7044
|
+
// Ensure text fields don't exceed reasonable limits
|
|
7045
|
+
name: artifact.name?.slice(0, 255) || void 0,
|
|
7046
|
+
description: artifact.description?.slice(0, 1e3) || void 0,
|
|
7047
|
+
// Clean any undefined values from JSON fields
|
|
7048
|
+
parts: artifact.parts ? JSON.parse(JSON.stringify(artifact.parts)) : null,
|
|
7049
|
+
metadata: artifact.metadata ? JSON.parse(JSON.stringify(artifact.metadata)) : null
|
|
7050
|
+
};
|
|
7051
|
+
}
|
|
7052
|
+
async function tryFallbackInsert(db, rows, _originalError) {
|
|
7053
|
+
for (let i = 0; i < rows.length; i++) {
|
|
7054
|
+
const row = rows[i];
|
|
7055
|
+
try {
|
|
7056
|
+
await db.insert(ledgerArtifacts).values([row]);
|
|
7057
|
+
} catch (_fallbackError) {
|
|
7058
|
+
try {
|
|
7059
|
+
const minimalRow = {
|
|
7060
|
+
id: row.id,
|
|
7061
|
+
tenantId: row.tenantId,
|
|
7062
|
+
projectId: row.projectId,
|
|
7063
|
+
taskId: row.taskId,
|
|
7064
|
+
toolCallId: row.toolCallId,
|
|
7065
|
+
contextId: row.contextId,
|
|
7066
|
+
type: row.type || "source",
|
|
7067
|
+
name: row.name || `Artifact ${row.id.substring(0, 8)}`,
|
|
7068
|
+
description: row.description || "Artifact from tool results",
|
|
7069
|
+
parts: null,
|
|
7070
|
+
// Skip complex JSON data
|
|
7071
|
+
metadata: null,
|
|
7072
|
+
// Skip complex JSON data
|
|
7073
|
+
summary: null,
|
|
7074
|
+
mime: null,
|
|
7075
|
+
visibility: "context",
|
|
7076
|
+
allowedAgents: null,
|
|
7077
|
+
derivedFrom: null,
|
|
7078
|
+
createdAt: row.createdAt,
|
|
7079
|
+
updatedAt: row.updatedAt
|
|
7080
|
+
};
|
|
7081
|
+
await db.insert(ledgerArtifacts).values([minimalRow]);
|
|
7082
|
+
} catch (_finalError) {
|
|
7083
|
+
}
|
|
7084
|
+
}
|
|
7085
|
+
}
|
|
7086
|
+
}
|
|
7087
|
+
var upsertLedgerArtifact = (db) => async (params) => {
|
|
7088
|
+
const { scopes, contextId, taskId, toolCallId = null, artifact } = params;
|
|
7089
|
+
validateArtifactData(artifact, 0);
|
|
7090
|
+
const sanitizedArt = sanitizeArtifactForDatabase(artifact);
|
|
7091
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7092
|
+
const artifactRow = {
|
|
7093
|
+
id: sanitizedArt.artifactId ?? nanoid.nanoid(),
|
|
7094
|
+
tenantId: scopes.tenantId,
|
|
7095
|
+
projectId: scopes.projectId,
|
|
7096
|
+
taskId,
|
|
7097
|
+
toolCallId,
|
|
7098
|
+
contextId,
|
|
7099
|
+
type: sanitizedArt.type ?? "source",
|
|
7100
|
+
name: sanitizedArt.name,
|
|
7101
|
+
description: sanitizedArt.description,
|
|
7102
|
+
parts: sanitizedArt.parts,
|
|
7103
|
+
metadata: sanitizedArt.metadata,
|
|
7104
|
+
summary: sanitizedArt.description?.slice(0, 200) ?? null,
|
|
7105
|
+
mime: determineMimeTypes(sanitizedArt),
|
|
7106
|
+
visibility: sanitizedArt.metadata?.visibility ?? "context",
|
|
7107
|
+
allowedAgents: sanitizedArt.metadata?.allowedAgents ?? [],
|
|
7108
|
+
derivedFrom: sanitizedArt.metadata?.derivedFrom ?? null,
|
|
7109
|
+
createdAt: now,
|
|
7110
|
+
updatedAt: now
|
|
7111
|
+
};
|
|
7112
|
+
try {
|
|
7113
|
+
await db.insert(ledgerArtifacts).values([artifactRow]);
|
|
7114
|
+
return { created: true };
|
|
7115
|
+
} catch (error) {
|
|
7116
|
+
if (error.message?.includes("UNIQUE") || error.message?.includes("duplicate")) {
|
|
7117
|
+
const existing = await db.select().from(ledgerArtifacts).where(
|
|
7118
|
+
drizzleOrm.and(
|
|
7119
|
+
drizzleOrm.eq(ledgerArtifacts.tenantId, scopes.tenantId),
|
|
7120
|
+
drizzleOrm.eq(ledgerArtifacts.projectId, scopes.projectId),
|
|
7121
|
+
drizzleOrm.eq(ledgerArtifacts.id, artifactRow.id),
|
|
7122
|
+
drizzleOrm.eq(ledgerArtifacts.taskId, taskId)
|
|
7123
|
+
)
|
|
7124
|
+
).limit(1);
|
|
7125
|
+
if (existing.length > 0) {
|
|
7126
|
+
return { created: false, existing: existing[0] };
|
|
7127
|
+
}
|
|
7128
|
+
}
|
|
7129
|
+
throw error;
|
|
7130
|
+
}
|
|
7131
|
+
};
|
|
6989
7132
|
var addLedgerArtifacts = (db) => async (params) => {
|
|
6990
|
-
const { scopes, contextId, taskId = null, artifacts } = params;
|
|
7133
|
+
const { scopes, contextId, taskId = null, toolCallId = null, artifacts } = params;
|
|
6991
7134
|
if (artifacts.length === 0) return;
|
|
7135
|
+
for (let i = 0; i < artifacts.length; i++) {
|
|
7136
|
+
validateArtifactData(artifacts[i], i);
|
|
7137
|
+
}
|
|
6992
7138
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6993
7139
|
const rows = artifacts.map((art) => {
|
|
6994
|
-
const
|
|
7140
|
+
const sanitizedArt = sanitizeArtifactForDatabase(art);
|
|
7141
|
+
const resolvedTaskId = taskId ?? sanitizedArt.taskId ?? sanitizedArt.metadata?.taskId ?? null;
|
|
6995
7142
|
return {
|
|
6996
|
-
id:
|
|
7143
|
+
id: sanitizedArt.artifactId ?? nanoid.nanoid(),
|
|
6997
7144
|
tenantId: scopes.tenantId,
|
|
6998
7145
|
projectId: scopes.projectId,
|
|
6999
7146
|
taskId: resolvedTaskId,
|
|
7147
|
+
toolCallId: toolCallId ?? sanitizedArt.metadata?.toolCallId ?? null,
|
|
7000
7148
|
contextId,
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7149
|
+
type: sanitizedArt.type ?? "source",
|
|
7150
|
+
name: sanitizedArt.name,
|
|
7151
|
+
description: sanitizedArt.description,
|
|
7152
|
+
parts: sanitizedArt.parts,
|
|
7153
|
+
metadata: sanitizedArt.metadata,
|
|
7005
7154
|
// extra (optional) ledger fields
|
|
7006
|
-
summary:
|
|
7007
|
-
mime:
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7155
|
+
summary: sanitizedArt.description?.slice(0, 200) ?? null,
|
|
7156
|
+
mime: determineMimeTypes(sanitizedArt),
|
|
7157
|
+
// Simple string fallback until we debug the issue
|
|
7158
|
+
visibility: sanitizedArt.metadata?.visibility ?? "context",
|
|
7159
|
+
allowedAgents: sanitizedArt.metadata?.allowedAgents ?? [],
|
|
7160
|
+
// Fix: use empty array, not null
|
|
7161
|
+
derivedFrom: sanitizedArt.metadata?.derivedFrom ?? null,
|
|
7011
7162
|
createdAt: now,
|
|
7012
7163
|
updatedAt: now
|
|
7013
7164
|
};
|
|
7014
7165
|
});
|
|
7015
|
-
|
|
7166
|
+
const maxRetries = 3;
|
|
7167
|
+
let lastError = null;
|
|
7168
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
7169
|
+
try {
|
|
7170
|
+
await db.insert(ledgerArtifacts).values(rows);
|
|
7171
|
+
return;
|
|
7172
|
+
} catch (error) {
|
|
7173
|
+
lastError = error;
|
|
7174
|
+
const isRetryable = error.code === "SQLITE_BUSY" || error.code === "SQLITE_LOCKED" || error.message?.includes("database is locked") || error.message?.includes("busy") || error.message?.includes("timeout");
|
|
7175
|
+
if (!isRetryable || attempt === maxRetries) {
|
|
7176
|
+
await tryFallbackInsert(db, rows);
|
|
7177
|
+
return;
|
|
7178
|
+
}
|
|
7179
|
+
const backoffMs = Math.min(1e3 * 2 ** (attempt - 1), 5e3);
|
|
7180
|
+
await new Promise((resolve) => setTimeout(resolve, backoffMs));
|
|
7181
|
+
}
|
|
7182
|
+
}
|
|
7183
|
+
throw lastError;
|
|
7016
7184
|
};
|
|
7017
7185
|
var getLedgerArtifacts = (db) => async (params) => {
|
|
7018
|
-
const { scopes, taskId, artifactId } = params;
|
|
7019
|
-
if (!taskId && !artifactId) {
|
|
7020
|
-
throw new Error("
|
|
7186
|
+
const { scopes, taskId, toolCallId, artifactId } = params;
|
|
7187
|
+
if (!taskId && !toolCallId && !artifactId) {
|
|
7188
|
+
throw new Error("At least one of taskId, toolCallId, or artifactId must be provided");
|
|
7021
7189
|
}
|
|
7022
7190
|
const conditions = [
|
|
7023
7191
|
drizzleOrm.eq(ledgerArtifacts.tenantId, scopes.tenantId),
|
|
@@ -7029,6 +7197,9 @@ var getLedgerArtifacts = (db) => async (params) => {
|
|
|
7029
7197
|
if (taskId) {
|
|
7030
7198
|
conditions.push(drizzleOrm.eq(ledgerArtifacts.taskId, taskId));
|
|
7031
7199
|
}
|
|
7200
|
+
if (toolCallId) {
|
|
7201
|
+
conditions.push(drizzleOrm.eq(ledgerArtifacts.toolCallId, toolCallId));
|
|
7202
|
+
}
|
|
7032
7203
|
const query = db.select().from(ledgerArtifacts).where(conditions.length > 1 ? drizzleOrm.and(...conditions) : conditions[0]);
|
|
7033
7204
|
const results = await query;
|
|
7034
7205
|
return results.map(
|
|
@@ -7036,6 +7207,8 @@ var getLedgerArtifacts = (db) => async (params) => {
|
|
|
7036
7207
|
artifactId: row.id,
|
|
7037
7208
|
type: row.type ?? "source",
|
|
7038
7209
|
taskId: row.taskId ?? void 0,
|
|
7210
|
+
toolCallId: row.toolCallId ?? void 0,
|
|
7211
|
+
// Added for traceability to the specific tool execution
|
|
7039
7212
|
name: row.name ?? void 0,
|
|
7040
7213
|
description: row.description ?? void 0,
|
|
7041
7214
|
parts: row.parts ?? [],
|
|
@@ -10383,6 +10556,8 @@ loadEnvironmentFiles();
|
|
|
10383
10556
|
var envSchema = zod.z.object({
|
|
10384
10557
|
ENVIRONMENT: zod.z.enum(["development", "production", "pentest", "test"]).optional(),
|
|
10385
10558
|
DB_FILE_NAME: zod.z.string().optional(),
|
|
10559
|
+
TURSO_DATABASE_URL: zod.z.string().optional(),
|
|
10560
|
+
TURSO_AUTH_TOKEN: zod.z.string().optional(),
|
|
10386
10561
|
OTEL_TRACES_FORCE_FLUSH_ENABLED: zod.z.coerce.boolean().optional()
|
|
10387
10562
|
});
|
|
10388
10563
|
var parseEnv = () => {
|
|
@@ -10798,6 +10973,7 @@ exports.ledgerArtifactsContextIdIdx = ledgerArtifactsContextIdIdx;
|
|
|
10798
10973
|
exports.ledgerArtifactsRelations = ledgerArtifactsRelations;
|
|
10799
10974
|
exports.ledgerArtifactsTaskContextNameUnique = ledgerArtifactsTaskContextNameUnique;
|
|
10800
10975
|
exports.ledgerArtifactsTaskIdIdx = ledgerArtifactsTaskIdIdx;
|
|
10976
|
+
exports.ledgerArtifactsToolCallIdIdx = ledgerArtifactsToolCallIdIdx;
|
|
10801
10977
|
exports.listAgentGraphs = listAgentGraphs;
|
|
10802
10978
|
exports.listAgentGraphsPaginated = listAgentGraphsPaginated;
|
|
10803
10979
|
exports.listAgentRelations = listAgentRelations;
|
|
@@ -10878,6 +11054,7 @@ exports.upsertContextConfig = upsertContextConfig;
|
|
|
10878
11054
|
exports.upsertCredentialReference = upsertCredentialReference;
|
|
10879
11055
|
exports.upsertDataComponent = upsertDataComponent;
|
|
10880
11056
|
exports.upsertExternalAgent = upsertExternalAgent;
|
|
11057
|
+
exports.upsertLedgerArtifact = upsertLedgerArtifact;
|
|
10881
11058
|
exports.upsertTool = upsertTool;
|
|
10882
11059
|
exports.validateAgainstJsonSchema = validateAgainstJsonSchema;
|
|
10883
11060
|
exports.validateAgentRelationships = validateAgentRelationships;
|