@inkeep/agents-sdk 0.41.2 → 0.43.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.
Files changed (43) hide show
  1. package/README.md +356 -2
  2. package/dist/agent.d.ts +84 -73
  3. package/dist/agent.js +42 -4
  4. package/dist/agentFullClient.d.ts +8 -8
  5. package/dist/agentFullClient.js +4 -4
  6. package/dist/artifact-component.d.ts +8 -8
  7. package/dist/artifact-component.js +2 -2
  8. package/dist/builderFunctions.d.ts +337 -248
  9. package/dist/builderFunctions.js +131 -2
  10. package/dist/builderFunctionsExperimental.d.ts +17 -17
  11. package/dist/builders.d.ts +48 -48
  12. package/dist/credential-provider.d.ts +93 -93
  13. package/dist/credential-provider.js +1 -1
  14. package/dist/credential-ref.d.ts +37 -37
  15. package/dist/data-component.d.ts +9 -9
  16. package/dist/data-component.js +2 -2
  17. package/dist/environment-settings.d.ts +4 -4
  18. package/dist/evaluationClient.d.ts +78 -0
  19. package/dist/evaluationClient.js +1202 -0
  20. package/dist/external-agent.d.ts +17 -17
  21. package/dist/external-agent.js +2 -2
  22. package/dist/index.d.ts +5 -3
  23. package/dist/index.js +4 -2
  24. package/dist/module-hosted-tool-manager.d.ts +1 -1
  25. package/dist/module-hosted-tool-manager.js +1 -1
  26. package/dist/project.d.ts +83 -83
  27. package/dist/project.js +23 -4
  28. package/dist/projectFullClient.d.ts +8 -8
  29. package/dist/projectFullClient.js +4 -4
  30. package/dist/runner.d.ts +15 -15
  31. package/dist/status-component.d.ts +3 -3
  32. package/dist/subAgent.d.ts +2 -2
  33. package/dist/subAgent.js +7 -7
  34. package/dist/telemetry-provider.d.ts +76 -76
  35. package/dist/tool.d.ts +16 -16
  36. package/dist/tool.js +23 -3
  37. package/dist/trigger.d.ts +46 -0
  38. package/dist/trigger.js +65 -0
  39. package/dist/types.d.ts +31 -22
  40. package/dist/utils/generateIdFromName.d.ts +4 -4
  41. package/dist/utils/tool-normalization.d.ts +10 -10
  42. package/dist/utils/validateFunction.d.ts +5 -5
  43. package/package.json +2 -2
@@ -1,60 +1,60 @@
1
1
  //#region src/credential-ref.d.ts
2
2
  /**
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
- */
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: 'credential-ref';
14
+ __type: "credential-ref";
15
15
  id: string;
16
16
  }
17
17
  /**
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
- */
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
- * Type guard to check if a value is a credential reference
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
- * Type helper to extract credential IDs from environment configuration
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
- * Type helper to create a union of all available credential IDs from multiple environments
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
- * Type helper to extract tool IDs from environment configuration
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
- * Type helper to create a union of all available tool IDs from multiple environments
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 };
@@ -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, 'tenantId' | 'projectId' | 'props' | 'render'> & {
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, 'tenantId' | 'projectId'>;
13
+ config: Omit<DataComponentInsert, "tenantId" | "projectId">;
14
14
  init(): Promise<void>;
15
- getId(): DataComponentInsert['id'];
16
- getName(): DataComponentInsert['name'];
17
- getDescription(): DataComponentInsert['description'];
18
- getProps(): DataComponentInsert['props'];
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, 'tenantId' | 'projectId'>;
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['props'];
34
- getRender(): DataComponentInsert['render'];
33
+ getProps(): DataComponentInsert["props"];
34
+ getRender(): DataComponentInsert["render"];
35
35
  init(): Promise<void>;
36
36
  private upsertDataComponent;
37
37
  }
@@ -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
- * Create a setting helper with TypeScript autocomplete
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
- * Create type-safe environment configurations
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 };
@@ -0,0 +1,78 @@
1
+ //#region src/evaluationClient.d.ts
2
+ interface EvaluationClientConfig {
3
+ tenantId: string;
4
+ projectId: string;
5
+ apiUrl: string;
6
+ apiKey?: string;
7
+ }
8
+ declare class EvaluationClient {
9
+ private tenantId;
10
+ private projectId;
11
+ private apiUrl;
12
+ private apiKey?;
13
+ constructor(config: EvaluationClientConfig);
14
+ private buildUrl;
15
+ private buildHeaders;
16
+ listDatasets(): Promise<unknown[]>;
17
+ getDataset(datasetId: string): Promise<unknown | null>;
18
+ createDataset(datasetData: Record<string, unknown>): Promise<unknown>;
19
+ updateDataset(datasetId: string, updateData: Record<string, unknown>): Promise<unknown>;
20
+ deleteDataset(datasetId: string): Promise<void>;
21
+ listDatasetItems(datasetId: string): Promise<unknown[]>;
22
+ getDatasetItem(datasetId: string, itemId: string): Promise<unknown | null>;
23
+ createDatasetItem(datasetId: string, itemData: Record<string, unknown>): Promise<unknown>;
24
+ createDatasetItems(datasetId: string, itemsData: Record<string, unknown>[]): Promise<unknown[]>;
25
+ updateDatasetItem(datasetId: string, itemId: string, updateData: Record<string, unknown>): Promise<unknown>;
26
+ deleteDatasetItem(datasetId: string, itemId: string): Promise<void>;
27
+ listEvaluators(): Promise<unknown[]>;
28
+ getEvaluator(evaluatorId: string): Promise<unknown | null>;
29
+ createEvaluator(evaluatorData: Record<string, unknown>): Promise<unknown>;
30
+ updateEvaluator(evaluatorId: string, updateData: Record<string, unknown>): Promise<unknown>;
31
+ deleteEvaluator(evaluatorId: string): Promise<void>;
32
+ listEvaluationSuiteConfigs(): Promise<unknown[]>;
33
+ getEvaluationSuiteConfig(configId: string): Promise<unknown | null>;
34
+ createEvaluationSuiteConfig(configData: Record<string, unknown>): Promise<unknown>;
35
+ updateEvaluationSuiteConfig(configId: string, updateData: Record<string, unknown>): Promise<unknown>;
36
+ deleteEvaluationSuiteConfig(configId: string): Promise<void>;
37
+ listEvaluationSuiteConfigEvaluators(configId: string): Promise<unknown[]>;
38
+ addEvaluatorToSuiteConfig(configId: string, evaluatorId: string): Promise<unknown>;
39
+ removeEvaluatorFromSuiteConfig(configId: string, evaluatorId: string): Promise<void>;
40
+ getEvaluationResult(resultId: string): Promise<unknown | null>;
41
+ createEvaluationResult(resultData: Record<string, unknown>): Promise<unknown>;
42
+ updateEvaluationResult(resultId: string, updateData: Record<string, unknown>): Promise<unknown>;
43
+ deleteEvaluationResult(resultId: string): Promise<void>;
44
+ /**
45
+ * Trigger batch evaluation of conversations with selected evaluators.
46
+ * Supports filtering by conversation IDs, date range, or dataset run IDs.
47
+ */
48
+ triggerBatchEvaluation(evaluationData: {
49
+ evaluatorIds: string[];
50
+ name?: string;
51
+ conversationIds?: string[];
52
+ dateRange?: {
53
+ startDate: string;
54
+ endDate: string;
55
+ };
56
+ datasetRunIds?: string[];
57
+ }): Promise<{
58
+ message: string;
59
+ evaluationJobConfigId: string;
60
+ evaluatorIds: string[];
61
+ }>;
62
+ listDatasetRuns(datasetId: string): Promise<unknown[]>;
63
+ getDatasetRun(runId: string): Promise<unknown | null>;
64
+ triggerDatasetRun(datasetId: string, runData: {
65
+ agentIds: string[];
66
+ evaluatorIds?: string[];
67
+ }): Promise<{
68
+ message: string;
69
+ datasetRunId: string;
70
+ datasetId: string;
71
+ }>;
72
+ }
73
+ /**
74
+ * Helper function to create an EvaluationClient instance
75
+ */
76
+ declare function evaluationClient(config: EvaluationClientConfig): EvaluationClient;
77
+ //#endregion
78
+ export { EvaluationClient, EvaluationClientConfig, evaluationClient };