@inkeep/agents-core 0.1.4 → 0.1.7

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 (278) hide show
  1. package/README.md +2 -2
  2. package/SUPPLEMENTAL_TERMS.md +40 -0
  3. package/dist/chunk-BMKWVKI2.js +126 -0
  4. package/dist/chunk-H2F72PDA.js +15 -0
  5. package/dist/chunk-MKBO26DX.js +9 -0
  6. package/dist/chunk-MXQKLGQK.js +925 -0
  7. package/dist/chunk-R3VVJXX7.js +575 -0
  8. package/dist/chunk-SVGQSPW4.js +24 -0
  9. package/dist/client-exports.cjs +1702 -0
  10. package/dist/client-exports.js +202 -246
  11. package/dist/db/schema.cjs +922 -0
  12. package/dist/db/schema.js +1 -696
  13. package/dist/index.cjs +10122 -0
  14. package/dist/index.js +7989 -13
  15. package/dist/types/index.cjs +45 -0
  16. package/dist/types/index.js +2 -6
  17. package/dist/validation/index.cjs +1772 -0
  18. package/dist/validation/index.js +2 -5
  19. package/package.json +11 -6
  20. package/dist/__tests__/integration/helpers.d.ts +0 -5
  21. package/dist/__tests__/integration/helpers.d.ts.map +0 -1
  22. package/dist/__tests__/integration/helpers.js +0 -37
  23. package/dist/__tests__/integration/helpers.js.map +0 -1
  24. package/dist/__tests__/setup.d.ts +0 -3
  25. package/dist/__tests__/setup.d.ts.map +0 -1
  26. package/dist/__tests__/setup.js +0 -29
  27. package/dist/__tests__/setup.js.map +0 -1
  28. package/dist/client-exports.d.ts +0 -300
  29. package/dist/client-exports.d.ts.map +0 -1
  30. package/dist/client-exports.js.map +0 -1
  31. package/dist/context/ContextConfig.d.ts +0 -54
  32. package/dist/context/ContextConfig.d.ts.map +0 -1
  33. package/dist/context/ContextConfig.js +0 -302
  34. package/dist/context/ContextConfig.js.map +0 -1
  35. package/dist/context/ContextFetcher.d.ts +0 -64
  36. package/dist/context/ContextFetcher.d.ts.map +0 -1
  37. package/dist/context/ContextFetcher.js +0 -325
  38. package/dist/context/ContextFetcher.js.map +0 -1
  39. package/dist/context/ContextResolver.d.ts +0 -52
  40. package/dist/context/ContextResolver.d.ts.map +0 -1
  41. package/dist/context/ContextResolver.js +0 -298
  42. package/dist/context/ContextResolver.js.map +0 -1
  43. package/dist/context/TemplateEngine.d.ts +0 -46
  44. package/dist/context/TemplateEngine.d.ts.map +0 -1
  45. package/dist/context/TemplateEngine.js +0 -175
  46. package/dist/context/TemplateEngine.js.map +0 -1
  47. package/dist/context/context.d.ts +0 -8
  48. package/dist/context/context.d.ts.map +0 -1
  49. package/dist/context/context.js +0 -157
  50. package/dist/context/context.js.map +0 -1
  51. package/dist/context/contextCache.d.ts +0 -50
  52. package/dist/context/contextCache.d.ts.map +0 -1
  53. package/dist/context/contextCache.js +0 -175
  54. package/dist/context/contextCache.js.map +0 -1
  55. package/dist/context/index.d.ts +0 -11
  56. package/dist/context/index.d.ts.map +0 -1
  57. package/dist/context/index.js +0 -8
  58. package/dist/context/index.js.map +0 -1
  59. package/dist/credential-stores/CredentialStoreRegistry.d.ts +0 -39
  60. package/dist/credential-stores/CredentialStoreRegistry.d.ts.map +0 -1
  61. package/dist/credential-stores/CredentialStoreRegistry.js +0 -65
  62. package/dist/credential-stores/CredentialStoreRegistry.js.map +0 -1
  63. package/dist/credential-stores/defaults.d.ts +0 -6
  64. package/dist/credential-stores/defaults.d.ts.map +0 -1
  65. package/dist/credential-stores/defaults.js +0 -22
  66. package/dist/credential-stores/defaults.js.map +0 -1
  67. package/dist/credential-stores/index.d.ts +0 -6
  68. package/dist/credential-stores/index.d.ts.map +0 -1
  69. package/dist/credential-stores/index.js +0 -6
  70. package/dist/credential-stores/index.js.map +0 -1
  71. package/dist/credential-stores/keychain-store.d.ts +0 -100
  72. package/dist/credential-stores/keychain-store.d.ts.map +0 -1
  73. package/dist/credential-stores/keychain-store.js +0 -225
  74. package/dist/credential-stores/keychain-store.js.map +0 -1
  75. package/dist/credential-stores/memory-store.d.ts +0 -39
  76. package/dist/credential-stores/memory-store.d.ts.map +0 -1
  77. package/dist/credential-stores/memory-store.js +0 -58
  78. package/dist/credential-stores/memory-store.js.map +0 -1
  79. package/dist/credential-stores/nango-store.d.ts +0 -59
  80. package/dist/credential-stores/nango-store.d.ts.map +0 -1
  81. package/dist/credential-stores/nango-store.js +0 -264
  82. package/dist/credential-stores/nango-store.js.map +0 -1
  83. package/dist/credential-stuffer/CredentialStuffer.d.ts +0 -80
  84. package/dist/credential-stuffer/CredentialStuffer.d.ts.map +0 -1
  85. package/dist/credential-stuffer/CredentialStuffer.js +0 -186
  86. package/dist/credential-stuffer/CredentialStuffer.js.map +0 -1
  87. package/dist/credential-stuffer/index.d.ts +0 -2
  88. package/dist/credential-stuffer/index.d.ts.map +0 -1
  89. package/dist/credential-stuffer/index.js +0 -2
  90. package/dist/credential-stuffer/index.js.map +0 -1
  91. package/dist/data-access/agentDataComponents.d.ts +0 -1
  92. package/dist/data-access/agentDataComponents.d.ts.map +0 -1
  93. package/dist/data-access/agentDataComponents.js +0 -2
  94. package/dist/data-access/agentDataComponents.js.map +0 -1
  95. package/dist/data-access/agentGraphs.d.ts +0 -406
  96. package/dist/data-access/agentGraphs.d.ts.map +0 -1
  97. package/dist/data-access/agentGraphs.js +0 -551
  98. package/dist/data-access/agentGraphs.js.map +0 -1
  99. package/dist/data-access/agentRelations.d.ts +0 -456
  100. package/dist/data-access/agentRelations.d.ts.map +0 -1
  101. package/dist/data-access/agentRelations.js +0 -471
  102. package/dist/data-access/agentRelations.js.map +0 -1
  103. package/dist/data-access/agents.d.ts +0 -218
  104. package/dist/data-access/agents.d.ts.map +0 -1
  105. package/dist/data-access/agents.js +0 -130
  106. package/dist/data-access/agents.js.map +0 -1
  107. package/dist/data-access/apiKeys.d.ts +0 -114
  108. package/dist/data-access/apiKeys.d.ts.map +0 -1
  109. package/dist/data-access/apiKeys.js +0 -185
  110. package/dist/data-access/apiKeys.js.map +0 -1
  111. package/dist/data-access/artifactComponents.d.ts +0 -152
  112. package/dist/data-access/artifactComponents.d.ts.map +0 -1
  113. package/dist/data-access/artifactComponents.js +0 -214
  114. package/dist/data-access/artifactComponents.js.map +0 -1
  115. package/dist/data-access/contextCache.d.ts +0 -68
  116. package/dist/data-access/contextCache.d.ts.map +0 -1
  117. package/dist/data-access/contextCache.js +0 -160
  118. package/dist/data-access/contextCache.js.map +0 -1
  119. package/dist/data-access/contextConfigs.d.ts +0 -110
  120. package/dist/data-access/contextConfigs.d.ts.map +0 -1
  121. package/dist/data-access/contextConfigs.js +0 -156
  122. package/dist/data-access/contextConfigs.js.map +0 -1
  123. package/dist/data-access/conversations.d.ts +0 -125
  124. package/dist/data-access/conversations.d.ts.map +0 -1
  125. package/dist/data-access/conversations.js +0 -244
  126. package/dist/data-access/conversations.js.map +0 -1
  127. package/dist/data-access/credentialReferences.d.ts +0 -86
  128. package/dist/data-access/credentialReferences.d.ts.map +0 -1
  129. package/dist/data-access/credentialReferences.js +0 -175
  130. package/dist/data-access/credentialReferences.js.map +0 -1
  131. package/dist/data-access/dataComponents.d.ts +0 -129
  132. package/dist/data-access/dataComponents.d.ts.map +0 -1
  133. package/dist/data-access/dataComponents.js +0 -213
  134. package/dist/data-access/dataComponents.js.map +0 -1
  135. package/dist/data-access/externalAgents.d.ts +0 -83
  136. package/dist/data-access/externalAgents.d.ts.map +0 -1
  137. package/dist/data-access/externalAgents.js +0 -163
  138. package/dist/data-access/externalAgents.js.map +0 -1
  139. package/dist/data-access/graphFull.d.ts +0 -32
  140. package/dist/data-access/graphFull.d.ts.map +0 -1
  141. package/dist/data-access/graphFull.js +0 -996
  142. package/dist/data-access/graphFull.js.map +0 -1
  143. package/dist/data-access/index.d.ts +0 -21
  144. package/dist/data-access/index.d.ts.map +0 -1
  145. package/dist/data-access/index.js +0 -22
  146. package/dist/data-access/index.js.map +0 -1
  147. package/dist/data-access/ledgerArtifacts.d.ts +0 -49
  148. package/dist/data-access/ledgerArtifacts.d.ts.map +0 -1
  149. package/dist/data-access/ledgerArtifacts.js +0 -112
  150. package/dist/data-access/ledgerArtifacts.js.map +0 -1
  151. package/dist/data-access/messages.d.ts +0 -209
  152. package/dist/data-access/messages.d.ts.map +0 -1
  153. package/dist/data-access/messages.js +0 -100
  154. package/dist/data-access/messages.js.map +0 -1
  155. package/dist/data-access/projects.d.ts +0 -67
  156. package/dist/data-access/projects.d.ts.map +0 -1
  157. package/dist/data-access/projects.js +0 -337
  158. package/dist/data-access/projects.js.map +0 -1
  159. package/dist/data-access/tasks.d.ts +0 -37
  160. package/dist/data-access/tasks.d.ts.map +0 -1
  161. package/dist/data-access/tasks.js +0 -40
  162. package/dist/data-access/tasks.js.map +0 -1
  163. package/dist/data-access/tools.d.ts +0 -277
  164. package/dist/data-access/tools.d.ts.map +0 -1
  165. package/dist/data-access/tools.js +0 -183
  166. package/dist/data-access/tools.js.map +0 -1
  167. package/dist/data-access/validation.d.ts +0 -17
  168. package/dist/data-access/validation.d.ts.map +0 -1
  169. package/dist/data-access/validation.js +0 -52
  170. package/dist/data-access/validation.js.map +0 -1
  171. package/dist/db/clean.d.ts +0 -6
  172. package/dist/db/clean.d.ts.map +0 -1
  173. package/dist/db/clean.js +0 -81
  174. package/dist/db/clean.js.map +0 -1
  175. package/dist/db/client.d.ts +0 -19
  176. package/dist/db/client.d.ts.map +0 -1
  177. package/dist/db/client.js +0 -24
  178. package/dist/db/client.js.map +0 -1
  179. package/dist/db/schema.d.ts +0 -4337
  180. package/dist/db/schema.d.ts.map +0 -1
  181. package/dist/db/schema.js.map +0 -1
  182. package/dist/db/test-client.d.ts +0 -25
  183. package/dist/db/test-client.d.ts.map +0 -1
  184. package/dist/db/test-client.js +0 -136
  185. package/dist/db/test-client.js.map +0 -1
  186. package/dist/env.d.ts +0 -19
  187. package/dist/env.d.ts.map +0 -1
  188. package/dist/env.js +0 -49
  189. package/dist/env.js.map +0 -1
  190. package/dist/index.d.ts +0 -12
  191. package/dist/index.d.ts.map +0 -1
  192. package/dist/index.js.map +0 -1
  193. package/dist/middleware/contextValidation.d.ts +0 -49
  194. package/dist/middleware/contextValidation.d.ts.map +0 -1
  195. package/dist/middleware/contextValidation.js +0 -473
  196. package/dist/middleware/contextValidation.js.map +0 -1
  197. package/dist/middleware/index.d.ts +0 -2
  198. package/dist/middleware/index.d.ts.map +0 -1
  199. package/dist/middleware/index.js +0 -2
  200. package/dist/middleware/index.js.map +0 -1
  201. package/dist/server/BaseServer.d.ts +0 -83
  202. package/dist/server/BaseServer.d.ts.map +0 -1
  203. package/dist/server/BaseServer.js +0 -218
  204. package/dist/server/BaseServer.js.map +0 -1
  205. package/dist/types/a2a.d.ts +0 -373
  206. package/dist/types/a2a.d.ts.map +0 -1
  207. package/dist/types/a2a.js +0 -14
  208. package/dist/types/a2a.js.map +0 -1
  209. package/dist/types/entities.d.ts +0 -147
  210. package/dist/types/entities.d.ts.map +0 -1
  211. package/dist/types/entities.js +0 -2
  212. package/dist/types/entities.js.map +0 -1
  213. package/dist/types/index.d.ts +0 -5
  214. package/dist/types/index.d.ts.map +0 -1
  215. package/dist/types/index.js.map +0 -1
  216. package/dist/types/server.d.ts +0 -116
  217. package/dist/types/server.d.ts.map +0 -1
  218. package/dist/types/server.js +0 -2
  219. package/dist/types/server.js.map +0 -1
  220. package/dist/types/utility.d.ts +0 -213
  221. package/dist/types/utility.d.ts.map +0 -1
  222. package/dist/types/utility.js +0 -9
  223. package/dist/types/utility.js.map +0 -1
  224. package/dist/utils/apiKeys.d.ts +0 -32
  225. package/dist/utils/apiKeys.d.ts.map +0 -1
  226. package/dist/utils/apiKeys.js +0 -117
  227. package/dist/utils/apiKeys.js.map +0 -1
  228. package/dist/utils/auth-detection.d.ts +0 -23
  229. package/dist/utils/auth-detection.d.ts.map +0 -1
  230. package/dist/utils/auth-detection.js +0 -148
  231. package/dist/utils/auth-detection.js.map +0 -1
  232. package/dist/utils/credential-store-utils.d.ts +0 -11
  233. package/dist/utils/credential-store-utils.d.ts.map +0 -1
  234. package/dist/utils/credential-store-utils.js +0 -19
  235. package/dist/utils/credential-store-utils.js.map +0 -1
  236. package/dist/utils/error.d.ts +0 -526
  237. package/dist/utils/error.d.ts.map +0 -1
  238. package/dist/utils/error.js +0 -282
  239. package/dist/utils/error.js.map +0 -1
  240. package/dist/utils/execution.d.ts +0 -18
  241. package/dist/utils/execution.d.ts.map +0 -1
  242. package/dist/utils/execution.js +0 -25
  243. package/dist/utils/execution.js.map +0 -1
  244. package/dist/utils/index.d.ts +0 -9
  245. package/dist/utils/index.d.ts.map +0 -1
  246. package/dist/utils/index.js +0 -9
  247. package/dist/utils/index.js.map +0 -1
  248. package/dist/utils/logger.d.ts +0 -79
  249. package/dist/utils/logger.d.ts.map +0 -1
  250. package/dist/utils/logger.js +0 -102
  251. package/dist/utils/logger.js.map +0 -1
  252. package/dist/utils/logging.d.ts +0 -11
  253. package/dist/utils/logging.d.ts.map +0 -1
  254. package/dist/utils/logging.js +0 -6
  255. package/dist/utils/logging.js.map +0 -1
  256. package/dist/utils/mcp-client.d.ts +0 -48
  257. package/dist/utils/mcp-client.d.ts.map +0 -1
  258. package/dist/utils/mcp-client.js +0 -174
  259. package/dist/utils/mcp-client.js.map +0 -1
  260. package/dist/utils/tracer.d.ts +0 -24
  261. package/dist/utils/tracer.d.ts.map +0 -1
  262. package/dist/utils/tracer.js +0 -110
  263. package/dist/utils/tracer.js.map +0 -1
  264. package/dist/validation/graphFull.d.ts +0 -36
  265. package/dist/validation/graphFull.d.ts.map +0 -1
  266. package/dist/validation/graphFull.js +0 -128
  267. package/dist/validation/graphFull.js.map +0 -1
  268. package/dist/validation/id-validation.d.ts +0 -38
  269. package/dist/validation/id-validation.d.ts.map +0 -1
  270. package/dist/validation/id-validation.js +0 -60
  271. package/dist/validation/id-validation.js.map +0 -1
  272. package/dist/validation/index.d.ts +0 -4
  273. package/dist/validation/index.d.ts.map +0 -1
  274. package/dist/validation/index.js.map +0 -1
  275. package/dist/validation/schemas.d.ts +0 -7238
  276. package/dist/validation/schemas.d.ts.map +0 -1
  277. package/dist/validation/schemas.js +0 -575
  278. package/dist/validation/schemas.js.map +0 -1
@@ -1,100 +0,0 @@
1
- import type { CredentialStore } from '../types/server';
2
- /**
3
- * KeyChainStore - Cross-platform system keychain credential storage
4
- *
5
- * Uses the native OS credential storage:
6
- * - macOS: Keychain
7
- * - Windows: Credential Vault
8
- * - Linux: Secret Service API/libsecret
9
- *
10
- * Requires the 'keytar' npm package to be installed.
11
- * Falls back gracefully if keytar is not available.
12
- *
13
- * ## macOS Permission Handling
14
- *
15
- * On macOS, when your Node.js app first calls keytar operations:
16
- * - `setPassword()` creates a new Keychain item (no prompt required)
17
- * - `getPassword()` may prompt the user for permission on first access
18
- * - Users can click "Allow", "Always Allow", or "Deny"
19
- * - If denied, keytar returns `null` which this implementation handles gracefully
20
- * - The calling binary (usually `node`) will be shown in the permission prompt
21
- * - For better UX in packaged apps, consider code signing and app bundling
22
- *
23
- * This implementation handles all permission scenarios gracefully:
24
- * - Returns `null` when access is denied or credentials don't exist
25
- * - Logs errors for debugging permission issues
26
- * - Never throws on permission denial, only on system-level errors
27
- */
28
- export declare class KeyChainStore implements CredentialStore {
29
- readonly id: string;
30
- readonly type = "keychain";
31
- private readonly service;
32
- private readonly logger;
33
- private keytarAvailable;
34
- private keytar;
35
- private initializationPromise;
36
- constructor(id: string, servicePrefix?: string);
37
- /**
38
- * Initialize keytar dynamically to handle optional availability
39
- */
40
- private initializeKeytar;
41
- /**
42
- * Get a credential from the keychain
43
- */
44
- get(key: string): Promise<string | null>;
45
- /**
46
- * Set a credential in the keychain
47
- */
48
- set(key: string, value: string): Promise<void>;
49
- /**
50
- * Check if a credential exists in the keychain
51
- */
52
- has(key: string): Promise<boolean>;
53
- /**
54
- * Delete a credential from the keychain
55
- */
56
- delete(key: string): Promise<boolean>;
57
- /**
58
- * Find all credentials for this service
59
- * Useful for debugging and listing stored credentials
60
- */
61
- findAllCredentials(): Promise<Array<{
62
- account: string;
63
- password: string;
64
- }>>;
65
- /**
66
- * Clear all credentials for this service
67
- * WARNING: This will delete all credentials stored under this service
68
- */
69
- clearAll(): Promise<number>;
70
- }
71
- /**
72
- * Factory function to create KeyChainStore
73
- * Provides consistent initialization and optional configuration
74
- *
75
- * ## Usage Recommendations for macOS Permission Handling
76
- *
77
- * 1. **First-time setup**: Inform users that they may see permission prompts
78
- * 2. **Error handling**: Check for `null` returns from `get()` operations
79
- * 3. **User guidance**: If credentials can't be retrieved, guide users to:
80
- * - Check Keychain Access app for denied permissions
81
- * - Re-run the application if they accidentally clicked "Deny"
82
- * 4. **Development**: Use a consistent `servicePrefix` to avoid permission prompt spam
83
- * 5. **Production**: Consider code-signing your distributed app for better permission prompts
84
- *
85
- * Example usage with permission handling:
86
- * ```typescript
87
- * const store = createKeyChainStore('my-app');
88
- *
89
- * // Always check for null when retrieving
90
- * const apiKey = await store.get('api-key');
91
- * if (!apiKey) {
92
- * console.log('API key not found or access denied');
93
- * // Guide user to check permissions or re-enter credentials
94
- * }
95
- * ```
96
- */
97
- export declare function createKeyChainStore(id: string, options?: {
98
- servicePrefix?: string;
99
- }): KeyChainStore;
100
- //# sourceMappingURL=keychain-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keychain-store.d.ts","sourceRoot":"","sources":["../../src/credential-stores/keychain-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,aAAc,YAAW,eAAe;IACnD,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,cAAc;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IACrD,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,qBAAqB,CAAgB;gBAEjC,EAAE,EAAE,MAAM,EAAE,aAAa,SAA2B;IAOhE;;OAEG;YACW,gBAAgB;IA4B9B;;OAEG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAiC9C;;OAEG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BpD;;OAEG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxC;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAsC3C;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAuBjF;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;CAwBlC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE;IACR,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACA,aAAa,CAEf"}
@@ -1,225 +0,0 @@
1
- import { getLogger } from '../utils/logger';
2
- /**
3
- * KeyChainStore - Cross-platform system keychain credential storage
4
- *
5
- * Uses the native OS credential storage:
6
- * - macOS: Keychain
7
- * - Windows: Credential Vault
8
- * - Linux: Secret Service API/libsecret
9
- *
10
- * Requires the 'keytar' npm package to be installed.
11
- * Falls back gracefully if keytar is not available.
12
- *
13
- * ## macOS Permission Handling
14
- *
15
- * On macOS, when your Node.js app first calls keytar operations:
16
- * - `setPassword()` creates a new Keychain item (no prompt required)
17
- * - `getPassword()` may prompt the user for permission on first access
18
- * - Users can click "Allow", "Always Allow", or "Deny"
19
- * - If denied, keytar returns `null` which this implementation handles gracefully
20
- * - The calling binary (usually `node`) will be shown in the permission prompt
21
- * - For better UX in packaged apps, consider code signing and app bundling
22
- *
23
- * This implementation handles all permission scenarios gracefully:
24
- * - Returns `null` when access is denied or credentials don't exist
25
- * - Logs errors for debugging permission issues
26
- * - Never throws on permission denial, only on system-level errors
27
- */
28
- export class KeyChainStore {
29
- id;
30
- type = 'keychain';
31
- service;
32
- logger = getLogger('KeyChainStore');
33
- keytarAvailable = false;
34
- keytar = null;
35
- initializationPromise;
36
- constructor(id, servicePrefix = 'inkeep-agent-framework') {
37
- this.id = id;
38
- // Use service prefix to isolate credentials by store ID
39
- this.service = `${servicePrefix}-${id}`;
40
- this.initializationPromise = this.initializeKeytar();
41
- }
42
- /**
43
- * Initialize keytar dynamically to handle optional availability
44
- */
45
- async initializeKeytar() {
46
- if (this.keytar) {
47
- this.keytarAvailable = true;
48
- return;
49
- }
50
- try {
51
- this.keytar = (await import('keytar')).default;
52
- this.keytarAvailable = true;
53
- this.logger.info({
54
- storeId: this.id,
55
- service: this.service,
56
- }, 'Keytar initialized successfully');
57
- }
58
- catch (error) {
59
- this.logger.warn({
60
- storeId: this.id,
61
- error: error instanceof Error ? error.message : 'Unknown error',
62
- }, 'Keytar not available - KeyChainStore will return null for all operations');
63
- this.keytarAvailable = false;
64
- }
65
- }
66
- /**
67
- * Get a credential from the keychain
68
- */
69
- async get(key) {
70
- await this.initializationPromise;
71
- if (!this.keytarAvailable || !this.keytar) {
72
- this.logger.debug({ storeId: this.id, key }, 'Keytar not available, returning null');
73
- return null;
74
- }
75
- try {
76
- const password = await this.keytar.getPassword(this.service, key);
77
- if (password === null) {
78
- this.logger.debug({ storeId: this.id, service: this.service, account: key }, 'No credential found in keychain');
79
- }
80
- return password;
81
- }
82
- catch (error) {
83
- this.logger.error({
84
- storeId: this.id,
85
- service: this.service,
86
- account: key,
87
- error: error instanceof Error ? error.message : 'Unknown error',
88
- }, 'Error getting credential from keychain');
89
- return null;
90
- }
91
- }
92
- /**
93
- * Set a credential in the keychain
94
- */
95
- async set(key, value) {
96
- await this.initializationPromise;
97
- if (!this.keytarAvailable || !this.keytar) {
98
- this.logger.warn({ storeId: this.id, key }, 'Keytar not available, cannot set credential');
99
- throw new Error('Keytar not available - cannot store credentials in system keychain');
100
- }
101
- try {
102
- await this.keytar.setPassword(this.service, key, value);
103
- this.logger.debug({ storeId: this.id, service: this.service, account: key }, 'Credential stored in keychain');
104
- }
105
- catch (error) {
106
- this.logger.error({
107
- storeId: this.id,
108
- service: this.service,
109
- account: key,
110
- error: error instanceof Error ? error.message : 'Unknown error',
111
- }, 'Error setting credential in keychain');
112
- throw new Error(`Failed to store credential in keychain: ${error instanceof Error ? error.message : 'Unknown error'}`);
113
- }
114
- }
115
- /**
116
- * Check if a credential exists in the keychain
117
- */
118
- async has(key) {
119
- const credential = await this.get(key);
120
- return credential !== null;
121
- }
122
- /**
123
- * Delete a credential from the keychain
124
- */
125
- async delete(key) {
126
- await this.initializationPromise;
127
- if (!this.keytarAvailable || !this.keytar) {
128
- this.logger.warn({ storeId: this.id, key }, 'Keytar not available, cannot delete credential');
129
- return false;
130
- }
131
- try {
132
- const result = await this.keytar.deletePassword(this.service, key);
133
- if (result) {
134
- this.logger.debug({ storeId: this.id, service: this.service, account: key }, 'Credential deleted from keychain');
135
- }
136
- else {
137
- this.logger.debug({ storeId: this.id, service: this.service, account: key }, 'Credential not found in keychain for deletion');
138
- }
139
- return result;
140
- }
141
- catch (error) {
142
- this.logger.error({
143
- storeId: this.id,
144
- service: this.service,
145
- account: key,
146
- error: error instanceof Error ? error.message : 'Unknown error',
147
- }, 'Error deleting credential from keychain');
148
- return false;
149
- }
150
- }
151
- /**
152
- * Find all credentials for this service
153
- * Useful for debugging and listing stored credentials
154
- */
155
- async findAllCredentials() {
156
- await this.initializationPromise;
157
- if (!this.keytarAvailable || !this.keytar) {
158
- return [];
159
- }
160
- try {
161
- const credentials = await this.keytar.findCredentials(this.service);
162
- return credentials || [];
163
- }
164
- catch (error) {
165
- this.logger.error({
166
- storeId: this.id,
167
- service: this.service,
168
- error: error instanceof Error ? error.message : 'Unknown error',
169
- }, 'Error finding credentials in keychain');
170
- return [];
171
- }
172
- }
173
- /**
174
- * Clear all credentials for this service
175
- * WARNING: This will delete all credentials stored under this service
176
- */
177
- async clearAll() {
178
- const credentials = await this.findAllCredentials();
179
- let deletedCount = 0;
180
- for (const cred of credentials) {
181
- const deleted = await this.delete(cred.account);
182
- if (deleted) {
183
- deletedCount++;
184
- }
185
- }
186
- if (deletedCount > 0) {
187
- this.logger.info({
188
- storeId: this.id,
189
- service: this.service,
190
- deletedCount,
191
- }, 'Cleared all credentials from keychain');
192
- }
193
- return deletedCount;
194
- }
195
- }
196
- /**
197
- * Factory function to create KeyChainStore
198
- * Provides consistent initialization and optional configuration
199
- *
200
- * ## Usage Recommendations for macOS Permission Handling
201
- *
202
- * 1. **First-time setup**: Inform users that they may see permission prompts
203
- * 2. **Error handling**: Check for `null` returns from `get()` operations
204
- * 3. **User guidance**: If credentials can't be retrieved, guide users to:
205
- * - Check Keychain Access app for denied permissions
206
- * - Re-run the application if they accidentally clicked "Deny"
207
- * 4. **Development**: Use a consistent `servicePrefix` to avoid permission prompt spam
208
- * 5. **Production**: Consider code-signing your distributed app for better permission prompts
209
- *
210
- * Example usage with permission handling:
211
- * ```typescript
212
- * const store = createKeyChainStore('my-app');
213
- *
214
- * // Always check for null when retrieving
215
- * const apiKey = await store.get('api-key');
216
- * if (!apiKey) {
217
- * console.log('API key not found or access denied');
218
- * // Guide user to check permissions or re-enter credentials
219
- * }
220
- * ```
221
- */
222
- export function createKeyChainStore(id, options) {
223
- return new KeyChainStore(id, options?.servicePrefix);
224
- }
225
- //# sourceMappingURL=keychain-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keychain-store.js","sourceRoot":"","sources":["../../src/credential-stores/keychain-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,aAAa;IACR,EAAE,CAAS;IACX,IAAI,GAAG,UA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C;AACvD,CAAC"}
@@ -1,39 +0,0 @@
1
- import type { CredentialStore } from '../types/server';
2
- /**
3
- * In-memory credential store implementation
4
- * Automatically loads environment variables prefixed with CREDENTIAL_STORE_ on initialization
5
- * Note: Runtime credentials are lost when the server restarts, but env vars are reloaded
6
- */
7
- export declare class InMemoryCredentialStore implements CredentialStore {
8
- readonly id: string;
9
- readonly type = "memory";
10
- private credentials;
11
- constructor(id?: string);
12
- /**
13
- * Get a credential from the in memory store.
14
- * If the key is not found in the in memory store then it is loaded from environment variables.
15
- * If the key is not found in the environment variables or in the in memory store then returns null.
16
- * @param key - The key of the credential to get
17
- * @returns The credential value or null if not found
18
- */
19
- get(key: string): Promise<string | null>;
20
- /**
21
- * Set a credential in the in memory store.
22
- * @param key - The key of the credential to set
23
- * @param value - The value of the credential to set
24
- */
25
- set(key: string, value: string): Promise<void>;
26
- /**
27
- * Check if a credential exists in the in memory store.
28
- * @param key - The key of the credential to check
29
- * @returns True if the credential exists, false otherwise
30
- */
31
- has(key: string): Promise<boolean>;
32
- /**
33
- * Delete a credential from the in memory store.
34
- * @param key - The key of the credential to delete
35
- * @returns True if the credential was deleted, false otherwise
36
- */
37
- delete(key: string): Promise<boolean>;
38
- }
39
- //# sourceMappingURL=memory-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../src/credential-stores/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;GAIG;AACH,qBAAa,uBAAwB,YAAW,eAAe;IAC7D,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,YAAY;IAChC,OAAO,CAAC,WAAW,CAA6B;gBAEpC,EAAE,SAAmB;IAIjC;;;;;;OAMG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAgB9C;;;;OAIG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpD;;;;OAIG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxC;;;;OAIG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG5C"}
@@ -1,58 +0,0 @@
1
- /**
2
- * In-memory credential store implementation
3
- * Automatically loads environment variables prefixed with CREDENTIAL_STORE_ on initialization
4
- * Note: Runtime credentials are lost when the server restarts, but env vars are reloaded
5
- */
6
- export class InMemoryCredentialStore {
7
- id;
8
- type = 'memory';
9
- credentials = new Map();
10
- constructor(id = 'memory-default') {
11
- this.id = id;
12
- }
13
- /**
14
- * Get a credential from the in memory store.
15
- * If the key is not found in the in memory store then it is loaded from environment variables.
16
- * If the key is not found in the environment variables or in the in memory store then returns null.
17
- * @param key - The key of the credential to get
18
- * @returns The credential value or null if not found
19
- */
20
- async get(key) {
21
- const credential = this.credentials.get(key);
22
- if (!credential) {
23
- // Try loading from environment variables
24
- const envValue = process.env[key];
25
- if (envValue) {
26
- this.credentials.set(key, envValue);
27
- return envValue;
28
- }
29
- return null;
30
- }
31
- return credential;
32
- }
33
- /**
34
- * Set a credential in the in memory store.
35
- * @param key - The key of the credential to set
36
- * @param value - The value of the credential to set
37
- */
38
- async set(key, value) {
39
- this.credentials.set(key, value);
40
- }
41
- /**
42
- * Check if a credential exists in the in memory store.
43
- * @param key - The key of the credential to check
44
- * @returns True if the credential exists, false otherwise
45
- */
46
- async has(key) {
47
- return this.credentials.has(key);
48
- }
49
- /**
50
- * Delete a credential from the in memory store.
51
- * @param key - The key of the credential to delete
52
- * @returns True if the credential was deleted, false otherwise
53
- */
54
- async delete(key) {
55
- return this.credentials.delete(key);
56
- }
57
- }
58
- //# sourceMappingURL=memory-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../src/credential-stores/memory-store.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAClB,EAAE,CAAS;IACX,IAAI,GAAG,QAAQ,CAAC;IACxB,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,YAAY,EAAE,GAAG,gBAAgB;QAC/B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE7C,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,yCAAyC;YACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;gBACpC,OAAO,QAAQ,CAAC;YAClB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa;QAClC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -1,59 +0,0 @@
1
- import type { CredentialStore } from '../types/server';
2
- export interface NangoConfig {
3
- secretKey: string;
4
- apiUrl?: string;
5
- }
6
- /**
7
- * Nango-specific credential data with additional properties
8
- */
9
- export interface NangoCredentialData {
10
- connectionId: string;
11
- providerConfigKey: string;
12
- secretKey: string;
13
- provider: string;
14
- token?: string;
15
- metadata?: Record<string, any>;
16
- }
17
- /**
18
- * Nango-based CredentialStore that fetches OAuth credentials from Nango API
19
- * Uses connectionId and providerConfigKey from metadata to fetch live credentials
20
- */
21
- export declare class NangoCredentialStore implements CredentialStore {
22
- readonly id: string;
23
- readonly type = "nango";
24
- private nangoConfig;
25
- private nangoClient;
26
- constructor(id: string, config: NangoConfig);
27
- private getAccessToken;
28
- private sanitizeMetadata;
29
- /**
30
- * Fetch credentials from Nango API using connection information
31
- * @param connectionId - The connection ID for the Nango connection
32
- * @param providerConfigKey - The provider config key for the Nango connection
33
- * @returns The credential data or null if the credentials are not found
34
- */
35
- private fetchCredentialsFromNango;
36
- /**
37
- * Get credentials by key - implements CredentialStore interface
38
- * Key format: JSON string with connectionId and providerConfigKey
39
- */
40
- get(key: string): Promise<string | null>;
41
- /**
42
- * Set credentials - not supported for Nango (OAuth flow handles this)
43
- */
44
- set(key: string, value: string): Promise<void>;
45
- /**
46
- * Check if credentials exist by attempting to fetch them
47
- */
48
- has(key: string): Promise<boolean>;
49
- /**
50
- * Delete credentials - not supported for Nango (revoke through Nango dashboard)
51
- */
52
- delete(key: string): Promise<boolean>;
53
- }
54
- /**
55
- * Factory function to create NangoCredentialStore
56
- * Automatically reads NANGO_SECRET_KEY from environment and validates it
57
- */
58
- export declare function createNangoCredentialStore(id: string, config?: Partial<NangoConfig>): NangoCredentialStore;
59
- //# sourceMappingURL=nango-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nango-store.d.ts","sourceRoot":"","sources":["../../src/credential-stores/nango-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAWvD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,E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