@inkeep/agents-core 0.64.2 → 0.64.6

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 (58) hide show
  1. package/dist/auth/auth-schema.d.ts +86 -86
  2. package/dist/auth/auth-validation-schemas.d.ts +137 -137
  3. package/dist/auth/init.js +2 -2
  4. package/dist/constants/otel-attributes.d.ts +5 -0
  5. package/dist/constants/otel-attributes.js +7 -2
  6. package/dist/constants/signoz-queries.d.ts +1 -0
  7. package/dist/constants/signoz-queries.js +2 -1
  8. package/dist/data-access/index.d.ts +2 -1
  9. package/dist/data-access/index.js +2 -1
  10. package/dist/data-access/manage/agents.d.ts +32 -32
  11. package/dist/data-access/manage/artifactComponents.d.ts +6 -6
  12. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  13. package/dist/data-access/manage/dataComponents.d.ts +4 -4
  14. package/dist/data-access/manage/functionTools.d.ts +10 -10
  15. package/dist/data-access/manage/skills.d.ts +5 -5
  16. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  17. package/dist/data-access/manage/subAgentRelations.d.ts +20 -20
  18. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  19. package/dist/data-access/manage/subAgents.d.ts +12 -12
  20. package/dist/data-access/manage/tools.d.ts +21 -21
  21. package/dist/data-access/manage/tools.js +1 -1
  22. package/dist/data-access/runtime/apiKeys.d.ts +8 -8
  23. package/dist/data-access/runtime/apps.d.ts +4 -4
  24. package/dist/data-access/runtime/conversations.d.ts +12 -12
  25. package/dist/data-access/runtime/messages.d.ts +3 -3
  26. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +4 -4
  27. package/dist/data-access/runtime/streamChunks.d.ts +29 -0
  28. package/dist/data-access/runtime/streamChunks.js +65 -0
  29. package/dist/data-access/runtime/tasks.d.ts +3 -3
  30. package/dist/db/manage/dolt-safe-jsonb.d.ts +12 -0
  31. package/dist/db/manage/dolt-safe-jsonb.js +61 -0
  32. package/dist/db/manage/manage-schema.d.ts +388 -388
  33. package/dist/db/manage/manage-schema.js +40 -39
  34. package/dist/db/runtime/runtime-schema.d.ts +136 -4
  35. package/dist/db/runtime/runtime-schema.js +20 -1
  36. package/dist/dolt/ref-helpers.js +15 -1
  37. package/dist/dolt/ref-scope.js +29 -1
  38. package/dist/index.d.ts +5 -4
  39. package/dist/index.js +5 -4
  40. package/dist/setup/setup.d.ts +3 -1
  41. package/dist/setup/setup.js +14 -10
  42. package/dist/utils/index.d.ts +3 -3
  43. package/dist/utils/index.js +3 -3
  44. package/dist/utils/jwt-helpers.d.ts +2 -3
  45. package/dist/utils/jwt-helpers.js +2 -3
  46. package/dist/utils/retry-client.d.ts +8 -0
  47. package/dist/utils/retry-client.js +29 -0
  48. package/dist/utils/service-token-auth.d.ts +3 -0
  49. package/dist/utils/service-token-auth.js +5 -2
  50. package/dist/utils/temp-jwt.d.ts +1 -6
  51. package/dist/utils/temp-jwt.js +1 -12
  52. package/dist/utils/work-app-mcp.js +1 -2
  53. package/dist/validation/schemas/skills.d.ts +25 -25
  54. package/dist/validation/schemas.d.ts +422 -422
  55. package/drizzle/runtime/0031_fantastic_gorilla_man.sql +13 -0
  56. package/drizzle/runtime/meta/0031_snapshot.json +4872 -0
  57. package/drizzle/runtime/meta/_journal.json +7 -0
  58. package/package.json +6 -2
@@ -1,6 +1,7 @@
1
1
  import { __exportAll } from "../../_virtual/rolldown_runtime.js";
2
+ import { jsonb as jsonb$1 } from "./dolt-safe-jsonb.js";
2
3
  import { relations } from "drizzle-orm";
3
- import { boolean, doublePrecision, foreignKey, index, jsonb, numeric, pgTable, primaryKey, text, timestamp, unique, varchar } from "drizzle-orm/pg-core";
4
+ import { boolean, doublePrecision, foreignKey, index, numeric, pgTable, primaryKey, text, timestamp, unique, varchar } from "drizzle-orm/pg-core";
4
5
 
5
6
  //#region src/db/manage/manage-schema.ts
6
7
  var manage_schema_exports = /* @__PURE__ */ __exportAll({
@@ -90,8 +91,8 @@ const timestamps = {
90
91
  const projects = pgTable("projects", {
91
92
  ...tenantScoped,
92
93
  ...uiProperties,
93
- models: jsonb("models").$type(),
94
- stopWhen: jsonb("stop_when").$type(),
94
+ models: jsonb$1("models").$type(),
95
+ stopWhen: jsonb$1("stop_when").$type(),
95
96
  ...timestamps
96
97
  }, (table) => [primaryKey({ columns: [table.tenantId, table.id] })]);
97
98
  const agents = pgTable("agent", {
@@ -99,10 +100,10 @@ const agents = pgTable("agent", {
99
100
  ...uiProperties,
100
101
  defaultSubAgentId: varchar("default_sub_agent_id", { length: 256 }),
101
102
  contextConfigId: varchar("context_config_id", { length: 256 }),
102
- models: jsonb("models").$type(),
103
- statusUpdates: jsonb("status_updates").$type(),
103
+ models: jsonb$1("models").$type(),
104
+ statusUpdates: jsonb$1("status_updates").$type(),
104
105
  prompt: text("prompt"),
105
- stopWhen: jsonb("stop_when").$type(),
106
+ stopWhen: jsonb$1("stop_when").$type(),
106
107
  executionMode: varchar("execution_mode", { length: 50 }).$type().notNull().default("classic"),
107
108
  ...timestamps
108
109
  }, (table) => [primaryKey({ columns: [
@@ -116,8 +117,8 @@ const agents = pgTable("agent", {
116
117
  }).onDelete("cascade")]);
117
118
  const contextConfigs = pgTable("context_configs", {
118
119
  ...agentScoped,
119
- headersSchema: jsonb("headers_schema").$type(),
120
- contextVariables: jsonb("context_variables").$type(),
120
+ headersSchema: jsonb$1("headers_schema").$type(),
121
+ contextVariables: jsonb$1("context_variables").$type(),
121
122
  ...timestamps
122
123
  }, (table) => [primaryKey({ columns: [
123
124
  table.tenantId,
@@ -141,12 +142,12 @@ const triggers = pgTable("triggers", {
141
142
  ...agentScoped,
142
143
  ...uiProperties,
143
144
  enabled: boolean("enabled").notNull().default(true),
144
- inputSchema: jsonb("input_schema").$type(),
145
- outputTransform: jsonb("output_transform").$type(),
145
+ inputSchema: jsonb$1("input_schema").$type(),
146
+ outputTransform: jsonb$1("output_transform").$type(),
146
147
  messageTemplate: text("message_template"),
147
- authentication: jsonb("authentication").$type(),
148
+ authentication: jsonb$1("authentication").$type(),
148
149
  signingSecretCredentialReferenceId: varchar("signing_secret_credential_reference_id", { length: 256 }),
149
- signatureVerification: jsonb("signature_verification").$type().default(null),
150
+ signatureVerification: jsonb$1("signature_verification").$type().default(null),
150
151
  runAsUserId: varchar("run_as_user_id", { length: 256 }),
151
152
  createdBy: varchar("created_by", { length: 256 }),
152
153
  ...timestamps
@@ -180,15 +181,15 @@ const subAgents = pgTable("sub_agents", {
180
181
  ...agentScoped,
181
182
  ...uiProperties,
182
183
  prompt: text("prompt"),
183
- conversationHistoryConfig: jsonb("conversation_history_config").$type().default({
184
+ conversationHistoryConfig: jsonb$1("conversation_history_config").$type().default({
184
185
  mode: "full",
185
186
  limit: 50,
186
187
  maxOutputTokens: 4e3,
187
188
  includeInternal: false,
188
189
  messageTypes: ["chat", "tool-result"]
189
190
  }),
190
- models: jsonb("models").$type(),
191
- stopWhen: jsonb("stop_when").$type(),
191
+ models: jsonb$1("models").$type(),
192
+ stopWhen: jsonb$1("stop_when").$type(),
192
193
  ...timestamps
193
194
  }, (table) => [primaryKey({ columns: [
194
195
  table.tenantId,
@@ -214,7 +215,7 @@ const skills = pgTable("skills", {
214
215
  name: varchar("name", { length: 64 }).notNull(),
215
216
  description: text("description").notNull(),
216
217
  content: text("content").notNull(),
217
- metadata: jsonb("metadata").$type(),
218
+ metadata: jsonb$1("metadata").$type(),
218
219
  ...timestamps
219
220
  }, (table) => [primaryKey({ columns: [
220
221
  table.tenantId,
@@ -347,8 +348,8 @@ const externalAgents = pgTable("external_agents", {
347
348
  const dataComponents = pgTable("data_components", {
348
349
  ...projectScoped,
349
350
  ...uiProperties,
350
- props: jsonb("props").$type().notNull(),
351
- render: jsonb("render").$type(),
351
+ props: jsonb$1("props").$type().notNull(),
352
+ render: jsonb$1("render").$type(),
352
353
  ...timestamps
353
354
  }, (table) => [primaryKey({ columns: [
354
355
  table.tenantId,
@@ -401,8 +402,8 @@ const subAgentDataComponents = pgTable("sub_agent_data_components", {
401
402
  const artifactComponents = pgTable("artifact_components", {
402
403
  ...projectScoped,
403
404
  ...uiProperties,
404
- props: jsonb("props").$type(),
405
- render: jsonb("render").$type(),
405
+ props: jsonb$1("props").$type(),
406
+ render: jsonb$1("render").$type(),
406
407
  ...timestamps
407
408
  }, (table) => [primaryKey({ columns: [
408
409
  table.tenantId,
@@ -460,12 +461,12 @@ const subAgentArtifactComponents = pgTable("sub_agent_artifact_components", {
460
461
  const tools = pgTable("tools", {
461
462
  ...projectScoped,
462
463
  ...uiProperties,
463
- config: jsonb("config").$type().notNull(),
464
+ config: jsonb$1("config").$type().notNull(),
464
465
  credentialReferenceId: varchar("credential_reference_id", { length: 256 }),
465
466
  credentialScope: varchar("credential_scope", { length: 50 }).notNull().default("project"),
466
- headers: jsonb("headers").$type(),
467
+ headers: jsonb$1("headers").$type(),
467
468
  imageUrl: text("image_url"),
468
- capabilities: jsonb("capabilities").$type(),
469
+ capabilities: jsonb$1("capabilities").$type(),
469
470
  lastError: text("last_error"),
470
471
  isWorkApp: boolean("is_work_app").notNull().default(false),
471
472
  ...timestamps
@@ -527,9 +528,9 @@ const functionTools = pgTable("function_tools", {
527
528
  ]);
528
529
  const functions = pgTable("functions", {
529
530
  ...projectScoped,
530
- inputSchema: jsonb("input_schema").$type(),
531
+ inputSchema: jsonb$1("input_schema").$type(),
531
532
  executeCode: text("execute_code").notNull(),
532
- dependencies: jsonb("dependencies").$type(),
533
+ dependencies: jsonb$1("dependencies").$type(),
533
534
  ...timestamps
534
535
  }, (table) => [primaryKey({ columns: [
535
536
  table.tenantId,
@@ -543,9 +544,9 @@ const functions = pgTable("functions", {
543
544
  const subAgentToolRelations = pgTable("sub_agent_tool_relations", {
544
545
  ...subAgentScoped,
545
546
  toolId: varchar("tool_id", { length: 256 }).notNull(),
546
- selectedTools: jsonb("selected_tools").$type(),
547
- headers: jsonb("headers").$type(),
548
- toolPolicies: jsonb("tool_policies").$type(),
547
+ selectedTools: jsonb$1("selected_tools").$type(),
548
+ headers: jsonb$1("headers").$type(),
549
+ toolPolicies: jsonb$1("tool_policies").$type(),
549
550
  ...timestamps
550
551
  }, (table) => [
551
552
  primaryKey({ columns: [
@@ -586,7 +587,7 @@ const subAgentToolRelations = pgTable("sub_agent_tool_relations", {
586
587
  const subAgentExternalAgentRelations = pgTable("sub_agent_external_agent_relations", {
587
588
  ...subAgentScoped,
588
589
  externalAgentId: varchar("external_agent_id", { length: 256 }).notNull(),
589
- headers: jsonb("headers").$type(),
590
+ headers: jsonb$1("headers").$type(),
590
591
  ...timestamps
591
592
  }, (table) => [
592
593
  primaryKey({
@@ -630,7 +631,7 @@ const subAgentExternalAgentRelations = pgTable("sub_agent_external_agent_relatio
630
631
  const subAgentTeamAgentRelations = pgTable("sub_agent_team_agent_relations", {
631
632
  ...subAgentScoped,
632
633
  targetAgentId: varchar("target_agent_id", { length: 256 }).notNull(),
633
- headers: jsonb("headers").$type(),
634
+ headers: jsonb$1("headers").$type(),
634
635
  ...timestamps
635
636
  }, (table) => [
636
637
  primaryKey({
@@ -674,7 +675,7 @@ const subAgentTeamAgentRelations = pgTable("sub_agent_team_agent_relations", {
674
675
  const subAgentFunctionToolRelations = pgTable("sub_agent_function_tool_relations", {
675
676
  ...subAgentScoped,
676
677
  functionToolId: varchar("function_tool_id", { length: 256 }).notNull(),
677
- toolPolicies: jsonb("tool_policies").$type(),
678
+ toolPolicies: jsonb$1("tool_policies").$type(),
678
679
  ...timestamps
679
680
  }, (table) => [
680
681
  primaryKey({
@@ -722,7 +723,7 @@ const credentialReferences = pgTable("credential_references", {
722
723
  name: uiProperties.name,
723
724
  type: varchar("type", { length: 256 }).notNull(),
724
725
  credentialStoreId: varchar("credential_store_id", { length: 256 }).notNull(),
725
- retrievalParams: jsonb("retrieval_params").$type(),
726
+ retrievalParams: jsonb$1("retrieval_params").$type(),
726
727
  toolId: varchar("tool_id", { length: 256 }),
727
728
  userId: varchar("user_id", { length: 256 }),
728
729
  createdBy: varchar("created_by", { length: 256 }),
@@ -775,8 +776,8 @@ const dataset = pgTable("dataset", {
775
776
  const datasetItem = pgTable("dataset_item", {
776
777
  ...projectScoped,
777
778
  datasetId: varchar("dataset_id", { length: 256 }).notNull(),
778
- input: jsonb("input").$type().notNull(),
779
- expectedOutput: jsonb("expected_output").$type(),
779
+ input: jsonb$1("input").$type().notNull(),
780
+ expectedOutput: jsonb$1("expected_output").$type(),
780
781
  ...timestamps
781
782
  }, (table) => [primaryKey({ columns: [
782
783
  table.tenantId,
@@ -799,9 +800,9 @@ const evaluator = pgTable("evaluator", {
799
800
  ...projectScoped,
800
801
  ...uiProperties,
801
802
  prompt: text("prompt").notNull(),
802
- schema: jsonb("schema").$type().notNull(),
803
- model: jsonb("model").$type().notNull(),
804
- passCriteria: jsonb("pass_criteria").$type(),
803
+ schema: jsonb$1("schema").$type().notNull(),
804
+ model: jsonb$1("model").$type().notNull(),
805
+ passCriteria: jsonb$1("pass_criteria").$type(),
805
806
  ...timestamps
806
807
  }, (table) => [primaryKey({ columns: [
807
808
  table.tenantId,
@@ -859,7 +860,7 @@ const datasetRunConfig = pgTable("dataset_run_config", {
859
860
  */
860
861
  const evaluationSuiteConfig = pgTable("evaluation_suite_config", {
861
862
  ...projectScoped,
862
- filters: jsonb("filters").$type(),
863
+ filters: jsonb$1("filters").$type(),
863
864
  sampleRate: doublePrecision("sample_rate"),
864
865
  ...timestamps
865
866
  }, (table) => [primaryKey({ columns: [
@@ -1010,7 +1011,7 @@ const evaluationRunConfig = pgTable("evaluation_run_config", {
1010
1011
  */
1011
1012
  const evaluationJobConfig = pgTable("evaluation_job_config", {
1012
1013
  ...projectScoped,
1013
- jobFilters: jsonb("job_filters").$type(),
1014
+ jobFilters: jsonb$1("job_filters").$type(),
1014
1015
  ...timestamps
1015
1016
  }, (table) => [primaryKey({ columns: [
1016
1017
  table.tenantId,
@@ -7,7 +7,7 @@ import * as drizzle_orm_pg_core1458 from "drizzle-orm/pg-core";
7
7
 
8
8
  //#region src/db/runtime/runtime-schema.d.ts
9
9
  declare namespace runtime_schema_d_exports {
10
- export { GenerationType, USAGE_GENERATION_TYPES, account, apiKeys, apps, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, invitation, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, orgEntitlement, organization, projectMetadata, scheduledTriggerInvocations, scheduledTriggers, schedulerState, session, ssoProvider, taskRelations, taskRelationsRelations, tasks, tasksRelations, triggerInvocations, user, userProfile, userProfileRelations, verification, workAppGitHubInstallations, workAppGitHubInstallationsRelations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubMcpToolRepositoryAccessRelations, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess, workAppGitHubProjectRepositoryAccessRelations, workAppGitHubRepositories, workAppGitHubRepositoriesRelations, workAppSlackChannelAgentConfigs, workAppSlackMcpToolAccessConfig, workAppSlackUserMappings, workAppSlackWorkspaces, workflowExecutions };
10
+ export { GenerationType, USAGE_GENERATION_TYPES, account, apiKeys, apps, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, invitation, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, orgEntitlement, organization, projectMetadata, scheduledTriggerInvocations, scheduledTriggers, schedulerState, session, ssoProvider, streamChunks, taskRelations, taskRelationsRelations, tasks, tasksRelations, triggerInvocations, user, userProfile, userProfileRelations, verification, workAppGitHubInstallations, workAppGitHubInstallationsRelations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubMcpToolRepositoryAccessRelations, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess, workAppGitHubProjectRepositoryAccessRelations, workAppGitHubRepositories, workAppGitHubRepositoriesRelations, workAppSlackChannelAgentConfigs, workAppSlackMcpToolAccessConfig, workAppSlackUserMappings, workAppSlackWorkspaces, workflowExecutions };
11
11
  }
12
12
  /**
13
13
  * Runtime projects table - source of truth for which projects exist in a tenant.
@@ -764,6 +764,138 @@ declare const workflowExecutions: drizzle_orm_pg_core1458.PgTableWithColumns<{
764
764
  };
765
765
  dialect: "pg";
766
766
  }>;
767
+ declare const streamChunks: drizzle_orm_pg_core1458.PgTableWithColumns<{
768
+ name: "stream_chunks";
769
+ schema: undefined;
770
+ columns: {
771
+ tenantId: drizzle_orm_pg_core1458.PgColumn<{
772
+ name: "tenant_id";
773
+ tableName: "stream_chunks";
774
+ dataType: "string";
775
+ columnType: "PgVarchar";
776
+ data: string;
777
+ driverParam: string;
778
+ notNull: true;
779
+ hasDefault: false;
780
+ isPrimaryKey: false;
781
+ isAutoincrement: false;
782
+ hasRuntimeDefault: false;
783
+ enumValues: [string, ...string[]];
784
+ baseColumn: never;
785
+ identity: undefined;
786
+ generated: undefined;
787
+ }, {}, {
788
+ length: 256;
789
+ }>;
790
+ projectId: drizzle_orm_pg_core1458.PgColumn<{
791
+ name: "project_id";
792
+ tableName: "stream_chunks";
793
+ dataType: "string";
794
+ columnType: "PgVarchar";
795
+ data: string;
796
+ driverParam: string;
797
+ notNull: true;
798
+ hasDefault: false;
799
+ isPrimaryKey: false;
800
+ isAutoincrement: false;
801
+ hasRuntimeDefault: false;
802
+ enumValues: [string, ...string[]];
803
+ baseColumn: never;
804
+ identity: undefined;
805
+ generated: undefined;
806
+ }, {}, {
807
+ length: 256;
808
+ }>;
809
+ conversationId: drizzle_orm_pg_core1458.PgColumn<{
810
+ name: "conversation_id";
811
+ tableName: "stream_chunks";
812
+ dataType: "string";
813
+ columnType: "PgVarchar";
814
+ data: string;
815
+ driverParam: string;
816
+ notNull: true;
817
+ hasDefault: false;
818
+ isPrimaryKey: false;
819
+ isAutoincrement: false;
820
+ hasRuntimeDefault: false;
821
+ enumValues: [string, ...string[]];
822
+ baseColumn: never;
823
+ identity: undefined;
824
+ generated: undefined;
825
+ }, {}, {
826
+ length: 256;
827
+ }>;
828
+ idx: drizzle_orm_pg_core1458.PgColumn<{
829
+ name: "idx";
830
+ tableName: "stream_chunks";
831
+ dataType: "number";
832
+ columnType: "PgInteger";
833
+ data: number;
834
+ driverParam: string | number;
835
+ notNull: true;
836
+ hasDefault: false;
837
+ isPrimaryKey: false;
838
+ isAutoincrement: false;
839
+ hasRuntimeDefault: false;
840
+ enumValues: undefined;
841
+ baseColumn: never;
842
+ identity: undefined;
843
+ generated: undefined;
844
+ }, {}, {}>;
845
+ data: drizzle_orm_pg_core1458.PgColumn<{
846
+ name: "data";
847
+ tableName: "stream_chunks";
848
+ dataType: "string";
849
+ columnType: "PgText";
850
+ data: string;
851
+ driverParam: string;
852
+ notNull: true;
853
+ hasDefault: false;
854
+ isPrimaryKey: false;
855
+ isAutoincrement: false;
856
+ hasRuntimeDefault: false;
857
+ enumValues: [string, ...string[]];
858
+ baseColumn: never;
859
+ identity: undefined;
860
+ generated: undefined;
861
+ }, {}, {}>;
862
+ isFinal: drizzle_orm_pg_core1458.PgColumn<{
863
+ name: "is_final";
864
+ tableName: "stream_chunks";
865
+ dataType: "boolean";
866
+ columnType: "PgBoolean";
867
+ data: boolean;
868
+ driverParam: boolean;
869
+ notNull: true;
870
+ hasDefault: true;
871
+ isPrimaryKey: false;
872
+ isAutoincrement: false;
873
+ hasRuntimeDefault: false;
874
+ enumValues: undefined;
875
+ baseColumn: never;
876
+ identity: undefined;
877
+ generated: undefined;
878
+ }, {}, {}>;
879
+ createdAt: drizzle_orm_pg_core1458.PgColumn<{
880
+ name: "created_at";
881
+ tableName: "stream_chunks";
882
+ dataType: "string";
883
+ columnType: "PgTimestampString";
884
+ data: string;
885
+ driverParam: string;
886
+ notNull: true;
887
+ hasDefault: true;
888
+ isPrimaryKey: false;
889
+ isAutoincrement: false;
890
+ hasRuntimeDefault: false;
891
+ enumValues: undefined;
892
+ baseColumn: never;
893
+ identity: undefined;
894
+ generated: undefined;
895
+ }, {}, {}>;
896
+ };
897
+ dialect: "pg";
898
+ }>;
767
899
  declare const apiKeys: drizzle_orm_pg_core1458.PgTableWithColumns<{
768
900
  name: "api_keys";
769
901
  schema: undefined;
@@ -2772,7 +2904,7 @@ declare const scheduledTriggerInvocations: drizzle_orm_pg_core1458.PgTableWithCo
2772
2904
  tableName: "scheduled_trigger_invocations";
2773
2905
  dataType: "string";
2774
2906
  columnType: "PgVarchar";
2775
- data: "pending" | "running" | "completed" | "failed" | "cancelled";
2907
+ data: "pending" | "failed" | "running" | "completed" | "cancelled";
2776
2908
  driverParam: string;
2777
2909
  notNull: true;
2778
2910
  hasDefault: false;
@@ -2785,7 +2917,7 @@ declare const scheduledTriggerInvocations: drizzle_orm_pg_core1458.PgTableWithCo
2785
2917
  generated: undefined;
2786
2918
  }, {}, {
2787
2919
  length: 50;
2788
- $type: "pending" | "running" | "completed" | "failed" | "cancelled";
2920
+ $type: "pending" | "failed" | "running" | "completed" | "cancelled";
2789
2921
  }>;
2790
2922
  scheduledFor: drizzle_orm_pg_core1458.PgColumn<{
2791
2923
  name: "scheduled_for";
@@ -6186,4 +6318,4 @@ declare const orgEntitlement: drizzle_orm_pg_core1458.PgTableWithColumns<{
6186
6318
  dialect: "pg";
6187
6319
  }>;
6188
6320
  //#endregion
6189
- export { GenerationType, USAGE_GENERATION_TYPES, account, apiKeys, apps, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, invitation, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, orgEntitlement, organization, projectMetadata, runtime_schema_d_exports, scheduledTriggerInvocations, scheduledTriggers, schedulerState, session, ssoProvider, taskRelations, taskRelationsRelations, tasks, tasksRelations, triggerInvocations, user, userProfile, userProfileRelations, verification, workAppGitHubInstallations, workAppGitHubInstallationsRelations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubMcpToolRepositoryAccessRelations, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess, workAppGitHubProjectRepositoryAccessRelations, workAppGitHubRepositories, workAppGitHubRepositoriesRelations, workAppSlackChannelAgentConfigs, workAppSlackMcpToolAccessConfig, workAppSlackUserMappings, workAppSlackWorkspaces, workflowExecutions };
6321
+ export { GenerationType, USAGE_GENERATION_TYPES, account, apiKeys, apps, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, invitation, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, orgEntitlement, organization, projectMetadata, runtime_schema_d_exports, scheduledTriggerInvocations, scheduledTriggers, schedulerState, session, ssoProvider, streamChunks, taskRelations, taskRelationsRelations, tasks, tasksRelations, triggerInvocations, user, userProfile, userProfileRelations, verification, workAppGitHubInstallations, workAppGitHubInstallationsRelations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubMcpToolRepositoryAccessRelations, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess, workAppGitHubProjectRepositoryAccessRelations, workAppGitHubRepositories, workAppGitHubRepositoriesRelations, workAppSlackChannelAgentConfigs, workAppSlackMcpToolAccessConfig, workAppSlackUserMappings, workAppSlackWorkspaces, workflowExecutions };
@@ -32,6 +32,7 @@ var runtime_schema_exports = /* @__PURE__ */ __exportAll({
32
32
  schedulerState: () => schedulerState,
33
33
  session: () => session,
34
34
  ssoProvider: () => ssoProvider,
35
+ streamChunks: () => streamChunks,
35
36
  taskRelations: () => taskRelations,
36
37
  taskRelationsRelations: () => taskRelationsRelations,
37
38
  tasks: () => tasks,
@@ -140,6 +141,24 @@ const workflowExecutions = pgTable("workflow_executions", {
140
141
  table.projectId,
141
142
  table.id
142
143
  ] }), index("workflow_executions_conversation_idx").on(table.tenantId, table.projectId, table.conversationId)]);
144
+ const streamChunks = pgTable("stream_chunks", {
145
+ tenantId: varchar("tenant_id", { length: 256 }).notNull(),
146
+ projectId: varchar("project_id", { length: 256 }).notNull(),
147
+ conversationId: varchar("conversation_id", { length: 256 }).notNull(),
148
+ idx: integer("idx").notNull(),
149
+ data: text("data").notNull(),
150
+ isFinal: boolean("is_final").notNull().default(false),
151
+ createdAt: timestamp("created_at", { mode: "string" }).notNull().defaultNow()
152
+ }, (table) => [
153
+ primaryKey({ columns: [
154
+ table.tenantId,
155
+ table.projectId,
156
+ table.conversationId,
157
+ table.idx
158
+ ] }),
159
+ index("stream_chunks_cleanup_idx").on(table.createdAt),
160
+ index("stream_chunks_conversation_idx").on(table.tenantId, table.projectId, table.conversationId, table.idx)
161
+ ]);
143
162
  const apiKeys = pgTable("api_keys", {
144
163
  ...projectScoped,
145
164
  agentId: varchar("agent_id", { length: 256 }).notNull(),
@@ -889,4 +908,4 @@ const orgEntitlement = pgTable("org_entitlement", {
889
908
  ]);
890
909
 
891
910
  //#endregion
892
- export { USAGE_GENERATION_TYPES, account, apiKeys, apps, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, invitation, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, orgEntitlement, organization, projectMetadata, runtime_schema_exports, scheduledTriggerInvocations, scheduledTriggers, schedulerState, session, ssoProvider, taskRelations, taskRelationsRelations, tasks, tasksRelations, triggerInvocations, user, userProfile, userProfileRelations, verification, workAppGitHubInstallations, workAppGitHubInstallationsRelations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubMcpToolRepositoryAccessRelations, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess, workAppGitHubProjectRepositoryAccessRelations, workAppGitHubRepositories, workAppGitHubRepositoriesRelations, workAppSlackChannelAgentConfigs, workAppSlackMcpToolAccessConfig, workAppSlackUserMappings, workAppSlackWorkspaces, workflowExecutions };
911
+ export { USAGE_GENERATION_TYPES, account, apiKeys, apps, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, invitation, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, orgEntitlement, organization, projectMetadata, runtime_schema_exports, scheduledTriggerInvocations, scheduledTriggers, schedulerState, session, ssoProvider, streamChunks, taskRelations, taskRelationsRelations, tasks, tasksRelations, triggerInvocations, user, userProfile, userProfileRelations, verification, workAppGitHubInstallations, workAppGitHubInstallationsRelations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubMcpToolRepositoryAccessRelations, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess, workAppGitHubProjectRepositoryAccessRelations, workAppGitHubRepositories, workAppGitHubRepositoriesRelations, workAppSlackChannelAgentConfigs, workAppSlackMcpToolAccessConfig, workAppSlackUserMappings, workAppSlackWorkspaces, workflowExecutions };
@@ -16,6 +16,7 @@ const getTenantScopedRef = (tenantId, ref) => {
16
16
  return `${tenantId}_${ref}`;
17
17
  };
18
18
  const resolveRef = (db) => async (ref) => {
19
+ const startTime = Date.now();
19
20
  if (isValidCommitHash(ref)) return {
20
21
  type: "commit",
21
22
  name: ref,
@@ -27,7 +28,20 @@ const resolveRef = (db) => async (ref) => {
27
28
  name: ref,
28
29
  hash: tag.tag_hash
29
30
  };
30
- const branch = (await doltListBranches(db)()).find((b) => b.name === ref);
31
+ const branchQueryStart = Date.now();
32
+ const branches = await doltListBranches(db)();
33
+ const branchQueryMs = Date.now() - branchQueryStart;
34
+ const branch = branches.find((b) => b.name === ref);
35
+ if (!branch) {
36
+ const totalMs = Date.now() - startTime;
37
+ logger.info({
38
+ ref,
39
+ branchCount: branches.length,
40
+ branchQueryMs,
41
+ totalMs,
42
+ branchNames: branches.map((b) => b.name)
43
+ }, "resolveRef: branch not found in dolt_branches result");
44
+ }
31
45
  if (branch) return {
32
46
  type: "branch",
33
47
  name: ref,
@@ -95,7 +95,14 @@ async function withRef(pool, resolvedRef, dataAccessFn, options) {
95
95
  refType: resolvedRef.type,
96
96
  connectionId
97
97
  }, "Acquiring connection for ref scope");
98
+ const connectStart = Date.now();
98
99
  const connection = await pool.connect();
100
+ const connectMs = Date.now() - connectStart;
101
+ if (connectMs > 5e3) logger.info({
102
+ ref: resolvedRef.name,
103
+ connectMs,
104
+ connectionId
105
+ }, "Slow pool.connect in withRef");
99
106
  let tempBranch = null;
100
107
  try {
101
108
  const db = drizzle(connection, { schema: manage_schema_exports });
@@ -104,10 +111,17 @@ async function withRef(pool, resolvedRef, dataAccessFn, options) {
104
111
  branch: resolvedRef.name,
105
112
  connectionId
106
113
  }, "Checking out branch");
114
+ const checkoutStart = Date.now();
107
115
  await checkoutBranch(db)({
108
116
  branchName: resolvedRef.name,
109
117
  syncSchema: false
110
118
  });
119
+ const checkoutMs = Date.now() - checkoutStart;
120
+ if (checkoutMs > 5e3) logger.info({
121
+ ref: resolvedRef.name,
122
+ checkoutMs,
123
+ connectionId
124
+ }, "Slow checkoutBranch in withRef");
111
125
  } else {
112
126
  tempBranch = `temp_${resolvedRef.type}_${Date.now()}_${generateId()}`;
113
127
  logger.debug({
@@ -180,6 +194,7 @@ async function withRef(pool, resolvedRef, dataAccessFn, options) {
180
194
  }, "Ref scope failed");
181
195
  throw error;
182
196
  } finally {
197
+ const cleanupStart = Date.now();
183
198
  try {
184
199
  await connection.query(`SELECT DOLT_CHECKOUT('main')`);
185
200
  if (tempBranch) {
@@ -190,16 +205,29 @@ async function withRef(pool, resolvedRef, dataAccessFn, options) {
190
205
  await connection.query(`SELECT DOLT_BRANCH('-D', $1)`, [tempBranch]);
191
206
  }
192
207
  } catch (cleanupError) {
208
+ logger.info({
209
+ ref: resolvedRef.name,
210
+ connectionId,
211
+ cleanupMs: Date.now() - cleanupStart,
212
+ error: cleanupError instanceof Error ? cleanupError.message : String(cleanupError)
213
+ }, "withRef cleanup failed");
193
214
  logger.error({
194
215
  error: cleanupError,
195
216
  tempBranch,
196
217
  connectionId
197
218
  }, "Error during ref scope cleanup");
198
219
  } finally {
220
+ const totalMs = Date.now() - startTime;
221
+ if (totalMs > 5e3) logger.info({
222
+ ref: resolvedRef.name,
223
+ totalMs,
224
+ connectMs,
225
+ connectionId
226
+ }, "Slow withRef total duration");
199
227
  connection.release();
200
228
  logger.debug({
201
229
  ref: resolvedRef.name,
202
- duration: Date.now() - startTime,
230
+ duration: totalMs,
203
231
  connectionId
204
232
  }, "Connection released");
205
233
  }