@inkeep/agents-core 0.0.0-dev-20251003195502 → 0.0.0-dev-20251003221329
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-Y63D625C.js → chunk-ZVLDWUCT.js} +1 -1
- package/dist/client-exports.js +2 -2
- package/dist/index.cjs +48 -4
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +54 -10
- package/dist/validation/index.js +2 -2
- package/package.json +1 -1
- package/dist/{chunk-YVZJ5VV7.js → chunk-AGEHLZUK.js} +1 -1
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-AGEHLZUK.js';
|
|
2
|
+
export { AgentStopWhenSchema, GraphStopWhenSchema, StopWhenSchema } from './chunk-AGEHLZUK.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/index.cjs
CHANGED
|
@@ -5544,6 +5544,9 @@ var McpClient = class {
|
|
|
5544
5544
|
{ capabilities: opts.capabilities || {} }
|
|
5545
5545
|
);
|
|
5546
5546
|
}
|
|
5547
|
+
isConnected() {
|
|
5548
|
+
return this.connected;
|
|
5549
|
+
}
|
|
5547
5550
|
async connect() {
|
|
5548
5551
|
if (this.connected) return;
|
|
5549
5552
|
await tsPattern.match(this.serverConfig).with({ type: MCPTransportType.streamableHttp }, (config) => this.connectHttp(config)).with({ type: MCPTransportType.sse }, (config) => this.connectSSE(config)).exhaustive();
|
|
@@ -10407,10 +10410,47 @@ var NangoCredentialStore = class {
|
|
|
10407
10410
|
if (error && typeof error === "object" && "status" in error && error.status === 404) {
|
|
10408
10411
|
return null;
|
|
10409
10412
|
}
|
|
10410
|
-
|
|
10413
|
+
logger11.error(
|
|
10414
|
+
{ error: error instanceof Error ? error.message : "Unknown error", uniqueKey },
|
|
10415
|
+
`Failed to fetch integration ${uniqueKey}`
|
|
10416
|
+
);
|
|
10411
10417
|
return null;
|
|
10412
10418
|
}
|
|
10413
10419
|
}
|
|
10420
|
+
/**
|
|
10421
|
+
* Optimize OAuth token data to fit within Nango's 1024 character limit for apiKey field
|
|
10422
|
+
* Strategy: Remove unnecessary fields
|
|
10423
|
+
*/
|
|
10424
|
+
optimizeOAuthTokenForNango(tokenData) {
|
|
10425
|
+
const parsed = JSON.parse(tokenData);
|
|
10426
|
+
const essential = {
|
|
10427
|
+
access_token: parsed.access_token,
|
|
10428
|
+
token_type: parsed.token_type,
|
|
10429
|
+
expires_in: parsed.expires_in,
|
|
10430
|
+
refresh_token: parsed.refresh_token
|
|
10431
|
+
};
|
|
10432
|
+
Object.keys(essential).forEach((key) => {
|
|
10433
|
+
if (essential[key] === void 0) {
|
|
10434
|
+
delete essential[key];
|
|
10435
|
+
}
|
|
10436
|
+
});
|
|
10437
|
+
const result = JSON.stringify(essential);
|
|
10438
|
+
if (result.length > 1024) {
|
|
10439
|
+
logger11.error(
|
|
10440
|
+
{
|
|
10441
|
+
originalLength: tokenData.length,
|
|
10442
|
+
essentialLength: result.length,
|
|
10443
|
+
accessTokenLength: parsed.access_token?.length || 0,
|
|
10444
|
+
refreshTokenLength: parsed.refresh_token?.length || 0
|
|
10445
|
+
},
|
|
10446
|
+
"OAuth token too large for Nango storage even after removing non-essential fields"
|
|
10447
|
+
);
|
|
10448
|
+
throw new Error(
|
|
10449
|
+
`OAuth token (${result.length} chars) exceeds Nango's 1024 character limit. Essential fields cannot be truncated without breaking functionality. Consider using keychain storage instead of Nango for this provider.`
|
|
10450
|
+
);
|
|
10451
|
+
}
|
|
10452
|
+
return result;
|
|
10453
|
+
}
|
|
10414
10454
|
/**
|
|
10415
10455
|
* Create an API key credential by setting up Nango integration and importing the connection
|
|
10416
10456
|
*/
|
|
@@ -10441,9 +10481,13 @@ var NangoCredentialStore = class {
|
|
|
10441
10481
|
throw new Error(`Integration '${name}' not found`);
|
|
10442
10482
|
}
|
|
10443
10483
|
const importConnectionUrl = `${process.env.NANGO_SERVER_URL || "https://api.nango.dev"}/connections`;
|
|
10484
|
+
const optimizedApiKey = this.optimizeOAuthTokenForNango(apiKeyToSet);
|
|
10485
|
+
if (!optimizedApiKey) {
|
|
10486
|
+
throw new Error(`Failed to optimize OAuth token for Nango.`);
|
|
10487
|
+
}
|
|
10444
10488
|
const credentials = {
|
|
10445
10489
|
type: "API_KEY",
|
|
10446
|
-
apiKey:
|
|
10490
|
+
apiKey: optimizedApiKey
|
|
10447
10491
|
};
|
|
10448
10492
|
const body = {
|
|
10449
10493
|
provider_config_key: integration.unique_key,
|
|
@@ -10460,12 +10504,12 @@ var NangoCredentialStore = class {
|
|
|
10460
10504
|
body: JSON.stringify(body)
|
|
10461
10505
|
});
|
|
10462
10506
|
if (!response.ok) {
|
|
10507
|
+
const errorText = await response.text();
|
|
10463
10508
|
throw new Error(
|
|
10464
|
-
`Failed to import connection: HTTP ${response.status} - ${response.statusText}`
|
|
10509
|
+
`Failed to import connection: HTTP ${response.status} - ${response.statusText}. Response: ${errorText}`
|
|
10465
10510
|
);
|
|
10466
10511
|
}
|
|
10467
10512
|
} catch (error) {
|
|
10468
|
-
console.error("Unexpected error creating API key credential:", error);
|
|
10469
10513
|
logger11.error(
|
|
10470
10514
|
{
|
|
10471
10515
|
error: error instanceof Error ? error.message : "Unknown error",
|
package/dist/index.d.cts
CHANGED
|
@@ -578,6 +578,11 @@ declare class NangoCredentialStore implements CredentialStore {
|
|
|
578
578
|
* Fetch a specific Nango integration
|
|
579
579
|
*/
|
|
580
580
|
private fetchNangoIntegration;
|
|
581
|
+
/**
|
|
582
|
+
* Optimize OAuth token data to fit within Nango's 1024 character limit for apiKey field
|
|
583
|
+
* Strategy: Remove unnecessary fields
|
|
584
|
+
*/
|
|
585
|
+
private optimizeOAuthTokenForNango;
|
|
581
586
|
/**
|
|
582
587
|
* Create an API key credential by setting up Nango integration and importing the connection
|
|
583
588
|
*/
|
|
@@ -730,6 +735,7 @@ declare class McpClient {
|
|
|
730
735
|
private serverConfig;
|
|
731
736
|
private connected;
|
|
732
737
|
constructor(opts: McpClientOptions);
|
|
738
|
+
isConnected(): boolean;
|
|
733
739
|
connect(): Promise<void>;
|
|
734
740
|
private connectSSE;
|
|
735
741
|
private connectHttp;
|
package/dist/index.d.ts
CHANGED
|
@@ -578,6 +578,11 @@ declare class NangoCredentialStore implements CredentialStore {
|
|
|
578
578
|
* Fetch a specific Nango integration
|
|
579
579
|
*/
|
|
580
580
|
private fetchNangoIntegration;
|
|
581
|
+
/**
|
|
582
|
+
* Optimize OAuth token data to fit within Nango's 1024 character limit for apiKey field
|
|
583
|
+
* Strategy: Remove unnecessary fields
|
|
584
|
+
*/
|
|
585
|
+
private optimizeOAuthTokenForNango;
|
|
581
586
|
/**
|
|
582
587
|
* Create an API key credential by setting up Nango integration and importing the connection
|
|
583
588
|
*/
|
|
@@ -730,6 +735,7 @@ declare class McpClient {
|
|
|
730
735
|
private serverConfig;
|
|
731
736
|
private connected;
|
|
732
737
|
constructor(opts: McpClientOptions);
|
|
738
|
+
isConnected(): boolean;
|
|
733
739
|
connect(): Promise<void>;
|
|
734
740
|
private connectSSE;
|
|
735
741
|
private connectHttp;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { TaskState } from './chunk-H2F72PDA.js';
|
|
2
|
-
import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-
|
|
3
|
-
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-
|
|
4
|
-
import { ContextConfigApiUpdateSchema } from './chunk-
|
|
5
|
-
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from './chunk-
|
|
6
|
-
import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-KBRQN63H.js';
|
|
7
|
-
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, ledgerArtifactsRelations, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-KBRQN63H.js';
|
|
2
|
+
import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-ZVLDWUCT.js';
|
|
3
|
+
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-ZVLDWUCT.js';
|
|
4
|
+
import { ContextConfigApiUpdateSchema } from './chunk-AGEHLZUK.js';
|
|
5
|
+
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from './chunk-AGEHLZUK.js';
|
|
8
6
|
import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-YFHT5M2R.js';
|
|
9
7
|
export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-YFHT5M2R.js';
|
|
8
|
+
import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-KBRQN63H.js';
|
|
9
|
+
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, ledgerArtifactsRelations, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-KBRQN63H.js';
|
|
10
10
|
import { __publicField } from './chunk-MKBO26DX.js';
|
|
11
11
|
import { z as z$1 } from 'zod';
|
|
12
12
|
import pino from 'pino';
|
|
@@ -3927,6 +3927,9 @@ var McpClient = class {
|
|
|
3927
3927
|
{ capabilities: opts.capabilities || {} }
|
|
3928
3928
|
);
|
|
3929
3929
|
}
|
|
3930
|
+
isConnected() {
|
|
3931
|
+
return this.connected;
|
|
3932
|
+
}
|
|
3930
3933
|
async connect() {
|
|
3931
3934
|
if (this.connected) return;
|
|
3932
3935
|
await match(this.serverConfig).with({ type: MCPTransportType.streamableHttp }, (config) => this.connectHttp(config)).with({ type: MCPTransportType.sse }, (config) => this.connectSSE(config)).exhaustive();
|
|
@@ -8790,10 +8793,47 @@ var NangoCredentialStore = class {
|
|
|
8790
8793
|
if (error && typeof error === "object" && "status" in error && error.status === 404) {
|
|
8791
8794
|
return null;
|
|
8792
8795
|
}
|
|
8793
|
-
|
|
8796
|
+
logger11.error(
|
|
8797
|
+
{ error: error instanceof Error ? error.message : "Unknown error", uniqueKey },
|
|
8798
|
+
`Failed to fetch integration ${uniqueKey}`
|
|
8799
|
+
);
|
|
8794
8800
|
return null;
|
|
8795
8801
|
}
|
|
8796
8802
|
}
|
|
8803
|
+
/**
|
|
8804
|
+
* Optimize OAuth token data to fit within Nango's 1024 character limit for apiKey field
|
|
8805
|
+
* Strategy: Remove unnecessary fields
|
|
8806
|
+
*/
|
|
8807
|
+
optimizeOAuthTokenForNango(tokenData) {
|
|
8808
|
+
const parsed = JSON.parse(tokenData);
|
|
8809
|
+
const essential = {
|
|
8810
|
+
access_token: parsed.access_token,
|
|
8811
|
+
token_type: parsed.token_type,
|
|
8812
|
+
expires_in: parsed.expires_in,
|
|
8813
|
+
refresh_token: parsed.refresh_token
|
|
8814
|
+
};
|
|
8815
|
+
Object.keys(essential).forEach((key) => {
|
|
8816
|
+
if (essential[key] === void 0) {
|
|
8817
|
+
delete essential[key];
|
|
8818
|
+
}
|
|
8819
|
+
});
|
|
8820
|
+
const result = JSON.stringify(essential);
|
|
8821
|
+
if (result.length > 1024) {
|
|
8822
|
+
logger11.error(
|
|
8823
|
+
{
|
|
8824
|
+
originalLength: tokenData.length,
|
|
8825
|
+
essentialLength: result.length,
|
|
8826
|
+
accessTokenLength: parsed.access_token?.length || 0,
|
|
8827
|
+
refreshTokenLength: parsed.refresh_token?.length || 0
|
|
8828
|
+
},
|
|
8829
|
+
"OAuth token too large for Nango storage even after removing non-essential fields"
|
|
8830
|
+
);
|
|
8831
|
+
throw new Error(
|
|
8832
|
+
`OAuth token (${result.length} chars) exceeds Nango's 1024 character limit. Essential fields cannot be truncated without breaking functionality. Consider using keychain storage instead of Nango for this provider.`
|
|
8833
|
+
);
|
|
8834
|
+
}
|
|
8835
|
+
return result;
|
|
8836
|
+
}
|
|
8797
8837
|
/**
|
|
8798
8838
|
* Create an API key credential by setting up Nango integration and importing the connection
|
|
8799
8839
|
*/
|
|
@@ -8824,9 +8864,13 @@ var NangoCredentialStore = class {
|
|
|
8824
8864
|
throw new Error(`Integration '${name}' not found`);
|
|
8825
8865
|
}
|
|
8826
8866
|
const importConnectionUrl = `${process.env.NANGO_SERVER_URL || "https://api.nango.dev"}/connections`;
|
|
8867
|
+
const optimizedApiKey = this.optimizeOAuthTokenForNango(apiKeyToSet);
|
|
8868
|
+
if (!optimizedApiKey) {
|
|
8869
|
+
throw new Error(`Failed to optimize OAuth token for Nango.`);
|
|
8870
|
+
}
|
|
8827
8871
|
const credentials = {
|
|
8828
8872
|
type: "API_KEY",
|
|
8829
|
-
apiKey:
|
|
8873
|
+
apiKey: optimizedApiKey
|
|
8830
8874
|
};
|
|
8831
8875
|
const body = {
|
|
8832
8876
|
provider_config_key: integration.unique_key,
|
|
@@ -8843,12 +8887,12 @@ var NangoCredentialStore = class {
|
|
|
8843
8887
|
body: JSON.stringify(body)
|
|
8844
8888
|
});
|
|
8845
8889
|
if (!response.ok) {
|
|
8890
|
+
const errorText = await response.text();
|
|
8846
8891
|
throw new Error(
|
|
8847
|
-
`Failed to import connection: HTTP ${response.status} - ${response.statusText}`
|
|
8892
|
+
`Failed to import connection: HTTP ${response.status} - ${response.statusText}. Response: ${errorText}`
|
|
8848
8893
|
);
|
|
8849
8894
|
}
|
|
8850
8895
|
} catch (error) {
|
|
8851
|
-
console.error("Unexpected error creating API key credential:", error);
|
|
8852
8896
|
logger11.error(
|
|
8853
8897
|
{
|
|
8854
8898
|
error: error instanceof Error ? error.message : "Unknown error",
|
package/dist/validation/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from '../chunk-
|
|
2
|
-
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from '../chunk-
|
|
1
|
+
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from '../chunk-ZVLDWUCT.js';
|
|
2
|
+
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from '../chunk-AGEHLZUK.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-core",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20251003221329",
|
|
4
4
|
"description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, credentialReferences, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-KBRQN63H.js';
|
|
2
1
|
import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-YFHT5M2R.js';
|
|
2
|
+
import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, credentialReferences, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-KBRQN63H.js';
|
|
3
3
|
import { z } from '@hono/zod-openapi';
|
|
4
4
|
import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
|
|
5
5
|
|