@inkeep/agents-sdk 0.41.2 → 0.42.0
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/agent.d.ts +84 -73
- package/dist/agent.js +40 -2
- package/dist/agentFullClient.d.ts +8 -8
- package/dist/agentFullClient.js +4 -4
- package/dist/artifact-component.d.ts +8 -8
- package/dist/artifact-component.js +2 -2
- package/dist/builderFunctions.d.ts +300 -248
- package/dist/builderFunctions.js +64 -1
- package/dist/builderFunctionsExperimental.d.ts +17 -17
- package/dist/builders.d.ts +48 -48
- package/dist/credential-provider.d.ts +93 -93
- package/dist/credential-ref.d.ts +37 -37
- package/dist/data-component.d.ts +9 -9
- package/dist/data-component.js +2 -2
- package/dist/environment-settings.d.ts +4 -4
- package/dist/evaluationClient.d.ts +78 -0
- package/dist/evaluationClient.js +1202 -0
- package/dist/external-agent.d.ts +17 -17
- package/dist/external-agent.js +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/module-hosted-tool-manager.d.ts +1 -1
- package/dist/module-hosted-tool-manager.js +1 -1
- package/dist/project.d.ts +83 -83
- package/dist/project.js +21 -2
- package/dist/projectFullClient.d.ts +8 -8
- package/dist/projectFullClient.js +4 -4
- package/dist/runner.d.ts +15 -15
- package/dist/status-component.d.ts +3 -3
- package/dist/subAgent.d.ts +2 -2
- package/dist/subAgent.js +7 -7
- package/dist/telemetry-provider.d.ts +76 -76
- package/dist/tool.d.ts +16 -16
- package/dist/tool.js +23 -3
- package/dist/trigger.d.ts +46 -0
- package/dist/trigger.js +65 -0
- package/dist/types.d.ts +31 -22
- package/dist/utils/generateIdFromName.d.ts +4 -4
- package/dist/utils/tool-normalization.d.ts +10 -10
- package/dist/utils/validateFunction.d.ts +5 -5
- package/package.json +2 -2
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
//#region src/builderFunctionsExperimental.d.ts
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
declare function agentRelation(targetAgent: string, relationType?:
|
|
3
|
+
* Creates an agent relation configuration.
|
|
4
|
+
*
|
|
5
|
+
* Relations define how agents can interact with each other.
|
|
6
|
+
* Transfer relations allow transfers, while delegate relations
|
|
7
|
+
* allow temporary task delegation.
|
|
8
|
+
*
|
|
9
|
+
* @param targetAgent - The ID of the target agent
|
|
10
|
+
* @param relationType - The type of relation (transfer or delegate)
|
|
11
|
+
* @returns An agent relation configuration
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const transferRelation = agentRelation('support-agent', 'transfer');
|
|
16
|
+
* const delegateRelation = agentRelation('specialist-agent', 'delegate');
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare function agentRelation(targetAgent: string, relationType?: "transfer" | "delegate"): {
|
|
20
20
|
targetAgent: string;
|
|
21
21
|
relationType: "transfer" | "delegate";
|
|
22
22
|
};
|
package/dist/builders.d.ts
CHANGED
|
@@ -7,18 +7,18 @@ import { z } from "zod";
|
|
|
7
7
|
//#region src/builders.d.ts
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
* Function signature for tool execution
|
|
11
|
+
* @template TParams - Type of input parameters
|
|
12
|
+
* @template TResult - Type of return value
|
|
13
|
+
*/
|
|
14
14
|
type ToolExecuteFunction<TParams = unknown, TResult = unknown> = (params: TParams) => Promise<TResult>;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
* Function signature for transfer conditions
|
|
17
|
+
*/
|
|
18
18
|
type TransferConditionFunction = (context: unknown) => boolean;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
* Configuration for MCP server builders
|
|
21
|
+
*/
|
|
22
22
|
interface MCPServerConfig {
|
|
23
23
|
name: string;
|
|
24
24
|
description: string;
|
|
@@ -26,14 +26,14 @@ interface MCPServerConfig {
|
|
|
26
26
|
id?: string;
|
|
27
27
|
parameters?: Record<string, z.ZodJSONSchema>;
|
|
28
28
|
credential?: CredentialReferenceApiInsert;
|
|
29
|
-
transport?:
|
|
29
|
+
transport?: "streamable_http" | "sse";
|
|
30
30
|
activeTools?: string[];
|
|
31
31
|
headers?: Record<string, string>;
|
|
32
32
|
imageUrl?: string;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
* Configuration for component builders
|
|
36
|
+
*/
|
|
37
37
|
interface ComponentConfig {
|
|
38
38
|
id?: string;
|
|
39
39
|
name: string;
|
|
@@ -55,12 +55,12 @@ interface StatusComponentConfig {
|
|
|
55
55
|
detailsSchema?: Record<string, unknown> | z.ZodObject<any>;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
declare const TransferConfigSchema: z.
|
|
61
|
-
agent:
|
|
62
|
-
description
|
|
63
|
-
}
|
|
58
|
+
* Schema for transfer configuration (excluding function properties)
|
|
59
|
+
*/
|
|
60
|
+
declare const TransferConfigSchema: z.ZodType<{
|
|
61
|
+
agent: SubAgent;
|
|
62
|
+
description?: string;
|
|
63
|
+
}>;
|
|
64
64
|
type AgentMcpConfig = {
|
|
65
65
|
server: Tool;
|
|
66
66
|
selectedTools?: string[];
|
|
@@ -68,44 +68,44 @@ type AgentMcpConfig = {
|
|
|
68
68
|
toolPolicies?: Record<string, ToolPolicy>;
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
* Input configuration for MCP tool customization
|
|
72
|
+
* Supports flexible tool selection with per-tool policies
|
|
73
|
+
*/
|
|
74
74
|
type AgentMcpConfigInput = {
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
* Tools to enable from the MCP server - can be strings or objects with policies
|
|
77
|
+
* - undefined or null: all tools enabled (no filtering)
|
|
78
|
+
* - []: zero tools enabled (explicit empty selection)
|
|
79
|
+
* - ['tool1', 'tool2']: specific tools enabled
|
|
80
|
+
*/
|
|
81
81
|
selectedTools?: McpToolSelection[] | null;
|
|
82
82
|
/** Custom headers for MCP server requests */
|
|
83
83
|
headers?: Record<string, string>;
|
|
84
84
|
};
|
|
85
85
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
86
|
+
* Creates a transfer configuration for agent transfers.
|
|
87
|
+
*
|
|
88
|
+
* Transfers allow one agent to hand off control to another agent
|
|
89
|
+
* based on optional conditions.
|
|
90
|
+
*
|
|
91
|
+
* @param targetAgent - The agent to transfer to
|
|
92
|
+
* @param description - Optional description of when/why to transfer
|
|
93
|
+
* @param condition - Optional function to determine if transfer should occur
|
|
94
|
+
* @returns A validated transfer configuration
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* // Simple transfer
|
|
99
|
+
* const transfer = transfer(supportAgent, 'Transfer to support');
|
|
100
|
+
*
|
|
101
|
+
* // Conditional transfer
|
|
102
|
+
* const conditionalHandoff = transfer(
|
|
103
|
+
* specialistAgent,
|
|
104
|
+
* 'Transfer to specialist for complex issues',
|
|
105
|
+
* (context) => context.complexity > 0.8
|
|
106
|
+
* );
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
109
|
declare function transfer(targetAgent: SubAgent, description?: string, condition?: TransferConditionFunction): TransferConfig;
|
|
110
110
|
//#endregion
|
|
111
111
|
export { AgentMcpConfig, AgentMcpConfigInput, ArtifactComponentConfig, ComponentConfig, DataComponentConfig, MCPServerConfig, StatusComponentConfig, ToolExecuteFunction, TransferConditionFunction, TransferConfigSchema, transfer };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
//#region src/credential-provider.d.ts
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
* InkeepCredentialProvider - Abstraction for Credential Management
|
|
4
|
+
*
|
|
5
|
+
* This module provides a clean abstraction over credential provider implementations.
|
|
6
|
+
* Cloud customers can use this without needing to know about or install internal
|
|
7
|
+
* dependencies like Nango.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Simple usage with environment variables (default)
|
|
12
|
+
* import { InkeepCredentialProvider } from '@inkeep/agents-sdk'
|
|
13
|
+
*
|
|
14
|
+
* const credentials = new InkeepCredentialProvider()
|
|
15
|
+
*
|
|
16
|
+
* // With custom configuration
|
|
17
|
+
* const credentials = new InkeepCredentialProvider({
|
|
18
|
+
* type: 'memory',
|
|
19
|
+
* id: 'my-store'
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
* Base interface for all credential stores
|
|
25
|
+
* This is a simplified version for SDK customers
|
|
26
|
+
*/
|
|
27
27
|
interface CredentialStore {
|
|
28
28
|
/** Unique identifier for this credential store */
|
|
29
29
|
readonly id: string;
|
|
@@ -44,33 +44,33 @@ interface CredentialStore {
|
|
|
44
44
|
}>;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
type CredentialProviderType =
|
|
47
|
+
* Supported credential provider types
|
|
48
|
+
*/
|
|
49
|
+
type CredentialProviderType = "memory" | "keychain" | "nango" | "custom";
|
|
50
50
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
* Configuration for memory-based credential storage
|
|
52
|
+
*/
|
|
53
53
|
interface MemoryCredentialConfig {
|
|
54
|
-
type:
|
|
54
|
+
type: "memory";
|
|
55
55
|
/** Optional store ID (defaults to 'memory-default') */
|
|
56
56
|
id?: string;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
* Configuration for keychain-based credential storage
|
|
60
|
+
*/
|
|
61
61
|
interface KeychainCredentialConfig {
|
|
62
|
-
type:
|
|
62
|
+
type: "keychain";
|
|
63
63
|
/** Optional store ID (defaults to 'keychain-default') */
|
|
64
64
|
id?: string;
|
|
65
65
|
/** Optional service name for keychain entries */
|
|
66
66
|
serviceName?: string;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
* Configuration for Nango-based credential storage (OAuth management)
|
|
70
|
+
* Note: Using Nango requires the @nangohq/node package to be installed
|
|
71
|
+
*/
|
|
72
72
|
interface NangoCredentialConfig {
|
|
73
|
-
type:
|
|
73
|
+
type: "nango";
|
|
74
74
|
/** Optional store ID (defaults to 'nango-default') */
|
|
75
75
|
id?: string;
|
|
76
76
|
/** Nango secret key (defaults to NANGO_SECRET_KEY env var) */
|
|
@@ -79,98 +79,98 @@ interface NangoCredentialConfig {
|
|
|
79
79
|
apiUrl?: string;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
* Configuration for custom credential provider
|
|
83
|
+
*/
|
|
84
84
|
interface CustomCredentialConfig {
|
|
85
|
-
type:
|
|
85
|
+
type: "custom";
|
|
86
86
|
/** Custom credential store implementation */
|
|
87
87
|
store: CredentialStore;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
* Union type for all credential provider configurations
|
|
91
|
+
*/
|
|
92
92
|
type CredentialProviderConfig = MemoryCredentialConfig | KeychainCredentialConfig | NangoCredentialConfig | CustomCredentialConfig;
|
|
93
93
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
94
|
+
* InkeepCredentialProvider - Unified credential management for Inkeep SDK
|
|
95
|
+
*
|
|
96
|
+
* Provides a clean abstraction over various credential storage backends.
|
|
97
|
+
* Cloud customers can use simple memory-based storage, while advanced
|
|
98
|
+
* users can integrate with OAuth providers like Nango.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* // Default memory-based storage
|
|
103
|
+
* const provider = new InkeepCredentialProvider()
|
|
104
|
+
*
|
|
105
|
+
* // Store and retrieve credentials
|
|
106
|
+
* await provider.set('my-api-key', 'secret-value')
|
|
107
|
+
* const key = await provider.get('my-api-key')
|
|
108
|
+
*
|
|
109
|
+
* // Use environment variables automatically
|
|
110
|
+
* process.env.MY_TOKEN = 'env-token'
|
|
111
|
+
* const token = await provider.get('MY_TOKEN') // Returns 'env-token'
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
114
|
declare class InkeepCredentialProvider implements CredentialStore {
|
|
115
115
|
private store;
|
|
116
116
|
constructor(config?: CredentialProviderConfig);
|
|
117
117
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
* Create the appropriate store based on configuration
|
|
119
|
+
*/
|
|
120
120
|
private createStore;
|
|
121
121
|
/**
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
* Create keychain store with dynamic import
|
|
123
|
+
*/
|
|
124
124
|
private createKeychainStore;
|
|
125
125
|
/**
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
* Create Nango store with dynamic import
|
|
127
|
+
*/
|
|
128
128
|
private createNangoStore;
|
|
129
129
|
get id(): string;
|
|
130
130
|
get type(): CredentialProviderType;
|
|
131
131
|
/**
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
* Get a credential by key
|
|
133
|
+
* @param key - The credential key
|
|
134
|
+
* @returns The credential value or null if not found
|
|
135
|
+
*/
|
|
136
136
|
get(key: string): Promise<string | null>;
|
|
137
137
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
* Set a credential
|
|
139
|
+
* @param key - The credential key
|
|
140
|
+
* @param value - The credential value
|
|
141
|
+
* @param metadata - Optional metadata
|
|
142
|
+
*/
|
|
143
143
|
set(key: string, value: string, metadata?: Record<string, string>): Promise<void>;
|
|
144
144
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
* Check if a credential exists
|
|
146
|
+
* @param key - The credential key
|
|
147
|
+
* @returns True if the credential exists
|
|
148
|
+
*/
|
|
149
149
|
has(key: string): Promise<boolean>;
|
|
150
150
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
* Delete a credential
|
|
152
|
+
* @param key - The credential key
|
|
153
|
+
* @returns True if the credential was deleted
|
|
154
|
+
*/
|
|
155
155
|
delete(key: string): Promise<boolean>;
|
|
156
156
|
/**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
* Check if the credential store is available and functional
|
|
158
|
+
* @returns Availability status
|
|
159
|
+
*/
|
|
160
160
|
checkAvailability(): Promise<{
|
|
161
161
|
available: boolean;
|
|
162
162
|
reason?: string;
|
|
163
163
|
}>;
|
|
164
164
|
/**
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
* Get the underlying store (for advanced use cases)
|
|
166
|
+
*/
|
|
167
167
|
getStore(): CredentialStore;
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
* Factory function to create an InkeepCredentialProvider
|
|
171
|
+
* @param config - Configuration options
|
|
172
|
+
* @returns A new InkeepCredentialProvider instance
|
|
173
|
+
*/
|
|
174
174
|
declare function createCredentialProvider(config?: CredentialProviderConfig): InkeepCredentialProvider;
|
|
175
175
|
//#endregion
|
|
176
176
|
export { CredentialProviderConfig, CredentialProviderType, CredentialStore, CustomCredentialConfig, InkeepCredentialProvider, KeychainCredentialConfig, MemoryCredentialConfig, NangoCredentialConfig, createCredentialProvider };
|
package/dist/credential-ref.d.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
//#region src/credential-ref.d.ts
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
* Credential Reference System
|
|
4
|
+
*
|
|
5
|
+
* This module provides a way to reference credentials by ID without including
|
|
6
|
+
* the full credential definition in the code. Credentials are resolved from
|
|
7
|
+
* environment files at runtime during the push operation.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Represents a reference to a credential by its ID.
|
|
11
|
+
* The actual credential will be resolved from the environment file at push time.
|
|
12
|
+
*/
|
|
13
13
|
interface CredentialReference {
|
|
14
|
-
__type:
|
|
14
|
+
__type: "credential-ref";
|
|
15
15
|
id: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
* Create a reference to a credential by its ID.
|
|
19
|
+
* The credential must be defined in the environment files.
|
|
20
|
+
*
|
|
21
|
+
* @param id - The ID of the credential to reference
|
|
22
|
+
* @returns A credential reference that will be resolved at push time
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const apiKeyRef = credentialRef('api-key');
|
|
27
|
+
*
|
|
28
|
+
* const fetchDef = fetchDefinition({
|
|
29
|
+
* credential: apiKeyRef,
|
|
30
|
+
* // ...
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
34
|
declare function credentialRef<T extends string = string>(id: T): CredentialReference;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* Type guard to check if a value is a credential reference
|
|
37
|
+
*/
|
|
38
38
|
declare function isCredentialReference(value: any): value is CredentialReference;
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
* Type helper to extract credential IDs from environment configuration
|
|
41
|
+
*/
|
|
42
42
|
type ExtractCredentialIds<T> = T extends {
|
|
43
43
|
credentials?: infer C;
|
|
44
44
|
} ? C extends Record<string, any> ? keyof C : never : never;
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
* Type helper to create a union of all available credential IDs from multiple environments
|
|
47
|
+
*/
|
|
48
48
|
type UnionCredentialIds<T extends Record<string, any>> = { [K in keyof T]: ExtractCredentialIds<T[K]> }[keyof T];
|
|
49
49
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
* Type helper to extract tool IDs from environment configuration
|
|
51
|
+
*/
|
|
52
52
|
type ExtractMcpServerIds<T> = T extends {
|
|
53
53
|
mcpServers?: infer T;
|
|
54
54
|
} ? T extends Record<string, any> ? keyof T : never : never;
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
* Type helper to create a union of all available tool IDs from multiple environments
|
|
57
|
+
*/
|
|
58
58
|
type UnionMcpServerIds<T extends Record<string, any>> = { [K in keyof T]: ExtractMcpServerIds<T[K]> }[keyof T];
|
|
59
59
|
//#endregion
|
|
60
60
|
export { CredentialReference, ExtractCredentialIds, ExtractMcpServerIds, UnionCredentialIds, UnionMcpServerIds, credentialRef, isCredentialReference };
|
package/dist/data-component.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { DataComponentInsert } from "@inkeep/agents-core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/data-component.d.ts
|
|
5
|
-
type DataComponentConfigWithZod = Omit<DataComponentInsert,
|
|
5
|
+
type DataComponentConfigWithZod = Omit<DataComponentInsert, "tenantId" | "projectId" | "props" | "render"> & {
|
|
6
6
|
props?: Record<string, unknown> | z.ZodObject<any> | null;
|
|
7
7
|
render?: {
|
|
8
8
|
component: string;
|
|
@@ -10,16 +10,16 @@ type DataComponentConfigWithZod = Omit<DataComponentInsert, 'tenantId' | 'projec
|
|
|
10
10
|
} | null;
|
|
11
11
|
};
|
|
12
12
|
interface DataComponentInterface {
|
|
13
|
-
config: Omit<DataComponentInsert,
|
|
13
|
+
config: Omit<DataComponentInsert, "tenantId" | "projectId">;
|
|
14
14
|
init(): Promise<void>;
|
|
15
|
-
getId(): DataComponentInsert[
|
|
16
|
-
getName(): DataComponentInsert[
|
|
17
|
-
getDescription(): DataComponentInsert[
|
|
18
|
-
getProps(): DataComponentInsert[
|
|
15
|
+
getId(): DataComponentInsert["id"];
|
|
16
|
+
getName(): DataComponentInsert["name"];
|
|
17
|
+
getDescription(): DataComponentInsert["description"];
|
|
18
|
+
getProps(): DataComponentInsert["props"];
|
|
19
19
|
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
20
20
|
}
|
|
21
21
|
declare class DataComponent implements DataComponentInterface {
|
|
22
|
-
config: Omit<DataComponentInsert,
|
|
22
|
+
config: Omit<DataComponentInsert, "tenantId" | "projectId">;
|
|
23
23
|
private baseURL;
|
|
24
24
|
private tenantId;
|
|
25
25
|
private projectId;
|
|
@@ -30,8 +30,8 @@ declare class DataComponent implements DataComponentInterface {
|
|
|
30
30
|
getId(): string;
|
|
31
31
|
getName(): string;
|
|
32
32
|
getDescription(): string;
|
|
33
|
-
getProps(): DataComponentInsert[
|
|
34
|
-
getRender(): DataComponentInsert[
|
|
33
|
+
getProps(): DataComponentInsert["props"];
|
|
34
|
+
getRender(): DataComponentInsert["render"];
|
|
35
35
|
init(): Promise<void>;
|
|
36
36
|
private upsertDataComponent;
|
|
37
37
|
}
|
package/dist/data-component.js
CHANGED
|
@@ -73,7 +73,7 @@ var DataComponent = class {
|
|
|
73
73
|
render: this.config.render
|
|
74
74
|
};
|
|
75
75
|
logger.info({ dataComponentData }, "dataComponentData for create/update");
|
|
76
|
-
const updateResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/data-components/${this.getId()}`, {
|
|
76
|
+
const updateResponse = await fetch(`${this.baseURL}/manage/tenants/${this.tenantId}/projects/${this.projectId}/data-components/${this.getId()}`, {
|
|
77
77
|
method: "PUT",
|
|
78
78
|
headers: { "Content-Type": "application/json" },
|
|
79
79
|
body: JSON.stringify(dataComponentData)
|
|
@@ -88,7 +88,7 @@ var DataComponent = class {
|
|
|
88
88
|
}
|
|
89
89
|
if (updateResponse.status === 404) {
|
|
90
90
|
logger.info({ dataComponentId: this.getId() }, "DataComponent not found, creating new data component");
|
|
91
|
-
const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/data-components`, {
|
|
91
|
+
const createResponse = await fetch(`${this.baseURL}/manage/tenants/${this.tenantId}/projects/${this.projectId}/data-components`, {
|
|
92
92
|
method: "POST",
|
|
93
93
|
headers: { "Content-Type": "application/json" },
|
|
94
94
|
body: JSON.stringify(dataComponentData)
|
|
@@ -12,16 +12,16 @@ interface EnvironmentSettingsConfig {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
* Create a setting helper with TypeScript autocomplete
|
|
16
|
+
*/
|
|
17
17
|
declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
|
|
18
18
|
getEnvironmentCredential: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
19
19
|
getEnvironmentMcp: (key: UnionMcpServerIds<T>) => Tool;
|
|
20
20
|
getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
* Create type-safe environment configurations
|
|
24
|
+
*/
|
|
25
25
|
declare function registerEnvironmentSettings<T extends EnvironmentSettingsConfig>(config: T): T;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { type ExtractCredentialIds, type ExtractMcpServerIds, type UnionCredentialIds, type UnionMcpServerIds, createEnvironmentSettings, registerEnvironmentSettings };
|