@inkeep/agents-sdk 0.5.0 → 0.6.4

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, MCPTransportType, CredentialReferenceSelect, AgentApiInsert, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
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
- tenantId?: string;
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 {
@@ -317,7 +368,6 @@ interface GraphConfig {
317
368
  description?: string;
318
369
  defaultAgent?: AgentInterface;
319
370
  agents?: () => AllAgentInterface[];
320
- tenantId?: string;
321
371
  contextConfig?: any;
322
372
  credentials?: () => CredentialReferenceApiInsert[];
323
373
  stopWhen?: GraphStopWhen;
@@ -356,6 +406,7 @@ interface AgentInterface {
356
406
  getDelegates(): AllAgentInterface[];
357
407
  getDataComponents(): DataComponentApiInsert[];
358
408
  getArtifactComponents(): ArtifactComponentApiInsert[];
409
+ setContext(tenantId: string, projectId: string): void;
359
410
  addTool(name: string, tool: any): void;
360
411
  addTransfer(...agents: AgentInterface[]): void;
361
412
  addDelegate(...agents: AgentInterface[]): void;
@@ -370,6 +421,7 @@ interface ExternalAgentInterface {
370
421
  getBaseUrl(): string;
371
422
  getCredentialReferenceId(): string | undefined;
372
423
  getHeaders(): Record<string, string> | undefined;
424
+ setContext?(tenantId: string): void;
373
425
  }
374
426
  interface GraphInterface {
375
427
  init(): Promise<void>;
@@ -418,6 +470,7 @@ declare class Agent implements AgentInterface {
418
470
  private projectId;
419
471
  private initialized;
420
472
  constructor(config: AgentConfig);
473
+ setContext(tenantId: string, projectId: string): void;
421
474
  getId(): string;
422
475
  getName(): string;
423
476
  getInstructions(): string;
@@ -450,56 +503,6 @@ declare class Agent implements AgentInterface {
450
503
  private createAgentToolRelation;
451
504
  }
452
505
 
453
- interface ArtifactComponentInterface {
454
- config: Omit<ArtifactComponentInsert, 'id'>;
455
- init(): Promise<void>;
456
- getId(): ArtifactComponentInsert['id'];
457
- getName(): ArtifactComponentInsert['name'];
458
- getDescription(): ArtifactComponentInsert['description'];
459
- getSummaryProps(): ArtifactComponentInsert['summaryProps'];
460
- getFullProps(): ArtifactComponentInsert['fullProps'];
461
- }
462
- declare class ArtifactComponent implements ArtifactComponentInterface {
463
- config: ArtifactComponentInsert;
464
- private baseURL;
465
- private tenantId;
466
- private projectId;
467
- private initialized;
468
- private id;
469
- constructor(config: Omit<ArtifactComponentInsert, 'id'>);
470
- getId(): string;
471
- getName(): string;
472
- getDescription(): string;
473
- getSummaryProps(): ArtifactComponentInsert['summaryProps'];
474
- getFullProps(): ArtifactComponentInsert['fullProps'];
475
- init(): Promise<void>;
476
- private upsertArtifactComponent;
477
- }
478
-
479
- interface DataComponentInterface {
480
- config: Omit<DataComponentInsert, 'id'>;
481
- init(): Promise<void>;
482
- getId(): DataComponentInsert['id'];
483
- getName(): DataComponentInsert['name'];
484
- getDescription(): DataComponentInsert['description'];
485
- getProps(): DataComponentInsert['props'];
486
- }
487
- declare class DataComponent implements DataComponentInterface {
488
- config: DataComponentInsert;
489
- private baseURL;
490
- private tenantId;
491
- private projectId;
492
- private initialized;
493
- private id;
494
- constructor(config: Omit<DataComponentInsert, 'id'>);
495
- getId(): string;
496
- getName(): string;
497
- getDescription(): string;
498
- getProps(): DataComponentInsert['props'];
499
- init(): Promise<void>;
500
- private upsertDataComponent;
501
- }
502
-
503
506
  declare class AgentGraph implements GraphInterface {
504
507
  private agents;
505
508
  private agentMap;
@@ -696,7 +699,6 @@ interface ProjectConfig {
696
699
  id: string;
697
700
  name: string;
698
701
  description?: string;
699
- tenantId?: string;
700
702
  models?: {
701
703
  base?: ModelSettings;
702
704
  structuredOutput?: ModelSettings;
@@ -704,9 +706,9 @@ interface ProjectConfig {
704
706
  };
705
707
  stopWhen?: StopWhen;
706
708
  graphs?: () => AgentGraph[];
707
- tools?: () => ToolConfig[];
708
- dataComponents?: () => DataComponentConfig[];
709
- artifactComponents?: () => ArtifactComponentConfig[];
709
+ tools?: () => Tool[];
710
+ dataComponents?: () => DataComponent[];
711
+ artifactComponents?: () => ArtifactComponent[];
710
712
  }
711
713
  /**
712
714
  * Project interface for operations
@@ -819,6 +821,17 @@ declare class Project implements ProjectInterface {
819
821
  * Set the project's stopWhen configuration
820
822
  */
821
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
+ }>;
822
835
  /**
823
836
  * Get all graphs in the project
824
837
  */
@@ -1047,6 +1060,56 @@ declare function artifactComponent(config: ArtifactComponentConfig): ArtifactCom
1047
1060
  declare function dataComponent(config: DataComponentConfig): DataComponent;
1048
1061
  declare function agentMcp(config: AgentMcpConfig): AgentMcpConfig;
1049
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
+
1050
1113
  interface EnvironmentSettingsConfig {
1051
1114
  credentials?: {
1052
1115
  [settingId: string]: CredentialReferenceApiInsert;
@@ -1056,7 +1119,7 @@ interface EnvironmentSettingsConfig {
1056
1119
  * Create a setting helper with TypeScript autocomplete
1057
1120
  */
1058
1121
  declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
1059
- getEnvironmentSetting: (key: keyof NonNullable<T[keyof T]["credentials"]>) => Promise<CredentialReferenceApiInsert>;
1122
+ getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
1060
1123
  };
1061
1124
  /**
1062
1125
  * Create type-safe environment configurations
@@ -1122,4 +1185,4 @@ declare const run: typeof Runner.run;
1122
1185
  declare const stream: typeof Runner.stream;
1123
1186
  declare const raceGraphs: typeof Runner.raceGraphs;
1124
1187
 
1125
- 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 StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
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 };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, MCPTransportType, CredentialReferenceSelect, AgentApiInsert, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
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
- tenantId?: string;
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 {
@@ -317,7 +368,6 @@ interface GraphConfig {
317
368
  description?: string;
318
369
  defaultAgent?: AgentInterface;
319
370
  agents?: () => AllAgentInterface[];
320
- tenantId?: string;
321
371
  contextConfig?: any;
322
372
  credentials?: () => CredentialReferenceApiInsert[];
323
373
  stopWhen?: GraphStopWhen;
@@ -356,6 +406,7 @@ interface AgentInterface {
356
406
  getDelegates(): AllAgentInterface[];
357
407
  getDataComponents(): DataComponentApiInsert[];
358
408
  getArtifactComponents(): ArtifactComponentApiInsert[];
409
+ setContext(tenantId: string, projectId: string): void;
359
410
  addTool(name: string, tool: any): void;
360
411
  addTransfer(...agents: AgentInterface[]): void;
361
412
  addDelegate(...agents: AgentInterface[]): void;
@@ -370,6 +421,7 @@ interface ExternalAgentInterface {
370
421
  getBaseUrl(): string;
371
422
  getCredentialReferenceId(): string | undefined;
372
423
  getHeaders(): Record<string, string> | undefined;
424
+ setContext?(tenantId: string): void;
373
425
  }
374
426
  interface GraphInterface {
375
427
  init(): Promise<void>;
@@ -418,6 +470,7 @@ declare class Agent implements AgentInterface {
418
470
  private projectId;
419
471
  private initialized;
420
472
  constructor(config: AgentConfig);
473
+ setContext(tenantId: string, projectId: string): void;
421
474
  getId(): string;
422
475
  getName(): string;
423
476
  getInstructions(): string;
@@ -450,56 +503,6 @@ declare class Agent implements AgentInterface {
450
503
  private createAgentToolRelation;
451
504
  }
452
505
 
453
- interface ArtifactComponentInterface {
454
- config: Omit<ArtifactComponentInsert, 'id'>;
455
- init(): Promise<void>;
456
- getId(): ArtifactComponentInsert['id'];
457
- getName(): ArtifactComponentInsert['name'];
458
- getDescription(): ArtifactComponentInsert['description'];
459
- getSummaryProps(): ArtifactComponentInsert['summaryProps'];
460
- getFullProps(): ArtifactComponentInsert['fullProps'];
461
- }
462
- declare class ArtifactComponent implements ArtifactComponentInterface {
463
- config: ArtifactComponentInsert;
464
- private baseURL;
465
- private tenantId;
466
- private projectId;
467
- private initialized;
468
- private id;
469
- constructor(config: Omit<ArtifactComponentInsert, 'id'>);
470
- getId(): string;
471
- getName(): string;
472
- getDescription(): string;
473
- getSummaryProps(): ArtifactComponentInsert['summaryProps'];
474
- getFullProps(): ArtifactComponentInsert['fullProps'];
475
- init(): Promise<void>;
476
- private upsertArtifactComponent;
477
- }
478
-
479
- interface DataComponentInterface {
480
- config: Omit<DataComponentInsert, 'id'>;
481
- init(): Promise<void>;
482
- getId(): DataComponentInsert['id'];
483
- getName(): DataComponentInsert['name'];
484
- getDescription(): DataComponentInsert['description'];
485
- getProps(): DataComponentInsert['props'];
486
- }
487
- declare class DataComponent implements DataComponentInterface {
488
- config: DataComponentInsert;
489
- private baseURL;
490
- private tenantId;
491
- private projectId;
492
- private initialized;
493
- private id;
494
- constructor(config: Omit<DataComponentInsert, 'id'>);
495
- getId(): string;
496
- getName(): string;
497
- getDescription(): string;
498
- getProps(): DataComponentInsert['props'];
499
- init(): Promise<void>;
500
- private upsertDataComponent;
501
- }
502
-
503
506
  declare class AgentGraph implements GraphInterface {
504
507
  private agents;
505
508
  private agentMap;
@@ -696,7 +699,6 @@ interface ProjectConfig {
696
699
  id: string;
697
700
  name: string;
698
701
  description?: string;
699
- tenantId?: string;
700
702
  models?: {
701
703
  base?: ModelSettings;
702
704
  structuredOutput?: ModelSettings;
@@ -704,9 +706,9 @@ interface ProjectConfig {
704
706
  };
705
707
  stopWhen?: StopWhen;
706
708
  graphs?: () => AgentGraph[];
707
- tools?: () => ToolConfig[];
708
- dataComponents?: () => DataComponentConfig[];
709
- artifactComponents?: () => ArtifactComponentConfig[];
709
+ tools?: () => Tool[];
710
+ dataComponents?: () => DataComponent[];
711
+ artifactComponents?: () => ArtifactComponent[];
710
712
  }
711
713
  /**
712
714
  * Project interface for operations
@@ -819,6 +821,17 @@ declare class Project implements ProjectInterface {
819
821
  * Set the project's stopWhen configuration
820
822
  */
821
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
+ }>;
822
835
  /**
823
836
  * Get all graphs in the project
824
837
  */
@@ -1047,6 +1060,56 @@ declare function artifactComponent(config: ArtifactComponentConfig): ArtifactCom
1047
1060
  declare function dataComponent(config: DataComponentConfig): DataComponent;
1048
1061
  declare function agentMcp(config: AgentMcpConfig): AgentMcpConfig;
1049
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
+
1050
1113
  interface EnvironmentSettingsConfig {
1051
1114
  credentials?: {
1052
1115
  [settingId: string]: CredentialReferenceApiInsert;
@@ -1056,7 +1119,7 @@ interface EnvironmentSettingsConfig {
1056
1119
  * Create a setting helper with TypeScript autocomplete
1057
1120
  */
1058
1121
  declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
1059
- getEnvironmentSetting: (key: keyof NonNullable<T[keyof T]["credentials"]>) => Promise<CredentialReferenceApiInsert>;
1122
+ getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
1060
1123
  };
1061
1124
  /**
1062
1125
  * Create type-safe environment configurations
@@ -1122,4 +1185,4 @@ declare const run: typeof Runner.run;
1122
1185
  declare const stream: typeof Runner.stream;
1123
1186
  declare const raceGraphs: typeof Runner.raceGraphs;
1124
1187
 
1125
- 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 StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
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 };