@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.
- package/README.md +356 -2
- package/dist/agent.d.ts +84 -73
- package/dist/agent.js +42 -4
- 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 +337 -248
- package/dist/builderFunctions.js +131 -2
- 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-provider.js +1 -1
- 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 +5 -3
- 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 +23 -4
- 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
package/dist/builderFunctions.js
CHANGED
|
@@ -7,7 +7,9 @@ import { Project } from "./project.js";
|
|
|
7
7
|
import { StatusComponent as StatusComponent$1 } from "./status-component.js";
|
|
8
8
|
import { Tool } from "./tool.js";
|
|
9
9
|
import { SubAgent } from "./subAgent.js";
|
|
10
|
-
import {
|
|
10
|
+
import { Trigger } from "./trigger.js";
|
|
11
|
+
import { CredentialReferenceApiInsertSchema, MCPToolConfigSchema, SignatureVerificationConfigSchema } from "@inkeep/agents-core";
|
|
12
|
+
import { validateJMESPath, validateRegex } from "@inkeep/agents-core/utils/signature-validation";
|
|
11
13
|
|
|
12
14
|
//#region src/builderFunctions.ts
|
|
13
15
|
/**
|
|
@@ -322,6 +324,133 @@ function agentMcp(config) {
|
|
|
322
324
|
function functionTool(config) {
|
|
323
325
|
return new FunctionTool(config);
|
|
324
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Creates a webhook trigger for external service integration.
|
|
329
|
+
*
|
|
330
|
+
* Triggers allow external services to invoke agents via webhooks.
|
|
331
|
+
* They support authentication via arbitrary header key-value pairs,
|
|
332
|
+
* payload transformation, input validation, and signature verification.
|
|
333
|
+
*
|
|
334
|
+
* @param config - Trigger configuration
|
|
335
|
+
* @returns A Trigger instance
|
|
336
|
+
* @throws {Error} If signatureVerification config validation fails
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```typescript
|
|
340
|
+
* import { z } from 'zod';
|
|
341
|
+
*
|
|
342
|
+
* // GitHub webhook trigger with signature verification
|
|
343
|
+
* const githubWebhookSecret = credential({
|
|
344
|
+
* id: 'github-webhook-secret',
|
|
345
|
+
* name: 'GitHub Webhook Secret',
|
|
346
|
+
* type: 'bearer',
|
|
347
|
+
* value: process.env.GITHUB_WEBHOOK_SECRET
|
|
348
|
+
* });
|
|
349
|
+
*
|
|
350
|
+
* const githubTrigger = trigger({
|
|
351
|
+
* name: 'GitHub Events',
|
|
352
|
+
* description: 'Handle GitHub webhook events',
|
|
353
|
+
* enabled: true,
|
|
354
|
+
* inputSchema: z.object({
|
|
355
|
+
* action: z.string(),
|
|
356
|
+
* repository: z.object({
|
|
357
|
+
* name: z.string(),
|
|
358
|
+
* url: z.string()
|
|
359
|
+
* })
|
|
360
|
+
* }),
|
|
361
|
+
* outputTransform: {
|
|
362
|
+
* jmespath: '{action: action, repo: repository.name, url: repository.url}'
|
|
363
|
+
* },
|
|
364
|
+
* messageTemplate: 'GitHub {{action}} on repository {{repo}}: {{url}}',
|
|
365
|
+
* authentication: {
|
|
366
|
+
* headers: [
|
|
367
|
+
* { name: 'X-GitHub-Token', value: process.env.GITHUB_TOKEN }
|
|
368
|
+
* ]
|
|
369
|
+
* },
|
|
370
|
+
* signingSecretCredentialReference: githubWebhookSecret,
|
|
371
|
+
* signatureVerification: {
|
|
372
|
+
* algorithm: 'sha256',
|
|
373
|
+
* encoding: 'hex',
|
|
374
|
+
* signature: {
|
|
375
|
+
* source: 'header',
|
|
376
|
+
* key: 'x-hub-signature-256',
|
|
377
|
+
* prefix: 'sha256='
|
|
378
|
+
* },
|
|
379
|
+
* signedComponents: [
|
|
380
|
+
* { source: 'body', required: true }
|
|
381
|
+
* ],
|
|
382
|
+
* componentJoin: {
|
|
383
|
+
* strategy: 'concatenate',
|
|
384
|
+
* separator: ''
|
|
385
|
+
* }
|
|
386
|
+
* }
|
|
387
|
+
* });
|
|
388
|
+
*
|
|
389
|
+
* // Slack webhook trigger with complex signature
|
|
390
|
+
* const slackTrigger = trigger({
|
|
391
|
+
* name: 'Slack Events',
|
|
392
|
+
* description: 'Handle Slack webhook events',
|
|
393
|
+
* messageTemplate: 'Slack event: {{type}}',
|
|
394
|
+
* signingSecretCredentialReference: slackSecret,
|
|
395
|
+
* signatureVerification: {
|
|
396
|
+
* algorithm: 'sha256',
|
|
397
|
+
* encoding: 'hex',
|
|
398
|
+
* signature: {
|
|
399
|
+
* source: 'header',
|
|
400
|
+
* key: 'x-slack-signature',
|
|
401
|
+
* prefix: 'v0='
|
|
402
|
+
* },
|
|
403
|
+
* signedComponents: [
|
|
404
|
+
* { source: 'literal', value: 'v0', required: true },
|
|
405
|
+
* { source: 'header', key: 'x-slack-request-timestamp', required: true },
|
|
406
|
+
* { source: 'body', required: true }
|
|
407
|
+
* ],
|
|
408
|
+
* componentJoin: {
|
|
409
|
+
* strategy: 'concatenate',
|
|
410
|
+
* separator: ':'
|
|
411
|
+
* }
|
|
412
|
+
* }
|
|
413
|
+
* });
|
|
414
|
+
*
|
|
415
|
+
* // Simple webhook trigger with no signature verification
|
|
416
|
+
* const simpleTrigger = trigger({
|
|
417
|
+
* name: 'Internal Webhook',
|
|
418
|
+
* description: 'Internal webhook with no signature',
|
|
419
|
+
* messageTemplate: 'New message: {{text}}'
|
|
420
|
+
* });
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
function trigger(config) {
|
|
424
|
+
if (config.signatureVerification !== void 0 && config.signatureVerification !== null) {
|
|
425
|
+
const triggerName = config.name || "unknown";
|
|
426
|
+
try {
|
|
427
|
+
SignatureVerificationConfigSchema.parse(config.signatureVerification);
|
|
428
|
+
} catch (error) {
|
|
429
|
+
if (error instanceof Error) throw new Error(`Invalid signatureVerification config in trigger '${triggerName}': ${error.message}`);
|
|
430
|
+
throw error;
|
|
431
|
+
}
|
|
432
|
+
const sigConfig = config.signatureVerification;
|
|
433
|
+
if (sigConfig.signature.regex) {
|
|
434
|
+
const result = validateRegex(sigConfig.signature.regex);
|
|
435
|
+
if (!result.valid) throw new Error(`Invalid signatureVerification config in trigger '${triggerName}': ${result.error}`);
|
|
436
|
+
}
|
|
437
|
+
if (sigConfig.signature.source === "body" && sigConfig.signature.key) {
|
|
438
|
+
const result = validateJMESPath(sigConfig.signature.key);
|
|
439
|
+
if (!result.valid) throw new Error(`Invalid signatureVerification config in trigger '${triggerName}': ${result.error}`);
|
|
440
|
+
}
|
|
441
|
+
for (const component of sigConfig.signedComponents) {
|
|
442
|
+
if (component.regex) {
|
|
443
|
+
const result = validateRegex(component.regex);
|
|
444
|
+
if (!result.valid) throw new Error(`Invalid signatureVerification config in trigger '${triggerName}': ${result.error}`);
|
|
445
|
+
}
|
|
446
|
+
if (component.source === "body" && component.key) {
|
|
447
|
+
const result = validateJMESPath(component.key);
|
|
448
|
+
if (!result.valid) throw new Error(`Invalid signatureVerification config in trigger '${triggerName}': ${result.error}`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return new Trigger(config);
|
|
453
|
+
}
|
|
325
454
|
|
|
326
455
|
//#endregion
|
|
327
|
-
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent };
|
|
456
|
+
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger };
|
|
@@ -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 };
|
|
@@ -111,7 +111,7 @@ var InkeepCredentialProvider = class {
|
|
|
111
111
|
} catch {
|
|
112
112
|
return {
|
|
113
113
|
available: false,
|
|
114
|
-
reason: "Keychain store requires
|
|
114
|
+
reason: "Keychain store requires @napi-rs/keyring package to be installed"
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
}
|