@ggakila/agentx-framework 0.1.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/CHANGELOG.md +107 -0
- package/LICENSE +21 -0
- package/README.md +335 -0
- package/dist/agent/Agent.d.ts +110 -0
- package/dist/agent/Agent.d.ts.map +1 -0
- package/dist/agent/Agent.js +291 -0
- package/dist/agent/Agent.js.map +1 -0
- package/dist/agent/index.d.ts +5 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +11 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/cli/CLI.d.ts +74 -0
- package/dist/cli/CLI.d.ts.map +1 -0
- package/dist/cli/CLI.js +255 -0
- package/dist/cli/CLI.js.map +1 -0
- package/dist/cli/InteractiveSetup.d.ts +104 -0
- package/dist/cli/InteractiveSetup.d.ts.map +1 -0
- package/dist/cli/InteractiveSetup.js +2225 -0
- package/dist/cli/InteractiveSetup.js.map +1 -0
- package/dist/cli/bin.d.ts +7 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +35 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/ProjectCommands.d.ts +23 -0
- package/dist/cli/commands/ProjectCommands.d.ts.map +1 -0
- package/dist/cli/commands/ProjectCommands.js +504 -0
- package/dist/cli/commands/ProjectCommands.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +21 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/credential/CredentialManager.d.ts +112 -0
- package/dist/credential/CredentialManager.d.ts.map +1 -0
- package/dist/credential/CredentialManager.js +343 -0
- package/dist/credential/CredentialManager.js.map +1 -0
- package/dist/credential/OAuth2Manager.d.ts +206 -0
- package/dist/credential/OAuth2Manager.d.ts.map +1 -0
- package/dist/credential/OAuth2Manager.js +463 -0
- package/dist/credential/OAuth2Manager.js.map +1 -0
- package/dist/credential/index.d.ts +6 -0
- package/dist/credential/index.d.ts.map +1 -0
- package/dist/credential/index.js +16 -0
- package/dist/credential/index.js.map +1 -0
- package/dist/error/ErrorHandler.d.ts +74 -0
- package/dist/error/ErrorHandler.d.ts.map +1 -0
- package/dist/error/ErrorHandler.js +279 -0
- package/dist/error/ErrorHandler.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/DatabaseTool.d.ts +149 -0
- package/dist/integrations/DatabaseTool.d.ts.map +1 -0
- package/dist/integrations/DatabaseTool.js +900 -0
- package/dist/integrations/DatabaseTool.js.map +1 -0
- package/dist/integrations/EmailTool.d.ts +142 -0
- package/dist/integrations/EmailTool.d.ts.map +1 -0
- package/dist/integrations/EmailTool.js +259 -0
- package/dist/integrations/EmailTool.js.map +1 -0
- package/dist/integrations/FileSystemTool.d.ts +153 -0
- package/dist/integrations/FileSystemTool.d.ts.map +1 -0
- package/dist/integrations/FileSystemTool.js +835 -0
- package/dist/integrations/FileSystemTool.js.map +1 -0
- package/dist/integrations/GoogleWorkspaceTool.d.ts +125 -0
- package/dist/integrations/GoogleWorkspaceTool.d.ts.map +1 -0
- package/dist/integrations/GoogleWorkspaceTool.js +765 -0
- package/dist/integrations/GoogleWorkspaceTool.js.map +1 -0
- package/dist/integrations/HttpTool.d.ts +55 -0
- package/dist/integrations/HttpTool.d.ts.map +1 -0
- package/dist/integrations/HttpTool.js +209 -0
- package/dist/integrations/HttpTool.js.map +1 -0
- package/dist/integrations/MessagingTool.d.ts +136 -0
- package/dist/integrations/MessagingTool.d.ts.map +1 -0
- package/dist/integrations/MessagingTool.js +503 -0
- package/dist/integrations/MessagingTool.js.map +1 -0
- package/dist/integrations/SchedulerTool.d.ts +147 -0
- package/dist/integrations/SchedulerTool.d.ts.map +1 -0
- package/dist/integrations/SchedulerTool.js +471 -0
- package/dist/integrations/SchedulerTool.js.map +1 -0
- package/dist/integrations/WebhookTool.d.ts +97 -0
- package/dist/integrations/WebhookTool.d.ts.map +1 -0
- package/dist/integrations/WebhookTool.js +351 -0
- package/dist/integrations/WebhookTool.js.map +1 -0
- package/dist/integrations/index.d.ts +13 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +60 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/llm/LLMProvider.d.ts +83 -0
- package/dist/llm/LLMProvider.d.ts.map +1 -0
- package/dist/llm/LLMProvider.js +370 -0
- package/dist/llm/LLMProvider.js.map +1 -0
- package/dist/llm/index.d.ts +5 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +14 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/payment/PaymentProvider.d.ts +157 -0
- package/dist/payment/PaymentProvider.d.ts.map +1 -0
- package/dist/payment/PaymentProvider.js +525 -0
- package/dist/payment/PaymentProvider.js.map +1 -0
- package/dist/payment/index.d.ts +5 -0
- package/dist/payment/index.d.ts.map +1 -0
- package/dist/payment/index.js +16 -0
- package/dist/payment/index.js.map +1 -0
- package/dist/plugin/PluginManager.d.ts +156 -0
- package/dist/plugin/PluginManager.d.ts.map +1 -0
- package/dist/plugin/PluginManager.js +288 -0
- package/dist/plugin/PluginManager.js.map +1 -0
- package/dist/plugin/index.d.ts +5 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +10 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/runtime/AgentXRuntime.d.ts +90 -0
- package/dist/runtime/AgentXRuntime.d.ts.map +1 -0
- package/dist/runtime/AgentXRuntime.js +469 -0
- package/dist/runtime/AgentXRuntime.js.map +1 -0
- package/dist/security/SecurityManager.d.ts +245 -0
- package/dist/security/SecurityManager.d.ts.map +1 -0
- package/dist/security/SecurityManager.js +512 -0
- package/dist/security/SecurityManager.js.map +1 -0
- package/dist/security/index.d.ts +5 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +14 -0
- package/dist/security/index.js.map +1 -0
- package/dist/tool/ToolRegistry.d.ts +58 -0
- package/dist/tool/ToolRegistry.d.ts.map +1 -0
- package/dist/tool/ToolRegistry.js +173 -0
- package/dist/tool/ToolRegistry.js.map +1 -0
- package/dist/tool/ToolValidator.d.ts +41 -0
- package/dist/tool/ToolValidator.d.ts.map +1 -0
- package/dist/tool/ToolValidator.js +158 -0
- package/dist/tool/ToolValidator.js.map +1 -0
- package/dist/tool/index.d.ts +6 -0
- package/dist/tool/index.d.ts.map +1 -0
- package/dist/tool/index.js +11 -0
- package/dist/tool/index.js.map +1 -0
- package/dist/transport/BaseTransport.d.ts +66 -0
- package/dist/transport/BaseTransport.d.ts.map +1 -0
- package/dist/transport/BaseTransport.js +103 -0
- package/dist/transport/BaseTransport.js.map +1 -0
- package/dist/transport/HttpTransport.d.ts +41 -0
- package/dist/transport/HttpTransport.d.ts.map +1 -0
- package/dist/transport/HttpTransport.js +160 -0
- package/dist/transport/HttpTransport.js.map +1 -0
- package/dist/transport/LocalTransport.d.ts +40 -0
- package/dist/transport/LocalTransport.d.ts.map +1 -0
- package/dist/transport/LocalTransport.js +157 -0
- package/dist/transport/LocalTransport.js.map +1 -0
- package/dist/transport/QueueTransport.d.ts +63 -0
- package/dist/transport/QueueTransport.d.ts.map +1 -0
- package/dist/transport/QueueTransport.js +194 -0
- package/dist/transport/QueueTransport.js.map +1 -0
- package/dist/transport/StdioTransport.d.ts +51 -0
- package/dist/transport/StdioTransport.d.ts.map +1 -0
- package/dist/transport/StdioTransport.js +216 -0
- package/dist/transport/StdioTransport.js.map +1 -0
- package/dist/transport/TransportFactory.d.ts +35 -0
- package/dist/transport/TransportFactory.d.ts.map +1 -0
- package/dist/transport/TransportFactory.js +100 -0
- package/dist/transport/TransportFactory.js.map +1 -0
- package/dist/transport/index.d.ts +10 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +19 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/types/agent.d.ts +66 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +3 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/config.d.ts +60 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +6 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/credential.d.ts +38 -0
- package/dist/types/credential.d.ts.map +1 -0
- package/dist/types/credential.js +3 -0
- package/dist/types/credential.js.map +1 -0
- package/dist/types/error.d.ts +136 -0
- package/dist/types/error.d.ts.map +1 -0
- package/dist/types/error.js +223 -0
- package/dist/types/error.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +27 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/llm.d.ts +43 -0
- package/dist/types/llm.d.ts.map +1 -0
- package/dist/types/llm.js +3 -0
- package/dist/types/llm.js.map +1 -0
- package/dist/types/payment.d.ts +129 -0
- package/dist/types/payment.d.ts.map +1 -0
- package/dist/types/payment.js +6 -0
- package/dist/types/payment.js.map +1 -0
- package/dist/types/runtime.d.ts +31 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +3 -0
- package/dist/types/runtime.js.map +1 -0
- package/dist/types/tool.d.ts +72 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/tool.js +3 -0
- package/dist/types/tool.js.map +1 -0
- package/dist/types/transport.d.ts +53 -0
- package/dist/types/transport.d.ts.map +1 -0
- package/dist/types/transport.js +3 -0
- package/dist/types/transport.js.map +1 -0
- package/dist/types/workflow.d.ts +72 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workflow.js +6 -0
- package/dist/types/workflow.js.map +1 -0
- package/dist/utils/factory.d.ts +14 -0
- package/dist/utils/factory.d.ts.map +1 -0
- package/dist/utils/factory.js +146 -0
- package/dist/utils/factory.js.map +1 -0
- package/dist/workflow/StateManager.d.ts +93 -0
- package/dist/workflow/StateManager.d.ts.map +1 -0
- package/dist/workflow/StateManager.js +223 -0
- package/dist/workflow/StateManager.js.map +1 -0
- package/dist/workflow/WorkflowDefinition.d.ts +49 -0
- package/dist/workflow/WorkflowDefinition.d.ts.map +1 -0
- package/dist/workflow/WorkflowDefinition.js +264 -0
- package/dist/workflow/WorkflowDefinition.js.map +1 -0
- package/dist/workflow/WorkflowExecutor.d.ts +42 -0
- package/dist/workflow/WorkflowExecutor.d.ts.map +1 -0
- package/dist/workflow/WorkflowExecutor.js +372 -0
- package/dist/workflow/WorkflowExecutor.js.map +1 -0
- package/dist/workflow/index.d.ts +7 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +17 -0
- package/dist/workflow/index.js.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Credential Management System
|
|
4
|
+
* Provides secure credential storage, encryption, and OAuth2 support
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CredentialScopeResolver = exports.CredentialManager = exports.InMemoryCredentialStore = void 0;
|
|
8
|
+
const crypto_1 = require("crypto");
|
|
9
|
+
const error_1 = require("../types/error");
|
|
10
|
+
class InMemoryCredentialStore {
|
|
11
|
+
store = new Map();
|
|
12
|
+
async save(key, data) {
|
|
13
|
+
this.store.set(key, data);
|
|
14
|
+
}
|
|
15
|
+
async load(key) {
|
|
16
|
+
return this.store.get(key) || null;
|
|
17
|
+
}
|
|
18
|
+
async delete(key) {
|
|
19
|
+
this.store.delete(key);
|
|
20
|
+
}
|
|
21
|
+
async list() {
|
|
22
|
+
return Array.from(this.store.keys());
|
|
23
|
+
}
|
|
24
|
+
clear() {
|
|
25
|
+
this.store.clear();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.InMemoryCredentialStore = InMemoryCredentialStore;
|
|
29
|
+
class CredentialManager {
|
|
30
|
+
store;
|
|
31
|
+
logger;
|
|
32
|
+
encryptionKey;
|
|
33
|
+
algorithm = 'aes-256-gcm';
|
|
34
|
+
oauth2Manager;
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this.store = config.store;
|
|
37
|
+
this.logger = config.logger;
|
|
38
|
+
this.oauth2Manager = config.oauth2Manager;
|
|
39
|
+
// Derive a 32-byte key from the provided encryption key
|
|
40
|
+
this.encryptionKey = (0, crypto_1.scryptSync)(config.encryptionKey, 'agentx-salt', 32);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Set the OAuth2 manager for token refresh support
|
|
44
|
+
*/
|
|
45
|
+
setOAuth2Manager(manager) {
|
|
46
|
+
this.oauth2Manager = manager;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the OAuth2 manager
|
|
50
|
+
*/
|
|
51
|
+
getOAuth2Manager() {
|
|
52
|
+
return this.oauth2Manager;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Store a credential with encryption
|
|
56
|
+
*/
|
|
57
|
+
async setCredential(scope, credential) {
|
|
58
|
+
this.validateCredential(credential);
|
|
59
|
+
this.validateScope(scope);
|
|
60
|
+
const key = this.getScopeKey(scope);
|
|
61
|
+
const encrypted = this.encrypt(JSON.stringify(credential));
|
|
62
|
+
await this.store.save(key, encrypted);
|
|
63
|
+
this.logger.info(`Credential stored for scope: ${scope}`, { type: credential.type });
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Retrieve and decrypt a credential
|
|
67
|
+
*/
|
|
68
|
+
async getCredential(scope) {
|
|
69
|
+
this.validateScope(scope);
|
|
70
|
+
const key = this.getScopeKey(scope);
|
|
71
|
+
const encrypted = await this.store.load(key);
|
|
72
|
+
if (!encrypted) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const decrypted = this.decrypt(encrypted);
|
|
77
|
+
const credential = JSON.parse(decrypted);
|
|
78
|
+
// Check expiration
|
|
79
|
+
if (credential.expiresAt && new Date(credential.expiresAt) < new Date()) {
|
|
80
|
+
this.logger.warn(`Credential expired for scope: ${scope}`);
|
|
81
|
+
// For OAuth2, try to refresh
|
|
82
|
+
if (credential.type === 'oauth2') {
|
|
83
|
+
return this.handleExpiredOAuth2(scope, credential);
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return credential;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
this.logger.error(`Failed to decrypt credential for scope: ${scope}`, error);
|
|
91
|
+
throw new error_1.SecurityError('Failed to decrypt credential', error_1.ErrorCodes.INVALID_CREDENTIALS);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Delete a credential
|
|
96
|
+
*/
|
|
97
|
+
async deleteCredential(scope) {
|
|
98
|
+
this.validateScope(scope);
|
|
99
|
+
const key = this.getScopeKey(scope);
|
|
100
|
+
await this.store.delete(key);
|
|
101
|
+
this.logger.info(`Credential deleted for scope: ${scope}`);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* List all credential scopes
|
|
105
|
+
*/
|
|
106
|
+
async listCredentials() {
|
|
107
|
+
const keys = await this.store.list();
|
|
108
|
+
return keys
|
|
109
|
+
.filter(k => k.startsWith('credential:'))
|
|
110
|
+
.map(k => k.replace('credential:', ''));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Inject credentials for a tool context
|
|
114
|
+
*/
|
|
115
|
+
async injectCredentials(scope) {
|
|
116
|
+
const credential = await this.getCredential(scope);
|
|
117
|
+
if (!credential) {
|
|
118
|
+
return {};
|
|
119
|
+
}
|
|
120
|
+
// Return only the data needed for the tool, not the full credential
|
|
121
|
+
return this.extractCredentialData(credential);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Check if a credential exists and is valid
|
|
125
|
+
*/
|
|
126
|
+
async hasValidCredential(scope) {
|
|
127
|
+
const credential = await this.getCredential(scope);
|
|
128
|
+
return credential !== null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Refresh an OAuth2 token
|
|
132
|
+
*/
|
|
133
|
+
async refreshOAuth2Token(scope, providerName) {
|
|
134
|
+
const credential = await this.getCredential(scope);
|
|
135
|
+
if (!credential || credential.type !== 'oauth2') {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const oauth2 = credential;
|
|
139
|
+
if (!oauth2.data.refreshToken) {
|
|
140
|
+
this.logger.warn(`No refresh token available for scope: ${scope}`);
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
// If we have an OAuth2Manager and provider name, use it for refresh
|
|
144
|
+
if (this.oauth2Manager && providerName) {
|
|
145
|
+
try {
|
|
146
|
+
const refreshed = await this.oauth2Manager.refreshToken(providerName, oauth2);
|
|
147
|
+
// Store the refreshed credential
|
|
148
|
+
await this.setCredential(scope, refreshed);
|
|
149
|
+
this.logger.info(`OAuth2 token refreshed for scope: ${scope}`);
|
|
150
|
+
return refreshed;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
this.logger.error(`OAuth2 token refresh failed for scope: ${scope}`, error);
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Fallback: return existing credential if no OAuth2Manager
|
|
158
|
+
this.logger.debug(`OAuth2 token refresh requested for scope: ${scope} (no OAuth2Manager configured)`);
|
|
159
|
+
return oauth2;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Initiate OAuth2 authorization flow
|
|
163
|
+
*/
|
|
164
|
+
initiateOAuth2Flow(providerName, scopes) {
|
|
165
|
+
if (!this.oauth2Manager) {
|
|
166
|
+
throw new error_1.ValidationError('OAuth2Manager not configured', error_1.ErrorCodes.MISSING_CONFIG);
|
|
167
|
+
}
|
|
168
|
+
return this.oauth2Manager.initiateFlow(providerName, scopes);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Complete OAuth2 authorization flow
|
|
172
|
+
*/
|
|
173
|
+
async completeOAuth2Flow(code, state, scope) {
|
|
174
|
+
if (!this.oauth2Manager) {
|
|
175
|
+
throw new error_1.ValidationError('OAuth2Manager not configured', error_1.ErrorCodes.MISSING_CONFIG);
|
|
176
|
+
}
|
|
177
|
+
const credential = await this.oauth2Manager.completeFlow(code, state);
|
|
178
|
+
// Store the credential
|
|
179
|
+
await this.setCredential(scope, credential);
|
|
180
|
+
return credential;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Register an OAuth2 provider
|
|
184
|
+
*/
|
|
185
|
+
registerOAuth2Provider(config) {
|
|
186
|
+
if (!this.oauth2Manager) {
|
|
187
|
+
throw new error_1.ValidationError('OAuth2Manager not configured', error_1.ErrorCodes.MISSING_CONFIG);
|
|
188
|
+
}
|
|
189
|
+
this.oauth2Manager.registerProvider(config);
|
|
190
|
+
}
|
|
191
|
+
// Private methods
|
|
192
|
+
encrypt(plaintext) {
|
|
193
|
+
const iv = (0, crypto_1.randomBytes)(16);
|
|
194
|
+
const cipher = (0, crypto_1.createCipheriv)(this.algorithm, this.encryptionKey, iv);
|
|
195
|
+
let encrypted = cipher.update(plaintext, 'utf8', 'hex');
|
|
196
|
+
encrypted += cipher.final('hex');
|
|
197
|
+
const authTag = cipher.getAuthTag();
|
|
198
|
+
// Combine IV + authTag + encrypted data
|
|
199
|
+
return iv.toString('hex') + ':' + authTag.toString('hex') + ':' + encrypted;
|
|
200
|
+
}
|
|
201
|
+
decrypt(ciphertext) {
|
|
202
|
+
const parts = ciphertext.split(':');
|
|
203
|
+
if (parts.length !== 3) {
|
|
204
|
+
throw new error_1.SecurityError('Invalid encrypted data format', error_1.ErrorCodes.INVALID_CREDENTIALS);
|
|
205
|
+
}
|
|
206
|
+
const iv = Buffer.from(parts[0], 'hex');
|
|
207
|
+
const authTag = Buffer.from(parts[1], 'hex');
|
|
208
|
+
const encrypted = parts[2];
|
|
209
|
+
const decipher = (0, crypto_1.createDecipheriv)(this.algorithm, this.encryptionKey, iv);
|
|
210
|
+
decipher.setAuthTag(authTag);
|
|
211
|
+
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
|
|
212
|
+
decrypted += decipher.final('utf8');
|
|
213
|
+
return decrypted;
|
|
214
|
+
}
|
|
215
|
+
validateCredential(credential) {
|
|
216
|
+
if (!credential.type) {
|
|
217
|
+
throw new error_1.ValidationError('Credential type is required', error_1.ErrorCodes.MISSING_REQUIRED_FIELD);
|
|
218
|
+
}
|
|
219
|
+
const validTypes = ['api_key', 'oauth2', 'basic_auth', 'custom'];
|
|
220
|
+
if (!validTypes.includes(credential.type)) {
|
|
221
|
+
throw new error_1.ValidationError(`Invalid credential type: ${credential.type}`, error_1.ErrorCodes.INVALID_FORMAT);
|
|
222
|
+
}
|
|
223
|
+
if (!credential.data || typeof credential.data !== 'object') {
|
|
224
|
+
throw new error_1.ValidationError('Credential data is required', error_1.ErrorCodes.MISSING_REQUIRED_FIELD);
|
|
225
|
+
}
|
|
226
|
+
// Type-specific validation
|
|
227
|
+
switch (credential.type) {
|
|
228
|
+
case 'api_key':
|
|
229
|
+
if (!credential.data.key) {
|
|
230
|
+
throw new error_1.ValidationError('API key credential requires key field', error_1.ErrorCodes.MISSING_REQUIRED_FIELD);
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
case 'oauth2':
|
|
234
|
+
if (!credential.data.accessToken) {
|
|
235
|
+
throw new error_1.ValidationError('OAuth2 credential requires accessToken', error_1.ErrorCodes.MISSING_REQUIRED_FIELD);
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
case 'basic_auth':
|
|
239
|
+
if (!credential.data.username || !credential.data.password) {
|
|
240
|
+
throw new error_1.ValidationError('Basic auth requires username and password', error_1.ErrorCodes.MISSING_REQUIRED_FIELD);
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
validateScope(scope) {
|
|
246
|
+
if (!scope || typeof scope !== 'string') {
|
|
247
|
+
throw new error_1.ValidationError('Scope is required', error_1.ErrorCodes.MISSING_REQUIRED_FIELD);
|
|
248
|
+
}
|
|
249
|
+
// Scope format: provider:resource or provider:resource:action
|
|
250
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]*(:[a-zA-Z][a-zA-Z0-9_-]*)*$/.test(scope)) {
|
|
251
|
+
throw new error_1.ValidationError('Invalid scope format. Use format: provider:resource[:action]', error_1.ErrorCodes.INVALID_FORMAT);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
getScopeKey(scope) {
|
|
255
|
+
return `credential:${scope}`;
|
|
256
|
+
}
|
|
257
|
+
extractCredentialData(credential) {
|
|
258
|
+
switch (credential.type) {
|
|
259
|
+
case 'api_key':
|
|
260
|
+
return { apiKey: credential.data.key };
|
|
261
|
+
case 'oauth2':
|
|
262
|
+
return {
|
|
263
|
+
accessToken: credential.data.accessToken,
|
|
264
|
+
tokenType: credential.data.tokenType || 'Bearer',
|
|
265
|
+
};
|
|
266
|
+
case 'basic_auth':
|
|
267
|
+
return {
|
|
268
|
+
username: credential.data.username,
|
|
269
|
+
password: credential.data.password,
|
|
270
|
+
};
|
|
271
|
+
case 'custom':
|
|
272
|
+
return credential.data;
|
|
273
|
+
default:
|
|
274
|
+
return {};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
async handleExpiredOAuth2(scope, credential) {
|
|
278
|
+
if (!credential.data.refreshToken) {
|
|
279
|
+
await this.deleteCredential(scope);
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
// Extract provider name from scope if possible (format: provider:resource)
|
|
283
|
+
const parts = scope.split(':');
|
|
284
|
+
const providerName = parts[0];
|
|
285
|
+
// Attempt refresh
|
|
286
|
+
try {
|
|
287
|
+
const refreshed = await this.refreshOAuth2Token(scope, providerName);
|
|
288
|
+
return refreshed;
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
this.logger.error(`Failed to refresh expired OAuth2 token for scope: ${scope}`, error);
|
|
292
|
+
await this.deleteCredential(scope);
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
exports.CredentialManager = CredentialManager;
|
|
298
|
+
/**
|
|
299
|
+
* Credential scoping utility
|
|
300
|
+
*/
|
|
301
|
+
class CredentialScopeResolver {
|
|
302
|
+
/**
|
|
303
|
+
* Check if a scope matches a pattern
|
|
304
|
+
*/
|
|
305
|
+
static matches(scope, pattern) {
|
|
306
|
+
// Exact match
|
|
307
|
+
if (scope === pattern)
|
|
308
|
+
return true;
|
|
309
|
+
// Wildcard match
|
|
310
|
+
if (pattern.endsWith(':*')) {
|
|
311
|
+
const prefix = pattern.slice(0, -2);
|
|
312
|
+
return scope.startsWith(prefix + ':') || scope === prefix;
|
|
313
|
+
}
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Get the most specific matching scope from a list
|
|
318
|
+
*/
|
|
319
|
+
static findBestMatch(scope, availableScopes) {
|
|
320
|
+
// First try exact match
|
|
321
|
+
if (availableScopes.includes(scope)) {
|
|
322
|
+
return scope;
|
|
323
|
+
}
|
|
324
|
+
// Then try wildcard matches, preferring more specific ones
|
|
325
|
+
const matches = availableScopes
|
|
326
|
+
.filter(s => this.matches(scope, s))
|
|
327
|
+
.sort((a, b) => b.length - a.length);
|
|
328
|
+
return matches[0] || null;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Parse a scope into its components
|
|
332
|
+
*/
|
|
333
|
+
static parse(scope) {
|
|
334
|
+
const parts = scope.split(':');
|
|
335
|
+
return {
|
|
336
|
+
provider: parts[0],
|
|
337
|
+
resource: parts[1],
|
|
338
|
+
action: parts[2],
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
exports.CredentialScopeResolver = CredentialScopeResolver;
|
|
343
|
+
//# sourceMappingURL=CredentialManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialManager.js","sourceRoot":"","sources":["../../src/credential/CredentialManager.ts"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IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAa,EAAE,eAAyB;QAC3D,wBAAwB;QACxB,IAAI,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,2DAA2D;QAC3D,MAAM,OAAO,GAAG,eAAe;aAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;aACnC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;QAEvC,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,KAAa;QACxB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,OAAO;YACL,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;YAClB,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;YAClB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;SACjB,CAAC;IACJ,CAAC;CACF;AA7CD,0DA6CC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth2 Flow and Token Management
|
|
3
|
+
* Provides OAuth2 authorization flow handling and automatic token refresh
|
|
4
|
+
*/
|
|
5
|
+
import { OAuth2Credential } from '../types/credential';
|
|
6
|
+
import { Logger } from '../types/tool';
|
|
7
|
+
/**
|
|
8
|
+
* OAuth2 Provider Configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface OAuth2ProviderConfig {
|
|
11
|
+
name: string;
|
|
12
|
+
authorizationUrl: string;
|
|
13
|
+
tokenUrl: string;
|
|
14
|
+
clientId: string;
|
|
15
|
+
clientSecret: string;
|
|
16
|
+
redirectUri: string;
|
|
17
|
+
scopes?: string[];
|
|
18
|
+
additionalParams?: Record<string, string>;
|
|
19
|
+
refreshThresholdSeconds?: number;
|
|
20
|
+
usesPKCE?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* OAuth2 Token Response from provider
|
|
24
|
+
*/
|
|
25
|
+
export interface OAuth2TokenResponse {
|
|
26
|
+
access_token: string;
|
|
27
|
+
token_type: string;
|
|
28
|
+
expires_in?: number;
|
|
29
|
+
refresh_token?: string;
|
|
30
|
+
scope?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* OAuth2 State for tracking authorization flows
|
|
34
|
+
*/
|
|
35
|
+
export interface OAuth2State {
|
|
36
|
+
provider: string;
|
|
37
|
+
scopes: string[];
|
|
38
|
+
redirectUri: string;
|
|
39
|
+
codeVerifier?: string;
|
|
40
|
+
createdAt: Date;
|
|
41
|
+
expiresAt: Date;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* HTTP Client interface for OAuth2 requests
|
|
45
|
+
*/
|
|
46
|
+
export interface OAuth2HttpClient {
|
|
47
|
+
post(url: string, data: Record<string, string>, headers?: Record<string, string>): Promise<OAuth2TokenResponse>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Default HTTP client using fetch
|
|
51
|
+
*/
|
|
52
|
+
export declare class DefaultOAuth2HttpClient implements OAuth2HttpClient {
|
|
53
|
+
post(url: string, data: Record<string, string>, headers?: Record<string, string>): Promise<OAuth2TokenResponse>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* OAuth2 Manager Configuration
|
|
57
|
+
*/
|
|
58
|
+
export interface OAuth2ManagerConfig {
|
|
59
|
+
logger: Logger;
|
|
60
|
+
httpClient?: OAuth2HttpClient;
|
|
61
|
+
stateExpirationMinutes?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* OAuth2 Manager
|
|
65
|
+
* Handles OAuth2 authorization flows and token management
|
|
66
|
+
*/
|
|
67
|
+
export declare class OAuth2Manager {
|
|
68
|
+
private providers;
|
|
69
|
+
private pendingStates;
|
|
70
|
+
private logger;
|
|
71
|
+
private httpClient;
|
|
72
|
+
private stateExpirationMinutes;
|
|
73
|
+
constructor(config: OAuth2ManagerConfig);
|
|
74
|
+
/**
|
|
75
|
+
* Register an OAuth2 provider
|
|
76
|
+
*/
|
|
77
|
+
registerProvider(config: OAuth2ProviderConfig): void;
|
|
78
|
+
/**
|
|
79
|
+
* Unregister an OAuth2 provider
|
|
80
|
+
*/
|
|
81
|
+
unregisterProvider(name: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Get a registered provider
|
|
84
|
+
*/
|
|
85
|
+
getProvider(name: string): OAuth2ProviderConfig | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* List all registered providers
|
|
88
|
+
*/
|
|
89
|
+
listProviders(): string[];
|
|
90
|
+
/**
|
|
91
|
+
* Initiate OAuth2 authorization flow
|
|
92
|
+
* Returns the authorization URL to redirect the user to
|
|
93
|
+
*/
|
|
94
|
+
initiateFlow(providerName: string, scopes?: string[]): string;
|
|
95
|
+
/**
|
|
96
|
+
* Complete OAuth2 authorization flow
|
|
97
|
+
* Exchange authorization code for tokens
|
|
98
|
+
*/
|
|
99
|
+
completeFlow(code: string, state: string): Promise<OAuth2Credential>;
|
|
100
|
+
/**
|
|
101
|
+
* Refresh an OAuth2 token
|
|
102
|
+
*/
|
|
103
|
+
refreshToken(providerName: string, credential: OAuth2Credential): Promise<OAuth2Credential>;
|
|
104
|
+
/**
|
|
105
|
+
* Check if a token needs refresh
|
|
106
|
+
*/
|
|
107
|
+
needsRefresh(credential: OAuth2Credential, thresholdSeconds?: number): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Check if a token is expired
|
|
110
|
+
*/
|
|
111
|
+
isExpired(credential: OAuth2Credential): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Get pending state data (for testing/debugging)
|
|
114
|
+
*/
|
|
115
|
+
getPendingState(state: string): OAuth2State | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Clean up expired states
|
|
118
|
+
*/
|
|
119
|
+
cleanupExpiredStates(): number;
|
|
120
|
+
private validateProviderConfig;
|
|
121
|
+
private generateState;
|
|
122
|
+
private generateCodeVerifier;
|
|
123
|
+
private generateCodeChallenge;
|
|
124
|
+
private buildCredential;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Common OAuth2 Provider Presets
|
|
128
|
+
* Pre-configured settings for popular OAuth2 providers
|
|
129
|
+
*/
|
|
130
|
+
export declare const OAuth2Providers: {
|
|
131
|
+
/**
|
|
132
|
+
* Google OAuth2 configuration
|
|
133
|
+
*/
|
|
134
|
+
google: (config: {
|
|
135
|
+
clientId: string;
|
|
136
|
+
clientSecret: string;
|
|
137
|
+
redirectUri: string;
|
|
138
|
+
scopes?: string[];
|
|
139
|
+
}) => OAuth2ProviderConfig;
|
|
140
|
+
/**
|
|
141
|
+
* GitHub OAuth2 configuration
|
|
142
|
+
*/
|
|
143
|
+
github: (config: {
|
|
144
|
+
clientId: string;
|
|
145
|
+
clientSecret: string;
|
|
146
|
+
redirectUri: string;
|
|
147
|
+
scopes?: string[];
|
|
148
|
+
}) => OAuth2ProviderConfig;
|
|
149
|
+
/**
|
|
150
|
+
* Microsoft/Azure AD OAuth2 configuration
|
|
151
|
+
*/
|
|
152
|
+
microsoft: (config: {
|
|
153
|
+
clientId: string;
|
|
154
|
+
clientSecret: string;
|
|
155
|
+
redirectUri: string;
|
|
156
|
+
tenantId?: string;
|
|
157
|
+
scopes?: string[];
|
|
158
|
+
}) => OAuth2ProviderConfig;
|
|
159
|
+
/**
|
|
160
|
+
* Slack OAuth2 configuration
|
|
161
|
+
*/
|
|
162
|
+
slack: (config: {
|
|
163
|
+
clientId: string;
|
|
164
|
+
clientSecret: string;
|
|
165
|
+
redirectUri: string;
|
|
166
|
+
scopes?: string[];
|
|
167
|
+
}) => OAuth2ProviderConfig;
|
|
168
|
+
/**
|
|
169
|
+
* Salesforce OAuth2 configuration
|
|
170
|
+
*/
|
|
171
|
+
salesforce: (config: {
|
|
172
|
+
clientId: string;
|
|
173
|
+
clientSecret: string;
|
|
174
|
+
redirectUri: string;
|
|
175
|
+
instanceUrl?: string;
|
|
176
|
+
scopes?: string[];
|
|
177
|
+
}) => OAuth2ProviderConfig;
|
|
178
|
+
/**
|
|
179
|
+
* Custom OAuth2 provider configuration
|
|
180
|
+
*/
|
|
181
|
+
custom: (config: OAuth2ProviderConfig) => OAuth2ProviderConfig;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Auto-refresh wrapper for OAuth2 credentials
|
|
185
|
+
* Automatically refreshes tokens before they expire
|
|
186
|
+
*/
|
|
187
|
+
export declare class OAuth2AutoRefresher {
|
|
188
|
+
private oauth2Manager;
|
|
189
|
+
private refreshCallbacks;
|
|
190
|
+
private refreshTimers;
|
|
191
|
+
private logger;
|
|
192
|
+
constructor(oauth2Manager: OAuth2Manager, logger: Logger);
|
|
193
|
+
/**
|
|
194
|
+
* Start auto-refresh for a credential
|
|
195
|
+
*/
|
|
196
|
+
startAutoRefresh(key: string, providerName: string, credential: OAuth2Credential, onRefresh: (credential: OAuth2Credential) => Promise<void>, thresholdSeconds?: number): void;
|
|
197
|
+
/**
|
|
198
|
+
* Stop auto-refresh for a credential
|
|
199
|
+
*/
|
|
200
|
+
stopAutoRefresh(key: string): void;
|
|
201
|
+
/**
|
|
202
|
+
* Stop all auto-refresh timers
|
|
203
|
+
*/
|
|
204
|
+
stopAll(): void;
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=OAuth2Manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuth2Manager.d.ts","sourceRoot":"","sources":["../../src/credential/OAuth2Manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAc,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,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