agentlang 0.9.9 → 0.9.11
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/out/extension/main.cjs +38 -38
- package/out/extension/main.cjs.map +2 -2
- package/out/language/generated/ast.d.ts +1 -1
- package/out/language/generated/ast.js +1 -1
- package/out/language/generated/grammar.d.ts +1 -1
- package/out/language/generated/grammar.js +1 -1
- package/out/language/generated/module.d.ts +1 -1
- package/out/language/generated/module.js +1 -1
- package/out/language/main.cjs +850 -2388
- package/out/language/main.cjs.map +4 -4
- package/out/runtime/agents/common.d.ts +3 -1
- package/out/runtime/agents/common.d.ts.map +1 -1
- package/out/runtime/agents/common.js +35 -31
- package/out/runtime/agents/common.js.map +1 -1
- package/out/runtime/docs.d.ts +1 -0
- package/out/runtime/docs.d.ts.map +1 -1
- package/out/runtime/docs.js +16 -1
- package/out/runtime/docs.js.map +1 -1
- package/out/runtime/interpreter.d.ts +1 -0
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +60 -9
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/jsmodules.d.ts +2 -1
- package/out/runtime/jsmodules.d.ts.map +1 -1
- package/out/runtime/jsmodules.js +2 -1
- package/out/runtime/jsmodules.js.map +1 -1
- package/out/runtime/loader.d.ts.map +1 -1
- package/out/runtime/loader.js +3 -2
- package/out/runtime/loader.js.map +1 -1
- package/out/runtime/module.d.ts +1 -0
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +3 -0
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.d.ts +12 -0
- package/out/runtime/modules/ai.d.ts.map +1 -1
- package/out/runtime/modules/ai.js +225 -28
- package/out/runtime/modules/ai.js.map +1 -1
- package/out/runtime/modules/core.d.ts.map +1 -1
- package/out/runtime/modules/core.js +7 -1
- package/out/runtime/modules/core.js.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.d.ts.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.js +37 -6
- package/out/runtime/resolvers/sqldb/impl.js.map +1 -1
- package/out/runtime/services/documentFetcher.d.ts +70 -0
- package/out/runtime/services/documentFetcher.d.ts.map +1 -0
- package/out/runtime/services/documentFetcher.js +582 -0
- package/out/runtime/services/documentFetcher.js.map +1 -0
- package/package.json +2 -1
- package/src/language/generated/ast.ts +1 -1
- package/src/language/generated/grammar.ts +1 -1
- package/src/language/generated/module.ts +1 -1
- package/src/runtime/agents/common.ts +37 -31
- package/src/runtime/docs.ts +17 -1
- package/src/runtime/interpreter.ts +64 -7
- package/src/runtime/jsmodules.ts +3 -1
- package/src/runtime/loader.ts +3 -2
- package/src/runtime/module.ts +4 -0
- package/src/runtime/modules/ai.ts +270 -33
- package/src/runtime/modules/core.ts +7 -1
- package/src/runtime/resolvers/sqldb/impl.ts +36 -6
- package/src/runtime/services/documentFetcher.ts +691 -0
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
2
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
3
|
+
var m = o[Symbol.asyncIterator], i;
|
|
4
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
5
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
6
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
7
|
+
};
|
|
8
|
+
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
|
9
|
+
import { readFile } from 'node:fs/promises';
|
|
10
|
+
import { logger } from '../logger.js';
|
|
11
|
+
import { parseAndEvaluateStatement } from '../interpreter.js';
|
|
12
|
+
import { CoreAIModuleName } from '../modules/ai.js';
|
|
13
|
+
import { TtlCache } from '../state.js';
|
|
14
|
+
import { preprocessRawConfig } from '../util.js';
|
|
15
|
+
import { marked } from 'marked';
|
|
16
|
+
import { isNodeEnv } from '../../utils/runtime.js';
|
|
17
|
+
class DocumentFetcherService {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.documentCache = new TtlCache(DocumentFetcherService.CACHE_TTL_MS);
|
|
20
|
+
this.s3Clients = new Map();
|
|
21
|
+
this.pdfParser = null;
|
|
22
|
+
}
|
|
23
|
+
configureDocumentService(config) {
|
|
24
|
+
this.documentServiceConfig = config;
|
|
25
|
+
logger.info('Document service configured', { baseUrl: config.baseUrl });
|
|
26
|
+
}
|
|
27
|
+
async fetchDocument(config) {
|
|
28
|
+
var _a, _b, _c, _d, _e;
|
|
29
|
+
this.ensureNodeEnv();
|
|
30
|
+
const cacheKey = `${config.title}:${config.url || config.documentServiceId}`;
|
|
31
|
+
const cached = this.documentCache.get(cacheKey);
|
|
32
|
+
if (cached) {
|
|
33
|
+
logger.debug('Returning cached document', { title: config.title });
|
|
34
|
+
return cached;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
let content;
|
|
38
|
+
let sourceUrl;
|
|
39
|
+
if ((_a = config.url) === null || _a === void 0 ? void 0 : _a.startsWith('document-service://')) {
|
|
40
|
+
if (!config.retrievalConfig || config.retrievalConfig.provider !== 'document-service') {
|
|
41
|
+
throw new Error('Document service URL requires retrievalConfig with provider: "document-service"');
|
|
42
|
+
}
|
|
43
|
+
const dsConfig = config.retrievalConfig.config;
|
|
44
|
+
if (!(dsConfig === null || dsConfig === void 0 ? void 0 : dsConfig.baseUrl)) {
|
|
45
|
+
throw new Error('Document service config requires baseUrl');
|
|
46
|
+
}
|
|
47
|
+
const urlPath = config.url.replace('document-service://', '');
|
|
48
|
+
const parts = urlPath.split('/');
|
|
49
|
+
if (parts.length !== 3) {
|
|
50
|
+
throw new Error(`Invalid document service URL format: ${config.url}. Expected: document-service://<user-uuid>/<app-uuid>/<doc-uuid>.ext`);
|
|
51
|
+
}
|
|
52
|
+
const appUuid = parts[1];
|
|
53
|
+
const docIdWithExt = parts[2];
|
|
54
|
+
const docId = docIdWithExt.split('.')[0]; // Remove extension
|
|
55
|
+
this.documentServiceConfig = {
|
|
56
|
+
baseUrl: dsConfig.baseUrl,
|
|
57
|
+
appName: appUuid,
|
|
58
|
+
authToken: dsConfig.authToken,
|
|
59
|
+
getAuthToken: dsConfig.getAuthToken,
|
|
60
|
+
};
|
|
61
|
+
content = await this.fetchFromDocumentService(docId);
|
|
62
|
+
sourceUrl = config.url;
|
|
63
|
+
}
|
|
64
|
+
else if (((_b = config.retrievalConfig) === null || _b === void 0 ? void 0 : _b.provider) === 'document-service') {
|
|
65
|
+
const dsConfig = config.retrievalConfig.config;
|
|
66
|
+
if (!(dsConfig === null || dsConfig === void 0 ? void 0 : dsConfig.baseUrl) || !(dsConfig === null || dsConfig === void 0 ? void 0 : dsConfig.appName)) {
|
|
67
|
+
throw new Error('Document service config requires baseUrl and appName');
|
|
68
|
+
}
|
|
69
|
+
this.documentServiceConfig = {
|
|
70
|
+
baseUrl: dsConfig.baseUrl,
|
|
71
|
+
appName: dsConfig.appName,
|
|
72
|
+
authToken: dsConfig.authToken,
|
|
73
|
+
getAuthToken: dsConfig.getAuthToken,
|
|
74
|
+
};
|
|
75
|
+
const docId = await this.lookupDocumentByTitle(config.title);
|
|
76
|
+
if (docId) {
|
|
77
|
+
content = await this.fetchFromDocumentService(docId);
|
|
78
|
+
sourceUrl = `document-service://${docId}`;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error(`Document not found by title in document service: ${config.title}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else if (config.documentServiceId && this.documentServiceConfig) {
|
|
85
|
+
content = await this.fetchFromDocumentService(config.documentServiceId);
|
|
86
|
+
sourceUrl = `document-service://${config.documentServiceId}`;
|
|
87
|
+
}
|
|
88
|
+
else if ((_c = config.url) === null || _c === void 0 ? void 0 : _c.startsWith('s3://')) {
|
|
89
|
+
content = await this.fetchFromS3(config);
|
|
90
|
+
sourceUrl = config.url;
|
|
91
|
+
}
|
|
92
|
+
else if (((_d = config.url) === null || _d === void 0 ? void 0 : _d.startsWith('http://')) || ((_e = config.url) === null || _e === void 0 ? void 0 : _e.startsWith('https://'))) {
|
|
93
|
+
content = await this.fetchFromUrl(config.url);
|
|
94
|
+
sourceUrl = config.url;
|
|
95
|
+
}
|
|
96
|
+
else if (config.url) {
|
|
97
|
+
content = await this.fetchFromLocal(config.url);
|
|
98
|
+
sourceUrl = config.url;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
if (this.documentServiceConfig) {
|
|
102
|
+
const docId = await this.lookupDocumentByTitle(config.title);
|
|
103
|
+
if (docId) {
|
|
104
|
+
content = await this.fetchFromDocumentService(docId);
|
|
105
|
+
sourceUrl = `document-service://${docId}`;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
throw new Error(`Document not found by title: ${config.title}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
throw new Error(`No URL or document service ID provided for: ${config.title}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const document = {
|
|
116
|
+
title: config.title,
|
|
117
|
+
content,
|
|
118
|
+
url: sourceUrl,
|
|
119
|
+
format: this.inferFormat(sourceUrl),
|
|
120
|
+
fetchedAt: new Date(),
|
|
121
|
+
embeddingConfig: config.embeddingConfig,
|
|
122
|
+
};
|
|
123
|
+
this.documentCache.set(cacheKey, document);
|
|
124
|
+
await this.createDocumentEntity(document);
|
|
125
|
+
return document;
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
logger.error('Failed to fetch document', {
|
|
129
|
+
title: config.title,
|
|
130
|
+
url: config.url,
|
|
131
|
+
documentServiceId: config.documentServiceId,
|
|
132
|
+
error: error instanceof Error ? error.message : String(error),
|
|
133
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
134
|
+
});
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async fetchDocumentByTitle(title) {
|
|
139
|
+
this.ensureNodeEnv();
|
|
140
|
+
try {
|
|
141
|
+
// First check if we have it in cache
|
|
142
|
+
const cacheKey = `${title}:lookup`;
|
|
143
|
+
const cached = this.documentCache.get(cacheKey);
|
|
144
|
+
if (cached) {
|
|
145
|
+
logger.debug('Returning cached document by title', { title });
|
|
146
|
+
return cached;
|
|
147
|
+
}
|
|
148
|
+
// Try document service lookup first (if configured)
|
|
149
|
+
if (this.documentServiceConfig) {
|
|
150
|
+
const docId = await this.lookupDocumentByTitle(title);
|
|
151
|
+
if (docId) {
|
|
152
|
+
return this.fetchDocument({
|
|
153
|
+
title,
|
|
154
|
+
documentServiceId: docId,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Fall back to config-based lookup
|
|
159
|
+
const doc = this.findDocumentInConfig(title);
|
|
160
|
+
if (doc) {
|
|
161
|
+
return this.fetchDocument(doc);
|
|
162
|
+
}
|
|
163
|
+
logger.warn('Document not found', { title });
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
logger.error('Failed to fetch document by title', { title, error });
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Fetch from secure document-service API
|
|
172
|
+
async fetchFromDocumentService(documentId) {
|
|
173
|
+
var _a, _b, _c, _d;
|
|
174
|
+
if (!this.documentServiceConfig) {
|
|
175
|
+
throw new Error('Document service not configured');
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
// Get token - either static from config or dynamic from function
|
|
179
|
+
let token;
|
|
180
|
+
if (this.documentServiceConfig.authToken) {
|
|
181
|
+
token = this.documentServiceConfig.authToken;
|
|
182
|
+
}
|
|
183
|
+
else if (this.documentServiceConfig.getAuthToken) {
|
|
184
|
+
token = await this.documentServiceConfig.getAuthToken();
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
throw new Error('Document service requires authToken or getAuthToken');
|
|
188
|
+
}
|
|
189
|
+
const url = `${this.documentServiceConfig.baseUrl}/api/documents/${documentId}/content`;
|
|
190
|
+
logger.debug('Fetching from document service', { documentId, url });
|
|
191
|
+
const response = await fetch(url, {
|
|
192
|
+
headers: {
|
|
193
|
+
Authorization: `Bearer ${token}`,
|
|
194
|
+
'x-app-name': this.documentServiceConfig.appName,
|
|
195
|
+
Accept: 'application/json',
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
if (!response.ok) {
|
|
199
|
+
if (response.status === 404) {
|
|
200
|
+
throw new Error(`Document not found: ${documentId}`);
|
|
201
|
+
}
|
|
202
|
+
else if (response.status === 403) {
|
|
203
|
+
throw new Error(`Access denied to document: ${documentId}`);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
throw new Error(`Document service error: ${response.status} ${response.statusText}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const data = await response.json();
|
|
210
|
+
if (data.isBase64) {
|
|
211
|
+
if (((_a = data.mimeType) === null || _a === void 0 ? void 0 : _a.includes('pdf')) || ((_b = data.format) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'pdf') {
|
|
212
|
+
try {
|
|
213
|
+
const { parsePdfBuffer } = await import('../docs.js');
|
|
214
|
+
const buffer = Buffer.from(data.content, 'base64');
|
|
215
|
+
const text = await parsePdfBuffer(new Uint8Array(buffer));
|
|
216
|
+
logger.debug('Extracted text from PDF', { documentId, textLength: text.length });
|
|
217
|
+
return text;
|
|
218
|
+
}
|
|
219
|
+
catch (pdfError) {
|
|
220
|
+
logger.error('Failed to parse PDF from document service', {
|
|
221
|
+
documentId,
|
|
222
|
+
error: pdfError.message,
|
|
223
|
+
});
|
|
224
|
+
throw new Error(`Failed to extract text from PDF: ${pdfError.message}`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return Buffer.from(data.content, 'base64').toString('utf-8');
|
|
228
|
+
}
|
|
229
|
+
if (((_c = data.format) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'md' || ((_d = data.format) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === 'markdown') {
|
|
230
|
+
try {
|
|
231
|
+
const parsedText = this.parseMarkdownText(data.content);
|
|
232
|
+
logger.debug('Parsed markdown content', { documentId, textLength: parsedText.length });
|
|
233
|
+
return parsedText;
|
|
234
|
+
}
|
|
235
|
+
catch (mdError) {
|
|
236
|
+
logger.warn('Markdown parsing failed, returning raw content', {
|
|
237
|
+
documentId,
|
|
238
|
+
error: mdError.message,
|
|
239
|
+
});
|
|
240
|
+
return data.content;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return data.content;
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
logger.error('Document service fetch failed', {
|
|
247
|
+
documentId,
|
|
248
|
+
error: error instanceof Error ? error.message : String(error),
|
|
249
|
+
});
|
|
250
|
+
throw error;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async lookupDocumentByTitle(title) {
|
|
254
|
+
if (!this.documentServiceConfig) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
let token;
|
|
259
|
+
if (this.documentServiceConfig.authToken) {
|
|
260
|
+
token = this.documentServiceConfig.authToken;
|
|
261
|
+
}
|
|
262
|
+
else if (this.documentServiceConfig.getAuthToken) {
|
|
263
|
+
token = await this.documentServiceConfig.getAuthToken();
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
throw new Error('Document service requires authToken or getAuthToken');
|
|
267
|
+
}
|
|
268
|
+
const url = `${this.documentServiceConfig.baseUrl}/api/documents/lookup/by-title?title=${encodeURIComponent(title)}`;
|
|
269
|
+
logger.debug('Looking up document by title', { title, url });
|
|
270
|
+
const response = await fetch(url, {
|
|
271
|
+
headers: {
|
|
272
|
+
Authorization: `Bearer ${token}`,
|
|
273
|
+
'x-app-name': this.documentServiceConfig.appName,
|
|
274
|
+
Accept: 'application/json',
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
if (response.status === 404) {
|
|
278
|
+
logger.debug('Document not found by title', { title });
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
if (!response.ok) {
|
|
282
|
+
throw new Error(`Document service lookup error: ${response.status}`);
|
|
283
|
+
}
|
|
284
|
+
const data = await response.json();
|
|
285
|
+
logger.debug('Found document by title', { title, documentId: data.documentId });
|
|
286
|
+
return data.documentId;
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
logger.error('Document lookup failed', {
|
|
290
|
+
title,
|
|
291
|
+
error: error instanceof Error ? error.message : String(error),
|
|
292
|
+
});
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
async fetchFromS3(config) {
|
|
297
|
+
const s3Config = this.parseS3Url(config.url, config.retrievalConfig);
|
|
298
|
+
const client = await this.getOrCreateS3Client(s3Config);
|
|
299
|
+
try {
|
|
300
|
+
const response = await client.send(new GetObjectCommand({
|
|
301
|
+
Bucket: s3Config.bucket,
|
|
302
|
+
Key: s3Config.key,
|
|
303
|
+
}));
|
|
304
|
+
if (!response.Body) {
|
|
305
|
+
throw new Error('S3 object has no body');
|
|
306
|
+
}
|
|
307
|
+
const bodyBuffer = await this.readS3BodyToBuffer(response.Body);
|
|
308
|
+
const contentType = (response.ContentType || '').toLowerCase();
|
|
309
|
+
const lowerKey = s3Config.key.toLowerCase();
|
|
310
|
+
const isPdf = contentType.includes('application/pdf') || lowerKey.endsWith('.pdf');
|
|
311
|
+
const isMarkdown = contentType.includes('text/markdown') ||
|
|
312
|
+
lowerKey.endsWith('.md') ||
|
|
313
|
+
lowerKey.endsWith('.markdown') ||
|
|
314
|
+
lowerKey.endsWith('.mdown');
|
|
315
|
+
if (isPdf) {
|
|
316
|
+
return await this.parsePdfBuffer(bodyBuffer);
|
|
317
|
+
}
|
|
318
|
+
if (isMarkdown) {
|
|
319
|
+
return this.parseMarkdownText(bodyBuffer.toString('utf-8'));
|
|
320
|
+
}
|
|
321
|
+
return bodyBuffer.toString('utf-8');
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
325
|
+
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
326
|
+
logger.error('S3 fetch failed', {
|
|
327
|
+
url: config.url,
|
|
328
|
+
bucket: s3Config.bucket,
|
|
329
|
+
key: s3Config.key,
|
|
330
|
+
region: s3Config.region,
|
|
331
|
+
hasAccessKey: !!s3Config.accessKeyId,
|
|
332
|
+
error: errorMessage,
|
|
333
|
+
stack: errorStack,
|
|
334
|
+
});
|
|
335
|
+
throw new Error(`Failed to fetch from S3 (bucket: ${s3Config.bucket}, key: ${s3Config.key}, region: ${s3Config.region}): ${errorMessage}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
async fetchFromUrl(url) {
|
|
339
|
+
try {
|
|
340
|
+
const response = await fetch(url, {
|
|
341
|
+
signal: AbortSignal.timeout(30000),
|
|
342
|
+
});
|
|
343
|
+
if (!response.ok) {
|
|
344
|
+
throw new Error(`HTTP ${response.status} ${response.statusText}`);
|
|
345
|
+
}
|
|
346
|
+
const body = await response.arrayBuffer();
|
|
347
|
+
const maxSize = 50 * 1024 * 1024;
|
|
348
|
+
if (body.byteLength > maxSize) {
|
|
349
|
+
throw new Error(`Response too large: ${body.byteLength} bytes`);
|
|
350
|
+
}
|
|
351
|
+
const contentType = (response.headers.get('content-type') || '').toLowerCase();
|
|
352
|
+
const lowerUrl = url.toLowerCase();
|
|
353
|
+
const isMarkdown = contentType.includes('text/markdown') ||
|
|
354
|
+
lowerUrl.endsWith('.md') ||
|
|
355
|
+
lowerUrl.endsWith('.markdown');
|
|
356
|
+
if (isMarkdown) {
|
|
357
|
+
return this.parseMarkdownText(Buffer.from(body).toString('utf-8'));
|
|
358
|
+
}
|
|
359
|
+
return Buffer.from(body).toString('utf-8');
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
logger.error('URL fetch failed', {
|
|
363
|
+
url,
|
|
364
|
+
error: error instanceof Error ? error.message : String(error),
|
|
365
|
+
});
|
|
366
|
+
throw error;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
async fetchFromLocal(filePath) {
|
|
370
|
+
try {
|
|
371
|
+
const content = await readFile(filePath, 'utf-8');
|
|
372
|
+
const lowerPath = filePath.toLowerCase();
|
|
373
|
+
const isMarkdown = lowerPath.endsWith('.md') || lowerPath.endsWith('.markdown');
|
|
374
|
+
if (isMarkdown) {
|
|
375
|
+
return this.parseMarkdownText(content);
|
|
376
|
+
}
|
|
377
|
+
return content;
|
|
378
|
+
}
|
|
379
|
+
catch (error) {
|
|
380
|
+
logger.error('Local file read failed', {
|
|
381
|
+
path: filePath,
|
|
382
|
+
error: error instanceof Error ? error.message : String(error),
|
|
383
|
+
});
|
|
384
|
+
throw error;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
parseS3Url(url, retrievalConfig) {
|
|
388
|
+
// Parse s3://bucket/key format
|
|
389
|
+
const withoutProtocol = url.replace('s3://', '');
|
|
390
|
+
const firstSlash = withoutProtocol.indexOf('/');
|
|
391
|
+
if (firstSlash === -1) {
|
|
392
|
+
throw new Error(`Invalid S3 URL format: ${url}`);
|
|
393
|
+
}
|
|
394
|
+
const bucket = withoutProtocol.slice(0, firstSlash);
|
|
395
|
+
const key = withoutProtocol.slice(firstSlash + 1);
|
|
396
|
+
const normalizedRetrievalConfig = this.normalizeRetrievalConfig(retrievalConfig);
|
|
397
|
+
// Get S3-specific config from retrievalConfig if provider is s3
|
|
398
|
+
let s3SpecificConfig = {};
|
|
399
|
+
if ((normalizedRetrievalConfig === null || normalizedRetrievalConfig === void 0 ? void 0 : normalizedRetrievalConfig.provider) === 's3' && normalizedRetrievalConfig.config) {
|
|
400
|
+
s3SpecificConfig = normalizedRetrievalConfig.config;
|
|
401
|
+
}
|
|
402
|
+
return {
|
|
403
|
+
bucket,
|
|
404
|
+
key,
|
|
405
|
+
region: s3SpecificConfig.region || process.env.AWS_REGION || 'us-east-1',
|
|
406
|
+
endpoint: s3SpecificConfig.endpoint,
|
|
407
|
+
accessKeyId: s3SpecificConfig.accessKeyId || process.env.AWS_ACCESS_KEY_ID,
|
|
408
|
+
secretAccessKey: s3SpecificConfig.secretAccessKey || process.env.AWS_SECRET_ACCESS_KEY,
|
|
409
|
+
forcePathStyle: s3SpecificConfig.forcePathStyle,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
normalizeRetrievalConfig(config) {
|
|
413
|
+
if (!config) {
|
|
414
|
+
return undefined;
|
|
415
|
+
}
|
|
416
|
+
// Handle nested config structure from Agentlang
|
|
417
|
+
const normalizedConfig = preprocessRawConfig(config);
|
|
418
|
+
return normalizedConfig;
|
|
419
|
+
}
|
|
420
|
+
async getOrCreateS3Client(config) {
|
|
421
|
+
const clientKey = `${config.region}:${config.endpoint || 'default'}:${config.accessKeyId || 'default'}`;
|
|
422
|
+
if (!this.s3Clients.has(clientKey)) {
|
|
423
|
+
const client = new S3Client({
|
|
424
|
+
region: config.region,
|
|
425
|
+
endpoint: config.endpoint,
|
|
426
|
+
forcePathStyle: config.forcePathStyle,
|
|
427
|
+
credentials: config.accessKeyId && config.secretAccessKey
|
|
428
|
+
? {
|
|
429
|
+
accessKeyId: config.accessKeyId,
|
|
430
|
+
secretAccessKey: config.secretAccessKey,
|
|
431
|
+
}
|
|
432
|
+
: undefined,
|
|
433
|
+
});
|
|
434
|
+
this.s3Clients.set(clientKey, client);
|
|
435
|
+
}
|
|
436
|
+
return this.s3Clients.get(clientKey);
|
|
437
|
+
}
|
|
438
|
+
async parsePdfBuffer(buffer) {
|
|
439
|
+
// Lazy load PDF parser
|
|
440
|
+
if (!this.pdfParser) {
|
|
441
|
+
try {
|
|
442
|
+
const pdfParse = await import('pdf-parse');
|
|
443
|
+
// Handle both ESM and CSM module formats
|
|
444
|
+
const parser = pdfParse.default || pdfParse;
|
|
445
|
+
this.pdfParser = parser;
|
|
446
|
+
}
|
|
447
|
+
catch (error) {
|
|
448
|
+
logger.error('Failed to load PDF parser', { error });
|
|
449
|
+
throw new Error('PDF parsing not available. Please install pdf-parse: npm install pdf-parse');
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
try {
|
|
453
|
+
const result = await this.pdfParser(buffer);
|
|
454
|
+
return result.text || '';
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
logger.error('PDF parsing failed', { error });
|
|
458
|
+
throw new Error(`Failed to parse PDF: ${error}`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
parseMarkdownText(text) {
|
|
462
|
+
// Convert markdown to plain text for embedding
|
|
463
|
+
// This removes formatting but preserves content structure
|
|
464
|
+
try {
|
|
465
|
+
const html = marked.parse(text);
|
|
466
|
+
// Simple HTML to text conversion
|
|
467
|
+
return html
|
|
468
|
+
.replace(/<[^>]+>/g, ' ') // Remove HTML tags
|
|
469
|
+
.replace(/\s+/g, ' ') // Normalize whitespace
|
|
470
|
+
.replace(/</g, '<')
|
|
471
|
+
.replace(/>/g, '>')
|
|
472
|
+
.replace(/&/g, '&')
|
|
473
|
+
.replace(/"/g, '"')
|
|
474
|
+
.trim();
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
logger.warn('Markdown parsing failed, returning raw text', { error });
|
|
478
|
+
return text;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
async readS3BodyToBuffer(body) {
|
|
482
|
+
var _a, e_1, _b, _c;
|
|
483
|
+
if (body.transformToByteArray) {
|
|
484
|
+
const data = await body.transformToByteArray();
|
|
485
|
+
return Buffer.from(data);
|
|
486
|
+
}
|
|
487
|
+
// Fallback for Readable streams
|
|
488
|
+
const chunks = [];
|
|
489
|
+
try {
|
|
490
|
+
for (var _d = true, body_1 = __asyncValues(body), body_1_1; body_1_1 = await body_1.next(), _a = body_1_1.done, !_a; _d = true) {
|
|
491
|
+
_c = body_1_1.value;
|
|
492
|
+
_d = false;
|
|
493
|
+
const chunk = _c;
|
|
494
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
498
|
+
finally {
|
|
499
|
+
try {
|
|
500
|
+
if (!_d && !_a && (_b = body_1.return)) await _b.call(body_1);
|
|
501
|
+
}
|
|
502
|
+
finally { if (e_1) throw e_1.error; }
|
|
503
|
+
}
|
|
504
|
+
return Buffer.concat(chunks);
|
|
505
|
+
}
|
|
506
|
+
async createDocumentEntity(document) {
|
|
507
|
+
try {
|
|
508
|
+
// Build the Document entity attributes
|
|
509
|
+
let docAttrs = `{title "${document.title}", content "${this.escapeContent(document.content)}"`;
|
|
510
|
+
// Add embeddingConfig if present
|
|
511
|
+
if (document.embeddingConfig) {
|
|
512
|
+
const configStr = JSON.stringify(document.embeddingConfig).replace(/"/g, '\\"');
|
|
513
|
+
docAttrs += `, embeddingConfig "${configStr}"`;
|
|
514
|
+
}
|
|
515
|
+
docAttrs += '}';
|
|
516
|
+
// Upsert to database
|
|
517
|
+
await parseAndEvaluateStatement(`{${CoreAIModuleName}/Document ${docAttrs}, @upsert}`);
|
|
518
|
+
logger.debug('Created Document entity', {
|
|
519
|
+
title: document.title,
|
|
520
|
+
url: document.url,
|
|
521
|
+
hasEmbeddingConfig: !!document.embeddingConfig,
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
logger.error('Failed to create Document entity', {
|
|
526
|
+
title: document.title,
|
|
527
|
+
error,
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
escapeContent(content) {
|
|
532
|
+
return content
|
|
533
|
+
.replace(/\\/g, '\\\\')
|
|
534
|
+
.replace(/"/g, '\\"')
|
|
535
|
+
.replace(/\n/g, '\\n')
|
|
536
|
+
.replace(/\r/g, '\\r')
|
|
537
|
+
.replace(/\t/g, '\\t');
|
|
538
|
+
}
|
|
539
|
+
inferFormat(url) {
|
|
540
|
+
// Handle document-service URLs
|
|
541
|
+
if (url.startsWith('document-service://')) {
|
|
542
|
+
return 'txt';
|
|
543
|
+
}
|
|
544
|
+
const parts = url.split('.');
|
|
545
|
+
if (parts.length > 1) {
|
|
546
|
+
return parts[parts.length - 1].toLowerCase();
|
|
547
|
+
}
|
|
548
|
+
return 'txt';
|
|
549
|
+
}
|
|
550
|
+
findDocumentInConfig(title) {
|
|
551
|
+
// This method should be called during config loading
|
|
552
|
+
// The documents are stored when the config is parsed
|
|
553
|
+
const docs = getConfiguredDocuments();
|
|
554
|
+
return docs.find(d => d.title === title) || null;
|
|
555
|
+
}
|
|
556
|
+
ensureNodeEnv() {
|
|
557
|
+
if (!isNodeEnv) {
|
|
558
|
+
throw new Error('Document fetching is only available in Node.js environment');
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
clearCache() {
|
|
562
|
+
// Clear all cache
|
|
563
|
+
this.documentCache.clear();
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
DocumentFetcherService.CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
567
|
+
// Singleton instance
|
|
568
|
+
const documentFetcher = new DocumentFetcherService();
|
|
569
|
+
// Helper function to get configured documents from module config
|
|
570
|
+
function getConfiguredDocuments() {
|
|
571
|
+
// This should be populated during config parsing
|
|
572
|
+
// For now, return empty array - actual implementation depends on how
|
|
573
|
+
// the config system stores document definitions
|
|
574
|
+
return global.__configuredDocuments || [];
|
|
575
|
+
}
|
|
576
|
+
// Export for use in config loading
|
|
577
|
+
export function setConfiguredDocuments(docs) {
|
|
578
|
+
global.__configuredDocuments = docs;
|
|
579
|
+
}
|
|
580
|
+
export { documentFetcher };
|
|
581
|
+
export default documentFetcher;
|
|
582
|
+
//# sourceMappingURL=documentFetcher.js.map
|
|
@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AI agents - enterprise-grade teams of AI agents that collaborate with each other and humans",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.11",
|
|
5
5
|
"license": "Sustainable Use License",
|
|
6
6
|
"author": "agentlang-ai",
|
|
7
7
|
"homepage": "https://github.com/agentlang-ai/agentlang#readme",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@aws-sdk/client-cognito-identity": "^3.975.0",
|
|
39
39
|
"@aws-sdk/client-cognito-identity-provider": "^3.975.0",
|
|
40
|
+
"@aws-sdk/client-s3": "^3.975.0",
|
|
40
41
|
"@aws-sdk/credential-providers": "^3.975.0",
|
|
41
42
|
"@isomorphic-git/lightning-fs": "^4.6.2",
|
|
42
43
|
"@langchain/anthropic": "^1.3.12",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 4.
|
|
2
|
+
* This file was generated by langium-cli 4.2.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 4.
|
|
2
|
+
* This file was generated by langium-cli 4.2.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 4.
|
|
2
|
+
* This file was generated by langium-cli 4.2.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|