@inkeep/agents-core 0.1.10 → 0.2.1

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/index.cjs CHANGED
@@ -1510,7 +1510,7 @@ var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
1510
1510
  var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
1511
1511
  agents: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])),
1512
1512
  tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
1513
- credentialReferences: zodOpenapi.z.array(CredentialReferenceApiInsertSchema).optional(),
1513
+ credentialReferences: zodOpenapi.z.record(zodOpenapi.z.string(), CredentialReferenceApiInsertSchema).optional(),
1514
1514
  dataComponents: zodOpenapi.z.record(zodOpenapi.z.string(), DataComponentApiInsertSchema).optional(),
1515
1515
  artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
1516
1516
  contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
@@ -1569,7 +1569,7 @@ var FullProjectDefinitionSchema = ProjectApiInsertSchema.extend({
1569
1569
  artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
1570
1570
  contextConfig: zodOpenapi.z.record(zodOpenapi.z.string(), ContextConfigApiInsertSchema).optional(),
1571
1571
  statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
1572
- credentialReferences: zodOpenapi.z.array(CredentialReferenceApiInsertSchema).optional(),
1572
+ credentialReferences: zodOpenapi.z.record(zodOpenapi.z.string(), CredentialReferenceApiInsertSchema).optional(),
1573
1573
  createdAt: zodOpenapi.z.string().optional(),
1574
1574
  updatedAt: zodOpenapi.z.string().optional()
1575
1575
  });
@@ -5267,33 +5267,35 @@ var createFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
5267
5267
  validateGraphStructure(typed);
5268
5268
  await applyExecutionLimitsInheritance(db, logger11, { tenantId, projectId }, typed);
5269
5269
  try {
5270
- if (typed.credentialReferences) {
5270
+ if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
5271
5271
  logger11.info(
5272
- { credentialReferencesCount: typed.credentialReferences.length },
5272
+ { credentialReferencesCount: Object.keys(typed.credentialReferences).length },
5273
5273
  "Processing credential references"
5274
5274
  );
5275
- const credentialRefPromises = typed.credentialReferences.map(async (credData) => {
5276
- try {
5277
- logger11.info({ credId: credData.id }, "Processing credential reference");
5278
- await upsertCredentialReference(db)({
5279
- data: {
5280
- ...credData,
5281
- tenantId,
5282
- projectId
5283
- }
5284
- });
5285
- logger11.info({ credId: credData.id }, "Credential reference processed successfully");
5286
- } catch (error) {
5287
- logger11.error(
5288
- { credId: credData.id, error },
5289
- "Failed to create/update credential reference"
5290
- );
5291
- throw error;
5275
+ const credentialRefPromises = Object.entries(typed.credentialReferences).map(
5276
+ async ([_credId, credData]) => {
5277
+ try {
5278
+ logger11.info({ credId: credData.id }, "Processing credential reference");
5279
+ await upsertCredentialReference(db)({
5280
+ data: {
5281
+ ...credData,
5282
+ tenantId,
5283
+ projectId
5284
+ }
5285
+ });
5286
+ logger11.info({ credId: credData.id }, "Credential reference processed successfully");
5287
+ } catch (error) {
5288
+ logger11.error(
5289
+ { credId: credData.id, error },
5290
+ "Failed to create/update credential reference"
5291
+ );
5292
+ throw error;
5293
+ }
5292
5294
  }
5293
- });
5295
+ );
5294
5296
  await Promise.all(credentialRefPromises);
5295
5297
  logger11.info(
5296
- { credentialReferencesCount: typed.credentialReferences.length },
5298
+ { credentialReferencesCount: Object.keys(typed.credentialReferences).length },
5297
5299
  "All credential references created/updated successfully"
5298
5300
  );
5299
5301
  }
@@ -5698,13 +5700,15 @@ var updateFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
5698
5700
  return createFullGraphServerSide(db)(scopes, graphData);
5699
5701
  }
5700
5702
  const existingGraphModels = existingGraph.models;
5701
- if (typedGraphDefinition.credentialReferences) {
5703
+ if (typedGraphDefinition.credentialReferences && Object.keys(typedGraphDefinition.credentialReferences).length > 0) {
5702
5704
  logger11.info(
5703
- { credentialReferencesCount: typedGraphDefinition.credentialReferences.length },
5705
+ {
5706
+ credentialReferencesCount: Object.keys(typedGraphDefinition.credentialReferences).length
5707
+ },
5704
5708
  "Processing credential references"
5705
5709
  );
5706
- const credentialRefPromises = typedGraphDefinition.credentialReferences.map(
5707
- async (credData) => {
5710
+ const credentialRefPromises = Object.entries(typedGraphDefinition.credentialReferences).map(
5711
+ async ([_credId, credData]) => {
5708
5712
  try {
5709
5713
  logger11.info({ credId: credData.id }, "Processing credential reference");
5710
5714
  await upsertCredentialReference(db)({
@@ -5726,7 +5730,9 @@ var updateFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
5726
5730
  );
5727
5731
  await Promise.all(credentialRefPromises);
5728
5732
  logger11.info(
5729
- { credentialReferencesCount: typedGraphDefinition.credentialReferences.length },
5733
+ {
5734
+ credentialReferencesCount: Object.keys(typedGraphDefinition.credentialReferences).length
5735
+ },
5730
5736
  "All credential references created/updated successfully"
5731
5737
  );
5732
5738
  }
@@ -6667,6 +6673,213 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
6667
6673
  logger11.info({ projectId: typed.id }, "Creating project metadata");
6668
6674
  await createProject(db)(projectPayload);
6669
6675
  logger11.info({ projectId: typed.id }, "Project metadata created successfully");
6676
+ if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
6677
+ logger11.info(
6678
+ {
6679
+ projectId: typed.id,
6680
+ count: Object.keys(typed.credentialReferences).length
6681
+ },
6682
+ "Creating project credentialReferences"
6683
+ );
6684
+ const credentialPromises = Object.entries(typed.credentialReferences).map(
6685
+ async ([_credId, credData]) => {
6686
+ try {
6687
+ logger11.info(
6688
+ { projectId: typed.id, credId: credData.id },
6689
+ "Creating credentialReference in project"
6690
+ );
6691
+ await upsertCredentialReference(db)({
6692
+ data: {
6693
+ ...credData,
6694
+ tenantId,
6695
+ projectId: typed.id
6696
+ }
6697
+ });
6698
+ logger11.info(
6699
+ { projectId: typed.id, credId: credData.id },
6700
+ "CredentialReference created successfully"
6701
+ );
6702
+ } catch (error) {
6703
+ logger11.error(
6704
+ { projectId: typed.id, credId: credData.id, error },
6705
+ "Failed to create credentialReference in project"
6706
+ );
6707
+ throw error;
6708
+ }
6709
+ }
6710
+ );
6711
+ await Promise.all(credentialPromises);
6712
+ logger11.info(
6713
+ {
6714
+ projectId: typed.id,
6715
+ count: Object.keys(typed.credentialReferences).length
6716
+ },
6717
+ "All project credentialReferences created successfully"
6718
+ );
6719
+ }
6720
+ if (typed.tools && Object.keys(typed.tools).length > 0) {
6721
+ logger11.info(
6722
+ {
6723
+ projectId: typed.id,
6724
+ toolCount: Object.keys(typed.tools).length
6725
+ },
6726
+ "Creating project tools"
6727
+ );
6728
+ const toolPromises = Object.entries(typed.tools).map(async ([toolId, toolData]) => {
6729
+ try {
6730
+ logger11.info({ projectId: typed.id, toolId }, "Creating tool in project");
6731
+ await upsertTool(db)({
6732
+ data: {
6733
+ tenantId,
6734
+ projectId: typed.id,
6735
+ ...toolData
6736
+ }
6737
+ });
6738
+ logger11.info({ projectId: typed.id, toolId }, "Tool created successfully");
6739
+ } catch (error) {
6740
+ logger11.error(
6741
+ { projectId: typed.id, toolId, error },
6742
+ "Failed to create tool in project"
6743
+ );
6744
+ throw error;
6745
+ }
6746
+ });
6747
+ await Promise.all(toolPromises);
6748
+ logger11.info(
6749
+ {
6750
+ projectId: typed.id,
6751
+ toolCount: Object.keys(typed.tools).length
6752
+ },
6753
+ "All project tools created successfully"
6754
+ );
6755
+ }
6756
+ if (typed.contextConfig && Object.keys(typed.contextConfig).length > 0) {
6757
+ logger11.info(
6758
+ {
6759
+ projectId: typed.id,
6760
+ count: Object.keys(typed.contextConfig).length
6761
+ },
6762
+ "Creating project contextConfigs"
6763
+ );
6764
+ const contextConfigPromises = Object.entries(typed.contextConfig).map(
6765
+ async ([configId, configData]) => {
6766
+ try {
6767
+ logger11.info({ projectId: typed.id, configId }, "Creating contextConfig in project");
6768
+ await upsertContextConfig(db)({
6769
+ data: {
6770
+ ...configData,
6771
+ tenantId,
6772
+ projectId: typed.id
6773
+ }
6774
+ });
6775
+ logger11.info({ projectId: typed.id, configId }, "ContextConfig created successfully");
6776
+ } catch (error) {
6777
+ logger11.error(
6778
+ { projectId: typed.id, configId, error },
6779
+ "Failed to create contextConfig in project"
6780
+ );
6781
+ throw error;
6782
+ }
6783
+ }
6784
+ );
6785
+ await Promise.all(contextConfigPromises);
6786
+ logger11.info(
6787
+ {
6788
+ projectId: typed.id,
6789
+ count: Object.keys(typed.contextConfig).length
6790
+ },
6791
+ "All project contextConfigs created successfully"
6792
+ );
6793
+ }
6794
+ if (typed.dataComponents && Object.keys(typed.dataComponents).length > 0) {
6795
+ logger11.info(
6796
+ {
6797
+ projectId: typed.id,
6798
+ count: Object.keys(typed.dataComponents).length
6799
+ },
6800
+ "Creating project dataComponents"
6801
+ );
6802
+ const dataComponentPromises = Object.entries(typed.dataComponents).map(
6803
+ async ([componentId, componentData]) => {
6804
+ try {
6805
+ logger11.info(
6806
+ { projectId: typed.id, componentId },
6807
+ "Creating dataComponent in project"
6808
+ );
6809
+ await upsertDataComponent(db)({
6810
+ data: {
6811
+ ...componentData,
6812
+ tenantId,
6813
+ projectId: typed.id
6814
+ }
6815
+ });
6816
+ logger11.info(
6817
+ { projectId: typed.id, componentId },
6818
+ "DataComponent created successfully"
6819
+ );
6820
+ } catch (error) {
6821
+ logger11.error(
6822
+ { projectId: typed.id, componentId, error },
6823
+ "Failed to create dataComponent in project"
6824
+ );
6825
+ throw error;
6826
+ }
6827
+ }
6828
+ );
6829
+ await Promise.all(dataComponentPromises);
6830
+ logger11.info(
6831
+ {
6832
+ projectId: typed.id,
6833
+ count: Object.keys(typed.dataComponents).length
6834
+ },
6835
+ "All project dataComponents created successfully"
6836
+ );
6837
+ }
6838
+ if (typed.artifactComponents && Object.keys(typed.artifactComponents).length > 0) {
6839
+ logger11.info(
6840
+ {
6841
+ projectId: typed.id,
6842
+ count: Object.keys(typed.artifactComponents).length
6843
+ },
6844
+ "Creating project artifactComponents"
6845
+ );
6846
+ const artifactComponentPromises = Object.entries(typed.artifactComponents).map(
6847
+ async ([componentId, componentData]) => {
6848
+ try {
6849
+ logger11.info(
6850
+ { projectId: typed.id, componentId },
6851
+ "Creating artifactComponent in project"
6852
+ );
6853
+ await upsertArtifactComponent(db)({
6854
+ data: {
6855
+ id: componentId,
6856
+ ...componentData,
6857
+ tenantId,
6858
+ projectId: typed.id
6859
+ }
6860
+ });
6861
+ logger11.info(
6862
+ { projectId: typed.id, componentId },
6863
+ "ArtifactComponent created successfully"
6864
+ );
6865
+ } catch (error) {
6866
+ logger11.error(
6867
+ { projectId: typed.id, componentId, error },
6868
+ "Failed to create artifactComponent in project"
6869
+ );
6870
+ throw error;
6871
+ }
6872
+ }
6873
+ );
6874
+ await Promise.all(artifactComponentPromises);
6875
+ logger11.info(
6876
+ {
6877
+ projectId: typed.id,
6878
+ count: Object.keys(typed.artifactComponents).length
6879
+ },
6880
+ "All project artifactComponents created successfully"
6881
+ );
6882
+ }
6670
6883
  if (typed.graphs && Object.keys(typed.graphs).length > 0) {
6671
6884
  logger11.info(
6672
6885
  {
@@ -6678,13 +6891,19 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
6678
6891
  const graphPromises = Object.entries(typed.graphs).map(async ([graphId, graphData]) => {
6679
6892
  try {
6680
6893
  logger11.info({ projectId: typed.id, graphId }, "Creating graph in project");
6681
- const graphDataWithUndefined = {
6894
+ const graphDataWithProjectResources = {
6682
6895
  ...graphData,
6896
+ tools: typed.tools || {},
6897
+ // Pass project-level resources for validation
6898
+ dataComponents: typed.dataComponents || {},
6899
+ artifactComponents: typed.artifactComponents || {},
6900
+ contextConfig: typed.contextConfig?.[graphId] || void 0,
6901
+ credentialReferences: typed.credentialReferences || {},
6683
6902
  statusUpdates: graphData.statusUpdates === null ? void 0 : graphData.statusUpdates
6684
6903
  };
6685
6904
  await createFullGraphServerSide(db, logger11)(
6686
6905
  { tenantId, projectId: typed.id },
6687
- graphDataWithUndefined
6906
+ graphDataWithProjectResources
6688
6907
  );
6689
6908
  logger11.info({ projectId: typed.id, graphId }, "Graph created successfully in project");
6690
6909
  } catch (error) {
@@ -6761,6 +6980,213 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
6761
6980
  data: projectUpdatePayload
6762
6981
  });
6763
6982
  logger11.info({ projectId: typed.id }, "Project metadata updated successfully");
6983
+ if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
6984
+ logger11.info(
6985
+ {
6986
+ projectId: typed.id,
6987
+ count: Object.keys(typed.credentialReferences).length
6988
+ },
6989
+ "Updating project credentialReferences"
6990
+ );
6991
+ const credentialPromises = Object.entries(typed.credentialReferences).map(
6992
+ async ([_credId, credData]) => {
6993
+ try {
6994
+ logger11.info(
6995
+ { projectId: typed.id, credId: credData.id },
6996
+ "Updating credentialReference in project"
6997
+ );
6998
+ await upsertCredentialReference(db)({
6999
+ data: {
7000
+ ...credData,
7001
+ tenantId,
7002
+ projectId: typed.id
7003
+ }
7004
+ });
7005
+ logger11.info(
7006
+ { projectId: typed.id, credId: credData.id },
7007
+ "CredentialReference updated successfully"
7008
+ );
7009
+ } catch (error) {
7010
+ logger11.error(
7011
+ { projectId: typed.id, credId: credData.id, error },
7012
+ "Failed to update credentialReference in project"
7013
+ );
7014
+ throw error;
7015
+ }
7016
+ }
7017
+ );
7018
+ await Promise.all(credentialPromises);
7019
+ logger11.info(
7020
+ {
7021
+ projectId: typed.id,
7022
+ count: Object.keys(typed.credentialReferences).length
7023
+ },
7024
+ "All project credentialReferences updated successfully"
7025
+ );
7026
+ }
7027
+ if (typed.tools && Object.keys(typed.tools).length > 0) {
7028
+ logger11.info(
7029
+ {
7030
+ projectId: typed.id,
7031
+ toolCount: Object.keys(typed.tools).length
7032
+ },
7033
+ "Updating project tools"
7034
+ );
7035
+ const toolPromises = Object.entries(typed.tools).map(async ([toolId, toolData]) => {
7036
+ try {
7037
+ logger11.info({ projectId: typed.id, toolId }, "Updating tool in project");
7038
+ await upsertTool(db)({
7039
+ data: {
7040
+ tenantId,
7041
+ projectId: typed.id,
7042
+ ...toolData
7043
+ }
7044
+ });
7045
+ logger11.info({ projectId: typed.id, toolId }, "Tool updated successfully");
7046
+ } catch (error) {
7047
+ logger11.error(
7048
+ { projectId: typed.id, toolId, error },
7049
+ "Failed to update tool in project"
7050
+ );
7051
+ throw error;
7052
+ }
7053
+ });
7054
+ await Promise.all(toolPromises);
7055
+ logger11.info(
7056
+ {
7057
+ projectId: typed.id,
7058
+ toolCount: Object.keys(typed.tools).length
7059
+ },
7060
+ "All project tools updated successfully"
7061
+ );
7062
+ }
7063
+ if (typed.contextConfig && Object.keys(typed.contextConfig).length > 0) {
7064
+ logger11.info(
7065
+ {
7066
+ projectId: typed.id,
7067
+ count: Object.keys(typed.contextConfig).length
7068
+ },
7069
+ "Updating project contextConfigs"
7070
+ );
7071
+ const contextConfigPromises = Object.entries(typed.contextConfig).map(
7072
+ async ([configId, configData]) => {
7073
+ try {
7074
+ logger11.info({ projectId: typed.id, configId }, "Updating contextConfig in project");
7075
+ await upsertContextConfig(db)({
7076
+ data: {
7077
+ ...configData,
7078
+ tenantId,
7079
+ projectId: typed.id
7080
+ }
7081
+ });
7082
+ logger11.info({ projectId: typed.id, configId }, "ContextConfig updated successfully");
7083
+ } catch (error) {
7084
+ logger11.error(
7085
+ { projectId: typed.id, configId, error },
7086
+ "Failed to update contextConfig in project"
7087
+ );
7088
+ throw error;
7089
+ }
7090
+ }
7091
+ );
7092
+ await Promise.all(contextConfigPromises);
7093
+ logger11.info(
7094
+ {
7095
+ projectId: typed.id,
7096
+ count: Object.keys(typed.contextConfig).length
7097
+ },
7098
+ "All project contextConfigs updated successfully"
7099
+ );
7100
+ }
7101
+ if (typed.dataComponents && Object.keys(typed.dataComponents).length > 0) {
7102
+ logger11.info(
7103
+ {
7104
+ projectId: typed.id,
7105
+ count: Object.keys(typed.dataComponents).length
7106
+ },
7107
+ "Updating project dataComponents"
7108
+ );
7109
+ const dataComponentPromises = Object.entries(typed.dataComponents).map(
7110
+ async ([componentId, componentData]) => {
7111
+ try {
7112
+ logger11.info(
7113
+ { projectId: typed.id, componentId },
7114
+ "Updating dataComponent in project"
7115
+ );
7116
+ await upsertDataComponent(db)({
7117
+ data: {
7118
+ ...componentData,
7119
+ tenantId,
7120
+ projectId: typed.id
7121
+ }
7122
+ });
7123
+ logger11.info(
7124
+ { projectId: typed.id, componentId },
7125
+ "DataComponent updated successfully"
7126
+ );
7127
+ } catch (error) {
7128
+ logger11.error(
7129
+ { projectId: typed.id, componentId, error },
7130
+ "Failed to update dataComponent in project"
7131
+ );
7132
+ throw error;
7133
+ }
7134
+ }
7135
+ );
7136
+ await Promise.all(dataComponentPromises);
7137
+ logger11.info(
7138
+ {
7139
+ projectId: typed.id,
7140
+ count: Object.keys(typed.dataComponents).length
7141
+ },
7142
+ "All project dataComponents updated successfully"
7143
+ );
7144
+ }
7145
+ if (typed.artifactComponents && Object.keys(typed.artifactComponents).length > 0) {
7146
+ logger11.info(
7147
+ {
7148
+ projectId: typed.id,
7149
+ count: Object.keys(typed.artifactComponents).length
7150
+ },
7151
+ "Updating project artifactComponents"
7152
+ );
7153
+ const artifactComponentPromises = Object.entries(typed.artifactComponents).map(
7154
+ async ([componentId, componentData]) => {
7155
+ try {
7156
+ logger11.info(
7157
+ { projectId: typed.id, componentId },
7158
+ "Updating artifactComponent in project"
7159
+ );
7160
+ await upsertArtifactComponent(db)({
7161
+ data: {
7162
+ id: componentId,
7163
+ ...componentData,
7164
+ tenantId,
7165
+ projectId: typed.id
7166
+ }
7167
+ });
7168
+ logger11.info(
7169
+ { projectId: typed.id, componentId },
7170
+ "ArtifactComponent updated successfully"
7171
+ );
7172
+ } catch (error) {
7173
+ logger11.error(
7174
+ { projectId: typed.id, componentId, error },
7175
+ "Failed to update artifactComponent in project"
7176
+ );
7177
+ throw error;
7178
+ }
7179
+ }
7180
+ );
7181
+ await Promise.all(artifactComponentPromises);
7182
+ logger11.info(
7183
+ {
7184
+ projectId: typed.id,
7185
+ count: Object.keys(typed.artifactComponents).length
7186
+ },
7187
+ "All project artifactComponents updated successfully"
7188
+ );
7189
+ }
6764
7190
  if (typed.graphs && Object.keys(typed.graphs).length > 0) {
6765
7191
  logger11.info(
6766
7192
  {
@@ -6772,13 +7198,19 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
6772
7198
  const graphPromises = Object.entries(typed.graphs).map(async ([graphId, graphData]) => {
6773
7199
  try {
6774
7200
  logger11.info({ projectId: typed.id, graphId }, "Updating graph in project");
6775
- const graphDataWithUndefined = {
7201
+ const graphDataWithProjectResources = {
6776
7202
  ...graphData,
7203
+ tools: typed.tools || {},
7204
+ // Pass project-level resources for validation
7205
+ dataComponents: typed.dataComponents || {},
7206
+ artifactComponents: typed.artifactComponents || {},
7207
+ contextConfig: typed.contextConfig?.[graphId] || void 0,
7208
+ credentialReferences: typed.credentialReferences || {},
6777
7209
  statusUpdates: graphData.statusUpdates === null ? void 0 : graphData.statusUpdates
6778
7210
  };
6779
7211
  await updateFullGraphServerSide(db, logger11)(
6780
7212
  { tenantId, projectId: typed.id },
6781
- graphDataWithUndefined
7213
+ graphDataWithProjectResources
6782
7214
  );
6783
7215
  logger11.info({ projectId: typed.id, graphId }, "Graph updated successfully in project");
6784
7216
  } catch (error) {
@@ -6842,6 +7274,129 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
6842
7274
  },
6843
7275
  "Found graphs for project"
6844
7276
  );
7277
+ const projectTools = {};
7278
+ try {
7279
+ const toolsList = await listTools(db)({
7280
+ scopes: { tenantId, projectId },
7281
+ pagination: { page: 1, limit: 1e3 }
7282
+ // Get all tools
7283
+ });
7284
+ for (const tool2 of toolsList.data) {
7285
+ projectTools[tool2.id] = {
7286
+ id: tool2.id,
7287
+ name: tool2.name,
7288
+ config: tool2.config,
7289
+ imageUrl: tool2.imageUrl || void 0,
7290
+ status: tool2.status,
7291
+ capabilities: tool2.capabilities || void 0,
7292
+ lastHealthCheck: tool2.lastHealthCheck && !Number.isNaN(new Date(tool2.lastHealthCheck).getTime()) ? new Date(tool2.lastHealthCheck).toISOString() : void 0,
7293
+ lastError: tool2.lastError || void 0,
7294
+ availableTools: tool2.availableTools || void 0,
7295
+ activeTools: tool2.config?.mcp?.activeTools || void 0,
7296
+ lastToolsSync: tool2.lastToolsSync && !Number.isNaN(new Date(tool2.lastToolsSync).getTime()) ? new Date(tool2.lastToolsSync).toISOString() : void 0
7297
+ };
7298
+ }
7299
+ logger11.info(
7300
+ { tenantId, projectId, toolCount: Object.keys(projectTools).length },
7301
+ "Tools retrieved for project"
7302
+ );
7303
+ } catch (error) {
7304
+ logger11.warn({ tenantId, projectId, error }, "Failed to retrieve tools for project");
7305
+ }
7306
+ const projectDataComponents = {};
7307
+ try {
7308
+ const dataComponentsList = await listDataComponents(db)({
7309
+ scopes: { tenantId, projectId }
7310
+ });
7311
+ for (const component of dataComponentsList) {
7312
+ projectDataComponents[component.id] = {
7313
+ id: component.id,
7314
+ name: component.name,
7315
+ description: component.description,
7316
+ props: component.props
7317
+ };
7318
+ }
7319
+ logger11.info(
7320
+ { tenantId, projectId, count: Object.keys(projectDataComponents).length },
7321
+ "DataComponents retrieved for project"
7322
+ );
7323
+ } catch (error) {
7324
+ logger11.warn(
7325
+ { tenantId, projectId, error },
7326
+ "Failed to retrieve dataComponents for project"
7327
+ );
7328
+ }
7329
+ const projectArtifactComponents = {};
7330
+ try {
7331
+ const artifactComponentsList = await listArtifactComponents(db)({
7332
+ scopes: { tenantId, projectId }
7333
+ });
7334
+ for (const component of artifactComponentsList) {
7335
+ projectArtifactComponents[component.id] = {
7336
+ id: component.id,
7337
+ name: component.name,
7338
+ description: component.description,
7339
+ summaryProps: component.summaryProps,
7340
+ fullProps: component.fullProps
7341
+ };
7342
+ }
7343
+ logger11.info(
7344
+ { tenantId, projectId, count: Object.keys(projectArtifactComponents).length },
7345
+ "ArtifactComponents retrieved for project"
7346
+ );
7347
+ } catch (error) {
7348
+ logger11.warn(
7349
+ { tenantId, projectId, error },
7350
+ "Failed to retrieve artifactComponents for project"
7351
+ );
7352
+ }
7353
+ const projectContextConfigs = {};
7354
+ try {
7355
+ const contextConfigsList = await listContextConfigs(db)({
7356
+ scopes: { tenantId, projectId }
7357
+ });
7358
+ for (const config of contextConfigsList) {
7359
+ projectContextConfigs[config.id] = {
7360
+ id: config.id,
7361
+ name: config.name,
7362
+ description: config.description,
7363
+ requestContextSchema: config.requestContextSchema,
7364
+ contextVariables: config.contextVariables
7365
+ };
7366
+ }
7367
+ logger11.info(
7368
+ { tenantId, projectId, count: Object.keys(projectContextConfigs).length },
7369
+ "ContextConfigs retrieved for project"
7370
+ );
7371
+ } catch (error) {
7372
+ logger11.warn(
7373
+ { tenantId, projectId, error },
7374
+ "Failed to retrieve contextConfigs for project"
7375
+ );
7376
+ }
7377
+ const projectCredentialReferences = {};
7378
+ try {
7379
+ const credentialReferencesList = await listCredentialReferences(db)({
7380
+ scopes: { tenantId, projectId }
7381
+ });
7382
+ for (const credential of credentialReferencesList) {
7383
+ projectCredentialReferences[credential.id] = {
7384
+ id: credential.id,
7385
+ type: credential.type,
7386
+ credentialStoreId: credential.credentialStoreId,
7387
+ retrievalParams: credential.retrievalParams
7388
+ };
7389
+ }
7390
+ logger11.info(
7391
+ { tenantId, projectId, count: Object.keys(projectCredentialReferences).length },
7392
+ "CredentialReferences retrieved for project"
7393
+ );
7394
+ } catch (error) {
7395
+ logger11.warn(
7396
+ { tenantId, projectId, error },
7397
+ "Failed to retrieve credentialReferences for project"
7398
+ );
7399
+ }
6845
7400
  const graphs = {};
6846
7401
  if (graphList.length > 0) {
6847
7402
  const graphPromises = graphList.map(async (graph) => {
@@ -6855,7 +7410,15 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
6855
7410
  graphId: graph.id
6856
7411
  });
6857
7412
  if (fullGraph) {
6858
- graphs[graph.id] = fullGraph;
7413
+ const {
7414
+ tools: _tools,
7415
+ dataComponents: _dataComponents,
7416
+ artifactComponents: _artifactComponents,
7417
+ contextConfig: _contextConfig,
7418
+ credentialReferences: _credentialReferences,
7419
+ ...graphWithoutProjectResources
7420
+ } = fullGraph;
7421
+ graphs[graph.id] = graphWithoutProjectResources;
6859
7422
  logger11.info(
6860
7423
  { tenantId, projectId, graphId: graph.id },
6861
7424
  "Full graph definition retrieved"
@@ -6879,8 +7442,11 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
6879
7442
  models: project.models || void 0,
6880
7443
  stopWhen: project.stopWhen || void 0,
6881
7444
  graphs,
6882
- tools: {},
6883
- // TODO: Implement proper tools retrieval
7445
+ tools: projectTools,
7446
+ dataComponents: projectDataComponents,
7447
+ artifactComponents: projectArtifactComponents,
7448
+ contextConfig: projectContextConfigs,
7449
+ credentialReferences: projectCredentialReferences,
6884
7450
  createdAt: project.createdAt,
6885
7451
  updatedAt: project.updatedAt
6886
7452
  };
@@ -9382,11 +9948,11 @@ var NangoCredentialStore = class {
9382
9948
  switch (type) {
9383
9949
  case "API_KEY":
9384
9950
  return {
9385
- token: credentials.apiKey
9951
+ token: credentials.apiKey || credentials.api_key
9386
9952
  };
9387
9953
  case "APP":
9388
9954
  return {
9389
- token: credentials.access_token
9955
+ token: credentials.accessToken || credentials.access_token
9390
9956
  };
9391
9957
  case "BASIC":
9392
9958
  return {