linguclaw 0.4.3 → 0.5.1
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/dist/api-integrations.d.ts +137 -0
- package/dist/api-integrations.d.ts.map +1 -0
- package/dist/api-integrations.js +348 -0
- package/dist/api-integrations.js.map +1 -0
- package/dist/chain-of-thought.d.ts +136 -0
- package/dist/chain-of-thought.d.ts.map +1 -0
- package/dist/chain-of-thought.js +337 -0
- package/dist/chain-of-thought.js.map +1 -0
- package/dist/code-sandbox.d.ts +81 -0
- package/dist/code-sandbox.d.ts.map +1 -0
- package/dist/code-sandbox.js +363 -0
- package/dist/code-sandbox.js.map +1 -0
- package/dist/lib.d.ts +22 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +63 -0
- package/dist/lib.js.map +1 -0
- package/dist/orchestrator.d.ts +28 -3
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +200 -20
- package/dist/orchestrator.js.map +1 -1
- package/dist/session-memory.d.ts +116 -0
- package/dist/session-memory.d.ts.map +1 -0
- package/dist/session-memory.js +351 -0
- package/dist/session-memory.js.map +1 -0
- package/dist/static/dashboard.html +1 -1
- package/dist/static/hub.html +1 -1
- package/dist/static/index.html +130 -5
- package/dist/task-planner.d.ts +145 -0
- package/dist/task-planner.d.ts.map +1 -0
- package/dist/task-planner.js +520 -0
- package/dist/task-planner.js.map +1 -0
- package/dist/web.d.ts +6 -2
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +186 -4
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Integration Framework - Connect to external services
|
|
3
|
+
*
|
|
4
|
+
* Core capabilities:
|
|
5
|
+
* - GitHub: Repository management, issues, PRs, code search
|
|
6
|
+
* - Slack: Send messages, read channels
|
|
7
|
+
* - Google Calendar: Create/read events
|
|
8
|
+
* - Generic REST API: Call any HTTP endpoint
|
|
9
|
+
* - Webhook: Receive and send webhooks
|
|
10
|
+
* - Rate limiting and retry built-in
|
|
11
|
+
*/
|
|
12
|
+
export interface APICredentials {
|
|
13
|
+
type: 'bearer' | 'basic' | 'api_key' | 'oauth2' | 'none';
|
|
14
|
+
token?: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
password?: string;
|
|
17
|
+
apiKey?: string;
|
|
18
|
+
apiKeyHeader?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface APIResponse<T = any> {
|
|
21
|
+
success: boolean;
|
|
22
|
+
data?: T;
|
|
23
|
+
status?: number;
|
|
24
|
+
headers?: Record<string, string>;
|
|
25
|
+
error?: string;
|
|
26
|
+
duration?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface IntegrationConfig {
|
|
29
|
+
name: string;
|
|
30
|
+
baseUrl: string;
|
|
31
|
+
credentials: APICredentials;
|
|
32
|
+
timeout?: number;
|
|
33
|
+
retries?: number;
|
|
34
|
+
rateLimitPerMinute?: number;
|
|
35
|
+
headers?: Record<string, string>;
|
|
36
|
+
}
|
|
37
|
+
export declare class APIClient {
|
|
38
|
+
private client;
|
|
39
|
+
private config;
|
|
40
|
+
private rateLimiter;
|
|
41
|
+
constructor(config: IntegrationConfig);
|
|
42
|
+
request<T = any>(method: string, path: string, data?: any, extraHeaders?: Record<string, string>): Promise<APIResponse<T>>;
|
|
43
|
+
get<T = any>(path: string, params?: Record<string, any>): Promise<APIResponse<T>>;
|
|
44
|
+
post<T = any>(path: string, data?: any): Promise<APIResponse<T>>;
|
|
45
|
+
put<T = any>(path: string, data?: any): Promise<APIResponse<T>>;
|
|
46
|
+
delete<T = any>(path: string): Promise<APIResponse<T>>;
|
|
47
|
+
patch<T = any>(path: string, data?: any): Promise<APIResponse<T>>;
|
|
48
|
+
}
|
|
49
|
+
export declare class GitHubIntegration {
|
|
50
|
+
private client;
|
|
51
|
+
constructor(token: string);
|
|
52
|
+
getRepo(owner: string, repo: string): Promise<APIResponse>;
|
|
53
|
+
listIssues(owner: string, repo: string, state?: 'open' | 'closed' | 'all'): Promise<APIResponse>;
|
|
54
|
+
createIssue(owner: string, repo: string, title: string, body: string, labels?: string[]): Promise<APIResponse>;
|
|
55
|
+
searchCode(query: string): Promise<APIResponse>;
|
|
56
|
+
getFileContent(owner: string, repo: string, path: string, ref?: string): Promise<APIResponse>;
|
|
57
|
+
createPullRequest(owner: string, repo: string, title: string, body: string, head: string, base: string): Promise<APIResponse>;
|
|
58
|
+
listPullRequests(owner: string, repo: string, state?: 'open' | 'closed' | 'all'): Promise<APIResponse>;
|
|
59
|
+
}
|
|
60
|
+
export declare class SlackIntegration {
|
|
61
|
+
private client;
|
|
62
|
+
constructor(token: string);
|
|
63
|
+
sendMessage(channel: string, text: string, blocks?: any[]): Promise<APIResponse>;
|
|
64
|
+
listChannels(): Promise<APIResponse>;
|
|
65
|
+
getChannelHistory(channel: string, limit?: number): Promise<APIResponse>;
|
|
66
|
+
uploadFile(channel: string, content: string, filename: string, title?: string): Promise<APIResponse>;
|
|
67
|
+
}
|
|
68
|
+
export declare class GenericAPI {
|
|
69
|
+
private client;
|
|
70
|
+
constructor(config: IntegrationConfig);
|
|
71
|
+
call(method: string, path: string, data?: any, headers?: Record<string, string>): Promise<APIResponse>;
|
|
72
|
+
get(path: string, params?: Record<string, any>): Promise<APIResponse>;
|
|
73
|
+
post(path: string, data?: any): Promise<APIResponse>;
|
|
74
|
+
}
|
|
75
|
+
export interface WebhookEvent {
|
|
76
|
+
id: string;
|
|
77
|
+
source: string;
|
|
78
|
+
event: string;
|
|
79
|
+
payload: any;
|
|
80
|
+
timestamp: Date;
|
|
81
|
+
headers: Record<string, string>;
|
|
82
|
+
}
|
|
83
|
+
export declare class WebhookHandler {
|
|
84
|
+
private handlers;
|
|
85
|
+
private eventLog;
|
|
86
|
+
private maxLogSize;
|
|
87
|
+
/**
|
|
88
|
+
* Register a handler for a specific event type
|
|
89
|
+
*/
|
|
90
|
+
on(eventType: string, handler: (event: WebhookEvent) => Promise<void>): void;
|
|
91
|
+
/**
|
|
92
|
+
* Process an incoming webhook
|
|
93
|
+
*/
|
|
94
|
+
process(source: string, event: string, payload: any, headers?: Record<string, string>): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Get recent webhook events
|
|
97
|
+
*/
|
|
98
|
+
getRecentEvents(limit?: number): WebhookEvent[];
|
|
99
|
+
/**
|
|
100
|
+
* Send a webhook to an external URL
|
|
101
|
+
*/
|
|
102
|
+
send(url: string, payload: any, headers?: Record<string, string>): Promise<APIResponse>;
|
|
103
|
+
}
|
|
104
|
+
export declare class IntegrationRegistry {
|
|
105
|
+
private integrations;
|
|
106
|
+
private webhookHandler;
|
|
107
|
+
/**
|
|
108
|
+
* Register a GitHub integration
|
|
109
|
+
*/
|
|
110
|
+
registerGitHub(token: string): GitHubIntegration;
|
|
111
|
+
/**
|
|
112
|
+
* Register a Slack integration
|
|
113
|
+
*/
|
|
114
|
+
registerSlack(token: string): SlackIntegration;
|
|
115
|
+
/**
|
|
116
|
+
* Register a generic API integration
|
|
117
|
+
*/
|
|
118
|
+
registerAPI(name: string, config: IntegrationConfig): GenericAPI;
|
|
119
|
+
/**
|
|
120
|
+
* Get an integration by name
|
|
121
|
+
*/
|
|
122
|
+
get<T = any>(name: string): T | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Get the webhook handler
|
|
125
|
+
*/
|
|
126
|
+
getWebhookHandler(): WebhookHandler;
|
|
127
|
+
/**
|
|
128
|
+
* List all registered integrations
|
|
129
|
+
*/
|
|
130
|
+
list(): string[];
|
|
131
|
+
/**
|
|
132
|
+
* Auto-register integrations from environment variables
|
|
133
|
+
*/
|
|
134
|
+
autoRegister(): string[];
|
|
135
|
+
}
|
|
136
|
+
export declare function getIntegrationRegistry(): IntegrationRegistry;
|
|
137
|
+
//# sourceMappingURL=api-integrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-integrations.d.ts","sourceRoot":"","sources":["../src/api-integrations.ts"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qBAAa,mBAAmB;IAC9B,OAAO,CAAC,YAAY,CAAyF;IAC7G,OAAO,CAAC,cAAc,CAAwC;IAE9D;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAOhD;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAO9C;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,UAAU;IAOhE;;OAEG;IACH,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIzC;;OAEG;IACH,iBAAiB,IAAI,cAAc;IAInC;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE;IAIhB;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;CAmBzB;AAMD,wBAAgB,sBAAsB,IAAI,mBAAmB,CAK5D"}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API Integration Framework - Connect to external services
|
|
4
|
+
*
|
|
5
|
+
* Core capabilities:
|
|
6
|
+
* - GitHub: Repository management, issues, PRs, code search
|
|
7
|
+
* - Slack: Send messages, read channels
|
|
8
|
+
* - Google Calendar: Create/read events
|
|
9
|
+
* - Generic REST API: Call any HTTP endpoint
|
|
10
|
+
* - Webhook: Receive and send webhooks
|
|
11
|
+
* - Rate limiting and retry built-in
|
|
12
|
+
*/
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.IntegrationRegistry = exports.WebhookHandler = exports.GenericAPI = exports.SlackIntegration = exports.GitHubIntegration = exports.APIClient = void 0;
|
|
18
|
+
exports.getIntegrationRegistry = getIntegrationRegistry;
|
|
19
|
+
const axios_1 = __importDefault(require("axios"));
|
|
20
|
+
const logger_1 = require("./logger");
|
|
21
|
+
const resilience_1 = require("./resilience");
|
|
22
|
+
const logger = (0, logger_1.getLogger)();
|
|
23
|
+
// ==================== Rate Limiter ====================
|
|
24
|
+
class RateLimiter {
|
|
25
|
+
timestamps = [];
|
|
26
|
+
limit;
|
|
27
|
+
windowMs;
|
|
28
|
+
constructor(requestsPerMinute) {
|
|
29
|
+
this.limit = requestsPerMinute;
|
|
30
|
+
this.windowMs = 60000;
|
|
31
|
+
}
|
|
32
|
+
async acquire() {
|
|
33
|
+
const now = Date.now();
|
|
34
|
+
this.timestamps = this.timestamps.filter(t => now - t < this.windowMs);
|
|
35
|
+
if (this.timestamps.length >= this.limit) {
|
|
36
|
+
const waitMs = this.windowMs - (now - this.timestamps[0]);
|
|
37
|
+
logger.debug(`[RateLimiter] Waiting ${waitMs}ms`);
|
|
38
|
+
await new Promise(resolve => setTimeout(resolve, waitMs));
|
|
39
|
+
}
|
|
40
|
+
this.timestamps.push(Date.now());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// ==================== Base API Client ====================
|
|
44
|
+
class APIClient {
|
|
45
|
+
client;
|
|
46
|
+
config;
|
|
47
|
+
rateLimiter;
|
|
48
|
+
constructor(config) {
|
|
49
|
+
this.config = config;
|
|
50
|
+
this.rateLimiter = config.rateLimitPerMinute
|
|
51
|
+
? new RateLimiter(config.rateLimitPerMinute)
|
|
52
|
+
: null;
|
|
53
|
+
const headers = {
|
|
54
|
+
'Content-Type': 'application/json',
|
|
55
|
+
'User-Agent': 'LinguClaw/0.4.3',
|
|
56
|
+
...config.headers,
|
|
57
|
+
};
|
|
58
|
+
// Apply credentials
|
|
59
|
+
if (config.credentials.type === 'bearer' && config.credentials.token) {
|
|
60
|
+
headers['Authorization'] = `Bearer ${config.credentials.token}`;
|
|
61
|
+
}
|
|
62
|
+
else if (config.credentials.type === 'api_key' && config.credentials.apiKey) {
|
|
63
|
+
headers[config.credentials.apiKeyHeader || 'X-API-Key'] = config.credentials.apiKey;
|
|
64
|
+
}
|
|
65
|
+
else if (config.credentials.type === 'basic' && config.credentials.username) {
|
|
66
|
+
const encoded = Buffer.from(`${config.credentials.username}:${config.credentials.password || ''}`).toString('base64');
|
|
67
|
+
headers['Authorization'] = `Basic ${encoded}`;
|
|
68
|
+
}
|
|
69
|
+
this.client = axios_1.default.create({
|
|
70
|
+
baseURL: config.baseUrl,
|
|
71
|
+
timeout: config.timeout || 30000,
|
|
72
|
+
headers,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async request(method, path, data, extraHeaders) {
|
|
76
|
+
if (this.rateLimiter)
|
|
77
|
+
await this.rateLimiter.acquire();
|
|
78
|
+
const startTime = Date.now();
|
|
79
|
+
try {
|
|
80
|
+
const response = await (0, resilience_1.withRetry)(() => this.client.request({
|
|
81
|
+
method,
|
|
82
|
+
url: path,
|
|
83
|
+
data,
|
|
84
|
+
headers: extraHeaders,
|
|
85
|
+
}), { maxRetries: this.config.retries || 2 }, `${this.config.name}:${method}:${path}`);
|
|
86
|
+
return {
|
|
87
|
+
success: true,
|
|
88
|
+
data: response.data,
|
|
89
|
+
status: response.status,
|
|
90
|
+
headers: response.headers,
|
|
91
|
+
duration: Date.now() - startTime,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
return {
|
|
96
|
+
success: false,
|
|
97
|
+
status: error.response?.status,
|
|
98
|
+
error: error.response?.data?.message || error.message,
|
|
99
|
+
duration: Date.now() - startTime,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async get(path, params) {
|
|
104
|
+
const query = params ? '?' + new URLSearchParams(params).toString() : '';
|
|
105
|
+
return this.request('GET', path + query);
|
|
106
|
+
}
|
|
107
|
+
async post(path, data) {
|
|
108
|
+
return this.request('POST', path, data);
|
|
109
|
+
}
|
|
110
|
+
async put(path, data) {
|
|
111
|
+
return this.request('PUT', path, data);
|
|
112
|
+
}
|
|
113
|
+
async delete(path) {
|
|
114
|
+
return this.request('DELETE', path);
|
|
115
|
+
}
|
|
116
|
+
async patch(path, data) {
|
|
117
|
+
return this.request('PATCH', path, data);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.APIClient = APIClient;
|
|
121
|
+
// ==================== GitHub Integration ====================
|
|
122
|
+
class GitHubIntegration {
|
|
123
|
+
client;
|
|
124
|
+
constructor(token) {
|
|
125
|
+
this.client = new APIClient({
|
|
126
|
+
name: 'GitHub',
|
|
127
|
+
baseUrl: 'https://api.github.com',
|
|
128
|
+
credentials: { type: 'bearer', token },
|
|
129
|
+
rateLimitPerMinute: 30,
|
|
130
|
+
retries: 2,
|
|
131
|
+
headers: { Accept: 'application/vnd.github.v3+json' },
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
async getRepo(owner, repo) {
|
|
135
|
+
return this.client.get(`/repos/${owner}/${repo}`);
|
|
136
|
+
}
|
|
137
|
+
async listIssues(owner, repo, state = 'open') {
|
|
138
|
+
return this.client.get(`/repos/${owner}/${repo}/issues`, { state, per_page: '30' });
|
|
139
|
+
}
|
|
140
|
+
async createIssue(owner, repo, title, body, labels) {
|
|
141
|
+
return this.client.post(`/repos/${owner}/${repo}/issues`, { title, body, labels });
|
|
142
|
+
}
|
|
143
|
+
async searchCode(query) {
|
|
144
|
+
return this.client.get('/search/code', { q: query });
|
|
145
|
+
}
|
|
146
|
+
async getFileContent(owner, repo, path, ref) {
|
|
147
|
+
const params = {};
|
|
148
|
+
if (ref)
|
|
149
|
+
params.ref = ref;
|
|
150
|
+
return this.client.get(`/repos/${owner}/${repo}/contents/${path}`, params);
|
|
151
|
+
}
|
|
152
|
+
async createPullRequest(owner, repo, title, body, head, base) {
|
|
153
|
+
return this.client.post(`/repos/${owner}/${repo}/pulls`, { title, body, head, base });
|
|
154
|
+
}
|
|
155
|
+
async listPullRequests(owner, repo, state = 'open') {
|
|
156
|
+
return this.client.get(`/repos/${owner}/${repo}/pulls`, { state, per_page: '30' });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.GitHubIntegration = GitHubIntegration;
|
|
160
|
+
// ==================== Slack Integration ====================
|
|
161
|
+
class SlackIntegration {
|
|
162
|
+
client;
|
|
163
|
+
constructor(token) {
|
|
164
|
+
this.client = new APIClient({
|
|
165
|
+
name: 'Slack',
|
|
166
|
+
baseUrl: 'https://slack.com/api',
|
|
167
|
+
credentials: { type: 'bearer', token },
|
|
168
|
+
rateLimitPerMinute: 50,
|
|
169
|
+
retries: 1,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
async sendMessage(channel, text, blocks) {
|
|
173
|
+
return this.client.post('/chat.postMessage', { channel, text, blocks });
|
|
174
|
+
}
|
|
175
|
+
async listChannels() {
|
|
176
|
+
return this.client.get('/conversations.list', { types: 'public_channel,private_channel', limit: '100' });
|
|
177
|
+
}
|
|
178
|
+
async getChannelHistory(channel, limit = 20) {
|
|
179
|
+
return this.client.get('/conversations.history', { channel, limit: limit.toString() });
|
|
180
|
+
}
|
|
181
|
+
async uploadFile(channel, content, filename, title) {
|
|
182
|
+
return this.client.post('/files.upload', { channels: channel, content, filename, title });
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.SlackIntegration = SlackIntegration;
|
|
186
|
+
// ==================== Generic REST API ====================
|
|
187
|
+
class GenericAPI {
|
|
188
|
+
client;
|
|
189
|
+
constructor(config) {
|
|
190
|
+
this.client = new APIClient(config);
|
|
191
|
+
}
|
|
192
|
+
async call(method, path, data, headers) {
|
|
193
|
+
return this.client.request(method, path, data, headers);
|
|
194
|
+
}
|
|
195
|
+
async get(path, params) {
|
|
196
|
+
return this.client.get(path, params);
|
|
197
|
+
}
|
|
198
|
+
async post(path, data) {
|
|
199
|
+
return this.client.post(path, data);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
exports.GenericAPI = GenericAPI;
|
|
203
|
+
class WebhookHandler {
|
|
204
|
+
handlers = new Map();
|
|
205
|
+
eventLog = [];
|
|
206
|
+
maxLogSize = 100;
|
|
207
|
+
/**
|
|
208
|
+
* Register a handler for a specific event type
|
|
209
|
+
*/
|
|
210
|
+
on(eventType, handler) {
|
|
211
|
+
if (!this.handlers.has(eventType)) {
|
|
212
|
+
this.handlers.set(eventType, []);
|
|
213
|
+
}
|
|
214
|
+
this.handlers.get(eventType).push(handler);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Process an incoming webhook
|
|
218
|
+
*/
|
|
219
|
+
async process(source, event, payload, headers = {}) {
|
|
220
|
+
const webhookEvent = {
|
|
221
|
+
id: `wh-${Date.now()}-${Math.random().toString(36).substr(2, 6)}`,
|
|
222
|
+
source,
|
|
223
|
+
event,
|
|
224
|
+
payload,
|
|
225
|
+
timestamp: new Date(),
|
|
226
|
+
headers,
|
|
227
|
+
};
|
|
228
|
+
this.eventLog.push(webhookEvent);
|
|
229
|
+
if (this.eventLog.length > this.maxLogSize) {
|
|
230
|
+
this.eventLog = this.eventLog.slice(-this.maxLogSize);
|
|
231
|
+
}
|
|
232
|
+
const handlers = this.handlers.get(event) || [];
|
|
233
|
+
const wildcardHandlers = this.handlers.get('*') || [];
|
|
234
|
+
for (const handler of [...handlers, ...wildcardHandlers]) {
|
|
235
|
+
try {
|
|
236
|
+
await handler(webhookEvent);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
logger.error(`[Webhook] Handler error for ${event}: ${error.message}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
logger.info(`[Webhook] Processed: ${source}/${event}`);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Get recent webhook events
|
|
246
|
+
*/
|
|
247
|
+
getRecentEvents(limit = 20) {
|
|
248
|
+
return this.eventLog.slice(-limit);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Send a webhook to an external URL
|
|
252
|
+
*/
|
|
253
|
+
async send(url, payload, headers) {
|
|
254
|
+
try {
|
|
255
|
+
const response = await axios_1.default.post(url, payload, {
|
|
256
|
+
headers: {
|
|
257
|
+
'Content-Type': 'application/json',
|
|
258
|
+
'User-Agent': 'LinguClaw-Webhook/0.4.3',
|
|
259
|
+
...headers,
|
|
260
|
+
},
|
|
261
|
+
timeout: 10000,
|
|
262
|
+
});
|
|
263
|
+
return { success: true, status: response.status, data: response.data };
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
return { success: false, error: error.message, status: error.response?.status };
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.WebhookHandler = WebhookHandler;
|
|
271
|
+
// ==================== Integration Registry ====================
|
|
272
|
+
class IntegrationRegistry {
|
|
273
|
+
integrations = new Map();
|
|
274
|
+
webhookHandler = new WebhookHandler();
|
|
275
|
+
/**
|
|
276
|
+
* Register a GitHub integration
|
|
277
|
+
*/
|
|
278
|
+
registerGitHub(token) {
|
|
279
|
+
const integration = new GitHubIntegration(token);
|
|
280
|
+
this.integrations.set('github', integration);
|
|
281
|
+
logger.info('[Integrations] GitHub registered');
|
|
282
|
+
return integration;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Register a Slack integration
|
|
286
|
+
*/
|
|
287
|
+
registerSlack(token) {
|
|
288
|
+
const integration = new SlackIntegration(token);
|
|
289
|
+
this.integrations.set('slack', integration);
|
|
290
|
+
logger.info('[Integrations] Slack registered');
|
|
291
|
+
return integration;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Register a generic API integration
|
|
295
|
+
*/
|
|
296
|
+
registerAPI(name, config) {
|
|
297
|
+
const integration = new GenericAPI(config);
|
|
298
|
+
this.integrations.set(name, integration);
|
|
299
|
+
logger.info(`[Integrations] ${name} registered`);
|
|
300
|
+
return integration;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Get an integration by name
|
|
304
|
+
*/
|
|
305
|
+
get(name) {
|
|
306
|
+
return this.integrations.get(name);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Get the webhook handler
|
|
310
|
+
*/
|
|
311
|
+
getWebhookHandler() {
|
|
312
|
+
return this.webhookHandler;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* List all registered integrations
|
|
316
|
+
*/
|
|
317
|
+
list() {
|
|
318
|
+
return Array.from(this.integrations.keys());
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Auto-register integrations from environment variables
|
|
322
|
+
*/
|
|
323
|
+
autoRegister() {
|
|
324
|
+
const registered = [];
|
|
325
|
+
if (process.env.GITHUB_TOKEN) {
|
|
326
|
+
this.registerGitHub(process.env.GITHUB_TOKEN);
|
|
327
|
+
registered.push('github');
|
|
328
|
+
}
|
|
329
|
+
if (process.env.SLACK_BOT_TOKEN) {
|
|
330
|
+
this.registerSlack(process.env.SLACK_BOT_TOKEN);
|
|
331
|
+
registered.push('slack');
|
|
332
|
+
}
|
|
333
|
+
if (registered.length > 0) {
|
|
334
|
+
logger.info(`[Integrations] Auto-registered: ${registered.join(', ')}`);
|
|
335
|
+
}
|
|
336
|
+
return registered;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
exports.IntegrationRegistry = IntegrationRegistry;
|
|
340
|
+
// ==================== Singleton ====================
|
|
341
|
+
let registryInstance = null;
|
|
342
|
+
function getIntegrationRegistry() {
|
|
343
|
+
if (!registryInstance) {
|
|
344
|
+
registryInstance = new IntegrationRegistry();
|
|
345
|
+
}
|
|
346
|
+
return registryInstance;
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=api-integrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-integrations.js","sourceRoot":"","sources":["../src/api-integrations.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;AA4aH,wDAKC;AA/aD,kDAAiE;AACjE,qCAAqC;AACrC,6CAAyC;AAEzC,MAAM,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;AAgC3B,yDAAy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;QACtB,gBAAgB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain of Thought - Transparent reasoning and action tracking system
|
|
3
|
+
*
|
|
4
|
+
* Core capabilities:
|
|
5
|
+
* - Thought Logs: See exactly what the agent is "thinking"
|
|
6
|
+
* - Action Tracking: Real-time visibility into which tools are being used
|
|
7
|
+
* - Reasoning Chain: Full audit trail of decisions and their outcomes
|
|
8
|
+
* - Event Streaming: WebSocket-compatible event emission for live UI updates
|
|
9
|
+
*/
|
|
10
|
+
import { EventEmitter } from 'events';
|
|
11
|
+
export type ThoughtType = 'reasoning' | 'planning' | 'observation' | 'decision' | 'reflection' | 'correction' | 'hypothesis' | 'conclusion';
|
|
12
|
+
export type ActionStatus = 'started' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
13
|
+
export interface ThoughtEntry {
|
|
14
|
+
id: string;
|
|
15
|
+
sessionId: string;
|
|
16
|
+
timestamp: Date;
|
|
17
|
+
type: ThoughtType;
|
|
18
|
+
content: string;
|
|
19
|
+
confidence?: number;
|
|
20
|
+
relatedActionId?: string;
|
|
21
|
+
parentThoughtId?: string;
|
|
22
|
+
metadata?: Record<string, any>;
|
|
23
|
+
}
|
|
24
|
+
export interface ActionEntry {
|
|
25
|
+
id: string;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
timestamp: Date;
|
|
28
|
+
tool: string;
|
|
29
|
+
operation: string;
|
|
30
|
+
input: string;
|
|
31
|
+
output?: string;
|
|
32
|
+
status: ActionStatus;
|
|
33
|
+
duration?: number;
|
|
34
|
+
error?: string;
|
|
35
|
+
metadata?: Record<string, any>;
|
|
36
|
+
}
|
|
37
|
+
export interface ReasoningStep {
|
|
38
|
+
thought: ThoughtEntry;
|
|
39
|
+
action?: ActionEntry;
|
|
40
|
+
result?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface SessionSummary {
|
|
43
|
+
sessionId: string;
|
|
44
|
+
task: string;
|
|
45
|
+
startedAt: Date;
|
|
46
|
+
endedAt?: Date;
|
|
47
|
+
totalThoughts: number;
|
|
48
|
+
totalActions: number;
|
|
49
|
+
failedActions: number;
|
|
50
|
+
corrections: number;
|
|
51
|
+
reasoningChain: ReasoningStep[];
|
|
52
|
+
finalConclusion?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ChainOfThoughtConfig {
|
|
55
|
+
maxThoughtsPerSession: number;
|
|
56
|
+
maxActionsPerSession: number;
|
|
57
|
+
enableStreaming: boolean;
|
|
58
|
+
verboseLogging: boolean;
|
|
59
|
+
persistToDisk: boolean;
|
|
60
|
+
persistPath?: string;
|
|
61
|
+
}
|
|
62
|
+
export declare class ChainOfThought extends EventEmitter {
|
|
63
|
+
private config;
|
|
64
|
+
private sessions;
|
|
65
|
+
private activeSession;
|
|
66
|
+
private idCounter;
|
|
67
|
+
constructor(config?: Partial<ChainOfThoughtConfig>);
|
|
68
|
+
/**
|
|
69
|
+
* Start a new reasoning session
|
|
70
|
+
*/
|
|
71
|
+
startSession(task: string, sessionId?: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* End a reasoning session
|
|
74
|
+
*/
|
|
75
|
+
endSession(sessionId?: string, conclusion?: string): SessionSummary | null;
|
|
76
|
+
/**
|
|
77
|
+
* Record a thought
|
|
78
|
+
*/
|
|
79
|
+
think(sessionId: string | null, type: ThoughtType, content: string, meta?: {
|
|
80
|
+
confidence?: number;
|
|
81
|
+
relatedActionId?: string;
|
|
82
|
+
parentThoughtId?: string;
|
|
83
|
+
metadata?: Record<string, any>;
|
|
84
|
+
}): ThoughtEntry;
|
|
85
|
+
/**
|
|
86
|
+
* Record an action start
|
|
87
|
+
*/
|
|
88
|
+
startAction(sessionId: string | null, tool: string, operation: string, input: string, metadata?: Record<string, any>): ActionEntry;
|
|
89
|
+
/**
|
|
90
|
+
* Update an action's status
|
|
91
|
+
*/
|
|
92
|
+
updateAction(actionId: string, update: {
|
|
93
|
+
status?: ActionStatus;
|
|
94
|
+
output?: string;
|
|
95
|
+
error?: string;
|
|
96
|
+
duration?: number;
|
|
97
|
+
}): ActionEntry | null;
|
|
98
|
+
/**
|
|
99
|
+
* Complete an action
|
|
100
|
+
*/
|
|
101
|
+
completeAction(actionId: string, output: string, startTime?: number): ActionEntry | null;
|
|
102
|
+
/**
|
|
103
|
+
* Fail an action
|
|
104
|
+
*/
|
|
105
|
+
failAction(actionId: string, error: string, startTime?: number): ActionEntry | null;
|
|
106
|
+
/**
|
|
107
|
+
* Get the full reasoning chain for a session
|
|
108
|
+
*/
|
|
109
|
+
getChain(sessionId?: string): ReasoningStep[];
|
|
110
|
+
/**
|
|
111
|
+
* Get all thoughts for a session
|
|
112
|
+
*/
|
|
113
|
+
getThoughts(sessionId?: string, type?: ThoughtType): ThoughtEntry[];
|
|
114
|
+
/**
|
|
115
|
+
* Get all actions for a session
|
|
116
|
+
*/
|
|
117
|
+
getActions(sessionId?: string, tool?: string): ActionEntry[];
|
|
118
|
+
/**
|
|
119
|
+
* Get session summary without ending it
|
|
120
|
+
*/
|
|
121
|
+
getSessionSummary(sessionId?: string): SessionSummary | null;
|
|
122
|
+
/**
|
|
123
|
+
* Get a human-readable reasoning trace
|
|
124
|
+
*/
|
|
125
|
+
getReadableTrace(sessionId?: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* Get active session ID
|
|
128
|
+
*/
|
|
129
|
+
getActiveSessionId(): string | null;
|
|
130
|
+
/**
|
|
131
|
+
* Clean up old sessions
|
|
132
|
+
*/
|
|
133
|
+
cleanup(maxAge?: number): void;
|
|
134
|
+
}
|
|
135
|
+
export declare function getChainOfThought(config?: Partial<ChainOfThoughtConfig>): ChainOfThought;
|
|
136
|
+
//# sourceMappingURL=chain-of-thought.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-of-thought.d.ts","sourceRoot":"","sources":["../src/chain-of-thought.ts"],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