@inkeep/agents-sdk 0.3.0 → 0.6.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/index.cjs +374 -112
- package/dist/index.d.cts +131 -86
- package/dist/index.d.ts +131 -86
- package/dist/index.js +374 -114
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert,
|
|
1
|
+
import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, CredentialReferenceSelect, DataComponentInsert, ArtifactComponentInsert, AgentApiInsert, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, ToolInsert, McpTransportConfig, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
interface ToolInterface {
|
|
@@ -17,7 +17,8 @@ declare class Tool implements ToolInterface {
|
|
|
17
17
|
private tenantId;
|
|
18
18
|
private initialized;
|
|
19
19
|
private projectId;
|
|
20
|
-
constructor(config: MCPToolConfig$1);
|
|
20
|
+
constructor(config: Omit<MCPToolConfig$1, 'tenantId' | 'projectId'>);
|
|
21
|
+
setContext(tenantId: string, projectId: string): void;
|
|
21
22
|
getId(): string;
|
|
22
23
|
getName(): string;
|
|
23
24
|
getDescription(): string;
|
|
@@ -44,8 +45,7 @@ interface MCPServerConfig {
|
|
|
44
45
|
id?: string;
|
|
45
46
|
parameters?: Record<string, z.ZodJSONSchema>;
|
|
46
47
|
credential?: CredentialReferenceApiInsert;
|
|
47
|
-
|
|
48
|
-
transport?: keyof typeof MCPTransportType;
|
|
48
|
+
transport?: 'streamable_http' | 'sse';
|
|
49
49
|
activeTools?: string[];
|
|
50
50
|
headers?: Record<string, string>;
|
|
51
51
|
imageUrl?: string;
|
|
@@ -54,10 +54,9 @@ interface MCPServerConfig {
|
|
|
54
54
|
* Configuration for component builders
|
|
55
55
|
*/
|
|
56
56
|
interface ComponentConfig {
|
|
57
|
+
id?: string;
|
|
57
58
|
name: string;
|
|
58
59
|
description: string;
|
|
59
|
-
tenantId?: string;
|
|
60
|
-
projectId?: string;
|
|
61
60
|
}
|
|
62
61
|
interface ArtifactComponentConfig extends ComponentConfig {
|
|
63
62
|
summaryProps: Record<string, unknown>;
|
|
@@ -98,7 +97,6 @@ declare function transfer(targetAgent: Agent, description?: string, condition?:
|
|
|
98
97
|
|
|
99
98
|
type ExternalAgentConfig = {
|
|
100
99
|
type?: 'external';
|
|
101
|
-
tenantId?: string;
|
|
102
100
|
id: string;
|
|
103
101
|
name: string;
|
|
104
102
|
description: string;
|
|
@@ -117,6 +115,7 @@ declare class ExternalAgent implements ExternalAgentInterface {
|
|
|
117
115
|
* Initialize the external agent by upserting it in the database
|
|
118
116
|
*/
|
|
119
117
|
init(): Promise<void>;
|
|
118
|
+
setContext(tenantId: string): void;
|
|
120
119
|
getId(): string;
|
|
121
120
|
private upsertExternalAgent;
|
|
122
121
|
/**
|
|
@@ -148,6 +147,60 @@ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
|
|
|
148
147
|
*/
|
|
149
148
|
declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
|
|
150
149
|
|
|
150
|
+
interface DataComponentInterface {
|
|
151
|
+
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
152
|
+
init(): Promise<void>;
|
|
153
|
+
getId(): DataComponentInsert['id'];
|
|
154
|
+
getName(): DataComponentInsert['name'];
|
|
155
|
+
getDescription(): DataComponentInsert['description'];
|
|
156
|
+
getProps(): DataComponentInsert['props'];
|
|
157
|
+
setContext(tenantId: string, projectId: string): void;
|
|
158
|
+
}
|
|
159
|
+
declare class DataComponent implements DataComponentInterface {
|
|
160
|
+
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
161
|
+
private baseURL;
|
|
162
|
+
private tenantId;
|
|
163
|
+
private projectId;
|
|
164
|
+
private initialized;
|
|
165
|
+
private id;
|
|
166
|
+
constructor(config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>);
|
|
167
|
+
setContext(tenantId: string, projectId: string): void;
|
|
168
|
+
getId(): string;
|
|
169
|
+
getName(): string;
|
|
170
|
+
getDescription(): string;
|
|
171
|
+
getProps(): DataComponentInsert['props'];
|
|
172
|
+
init(): Promise<void>;
|
|
173
|
+
private upsertDataComponent;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface ArtifactComponentInterface {
|
|
177
|
+
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
178
|
+
init(): Promise<void>;
|
|
179
|
+
getId(): ArtifactComponentInsert['id'];
|
|
180
|
+
getName(): ArtifactComponentInsert['name'];
|
|
181
|
+
getDescription(): ArtifactComponentInsert['description'];
|
|
182
|
+
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
183
|
+
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
184
|
+
setContext(tenantId: string, projectId: string): void;
|
|
185
|
+
}
|
|
186
|
+
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
187
|
+
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
188
|
+
private baseURL;
|
|
189
|
+
private tenantId;
|
|
190
|
+
private projectId;
|
|
191
|
+
private initialized;
|
|
192
|
+
private id;
|
|
193
|
+
constructor(config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>);
|
|
194
|
+
setContext(tenantId: string, projectId: string): void;
|
|
195
|
+
getId(): string;
|
|
196
|
+
getName(): string;
|
|
197
|
+
getDescription(): string;
|
|
198
|
+
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
199
|
+
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
200
|
+
init(): Promise<void>;
|
|
201
|
+
private upsertArtifactComponent;
|
|
202
|
+
}
|
|
203
|
+
|
|
151
204
|
interface UserMessage {
|
|
152
205
|
role: 'user';
|
|
153
206
|
content: string;
|
|
@@ -188,8 +241,6 @@ interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
|
|
|
188
241
|
canUse?: () => AgentCanUseType[];
|
|
189
242
|
canTransferTo?: () => AgentInterface[];
|
|
190
243
|
canDelegateTo?: () => AllAgentInterface[];
|
|
191
|
-
tenantId?: string;
|
|
192
|
-
projectId?: string;
|
|
193
244
|
models?: {
|
|
194
245
|
base?: ModelSettings;
|
|
195
246
|
structuredOutput?: ModelSettings;
|
|
@@ -200,8 +251,8 @@ interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
|
|
|
200
251
|
type: 'conversation' | 'episodic' | 'short_term';
|
|
201
252
|
capacity?: number;
|
|
202
253
|
};
|
|
203
|
-
dataComponents?: () => DataComponentApiInsert[];
|
|
204
|
-
artifactComponents?: () => ArtifactComponentApiInsert[];
|
|
254
|
+
dataComponents?: () => (DataComponentApiInsert | DataComponentInterface)[];
|
|
255
|
+
artifactComponents?: () => (ArtifactComponentApiInsert | ArtifactComponentInterface)[];
|
|
205
256
|
conversationHistoryConfig?: AgentConversationHistoryConfig;
|
|
206
257
|
}
|
|
207
258
|
interface ModelSettings {
|
|
@@ -311,30 +362,12 @@ interface RunResult {
|
|
|
311
362
|
transfers: TransferConfig[];
|
|
312
363
|
};
|
|
313
364
|
}
|
|
314
|
-
interface StatusComponent {
|
|
315
|
-
type: string;
|
|
316
|
-
description?: string;
|
|
317
|
-
schema?: {
|
|
318
|
-
type: 'object';
|
|
319
|
-
properties: Record<string, any>;
|
|
320
|
-
required?: string[];
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
interface StatusUpdateSettings {
|
|
324
|
-
enabled?: boolean;
|
|
325
|
-
numEvents?: number;
|
|
326
|
-
timeInSeconds?: number;
|
|
327
|
-
model?: string;
|
|
328
|
-
statusComponents?: StatusComponent[];
|
|
329
|
-
prompt?: string;
|
|
330
|
-
}
|
|
331
365
|
interface GraphConfig {
|
|
332
366
|
id: string;
|
|
333
367
|
name?: string;
|
|
334
368
|
description?: string;
|
|
335
369
|
defaultAgent?: AgentInterface;
|
|
336
370
|
agents?: () => AllAgentInterface[];
|
|
337
|
-
tenantId?: string;
|
|
338
371
|
contextConfig?: any;
|
|
339
372
|
credentials?: () => CredentialReferenceApiInsert[];
|
|
340
373
|
stopWhen?: GraphStopWhen;
|
|
@@ -373,6 +406,7 @@ interface AgentInterface {
|
|
|
373
406
|
getDelegates(): AllAgentInterface[];
|
|
374
407
|
getDataComponents(): DataComponentApiInsert[];
|
|
375
408
|
getArtifactComponents(): ArtifactComponentApiInsert[];
|
|
409
|
+
setContext(tenantId: string, projectId: string): void;
|
|
376
410
|
addTool(name: string, tool: any): void;
|
|
377
411
|
addTransfer(...agents: AgentInterface[]): void;
|
|
378
412
|
addDelegate(...agents: AgentInterface[]): void;
|
|
@@ -387,6 +421,7 @@ interface ExternalAgentInterface {
|
|
|
387
421
|
getBaseUrl(): string;
|
|
388
422
|
getCredentialReferenceId(): string | undefined;
|
|
389
423
|
getHeaders(): Record<string, string> | undefined;
|
|
424
|
+
setContext?(tenantId: string): void;
|
|
390
425
|
}
|
|
391
426
|
interface GraphInterface {
|
|
392
427
|
init(): Promise<void>;
|
|
@@ -435,6 +470,7 @@ declare class Agent implements AgentInterface {
|
|
|
435
470
|
private projectId;
|
|
436
471
|
private initialized;
|
|
437
472
|
constructor(config: AgentConfig);
|
|
473
|
+
setContext(tenantId: string, projectId: string): void;
|
|
438
474
|
getId(): string;
|
|
439
475
|
getName(): string;
|
|
440
476
|
getInstructions(): string;
|
|
@@ -467,56 +503,6 @@ declare class Agent implements AgentInterface {
|
|
|
467
503
|
private createAgentToolRelation;
|
|
468
504
|
}
|
|
469
505
|
|
|
470
|
-
interface ArtifactComponentInterface {
|
|
471
|
-
config: Omit<ArtifactComponentInsert, 'id'>;
|
|
472
|
-
init(): Promise<void>;
|
|
473
|
-
getId(): ArtifactComponentInsert['id'];
|
|
474
|
-
getName(): ArtifactComponentInsert['name'];
|
|
475
|
-
getDescription(): ArtifactComponentInsert['description'];
|
|
476
|
-
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
477
|
-
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
478
|
-
}
|
|
479
|
-
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
480
|
-
config: ArtifactComponentInsert;
|
|
481
|
-
private baseURL;
|
|
482
|
-
private tenantId;
|
|
483
|
-
private projectId;
|
|
484
|
-
private initialized;
|
|
485
|
-
private id;
|
|
486
|
-
constructor(config: Omit<ArtifactComponentInsert, 'id'>);
|
|
487
|
-
getId(): string;
|
|
488
|
-
getName(): string;
|
|
489
|
-
getDescription(): string;
|
|
490
|
-
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
491
|
-
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
492
|
-
init(): Promise<void>;
|
|
493
|
-
private upsertArtifactComponent;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
interface DataComponentInterface {
|
|
497
|
-
config: Omit<DataComponentInsert, 'id'>;
|
|
498
|
-
init(): Promise<void>;
|
|
499
|
-
getId(): DataComponentInsert['id'];
|
|
500
|
-
getName(): DataComponentInsert['name'];
|
|
501
|
-
getDescription(): DataComponentInsert['description'];
|
|
502
|
-
getProps(): DataComponentInsert['props'];
|
|
503
|
-
}
|
|
504
|
-
declare class DataComponent implements DataComponentInterface {
|
|
505
|
-
config: DataComponentInsert;
|
|
506
|
-
private baseURL;
|
|
507
|
-
private tenantId;
|
|
508
|
-
private projectId;
|
|
509
|
-
private initialized;
|
|
510
|
-
private id;
|
|
511
|
-
constructor(config: Omit<DataComponentInsert, 'id'>);
|
|
512
|
-
getId(): string;
|
|
513
|
-
getName(): string;
|
|
514
|
-
getDescription(): string;
|
|
515
|
-
getProps(): DataComponentInsert['props'];
|
|
516
|
-
init(): Promise<void>;
|
|
517
|
-
private upsertDataComponent;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
506
|
declare class AgentGraph implements GraphInterface {
|
|
521
507
|
private agents;
|
|
522
508
|
private agentMap;
|
|
@@ -713,7 +699,6 @@ interface ProjectConfig {
|
|
|
713
699
|
id: string;
|
|
714
700
|
name: string;
|
|
715
701
|
description?: string;
|
|
716
|
-
tenantId?: string;
|
|
717
702
|
models?: {
|
|
718
703
|
base?: ModelSettings;
|
|
719
704
|
structuredOutput?: ModelSettings;
|
|
@@ -721,6 +706,9 @@ interface ProjectConfig {
|
|
|
721
706
|
};
|
|
722
707
|
stopWhen?: StopWhen;
|
|
723
708
|
graphs?: () => AgentGraph[];
|
|
709
|
+
tools?: () => Tool[];
|
|
710
|
+
dataComponents?: () => DataComponent[];
|
|
711
|
+
artifactComponents?: () => ArtifactComponent[];
|
|
724
712
|
}
|
|
725
713
|
/**
|
|
726
714
|
* Project interface for operations
|
|
@@ -833,6 +821,17 @@ declare class Project implements ProjectInterface {
|
|
|
833
821
|
* Set the project's stopWhen configuration
|
|
834
822
|
*/
|
|
835
823
|
setStopWhen(stopWhen: ProjectConfig['stopWhen']): void;
|
|
824
|
+
/**
|
|
825
|
+
* Get credential tracking information
|
|
826
|
+
*/
|
|
827
|
+
getCredentialTracking(): Promise<{
|
|
828
|
+
credentials: Record<string, any>;
|
|
829
|
+
usage: Record<string, Array<{
|
|
830
|
+
type: string;
|
|
831
|
+
id: string;
|
|
832
|
+
graphId?: string;
|
|
833
|
+
}>>;
|
|
834
|
+
}>;
|
|
836
835
|
/**
|
|
837
836
|
* Get all graphs in the project
|
|
838
837
|
*/
|
|
@@ -869,10 +868,6 @@ declare class Project implements ProjectInterface {
|
|
|
869
868
|
* Convert the Project to FullProjectDefinition format
|
|
870
869
|
*/
|
|
871
870
|
private toFullProjectDefinition;
|
|
872
|
-
/**
|
|
873
|
-
* Convert project configuration to API format
|
|
874
|
-
*/
|
|
875
|
-
private toApiFormat;
|
|
876
871
|
}
|
|
877
872
|
|
|
878
873
|
/**
|
|
@@ -1065,6 +1060,56 @@ declare function artifactComponent(config: ArtifactComponentConfig): ArtifactCom
|
|
|
1065
1060
|
declare function dataComponent(config: DataComponentConfig): DataComponent;
|
|
1066
1061
|
declare function agentMcp(config: AgentMcpConfig): AgentMcpConfig;
|
|
1067
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* Credential Reference System
|
|
1065
|
+
*
|
|
1066
|
+
* This module provides a way to reference credentials by ID without including
|
|
1067
|
+
* the full credential definition in the code. Credentials are resolved from
|
|
1068
|
+
* environment files at runtime during the push operation.
|
|
1069
|
+
*/
|
|
1070
|
+
/**
|
|
1071
|
+
* Represents a reference to a credential by its ID.
|
|
1072
|
+
* The actual credential will be resolved from the environment file at push time.
|
|
1073
|
+
*/
|
|
1074
|
+
interface CredentialReference {
|
|
1075
|
+
__type: 'credential-ref';
|
|
1076
|
+
id: string;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Create a reference to a credential by its ID.
|
|
1080
|
+
* The credential must be defined in the environment files.
|
|
1081
|
+
*
|
|
1082
|
+
* @param id - The ID of the credential to reference
|
|
1083
|
+
* @returns A credential reference that will be resolved at push time
|
|
1084
|
+
*
|
|
1085
|
+
* @example
|
|
1086
|
+
* ```typescript
|
|
1087
|
+
* const apiKeyRef = credentialRef('api-key');
|
|
1088
|
+
*
|
|
1089
|
+
* const fetchDef = fetchDefinition({
|
|
1090
|
+
* credential: apiKeyRef,
|
|
1091
|
+
* // ...
|
|
1092
|
+
* });
|
|
1093
|
+
* ```
|
|
1094
|
+
*/
|
|
1095
|
+
declare function credentialRef<T extends string = string>(id: T): CredentialReference;
|
|
1096
|
+
/**
|
|
1097
|
+
* Type guard to check if a value is a credential reference
|
|
1098
|
+
*/
|
|
1099
|
+
declare function isCredentialReference(value: any): value is CredentialReference;
|
|
1100
|
+
/**
|
|
1101
|
+
* Type helper to extract credential IDs from environment configuration
|
|
1102
|
+
*/
|
|
1103
|
+
type ExtractCredentialIds<T> = T extends {
|
|
1104
|
+
credentials?: infer C;
|
|
1105
|
+
} ? C extends Record<string, any> ? keyof C : never : never;
|
|
1106
|
+
/**
|
|
1107
|
+
* Type helper to create a union of all available credential IDs from multiple environments
|
|
1108
|
+
*/
|
|
1109
|
+
type UnionCredentialIds<T extends Record<string, any>> = {
|
|
1110
|
+
[K in keyof T]: ExtractCredentialIds<T[K]>;
|
|
1111
|
+
}[keyof T];
|
|
1112
|
+
|
|
1068
1113
|
interface EnvironmentSettingsConfig {
|
|
1069
1114
|
credentials?: {
|
|
1070
1115
|
[settingId: string]: CredentialReferenceApiInsert;
|
|
@@ -1074,7 +1119,7 @@ interface EnvironmentSettingsConfig {
|
|
|
1074
1119
|
* Create a setting helper with TypeScript autocomplete
|
|
1075
1120
|
*/
|
|
1076
1121
|
declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
|
|
1077
|
-
getEnvironmentSetting: (key:
|
|
1122
|
+
getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
1078
1123
|
};
|
|
1079
1124
|
/**
|
|
1080
1125
|
* Create type-safe environment configurations
|
|
@@ -1140,4 +1185,4 @@ declare const run: typeof Runner.run;
|
|
|
1140
1185
|
declare const stream: typeof Runner.stream;
|
|
1141
1186
|
declare const raceGraphs: typeof Runner.raceGraphs;
|
|
1142
1187
|
|
|
1143
|
-
export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AllAgentInterface, ArtifactComponent, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, DataComponent, ExternalAgent, type ExternalAgentInterface, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, type ModelSettings, ModelSettingsSchema, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type
|
|
1188
|
+
export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AllAgentInterface, ArtifactComponent, type ArtifactComponentInterface, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, type CredentialReference, DataComponent, type DataComponentInterface, ExternalAgent, type ExternalAgentInterface, type ExtractCredentialIds, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, type ModelSettings, ModelSettingsSchema, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UnionCredentialIds, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
|