@inkeep/agents-core 0.35.3 → 0.35.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.
@@ -0,0 +1,38 @@
1
+ import { schemaValidationDefaults } from './chunk-Z64UK4CA.js';
2
+ import { loadEnvironmentFiles } from './chunk-4RVJB4KV.js';
3
+ import { z } from 'zod';
4
+
5
+ loadEnvironmentFiles();
6
+ var constantsSchema = z.object(
7
+ Object.fromEntries(
8
+ Object.keys(schemaValidationDefaults).map((key) => [
9
+ `AGENTS_${key}`,
10
+ z.coerce.number().optional()
11
+ ])
12
+ )
13
+ );
14
+ var parseConstants = () => {
15
+ const envOverrides = constantsSchema.parse(process.env);
16
+ return Object.fromEntries(
17
+ Object.entries(schemaValidationDefaults).map(([key, defaultValue]) => [
18
+ key,
19
+ envOverrides[`AGENTS_${key}`] ?? defaultValue
20
+ ])
21
+ );
22
+ };
23
+ var constants = parseConstants();
24
+ var {
25
+ AGENT_EXECUTION_TRANSFER_COUNT_MIN,
26
+ AGENT_EXECUTION_TRANSFER_COUNT_MAX,
27
+ AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT,
28
+ SUB_AGENT_TURN_GENERATION_STEPS_MIN,
29
+ SUB_AGENT_TURN_GENERATION_STEPS_MAX,
30
+ SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT,
31
+ STATUS_UPDATE_MAX_NUM_EVENTS,
32
+ STATUS_UPDATE_MAX_INTERVAL_SECONDS,
33
+ VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS,
34
+ VALIDATION_AGENT_PROMPT_MAX_CHARS,
35
+ CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT
36
+ } = constants;
37
+
38
+ export { AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT, AGENT_EXECUTION_TRANSFER_COUNT_MAX, AGENT_EXECUTION_TRANSFER_COUNT_MIN, CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT, STATUS_UPDATE_MAX_INTERVAL_SECONDS, STATUS_UPDATE_MAX_NUM_EVENTS, SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT, SUB_AGENT_TURN_GENERATION_STEPS_MAX, SUB_AGENT_TURN_GENERATION_STEPS_MIN, VALIDATION_AGENT_PROMPT_MAX_CHARS, VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS };
@@ -0,0 +1,74 @@
1
+ import { schema_exports, projects } from './chunk-NFYCSHD3.js';
2
+ import { organization } from './chunk-NOPEANIU.js';
3
+ import { dirname, join } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import { PGlite } from '@electric-sql/pglite';
6
+ import { sql } from 'drizzle-orm';
7
+ import { drizzle } from 'drizzle-orm/pglite';
8
+ import { migrate } from 'drizzle-orm/pglite/migrator';
9
+
10
+ var FILENAME = fileURLToPath(import.meta.url);
11
+ var DIRNAME = dirname(FILENAME);
12
+ async function createTestDatabaseClient(drizzleDir) {
13
+ const client = new PGlite();
14
+ const db = drizzle(client, { schema: schema_exports });
15
+ try {
16
+ if (!drizzleDir) {
17
+ drizzleDir = join(DIRNAME, "../../drizzle");
18
+ }
19
+ await migrate(db, { migrationsFolder: drizzleDir });
20
+ } catch (error) {
21
+ console.error("Failed to initialize test database schema:", error);
22
+ throw error;
23
+ }
24
+ return db;
25
+ }
26
+ async function cleanupTestDatabase(db) {
27
+ try {
28
+ const result = await db.execute(
29
+ sql.raw(`
30
+ SELECT tablename
31
+ FROM pg_tables
32
+ WHERE schemaname = 'public'
33
+ `)
34
+ );
35
+ const tables = result.rows.map((row) => row.tablename);
36
+ if (tables.length === 0) {
37
+ return;
38
+ }
39
+ const tableList = tables.map((t) => `"${t}"`).join(", ");
40
+ await db.execute(sql.raw(`TRUNCATE TABLE ${tableList} RESTART IDENTITY CASCADE`));
41
+ } catch (error) {
42
+ console.debug("Could not clean test database:", error);
43
+ }
44
+ }
45
+ async function closeTestDatabase(db) {
46
+ try {
47
+ if ("close" in db && typeof db.close === "function") {
48
+ db.close();
49
+ }
50
+ } catch (error) {
51
+ console.debug("Error closing database:", error);
52
+ }
53
+ }
54
+ async function createTestOrganization(db, tenantId) {
55
+ const slug = tenantId.replace(/^test-tenant-/, "").substring(0, 50);
56
+ await db.insert(organization).values({
57
+ id: tenantId,
58
+ name: `Test Organization ${tenantId}`,
59
+ slug,
60
+ createdAt: /* @__PURE__ */ new Date(),
61
+ metadata: null
62
+ }).onConflictDoNothing();
63
+ }
64
+ async function createTestProject(db, tenantId, projectId = "default") {
65
+ await createTestOrganization(db, tenantId);
66
+ await db.insert(projects).values({
67
+ tenantId,
68
+ id: projectId,
69
+ name: `Test Project ${projectId}`,
70
+ description: `Test project for ${projectId}`
71
+ }).onConflictDoNothing();
72
+ }
73
+
74
+ export { cleanupTestDatabase, closeTestDatabase, createTestDatabaseClient, createTestOrganization, createTestProject };
@@ -1,4 +1,4 @@
1
- import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-VBCCPAZK.js';
1
+ import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-3AK7OSAT.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  // src/validation/cycleDetection.ts
@@ -0,0 +1,35 @@
1
+ // src/constants/schema-validation/defaults.ts
2
+ var schemaValidationDefaults = {
3
+ // Agent Execution Transfer Count
4
+ // Controls how many times an agent can transfer control to sub-agents in a single conversation turn.
5
+ // This prevents infinite transfer loops while allowing multi-agent collaboration workflows.
6
+ AGENT_EXECUTION_TRANSFER_COUNT_MIN: 1,
7
+ AGENT_EXECUTION_TRANSFER_COUNT_MAX: 1e3,
8
+ AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT: 10,
9
+ // Sub-Agent Turn Generation Steps
10
+ // Limits how many AI generation steps a sub-agent can perform within a single turn.
11
+ // Each generation step typically involves sending a prompt to the LLM and processing its response.
12
+ // This prevents runaway token usage while allowing complex multi-step reasoning.
13
+ SUB_AGENT_TURN_GENERATION_STEPS_MIN: 1,
14
+ SUB_AGENT_TURN_GENERATION_STEPS_MAX: 1e3,
15
+ SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT: 12,
16
+ // Status Update Thresholds
17
+ // Real-time status updates are triggered when either threshold is exceeded during longer operations.
18
+ // MAX_NUM_EVENTS: Maximum number of internal events before forcing a status update to the client.
19
+ // MAX_INTERVAL_SECONDS: Maximum time between status updates regardless of event count.
20
+ STATUS_UPDATE_MAX_NUM_EVENTS: 100,
21
+ STATUS_UPDATE_MAX_INTERVAL_SECONDS: 600,
22
+ // 10 minutes
23
+ // Prompt Text Length Validation
24
+ // Maximum character limits for agent and sub-agent system prompts to prevent excessive token usage.
25
+ // Enforced during agent configuration to ensure prompts remain focused and manageable.
26
+ VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: 2e3,
27
+ VALIDATION_AGENT_PROMPT_MAX_CHARS: 5e3,
28
+ // Context Fetcher HTTP Timeout
29
+ // Maximum time allowed for HTTP requests made by Context Fetchers (e.g., CRM lookups, external API calls).
30
+ // Context Fetchers automatically retrieve external data at the start of a conversation to enrich agent context.
31
+ CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 1e4
32
+ // 10 seconds
33
+ };
34
+
35
+ export { schemaValidationDefaults };
@@ -1,6 +1,6 @@
1
1
  import { NodePgDatabase } from 'drizzle-orm/node-postgres';
2
2
  import { PgliteDatabase } from 'drizzle-orm/pglite';
3
- import { s as schema } from './schema-5N2lPWNV.js';
3
+ import { s as schema } from './schema-CoC3tYFX.js';
4
4
 
5
5
  type DatabaseClient = NodePgDatabase<typeof schema> | PgliteDatabase<typeof schema>;
6
6
  interface DatabaseConfig {
@@ -1,7 +1,7 @@
1
1
  export { i as ACTIVITY_NAMES, g as ACTIVITY_STATUS, f as ACTIVITY_TYPES, h as AGENT_IDS, p as AGGREGATE_OPERATORS, A as AI_OPERATIONS, j as AI_TOOL_TYPES, o as DATA_SOURCES, k as DATA_TYPES, D as DELEGATION_FROM_SUB_AGENT_ID, b as DELEGATION_ID, a as DELEGATION_TO_SUB_AGENT_ID, F as FIELD_TYPES, O as OPERATORS, m as ORDER_DIRECTIONS, P as PANEL_TYPES, q as QUERY_DEFAULTS, l as QUERY_EXPRESSIONS, Q as QUERY_FIELD_CONFIGS, n as QUERY_TYPES, R as REDUCE_OPERATIONS, e as SPAN_KEYS, S as SPAN_NAMES, T as TRANSFER_FROM_SUB_AGENT_ID, c as TRANSFER_TO_SUB_AGENT_ID, U as UNKNOWN_VALUE, d as detectAuthenticationRequired } from './auth-detection-CGqhPDnj.js';
2
2
  import { z } from 'zod';
3
- import { C as ConversationHistoryConfig, F as FunctionApiInsertSchema, A as ApiKeyApiUpdateSchema, a as FullAgentAgentInsertSchema } from './utility-DbltUp2Q.js';
4
- export { e as AgentStopWhen, b as AgentStopWhenSchema, h as CredentialStoreType, j as FunctionApiSelectSchema, k as FunctionApiUpdateSchema, i as MCPTransportType, g as ModelSettings, M as ModelSettingsSchema, d as StopWhen, S as StopWhenSchema, f as SubAgentStopWhen, c as SubAgentStopWhenSchema } from './utility-DbltUp2Q.js';
3
+ import { C as ConversationHistoryConfig, F as FunctionApiInsertSchema, A as ApiKeyApiUpdateSchema, a as FullAgentAgentInsertSchema } from './utility-C4QAannk.js';
4
+ export { e as AgentStopWhen, b as AgentStopWhenSchema, h as CredentialStoreType, j as FunctionApiSelectSchema, k as FunctionApiUpdateSchema, i as MCPTransportType, g as ModelSettings, M as ModelSettingsSchema, d as StopWhen, S as StopWhenSchema, f as SubAgentStopWhen, c as SubAgentStopWhenSchema } from './utility-C4QAannk.js';
5
5
  export { v as validatePropsAsJsonSchema } from './props-validation-BMR1qNiy.js';
6
6
  import 'pino';
7
7
  import 'drizzle-zod';
@@ -1,6 +1,7 @@
1
1
  export { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AGGREGATE_OPERATORS, AI_OPERATIONS, AI_TOOL_TYPES, DATA_SOURCES, DATA_TYPES, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, FIELD_TYPES, OPERATORS, ORDER_DIRECTIONS, PANEL_TYPES, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS, SPAN_KEYS, SPAN_NAMES, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE } from './chunk-TGESM3JG.js';
2
- import { ModelSettingsSchema, schemaValidationDefaults, FullAgentAgentInsertSchema, ArtifactComponentApiInsertSchema } from './chunk-VBCCPAZK.js';
3
- export { AgentStopWhenSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, ModelSettingsSchema, StopWhenSchema, SubAgentStopWhenSchema, validatePropsAsJsonSchema } from './chunk-VBCCPAZK.js';
2
+ import { ModelSettingsSchema, FullAgentAgentInsertSchema, ArtifactComponentApiInsertSchema } from './chunk-3AK7OSAT.js';
3
+ export { AgentStopWhenSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, ModelSettingsSchema, StopWhenSchema, SubAgentStopWhenSchema, validatePropsAsJsonSchema } from './chunk-3AK7OSAT.js';
4
+ import { schemaValidationDefaults } from './chunk-Z64UK4CA.js';
4
5
  export { detectAuthenticationRequired } from './chunk-4JZT4QEE.js';
5
6
  import { CredentialStoreType } from './chunk-YFHT5M2R.js';
6
7
  export { CredentialStoreType, MCPTransportType } from './chunk-YFHT5M2R.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Schema validation default constants used in Zod schemas.
3
+ * These define limits and defaults for user-configurable values.
4
+ */
5
+ declare const schemaValidationDefaults: {
6
+ readonly AGENT_EXECUTION_TRANSFER_COUNT_MIN: 1;
7
+ readonly AGENT_EXECUTION_TRANSFER_COUNT_MAX: 1000;
8
+ readonly AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT: 10;
9
+ readonly SUB_AGENT_TURN_GENERATION_STEPS_MIN: 1;
10
+ readonly SUB_AGENT_TURN_GENERATION_STEPS_MAX: 1000;
11
+ readonly SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT: 12;
12
+ readonly STATUS_UPDATE_MAX_NUM_EVENTS: 100;
13
+ readonly STATUS_UPDATE_MAX_INTERVAL_SECONDS: 600;
14
+ readonly VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: 2000;
15
+ readonly VALIDATION_AGENT_PROMPT_MAX_CHARS: 5000;
16
+ readonly CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 10000;
17
+ };
18
+
19
+ declare const AGENT_EXECUTION_TRANSFER_COUNT_MIN: 1;
20
+ declare const AGENT_EXECUTION_TRANSFER_COUNT_MAX: 1000;
21
+ declare const AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT: 10;
22
+ declare const SUB_AGENT_TURN_GENERATION_STEPS_MIN: 1;
23
+ declare const SUB_AGENT_TURN_GENERATION_STEPS_MAX: 1000;
24
+ declare const SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT: 12;
25
+ declare const STATUS_UPDATE_MAX_NUM_EVENTS: 100;
26
+ declare const STATUS_UPDATE_MAX_INTERVAL_SECONDS: 600;
27
+ declare const VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: 2000;
28
+ declare const VALIDATION_AGENT_PROMPT_MAX_CHARS: 5000;
29
+ declare const CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 10000;
30
+
31
+ export { AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT, AGENT_EXECUTION_TRANSFER_COUNT_MAX, AGENT_EXECUTION_TRANSFER_COUNT_MIN, CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT, STATUS_UPDATE_MAX_INTERVAL_SECONDS, STATUS_UPDATE_MAX_NUM_EVENTS, SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT, SUB_AGENT_TURN_GENERATION_STEPS_MAX, SUB_AGENT_TURN_GENERATION_STEPS_MIN, VALIDATION_AGENT_PROMPT_MAX_CHARS, VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS, schemaValidationDefaults };
@@ -0,0 +1,2 @@
1
+ export { AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT, AGENT_EXECUTION_TRANSFER_COUNT_MAX, AGENT_EXECUTION_TRANSFER_COUNT_MIN, CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT, STATUS_UPDATE_MAX_INTERVAL_SECONDS, STATUS_UPDATE_MAX_NUM_EVENTS, SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT, SUB_AGENT_TURN_GENERATION_STEPS_MAX, SUB_AGENT_TURN_GENERATION_STEPS_MIN, VALIDATION_AGENT_PROMPT_MAX_CHARS, VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS } from '../../chunk-KMLLKRUY.js';
2
+ export { schemaValidationDefaults } from '../../chunk-Z64UK4CA.js';
@@ -0,0 +1,268 @@
1
+ import { CredentialStore } from '../types/index.js';
2
+ import '../utility-C4QAannk.js';
3
+ import 'zod';
4
+ import 'drizzle-zod';
5
+ import 'drizzle-orm/pg-core';
6
+ import '@hono/zod-openapi';
7
+ import 'hono';
8
+
9
+ /**
10
+ * Registry for managing credential stores in the application context
11
+ * Provides methods to register, retrieve, and manage credential stores
12
+ */
13
+ declare class CredentialStoreRegistry {
14
+ private stores;
15
+ private logger;
16
+ constructor(initialStores?: CredentialStore[]);
17
+ /**
18
+ * Add a credential store to the registry
19
+ */
20
+ add(store: CredentialStore): void;
21
+ /**
22
+ * Get a credential store by ID
23
+ */
24
+ get(id: string): CredentialStore | undefined;
25
+ /**
26
+ * Get all registered credential stores
27
+ */
28
+ getAll(): CredentialStore[];
29
+ /**
30
+ * Get all credential store IDs
31
+ */
32
+ getIds(): string[];
33
+ /**
34
+ * Check if a credential store is registered
35
+ */
36
+ has(id: string): boolean;
37
+ /**
38
+ * Remove a credential store
39
+ */
40
+ remove(id: string): boolean;
41
+ /**
42
+ * Get the number of registered stores
43
+ */
44
+ size(): number;
45
+ }
46
+
47
+ /**
48
+ * Create default credential stores based on environment variables
49
+ */
50
+ declare function createDefaultCredentialStores(): CredentialStore[];
51
+
52
+ /**
53
+ * KeyChainStore - Cross-platform system keychain credential storage
54
+ *
55
+ * Uses the native OS credential storage:
56
+ * - macOS: Keychain
57
+ * - Windows: Credential Vault
58
+ * - Linux: Secret Service API/libsecret
59
+ *
60
+ * Requires the 'keytar' npm package to be installed.
61
+ * Falls back gracefully if keytar is not available.
62
+ *
63
+ * ## macOS Permission Handling
64
+ *
65
+ * On macOS, when your Node.js app first calls keytar operations:
66
+ * - `setPassword()` creates a new Keychain item (no prompt required)
67
+ * - `getPassword()` may prompt the user for permission on first access
68
+ * - Users can click "Allow", "Always Allow", or "Deny"
69
+ * - If denied, keytar returns `null` which this implementation handles gracefully
70
+ * - The calling binary (usually `node`) will be shown in the permission prompt
71
+ * - For better UX in packaged apps, consider code signing and app bundling
72
+ *
73
+ * This implementation handles all permission scenarios gracefully:
74
+ * - Returns `null` when access is denied or credentials don't exist
75
+ * - Logs errors for debugging permission issues
76
+ * - Never throws on permission denial, only on system-level errors
77
+ */
78
+ declare class KeyChainStore implements CredentialStore {
79
+ readonly id: string;
80
+ readonly type: "keychain";
81
+ private readonly service;
82
+ private readonly logger;
83
+ private keytarAvailable;
84
+ private keytar;
85
+ private initializationPromise;
86
+ constructor(id: string, servicePrefix?: string);
87
+ /**
88
+ * Initialize keytar dynamically to handle optional availability
89
+ */
90
+ private initializeKeytar;
91
+ /**
92
+ * Get a credential from the keychain
93
+ */
94
+ get(key: string): Promise<string | null>;
95
+ /**
96
+ * Set a credential in the keychain
97
+ * @param metadata - Optional metadata (ignored by keychain store)
98
+ */
99
+ set(key: string, value: string, _metadata?: Record<string, string>): Promise<void>;
100
+ /**
101
+ * Check if a credential exists in the keychain
102
+ */
103
+ has(key: string): Promise<boolean>;
104
+ /**
105
+ * Check if the credential store is available and functional
106
+ */
107
+ checkAvailability(): Promise<{
108
+ available: boolean;
109
+ reason?: string;
110
+ }>;
111
+ /**
112
+ * Delete a credential from the keychain
113
+ */
114
+ delete(key: string): Promise<boolean>;
115
+ /**
116
+ * Find all credentials for this service
117
+ * Useful for debugging and listing stored credentials
118
+ */
119
+ findAllCredentials(): Promise<Array<{
120
+ account: string;
121
+ password: string;
122
+ }>>;
123
+ /**
124
+ * Clear all credentials for this service
125
+ * WARNING: This will delete all credentials stored under this service
126
+ */
127
+ clearAll(): Promise<number>;
128
+ }
129
+ /**
130
+ * Factory function to create KeyChainStore
131
+ * Provides consistent initialization and optional configuration
132
+ *
133
+ * ## Usage Recommendations for macOS Permission Handling
134
+ *
135
+ * 1. **First-time setup**: Inform users that they may see permission prompts
136
+ * 2. **Error handling**: Check for `null` returns from `get()` operations
137
+ * 3. **User guidance**: If credentials can't be retrieved, guide users to:
138
+ * - Check Keychain Access app for denied permissions
139
+ * - Re-run the application if they accidentally clicked "Deny"
140
+ * 4. **Development**: Use a consistent `servicePrefix` to avoid permission prompt spam
141
+ * 5. **Production**: Consider code-signing your distributed app for better permission prompts
142
+ *
143
+ * Example usage with permission handling:
144
+ * ```typescript
145
+ * const store = createKeyChainStore('my-app');
146
+ *
147
+ * // Always check for null when retrieving
148
+ * const apiKey = await store.get('api-key');
149
+ * if (!apiKey) {
150
+ * console.log('API key not found or access denied');
151
+ * // Guide user to check permissions or re-enter credentials
152
+ * }
153
+ * ```
154
+ */
155
+ declare function createKeyChainStore(id: string, options?: {
156
+ servicePrefix?: string;
157
+ }): KeyChainStore;
158
+
159
+ /**
160
+ * In-memory credential store implementation
161
+ * Automatically loads environment variables prefixed with CREDENTIAL_STORE_ on initialization
162
+ * Note: Runtime credentials are lost when the server restarts, but env vars are reloaded
163
+ */
164
+ declare class InMemoryCredentialStore implements CredentialStore {
165
+ readonly id: string;
166
+ readonly type: "memory";
167
+ private credentials;
168
+ constructor(id?: string);
169
+ /**
170
+ * Get a credential from the in memory store.
171
+ * If the key is not found in the in memory store then it is loaded from environment variables.
172
+ * If the key is not found in the environment variables or in the in memory store then returns null.
173
+ * @param key - The key of the credential to get
174
+ * @returns The credential value or null if not found
175
+ */
176
+ get(key: string): Promise<string | null>;
177
+ /**
178
+ * Set a credential in the in memory store.
179
+ * @param key - The key of the credential to set
180
+ * @param value - The value of the credential to set
181
+ * @param metadata - Optional metadata (ignored by memory store)
182
+ */
183
+ set(key: string, value: string, _metadata?: Record<string, string>): Promise<void>;
184
+ /**
185
+ * Check if a credential exists in the in memory store.
186
+ * @param key - The key of the credential to check
187
+ * @returns True if the credential exists, false otherwise
188
+ */
189
+ has(key: string): Promise<boolean>;
190
+ /**
191
+ * Delete a credential from the in memory store.
192
+ * @param key - The key of the credential to delete
193
+ * @returns True if the credential was deleted, false otherwise
194
+ */
195
+ delete(key: string): Promise<boolean>;
196
+ /**
197
+ * Check if the credential store is available and functional
198
+ */
199
+ checkAvailability(): Promise<{
200
+ available: boolean;
201
+ reason?: string;
202
+ }>;
203
+ }
204
+
205
+ interface NangoConfig {
206
+ secretKey: string;
207
+ apiUrl?: string;
208
+ }
209
+ /**
210
+ * Nango-based CredentialStore that fetches OAuth credentials from Nango API
211
+ * Uses connectionId and providerConfigKey from metadata to fetch live credentials
212
+ */
213
+ declare class NangoCredentialStore implements CredentialStore {
214
+ readonly id: string;
215
+ readonly type: "nango";
216
+ private nangoConfig;
217
+ private nangoClient;
218
+ constructor(id: string, config: NangoConfig);
219
+ private getAccessToken;
220
+ private sanitizeMetadata;
221
+ /**
222
+ * Fetch a specific Nango integration
223
+ */
224
+ private fetchNangoIntegration;
225
+ /**
226
+ * Create an API key credential by setting up Nango integration and importing the connection
227
+ */
228
+ private createNangoApiKeyConnection;
229
+ /**
230
+ * Fetch credentials from Nango API using connection information
231
+ * @param connectionId - The connection ID for the Nango connection
232
+ * @param providerConfigKey - The provider config key for the Nango connection
233
+ * @returns The credential data or null if the credentials are not found
234
+ */
235
+ private fetchCredentialsFromNango;
236
+ /**
237
+ * Get credentials by key - implements CredentialStore interface
238
+ * Key format: JSON string with connectionId and providerConfigKey
239
+ */
240
+ get(key: string): Promise<string | null>;
241
+ /**
242
+ * Set credentials - this is used to save bearer auth
243
+ * Key format: JSON string with connectionId and providerConfigKey
244
+ */
245
+ set(key: string, value: string, metadata?: Record<string, string>): Promise<void>;
246
+ /**
247
+ * Check if credentials exist by attempting to fetch them
248
+ */
249
+ has(key: string): Promise<boolean>;
250
+ /**
251
+ * Delete credentials - not supported for Nango (revoke through Nango dashboard)
252
+ */
253
+ delete(key: string): Promise<boolean>;
254
+ /**
255
+ * Check if the credential store is available and functional
256
+ */
257
+ checkAvailability(): Promise<{
258
+ available: boolean;
259
+ reason?: string;
260
+ }>;
261
+ }
262
+ /**
263
+ * Factory function to create NangoCredentialStore
264
+ * Automatically reads NANGO_SECRET_KEY from environment and validates it
265
+ */
266
+ declare function createNangoCredentialStore(id: string, config?: Partial<NangoConfig>): NangoCredentialStore;
267
+
268
+ export { CredentialStoreRegistry, InMemoryCredentialStore, KeyChainStore, NangoCredentialStore, createDefaultCredentialStores, createKeyChainStore, createNangoCredentialStore };
@@ -0,0 +1 @@
1
+ export { CredentialStoreRegistry, InMemoryCredentialStore, KeyChainStore, NangoCredentialStore, createDefaultCredentialStores, createKeyChainStore, createNangoCredentialStore } from '../chunk-FOK3JSQN.js';
@@ -1,8 +1,8 @@
1
1
  import 'drizzle-orm';
2
2
  import 'drizzle-orm/pg-core';
3
- import '../utility-DbltUp2Q.js';
3
+ import '../utility-C4QAannk.js';
4
4
  export { account, invitation, member, organization, session, ssoProvider, user, verification } from '../auth/auth-schema.js';
5
- export { G as agentRelations, J as agentToolRelationsRelations, a as agents, y as apiKeys, I as apiKeysRelations, j as artifactComponents, O as artifactComponentsRelations, b as contextCache, E as contextCacheRelations, c as contextConfigs, D as contextConfigsRelations, v as conversations, M as conversationsRelations, z as credentialReferences, K as credentialReferencesRelations, h as dataComponents, Q as dataComponentsRelations, f as externalAgents, H as externalAgentsRelations, m as functionTools, V as functionToolsRelations, n as functions, T as functionsRelations, x as ledgerArtifacts, S as ledgerArtifactsRelations, w as messages, N as messagesRelations, p as projects, B as projectsRelations, k as subAgentArtifactComponents, P as subAgentArtifactComponentsRelations, i as subAgentDataComponents, R as subAgentDataComponentsRelations, q as subAgentExternalAgentRelations, X as subAgentExternalAgentRelationsRelations, u as subAgentFunctionToolRelations, W as subAgentFunctionToolRelationsRelations, e as subAgentRelations, U as subAgentRelationsRelations, r as subAgentTeamAgentRelations, Y as subAgentTeamAgentRelationsRelations, o as subAgentToolRelations, d as subAgents, F as subAgentsRelations, g as taskRelations, C as taskRelationsRelations, t as tasks, A as tasksRelations, l as tools, L as toolsRelations } from '../schema-5N2lPWNV.js';
5
+ export { G as agentRelations, J as agentToolRelationsRelations, a as agents, y as apiKeys, I as apiKeysRelations, j as artifactComponents, O as artifactComponentsRelations, b as contextCache, E as contextCacheRelations, c as contextConfigs, D as contextConfigsRelations, v as conversations, M as conversationsRelations, z as credentialReferences, K as credentialReferencesRelations, h as dataComponents, Q as dataComponentsRelations, f as externalAgents, H as externalAgentsRelations, m as functionTools, V as functionToolsRelations, n as functions, T as functionsRelations, x as ledgerArtifacts, S as ledgerArtifactsRelations, w as messages, N as messagesRelations, p as projects, B as projectsRelations, k as subAgentArtifactComponents, P as subAgentArtifactComponentsRelations, i as subAgentDataComponents, R as subAgentDataComponentsRelations, q as subAgentExternalAgentRelations, X as subAgentExternalAgentRelationsRelations, u as subAgentFunctionToolRelations, W as subAgentFunctionToolRelationsRelations, e as subAgentRelations, U as subAgentRelationsRelations, r as subAgentTeamAgentRelations, Y as subAgentTeamAgentRelationsRelations, o as subAgentToolRelations, d as subAgents, F as subAgentsRelations, g as taskRelations, C as taskRelationsRelations, t as tasks, A as tasksRelations, l as tools, L as toolsRelations } from '../schema-CoC3tYFX.js';
6
6
  import 'zod';
7
7
  import 'drizzle-zod';
8
8
  import '@hono/zod-openapi';
@@ -0,0 +1,39 @@
1
+ import { D as DatabaseClient } from '../client-HrEgt7wv.js';
2
+ import 'drizzle-orm/node-postgres';
3
+ import 'drizzle-orm/pglite';
4
+ import '../schema-CoC3tYFX.js';
5
+ import 'drizzle-orm';
6
+ import 'drizzle-orm/pg-core';
7
+ import '../utility-C4QAannk.js';
8
+ import 'zod';
9
+ import 'drizzle-zod';
10
+ import '@hono/zod-openapi';
11
+ import '../auth/auth-schema.js';
12
+
13
+ /**
14
+ * Creates a test database client using an in-memory PostgreSQL database (PGlite)
15
+ * This provides real database operations for integration testing with perfect isolation
16
+ * Each call creates a fresh database with all migrations applied
17
+ */
18
+ declare function createTestDatabaseClient(drizzleDir?: string): Promise<DatabaseClient>;
19
+ /**
20
+ * Cleans up test database by removing all data but keeping schema
21
+ * Dynamically gets all tables from the public schema and truncates them
22
+ */
23
+ declare function cleanupTestDatabase(db: DatabaseClient): Promise<void>;
24
+ /**
25
+ * Closes the test database and removes the file
26
+ */
27
+ declare function closeTestDatabase(db: DatabaseClient): Promise<void>;
28
+ /**
29
+ * Creates a test organization in the database
30
+ * This is a helper for tests that need organization records before creating projects/agents
31
+ */
32
+ declare function createTestOrganization(db: DatabaseClient, tenantId: string): Promise<void>;
33
+ /**
34
+ * Creates a test project in the database
35
+ * Ensures the organization exists first
36
+ */
37
+ declare function createTestProject(db: DatabaseClient, tenantId: string, projectId?: string): Promise<void>;
38
+
39
+ export { cleanupTestDatabase, closeTestDatabase, createTestDatabaseClient, createTestOrganization, createTestProject };
@@ -0,0 +1 @@
1
+ export { cleanupTestDatabase, closeTestDatabase, createTestDatabaseClient, createTestOrganization, createTestProject } from '../chunk-SG75RA63.js';