fss-link 1.0.80 → 1.0.82
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/bundle/fss-link.js +316 -177
- package/package.json +1 -1
package/bundle/fss-link.js
CHANGED
|
@@ -11076,7 +11076,7 @@ var init_sdk = __esm({
|
|
|
11076
11076
|
CompressionAlgorithm = otelExporterBase.CompressionAlgorithm;
|
|
11077
11077
|
NodeSDK = otelSdkNode.NodeSDK;
|
|
11078
11078
|
SemanticResourceAttributes = otelSemanticConventions.SemanticResourceAttributes;
|
|
11079
|
-
resourceFromAttributes = otelResources.
|
|
11079
|
+
resourceFromAttributes = (attributes) => new otelResources.Resource(attributes);
|
|
11080
11080
|
BatchSpanProcessor = otelSdkTraceNode.BatchSpanProcessor;
|
|
11081
11081
|
ConsoleSpanExporter = otelSdkTraceNode.ConsoleSpanExporter;
|
|
11082
11082
|
BatchLogRecordProcessor = otelSdkLogs.BatchLogRecordProcessor;
|
|
@@ -22315,7 +22315,7 @@ var init_qwenContentGenerator = __esm({
|
|
|
22315
22315
|
|
|
22316
22316
|
// packages/core/dist/src/core/contentGenerator.js
|
|
22317
22317
|
import { GoogleGenAI } from "@google/genai";
|
|
22318
|
-
function createContentGeneratorConfig(config, authType) {
|
|
22318
|
+
async function createContentGeneratorConfig(config, authType) {
|
|
22319
22319
|
const geminiApiKey = process.env["GEMINI_API_KEY"] || void 0;
|
|
22320
22320
|
const googleApiKey = process.env["GOOGLE_API_KEY"] || void 0;
|
|
22321
22321
|
const googleCloudProject = process.env["GOOGLE_CLOUD_PROJECT"] || void 0;
|
|
@@ -22330,6 +22330,7 @@ function createContentGeneratorConfig(config, authType) {
|
|
|
22330
22330
|
const lmStudioBaseUrl = process.env["LM_STUDIO_BASE_URL"] || void 0;
|
|
22331
22331
|
const lmStudioModel = process.env["LM_STUDIO_MODEL"] || void 0;
|
|
22332
22332
|
const effectiveModel = config.getModel() || DEFAULT_GEMINI_MODEL;
|
|
22333
|
+
const samplingParams = await config.getContentGeneratorSamplingParamsAsync();
|
|
22333
22334
|
const contentGeneratorConfig = {
|
|
22334
22335
|
model: effectiveModel,
|
|
22335
22336
|
authType,
|
|
@@ -22338,7 +22339,7 @@ function createContentGeneratorConfig(config, authType) {
|
|
|
22338
22339
|
timeout: config.getContentGeneratorTimeout(),
|
|
22339
22340
|
maxRetries: config.getContentGeneratorMaxRetries(),
|
|
22340
22341
|
disableCacheControl: config.getContentGeneratorDisableCacheControl(),
|
|
22341
|
-
samplingParams
|
|
22342
|
+
samplingParams
|
|
22342
22343
|
};
|
|
22343
22344
|
if (authType === AuthType.LOGIN_WITH_GOOGLE || authType === AuthType.CLOUD_SHELL) {
|
|
22344
22345
|
return contentGeneratorConfig;
|
|
@@ -22379,7 +22380,8 @@ function createContentGeneratorConfig(config, authType) {
|
|
|
22379
22380
|
return contentGeneratorConfig;
|
|
22380
22381
|
}
|
|
22381
22382
|
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
22382
|
-
|
|
22383
|
+
console.log(`\u{1F41B} DEBUG createContentGenerator: authType=${config.authType}, apiKey=${config.apiKey}, baseUrl=${config.baseUrl}`);
|
|
22384
|
+
const version = "1.0.82";
|
|
22383
22385
|
const userAgent = `FSS-Link/${version} (${process.platform}; ${process.arch})`;
|
|
22384
22386
|
const baseHeaders = {
|
|
22385
22387
|
"User-Agent": userAgent
|
|
@@ -98808,6 +98810,17 @@ var init_excel_parser = __esm({
|
|
|
98808
98810
|
this.safetyManager = new SafetyManager();
|
|
98809
98811
|
this.memoryTracker = new MemoryTracker(this.config.maxMemoryUsage);
|
|
98810
98812
|
}
|
|
98813
|
+
// Get current configuration
|
|
98814
|
+
getConfig() {
|
|
98815
|
+
return { ...this.config };
|
|
98816
|
+
}
|
|
98817
|
+
// Update configuration
|
|
98818
|
+
updateConfig(newConfig) {
|
|
98819
|
+
this.config = { ...this.config, ...newConfig };
|
|
98820
|
+
if (newConfig.maxMemoryUsage !== void 0) {
|
|
98821
|
+
this.memoryTracker = new MemoryTracker(newConfig.maxMemoryUsage);
|
|
98822
|
+
}
|
|
98823
|
+
}
|
|
98811
98824
|
// Set progress callback for streaming operations
|
|
98812
98825
|
setProgressCallback(callback2) {
|
|
98813
98826
|
this.progressCallback = callback2;
|
|
@@ -98922,7 +98935,15 @@ var init_excel_parser = __esm({
|
|
|
98922
98935
|
default:
|
|
98923
98936
|
throw new Error(`Unsupported file format: ${extension}`);
|
|
98924
98937
|
}
|
|
98925
|
-
|
|
98938
|
+
if (this.config.preserveFormulas || this.shouldEnhanceData()) {
|
|
98939
|
+
if (extension === "xlsx" || extension === "xls" || extension === "xlsm") {
|
|
98940
|
+
result.data = await this.enhanceWorkbookDataWithXLSX(workbookData, filePath);
|
|
98941
|
+
} else {
|
|
98942
|
+
result.data = this.enhanceWorkbookData(workbookData);
|
|
98943
|
+
}
|
|
98944
|
+
} else {
|
|
98945
|
+
result.data = workbookData;
|
|
98946
|
+
}
|
|
98926
98947
|
if (workbookData.metadata) {
|
|
98927
98948
|
result.metadata = workbookData.metadata;
|
|
98928
98949
|
}
|
|
@@ -98940,6 +98961,133 @@ var init_excel_parser = __esm({
|
|
|
98940
98961
|
}
|
|
98941
98962
|
return result;
|
|
98942
98963
|
}
|
|
98964
|
+
// Determine if data should be enhanced with advanced features
|
|
98965
|
+
shouldEnhanceData() {
|
|
98966
|
+
return this.config.preserveFormulas || this.config.includeMetadata;
|
|
98967
|
+
}
|
|
98968
|
+
// Convert basic WorkbookData to EnhancedWorkbookData with XLSX workbook access
|
|
98969
|
+
async enhanceWorkbookDataWithXLSX(workbookData, filePath) {
|
|
98970
|
+
const xlsxWorkbook = import_xlsx.default.readFile(filePath, {
|
|
98971
|
+
bookProps: true,
|
|
98972
|
+
cellFormula: this.config.preserveFormulas
|
|
98973
|
+
});
|
|
98974
|
+
const enhancedSheets = {};
|
|
98975
|
+
for (const [sheetName, sheetData] of Object.entries(workbookData.sheets)) {
|
|
98976
|
+
const enhancedSheet = {
|
|
98977
|
+
...sheetData,
|
|
98978
|
+
formulaRelationships: this.extractFormulaRelationships(sheetData),
|
|
98979
|
+
tables: this.detectTables(sheetData),
|
|
98980
|
+
charts: [],
|
|
98981
|
+
// TODO: Implement chart detection
|
|
98982
|
+
revisionHistory: []
|
|
98983
|
+
// TODO: Implement sheet-level revision history
|
|
98984
|
+
};
|
|
98985
|
+
enhancedSheets[sheetName] = enhancedSheet;
|
|
98986
|
+
}
|
|
98987
|
+
const enhancedData = {
|
|
98988
|
+
...workbookData,
|
|
98989
|
+
sheets: enhancedSheets,
|
|
98990
|
+
revisionHistory: this.extractRevisionHistory(xlsxWorkbook),
|
|
98991
|
+
lastAuthors: this.extractLastAuthors(xlsxWorkbook),
|
|
98992
|
+
documentVersionInfo: void 0
|
|
98993
|
+
// TODO: Implement version info extraction
|
|
98994
|
+
};
|
|
98995
|
+
return enhancedData;
|
|
98996
|
+
}
|
|
98997
|
+
// Convert basic WorkbookData to EnhancedWorkbookData
|
|
98998
|
+
enhanceWorkbookData(workbookData) {
|
|
98999
|
+
const enhancedSheets = {};
|
|
99000
|
+
for (const [sheetName, sheetData] of Object.entries(workbookData.sheets)) {
|
|
99001
|
+
const enhancedSheet = {
|
|
99002
|
+
...sheetData,
|
|
99003
|
+
formulaRelationships: this.extractFormulaRelationships(sheetData),
|
|
99004
|
+
tables: this.detectTables(sheetData),
|
|
99005
|
+
charts: [],
|
|
99006
|
+
// TODO: Implement chart detection
|
|
99007
|
+
revisionHistory: []
|
|
99008
|
+
// TODO: Implement sheet-level revision history
|
|
99009
|
+
};
|
|
99010
|
+
enhancedSheets[sheetName] = enhancedSheet;
|
|
99011
|
+
}
|
|
99012
|
+
const enhancedData = {
|
|
99013
|
+
...workbookData,
|
|
99014
|
+
sheets: enhancedSheets,
|
|
99015
|
+
revisionHistory: this.extractRevisionHistory({}),
|
|
99016
|
+
// TODO: Pass actual workbook object
|
|
99017
|
+
lastAuthors: this.extractLastAuthors({}),
|
|
99018
|
+
// TODO: Pass actual workbook object
|
|
99019
|
+
documentVersionInfo: void 0
|
|
99020
|
+
// TODO: Implement version info extraction
|
|
99021
|
+
};
|
|
99022
|
+
return enhancedData;
|
|
99023
|
+
}
|
|
99024
|
+
// Extract formula relationships from sheet data
|
|
99025
|
+
extractFormulaRelationships(sheetData) {
|
|
99026
|
+
const relationships = [];
|
|
99027
|
+
if (!this.config.preserveFormulas) {
|
|
99028
|
+
return relationships;
|
|
99029
|
+
}
|
|
99030
|
+
for (let rowIndex = 0; rowIndex < sheetData.data.length; rowIndex++) {
|
|
99031
|
+
const row = sheetData.data[rowIndex];
|
|
99032
|
+
for (let colIndex = 0; colIndex < row.length; colIndex++) {
|
|
99033
|
+
const cell = row[colIndex];
|
|
99034
|
+
if (cell.formula) {
|
|
99035
|
+
const cellAddress = this.getCellAddress(rowIndex, colIndex);
|
|
99036
|
+
const dependencies = this.extractFormulaDependencies(cell.formula);
|
|
99037
|
+
relationships.push({
|
|
99038
|
+
sourceCell: cellAddress,
|
|
99039
|
+
targetCells: [],
|
|
99040
|
+
// TODO: Find cells that reference this one
|
|
99041
|
+
formula: cell.formula,
|
|
99042
|
+
dependencies
|
|
99043
|
+
});
|
|
99044
|
+
}
|
|
99045
|
+
}
|
|
99046
|
+
}
|
|
99047
|
+
return relationships;
|
|
99048
|
+
}
|
|
99049
|
+
// Detect tables in sheet data (basic implementation)
|
|
99050
|
+
detectTables(sheetData) {
|
|
99051
|
+
const tables = [];
|
|
99052
|
+
if (sheetData.data.length < 2) {
|
|
99053
|
+
return tables;
|
|
99054
|
+
}
|
|
99055
|
+
const firstRow = sheetData.data[0];
|
|
99056
|
+
const hasHeaders = firstRow.every((cell) => cell.value && typeof cell.value === "string");
|
|
99057
|
+
if (hasHeaders && sheetData.data.length > 1) {
|
|
99058
|
+
const headers = firstRow.map((cell) => String(cell.value));
|
|
99059
|
+
tables.push({
|
|
99060
|
+
name: `Table1`,
|
|
99061
|
+
// Simple naming
|
|
99062
|
+
range: `A1:${this.getCellAddress(sheetData.data.length - 1, firstRow.length - 1)}`,
|
|
99063
|
+
headers,
|
|
99064
|
+
rowCount: sheetData.data.length,
|
|
99065
|
+
// Include header in total count
|
|
99066
|
+
columnCount: firstRow.length
|
|
99067
|
+
});
|
|
99068
|
+
}
|
|
99069
|
+
return tables;
|
|
99070
|
+
}
|
|
99071
|
+
// Convert row/col indices to cell address (e.g., 0,0 -> "A1")
|
|
99072
|
+
getCellAddress(row, col) {
|
|
99073
|
+
let colStr = "";
|
|
99074
|
+
let colNum = col;
|
|
99075
|
+
while (colNum >= 0) {
|
|
99076
|
+
colStr = String.fromCharCode(65 + colNum % 26) + colStr;
|
|
99077
|
+
colNum = Math.floor(colNum / 26) - 1;
|
|
99078
|
+
}
|
|
99079
|
+
return colStr + (row + 1);
|
|
99080
|
+
}
|
|
99081
|
+
// Extract cell references from formula (basic implementation)
|
|
99082
|
+
extractFormulaDependencies(formula) {
|
|
99083
|
+
const dependencies = [];
|
|
99084
|
+
const cellRefRegex = /\b[A-Z]+\d+\b/g;
|
|
99085
|
+
const matches = formula.match(cellRefRegex);
|
|
99086
|
+
if (matches) {
|
|
99087
|
+
dependencies.push(...matches);
|
|
99088
|
+
}
|
|
99089
|
+
return dependencies;
|
|
99090
|
+
}
|
|
98943
99091
|
// Enhanced streaming Excel file parser
|
|
98944
99092
|
async _parseExcelFileStreaming(filePath) {
|
|
98945
99093
|
this.reportProgress("reading", filePath, 0, 1, 0, 0);
|
|
@@ -98949,6 +99097,21 @@ var init_excel_parser = __esm({
|
|
|
98949
99097
|
sheetRows: 0
|
|
98950
99098
|
// Don't load data yet
|
|
98951
99099
|
});
|
|
99100
|
+
if (!workbook.SheetNames || !Array.isArray(workbook.SheetNames) || workbook.SheetNames.length === 0) {
|
|
99101
|
+
console.warn("bookProps option interfered with SheetNames, attempting recovery...");
|
|
99102
|
+
const recoveryWorkbook = import_xlsx.default.readFile(filePath, {
|
|
99103
|
+
bookSheets: true,
|
|
99104
|
+
sheetRows: 0
|
|
99105
|
+
});
|
|
99106
|
+
if (recoveryWorkbook.SheetNames && Array.isArray(recoveryWorkbook.SheetNames) && recoveryWorkbook.SheetNames.length > 0) {
|
|
99107
|
+
workbook.SheetNames = recoveryWorkbook.SheetNames;
|
|
99108
|
+
if (recoveryWorkbook.Sheets) {
|
|
99109
|
+
workbook.Sheets = { ...workbook.Sheets, ...recoveryWorkbook.Sheets };
|
|
99110
|
+
}
|
|
99111
|
+
} else {
|
|
99112
|
+
throw new Error("No sheets found in workbook or SheetNames is invalid");
|
|
99113
|
+
}
|
|
99114
|
+
}
|
|
98952
99115
|
const workbookData = {
|
|
98953
99116
|
sheets: {},
|
|
98954
99117
|
metadata: this.extractWorkbookMetadata(workbook),
|
|
@@ -99016,7 +99179,19 @@ var init_excel_parser = __esm({
|
|
|
99016
99179
|
options3.cellFormula = this.config.preserveFormulas;
|
|
99017
99180
|
if (this.config.includeFormatting !== void 0)
|
|
99018
99181
|
options3.cellStyles = this.config.includeFormatting;
|
|
99019
|
-
|
|
99182
|
+
if (this.config.includeMetadata !== void 0)
|
|
99183
|
+
options3.bookProps = this.config.includeMetadata;
|
|
99184
|
+
let workbook = import_xlsx.default.readFile(filePath, options3);
|
|
99185
|
+
if (this.config.includeMetadata && (!workbook.SheetNames || workbook.SheetNames.length === 0)) {
|
|
99186
|
+
console.warn("bookProps option interfered with SheetNames, attempting recovery...");
|
|
99187
|
+
const savedProps = workbook.Props;
|
|
99188
|
+
const optionsWithoutProps = { ...options3 };
|
|
99189
|
+
delete optionsWithoutProps.bookProps;
|
|
99190
|
+
workbook = import_xlsx.default.readFile(filePath, optionsWithoutProps);
|
|
99191
|
+
if (savedProps) {
|
|
99192
|
+
workbook.Props = savedProps;
|
|
99193
|
+
}
|
|
99194
|
+
}
|
|
99020
99195
|
const workbookData = {
|
|
99021
99196
|
sheets: {}
|
|
99022
99197
|
};
|
|
@@ -99038,7 +99213,7 @@ var init_excel_parser = __esm({
|
|
|
99038
99213
|
workbookData.metadata = metadata;
|
|
99039
99214
|
}
|
|
99040
99215
|
if (!workbook.SheetNames || !Array.isArray(workbook.SheetNames) || workbook.SheetNames.length === 0) {
|
|
99041
|
-
throw new Error("No sheets found in workbook
|
|
99216
|
+
throw new Error("No sheets found in workbook - file may be corrupted or invalid");
|
|
99042
99217
|
}
|
|
99043
99218
|
const sheetsToProcess = this.config.readAllSheets ? workbook.SheetNames : [workbook.SheetNames[0]];
|
|
99044
99219
|
for (const sheetName of sheetsToProcess) {
|
|
@@ -99050,7 +99225,16 @@ var init_excel_parser = __esm({
|
|
|
99050
99225
|
return workbookData;
|
|
99051
99226
|
}
|
|
99052
99227
|
processWorksheet(worksheet, sheetName) {
|
|
99053
|
-
|
|
99228
|
+
if (!worksheet["!ref"]) {
|
|
99229
|
+
return {
|
|
99230
|
+
name: sheetName,
|
|
99231
|
+
data: [],
|
|
99232
|
+
range: "",
|
|
99233
|
+
rowCount: 0,
|
|
99234
|
+
columnCount: 0
|
|
99235
|
+
};
|
|
99236
|
+
}
|
|
99237
|
+
const sheetRange = worksheet["!ref"];
|
|
99054
99238
|
const targetRange = this.config.range || sheetRange;
|
|
99055
99239
|
let range;
|
|
99056
99240
|
try {
|
|
@@ -99238,9 +99422,10 @@ var init_excel_parser = __esm({
|
|
|
99238
99422
|
}
|
|
99239
99423
|
// Extract revision history from workbook properties
|
|
99240
99424
|
extractRevisionHistory(workbook) {
|
|
99241
|
-
if (!workbook.Props)
|
|
99242
|
-
return void 0;
|
|
99243
99425
|
const revisions = [];
|
|
99426
|
+
if (!workbook.Props) {
|
|
99427
|
+
return revisions;
|
|
99428
|
+
}
|
|
99244
99429
|
if (workbook.Props.LastAuthor) {
|
|
99245
99430
|
revisions.push({
|
|
99246
99431
|
author: workbook.Props.LastAuthor,
|
|
@@ -99248,158 +99433,27 @@ var init_excel_parser = __esm({
|
|
|
99248
99433
|
description: "Last modification"
|
|
99249
99434
|
});
|
|
99250
99435
|
}
|
|
99251
|
-
|
|
99436
|
+
if (workbook.Props.Author && workbook.Props.Author !== workbook.Props.LastAuthor) {
|
|
99437
|
+
revisions.push({
|
|
99438
|
+
author: workbook.Props.Author,
|
|
99439
|
+
timestamp: workbook.Props.CreatedDate,
|
|
99440
|
+
description: "Document creation"
|
|
99441
|
+
});
|
|
99442
|
+
}
|
|
99443
|
+
return revisions;
|
|
99252
99444
|
}
|
|
99253
99445
|
// Extract last authors from document properties
|
|
99254
99446
|
extractLastAuthors(workbook) {
|
|
99255
|
-
if (!workbook.Props)
|
|
99256
|
-
return void 0;
|
|
99257
99447
|
const authors = [];
|
|
99448
|
+
if (!workbook.Props) {
|
|
99449
|
+
return authors;
|
|
99450
|
+
}
|
|
99258
99451
|
if (workbook.Props.Author)
|
|
99259
99452
|
authors.push(workbook.Props.Author);
|
|
99260
99453
|
if (workbook.Props.LastAuthor && workbook.Props.LastAuthor !== workbook.Props.Author) {
|
|
99261
99454
|
authors.push(workbook.Props.LastAuthor);
|
|
99262
99455
|
}
|
|
99263
|
-
return authors
|
|
99264
|
-
}
|
|
99265
|
-
// Extract formula relationships for enhanced formula preservation
|
|
99266
|
-
extractFormulaRelationships(worksheet) {
|
|
99267
|
-
const relationships = [];
|
|
99268
|
-
const cellAddresses = Object.keys(worksheet).filter((addr) => addr.match(/^[A-Z]+\d+$/));
|
|
99269
|
-
for (const cellAddr of cellAddresses) {
|
|
99270
|
-
const cell = worksheet[cellAddr];
|
|
99271
|
-
if (cell && cell.f) {
|
|
99272
|
-
const dependencies = this.extractFormulaDependencies(cell.f);
|
|
99273
|
-
const targetCells = this.findReferencingCells(worksheet, cellAddr);
|
|
99274
|
-
relationships.push({
|
|
99275
|
-
sourceCell: cellAddr,
|
|
99276
|
-
targetCells,
|
|
99277
|
-
formula: cell.f,
|
|
99278
|
-
dependencies
|
|
99279
|
-
});
|
|
99280
|
-
}
|
|
99281
|
-
}
|
|
99282
|
-
return relationships;
|
|
99283
|
-
}
|
|
99284
|
-
// Extract dependencies from formula string
|
|
99285
|
-
extractFormulaDependencies(formula) {
|
|
99286
|
-
const cellRefRegex = /\b[A-Z]+\d+\b/g;
|
|
99287
|
-
const matches = formula.match(cellRefRegex);
|
|
99288
|
-
return matches ? Array.from(new Set(matches)) : [];
|
|
99289
|
-
}
|
|
99290
|
-
// Find cells that reference the given cell
|
|
99291
|
-
findReferencingCells(worksheet, targetCell) {
|
|
99292
|
-
const referencingCells = [];
|
|
99293
|
-
const cellAddresses = Object.keys(worksheet).filter((addr) => addr.match(/^[A-Z]+\d+$/));
|
|
99294
|
-
for (const cellAddr of cellAddresses) {
|
|
99295
|
-
const cell = worksheet[cellAddr];
|
|
99296
|
-
if (cell && cell.f) {
|
|
99297
|
-
const dependencies = this.extractFormulaDependencies(cell.f);
|
|
99298
|
-
if (dependencies.includes(targetCell)) {
|
|
99299
|
-
referencingCells.push(cellAddr);
|
|
99300
|
-
}
|
|
99301
|
-
}
|
|
99302
|
-
}
|
|
99303
|
-
return referencingCells;
|
|
99304
|
-
}
|
|
99305
|
-
// Extract table information from worksheet
|
|
99306
|
-
extractTableInfo(worksheet) {
|
|
99307
|
-
const tables = [];
|
|
99308
|
-
if (worksheet["!ref"]) {
|
|
99309
|
-
const range = import_xlsx.default.utils.decode_range(worksheet["!ref"]);
|
|
99310
|
-
const hasHeaders = this.detectHeaders(worksheet, range);
|
|
99311
|
-
if (hasHeaders) {
|
|
99312
|
-
const headers = this.extractTableHeaders(worksheet, range);
|
|
99313
|
-
tables.push({
|
|
99314
|
-
range: worksheet["!ref"],
|
|
99315
|
-
headers,
|
|
99316
|
-
columnCount: range.e.c - range.s.c + 1,
|
|
99317
|
-
rowCount: range.e.r - range.s.r + 1,
|
|
99318
|
-
hasFilters: false,
|
|
99319
|
-
// Could be enhanced to detect actual filters
|
|
99320
|
-
hasTotalsRow: false
|
|
99321
|
-
// Could be enhanced to detect totals
|
|
99322
|
-
});
|
|
99323
|
-
}
|
|
99324
|
-
}
|
|
99325
|
-
return tables;
|
|
99326
|
-
}
|
|
99327
|
-
// Extract chart information (basic implementation)
|
|
99328
|
-
extractChartInfo(worksheet) {
|
|
99329
|
-
return [];
|
|
99330
|
-
}
|
|
99331
|
-
// Extract sheet-level revision history
|
|
99332
|
-
extractSheetRevisionHistory(worksheet) {
|
|
99333
|
-
return void 0;
|
|
99334
|
-
}
|
|
99335
|
-
// Detect if worksheet has headers
|
|
99336
|
-
detectHeaders(worksheet, range) {
|
|
99337
|
-
for (let col = range.s.c; col <= range.e.c; col++) {
|
|
99338
|
-
const cellAddr = import_xlsx.default.utils.encode_cell({ r: range.s.r, c: col });
|
|
99339
|
-
const cell = worksheet[cellAddr];
|
|
99340
|
-
if (cell && typeof cell.v === "string") {
|
|
99341
|
-
return true;
|
|
99342
|
-
}
|
|
99343
|
-
}
|
|
99344
|
-
return false;
|
|
99345
|
-
}
|
|
99346
|
-
// Extract table headers from first row
|
|
99347
|
-
extractTableHeaders(worksheet, range) {
|
|
99348
|
-
const headers = [];
|
|
99349
|
-
for (let col = range.s.c; col <= range.e.c; col++) {
|
|
99350
|
-
const cellAddr = import_xlsx.default.utils.encode_cell({ r: range.s.r, c: col });
|
|
99351
|
-
const cell = worksheet[cellAddr];
|
|
99352
|
-
headers.push(cell ? String(cell.v || `Column ${col + 1}`) : `Column ${col + 1}`);
|
|
99353
|
-
}
|
|
99354
|
-
return headers;
|
|
99355
|
-
}
|
|
99356
|
-
// Streaming CSV parser for large files
|
|
99357
|
-
async _parseCsvFileStreaming(filePath, delimiter2 = ",") {
|
|
99358
|
-
return new Promise((resolve19, reject) => {
|
|
99359
|
-
const data = [];
|
|
99360
|
-
const fileStream = fs24.createReadStream(filePath);
|
|
99361
|
-
let rowCount = 0;
|
|
99362
|
-
const chunkSize = this.config.chunkSize || 1e3;
|
|
99363
|
-
fileStream.pipe(parse3({
|
|
99364
|
-
delimiter: delimiter2,
|
|
99365
|
-
skip_empty_lines: true,
|
|
99366
|
-
trim: true
|
|
99367
|
-
})).on("data", (row) => {
|
|
99368
|
-
if (rowCount % chunkSize === 0) {
|
|
99369
|
-
this.reportProgress("processing", "CSV Data", 0, 1, rowCount, rowCount);
|
|
99370
|
-
if (this.memoryTracker.isMemoryLimitApproached()) {
|
|
99371
|
-
this.memoryTracker.forceGC();
|
|
99372
|
-
}
|
|
99373
|
-
if (this.memoryTracker.isMemoryLimitExceeded()) {
|
|
99374
|
-
reject(new Error(`Memory limit exceeded while processing CSV: ${this.memoryTracker.getCurrentUsage()}MB`));
|
|
99375
|
-
return;
|
|
99376
|
-
}
|
|
99377
|
-
}
|
|
99378
|
-
const rowData = row.map((cell) => ({
|
|
99379
|
-
value: this.parseValue(cell),
|
|
99380
|
-
type: this.inferType(cell)
|
|
99381
|
-
}));
|
|
99382
|
-
data.push(rowData);
|
|
99383
|
-
rowCount++;
|
|
99384
|
-
}).on("end", () => {
|
|
99385
|
-
const sheetData = {
|
|
99386
|
-
name: "Sheet1",
|
|
99387
|
-
data,
|
|
99388
|
-
range: `A1:${import_xlsx.default.utils.encode_cell({ r: data.length - 1, c: Math.max(0, (data[0]?.length || 1) - 1) })}`,
|
|
99389
|
-
rowCount: data.length,
|
|
99390
|
-
columnCount: data[0]?.length || 0
|
|
99391
|
-
};
|
|
99392
|
-
resolve19({
|
|
99393
|
-
sheets: { "Sheet1": sheetData }
|
|
99394
|
-
});
|
|
99395
|
-
}).on("error", reject);
|
|
99396
|
-
});
|
|
99397
|
-
}
|
|
99398
|
-
updateConfig(newConfig) {
|
|
99399
|
-
this.config = { ...this.config, ...newConfig };
|
|
99400
|
-
}
|
|
99401
|
-
getConfig() {
|
|
99402
|
-
return { ...this.config };
|
|
99456
|
+
return authors;
|
|
99403
99457
|
}
|
|
99404
99458
|
// New method: Generate Excel file (round-trip functionality)
|
|
99405
99459
|
async generateExcel(data, outputPath) {
|
|
@@ -99697,6 +99751,15 @@ Perfect for:
|
|
|
99697
99751
|
return excelParserSchemaData;
|
|
99698
99752
|
}
|
|
99699
99753
|
createInvocation(params) {
|
|
99754
|
+
if (!params.file_path || params.file_path.trim() === "") {
|
|
99755
|
+
throw new Error("file_path is required and cannot be empty");
|
|
99756
|
+
}
|
|
99757
|
+
if (params.output_format) {
|
|
99758
|
+
const validFormats = ["json", "markdown", "csv", "yaml"];
|
|
99759
|
+
if (!validFormats.includes(params.output_format)) {
|
|
99760
|
+
throw new Error(`Invalid output_format: ${params.output_format}. Valid formats: ${validFormats.join(", ")}`);
|
|
99761
|
+
}
|
|
99762
|
+
}
|
|
99700
99763
|
return new ExcelParserToolInvocation(params);
|
|
99701
99764
|
}
|
|
99702
99765
|
};
|
|
@@ -351100,7 +351163,7 @@ var init_config = __esm({
|
|
|
351100
351163
|
if (this.geminiClient && this.geminiClient.isInitialized()) {
|
|
351101
351164
|
existingHistory = this.geminiClient.getHistory();
|
|
351102
351165
|
}
|
|
351103
|
-
const newContentGeneratorConfig = createContentGeneratorConfig(this, authMethod);
|
|
351166
|
+
const newContentGeneratorConfig = await createContentGeneratorConfig(this, authMethod);
|
|
351104
351167
|
const newGeminiClient = new GeminiClient(this);
|
|
351105
351168
|
await newGeminiClient.initialize(newContentGeneratorConfig);
|
|
351106
351169
|
const fromGenaiToVertex = this.contentGeneratorConfig?.authType === AuthType.USE_GEMINI && authMethod === AuthType.LOGIN_WITH_GOOGLE;
|
|
@@ -351379,6 +351442,23 @@ var init_config = __esm({
|
|
|
351379
351442
|
getContentGeneratorSamplingParams() {
|
|
351380
351443
|
return this.contentGenerator?.samplingParams;
|
|
351381
351444
|
}
|
|
351445
|
+
/**
|
|
351446
|
+
* Get sampling parameters with async ModelStateProvider support
|
|
351447
|
+
* This is used by createContentGeneratorConfig to get current database settings
|
|
351448
|
+
*/
|
|
351449
|
+
async getContentGeneratorSamplingParamsAsync() {
|
|
351450
|
+
if (this.modelStateProvider) {
|
|
351451
|
+
try {
|
|
351452
|
+
const samplingParams = await this.modelStateProvider.getCurrentSamplingParams();
|
|
351453
|
+
if (samplingParams && Object.keys(samplingParams).length > 0) {
|
|
351454
|
+
return samplingParams;
|
|
351455
|
+
}
|
|
351456
|
+
} catch (error) {
|
|
351457
|
+
console.debug("Failed to get sampling params from ModelStateProvider:", error);
|
|
351458
|
+
}
|
|
351459
|
+
}
|
|
351460
|
+
return this.contentGenerator?.samplingParams;
|
|
351461
|
+
}
|
|
351382
351462
|
setContentGeneratorSamplingParams(newParams) {
|
|
351383
351463
|
if (this.contentGenerator) {
|
|
351384
351464
|
this.contentGenerator.samplingParams = {
|
|
@@ -369161,7 +369241,7 @@ function saveSettings(settingsFile) {
|
|
|
369161
369241
|
// packages/cli/src/config/databasePool.ts
|
|
369162
369242
|
import initSqlJs from "sql.js";
|
|
369163
369243
|
import * as fs48 from "fs";
|
|
369164
|
-
var
|
|
369244
|
+
var DatabaseConnectionPool2 = class {
|
|
369165
369245
|
connections = [];
|
|
369166
369246
|
availableConnections = [];
|
|
369167
369247
|
maxConnections;
|
|
@@ -369279,7 +369359,9 @@ var DatabaseConnectionPool = class {
|
|
|
369279
369359
|
const connection = await this.getConnection();
|
|
369280
369360
|
try {
|
|
369281
369361
|
const data = connection.export();
|
|
369282
|
-
|
|
369362
|
+
const tempPath = `${this.dbPath}.tmp`;
|
|
369363
|
+
fs48.writeFileSync(tempPath, Buffer.from(data));
|
|
369364
|
+
fs48.renameSync(tempPath, this.dbPath);
|
|
369283
369365
|
} finally {
|
|
369284
369366
|
this.releaseConnection(connection);
|
|
369285
369367
|
}
|
|
@@ -369312,7 +369394,7 @@ var DatabaseConnectionPool = class {
|
|
|
369312
369394
|
var globalPool = null;
|
|
369313
369395
|
function getDatabasePool(dbPath) {
|
|
369314
369396
|
if (!globalPool && dbPath) {
|
|
369315
|
-
globalPool = new
|
|
369397
|
+
globalPool = new DatabaseConnectionPool2(dbPath);
|
|
369316
369398
|
}
|
|
369317
369399
|
if (!globalPool) {
|
|
369318
369400
|
throw new Error("Database pool not initialized. Call with dbPath first.");
|
|
@@ -371406,6 +371488,17 @@ var FSSLinkDatabase = class {
|
|
|
371406
371488
|
throw new Error("Database schema validation failed");
|
|
371407
371489
|
}
|
|
371408
371490
|
debugLog("Database schema validation passed");
|
|
371491
|
+
debugLog("Testing database runtime integrity...");
|
|
371492
|
+
try {
|
|
371493
|
+
db.exec("SELECT 1;");
|
|
371494
|
+
const testStmt = db.prepare("SELECT COUNT(*) as count FROM model_configs;");
|
|
371495
|
+
testStmt.step();
|
|
371496
|
+
testStmt.free();
|
|
371497
|
+
debugLog("Database runtime integrity test passed");
|
|
371498
|
+
} catch (error) {
|
|
371499
|
+
console.warn("Database runtime integrity test failed:", error);
|
|
371500
|
+
throw new Error("Database corruption detected - runtime test failed");
|
|
371501
|
+
}
|
|
371409
371502
|
debugLog("Running legacy schema initialization...");
|
|
371410
371503
|
await this.initializeSchema(db);
|
|
371411
371504
|
debugLog("Legacy schema initialization completed");
|
|
@@ -371423,10 +371516,41 @@ var FSSLinkDatabase = class {
|
|
|
371423
371516
|
debugLog("FSS Link database initialization completed successfully");
|
|
371424
371517
|
} catch (error) {
|
|
371425
371518
|
console.error("Database initialization failed:", error);
|
|
371519
|
+
if (error instanceof Error && error.message.includes("corruption detected")) {
|
|
371520
|
+
console.warn("\u{1F527} Database corruption detected, attempting automatic recovery...");
|
|
371521
|
+
try {
|
|
371522
|
+
await this.recoverFromCorruption();
|
|
371523
|
+
console.log("\u2705 Database recovery successful, retrying initialization...");
|
|
371524
|
+
await this.initialize();
|
|
371525
|
+
return;
|
|
371526
|
+
} catch (recoveryError) {
|
|
371527
|
+
console.error("\u274C Database recovery failed:", recoveryError);
|
|
371528
|
+
}
|
|
371529
|
+
}
|
|
371426
371530
|
this.initialized = false;
|
|
371427
371531
|
throw error;
|
|
371428
371532
|
}
|
|
371429
371533
|
}
|
|
371534
|
+
/**
|
|
371535
|
+
* Recover from database corruption by resetting to fresh state
|
|
371536
|
+
*/
|
|
371537
|
+
async recoverFromCorruption() {
|
|
371538
|
+
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
371539
|
+
const backupPath = `${this.dbPath}.corrupted.${timestamp2}`;
|
|
371540
|
+
try {
|
|
371541
|
+
await this.pool.close();
|
|
371542
|
+
if (fs50.existsSync(this.dbPath)) {
|
|
371543
|
+
fs50.renameSync(this.dbPath, backupPath);
|
|
371544
|
+
console.log(`\u{1F4C1} Corrupted database backed up to: ${backupPath}`);
|
|
371545
|
+
}
|
|
371546
|
+
this.initialized = false;
|
|
371547
|
+
this.pool = new DatabaseConnectionPool(this.dbPath);
|
|
371548
|
+
console.log("\u{1F504} Database reset complete, will reinitialize with fresh state");
|
|
371549
|
+
} catch (error) {
|
|
371550
|
+
console.error("Failed to recover from database corruption:", error);
|
|
371551
|
+
throw error;
|
|
371552
|
+
}
|
|
371553
|
+
}
|
|
371430
371554
|
/**
|
|
371431
371555
|
* Ensure database is initialized
|
|
371432
371556
|
*/
|
|
@@ -372530,6 +372654,17 @@ var ModelManager = class {
|
|
|
372530
372654
|
const db = await this.getDb();
|
|
372531
372655
|
const modelId = await db.upsertModelConfig(config);
|
|
372532
372656
|
await db.setActiveModel(modelId);
|
|
372657
|
+
if (config.authType === "ollama" || config.authType === AuthType.OLLAMA) {
|
|
372658
|
+
try {
|
|
372659
|
+
const existingSettings = await db.getProviderSettings(modelId);
|
|
372660
|
+
if (!existingSettings["num_ctx"]) {
|
|
372661
|
+
console.log(`Creating provider settings for model ${modelId}`);
|
|
372662
|
+
console.log(`\u2705 Created default provider settings for Ollama model ${modelId}: num_ctx=32768`);
|
|
372663
|
+
}
|
|
372664
|
+
} catch (error) {
|
|
372665
|
+
console.warn("Failed to initialize provider settings for new model:", error);
|
|
372666
|
+
}
|
|
372667
|
+
}
|
|
372533
372668
|
await this.updateEnvironmentFromModel(config);
|
|
372534
372669
|
return modelId;
|
|
372535
372670
|
}
|
|
@@ -372663,8 +372798,8 @@ var ModelManager = class {
|
|
|
372663
372798
|
try {
|
|
372664
372799
|
const db = await this.getDb();
|
|
372665
372800
|
const providerModel = await db.getModelByAuthType(model.authType);
|
|
372666
|
-
if (providerModel && providerModel
|
|
372667
|
-
settings = await db.getProviderSettings(providerModel
|
|
372801
|
+
if (providerModel && providerModel["id"]) {
|
|
372802
|
+
settings = await db.getProviderSettings(providerModel["id"]);
|
|
372668
372803
|
}
|
|
372669
372804
|
} catch (error) {
|
|
372670
372805
|
console.warn("Failed to load provider settings:", error);
|
|
@@ -372756,7 +372891,8 @@ var ModelManager = class {
|
|
|
372756
372891
|
return {};
|
|
372757
372892
|
}
|
|
372758
372893
|
const db = await this.getDb();
|
|
372759
|
-
const settings = await db.getProviderSettings(activeModel.
|
|
372894
|
+
const settings = await db.getProviderSettings(activeModel.id);
|
|
372895
|
+
console.log(`\u{1F41B} DEBUG getCurrentSamplingParams: Retrieved settings for model ID ${activeModel.id}:`, settings);
|
|
372760
372896
|
const samplingParams = {};
|
|
372761
372897
|
if (settings["num_ctx"]) {
|
|
372762
372898
|
samplingParams["num_ctx"] = parseInt(settings["num_ctx"], 10);
|
|
@@ -372770,6 +372906,7 @@ var ModelManager = class {
|
|
|
372770
372906
|
if (settings["top_k"]) {
|
|
372771
372907
|
samplingParams["top_k"] = parseInt(settings["top_k"], 10);
|
|
372772
372908
|
}
|
|
372909
|
+
console.log(`\u{1F41B} DEBUG getCurrentSamplingParams: Final sampling params:`, samplingParams);
|
|
372773
372910
|
return samplingParams;
|
|
372774
372911
|
} catch (error) {
|
|
372775
372912
|
console.warn("Failed to get current sampling params:", error);
|
|
@@ -373585,7 +373722,7 @@ async function getPackageJson() {
|
|
|
373585
373722
|
// packages/cli/src/utils/version.ts
|
|
373586
373723
|
async function getCliVersion() {
|
|
373587
373724
|
const pkgJson = await getPackageJson();
|
|
373588
|
-
return "1.0.
|
|
373725
|
+
return "1.0.82";
|
|
373589
373726
|
}
|
|
373590
373727
|
|
|
373591
373728
|
// packages/cli/src/ui/commands/aboutCommand.ts
|
|
@@ -373637,7 +373774,7 @@ import open4 from "open";
|
|
|
373637
373774
|
import process11 from "node:process";
|
|
373638
373775
|
|
|
373639
373776
|
// packages/cli/src/generated/git-commit.ts
|
|
373640
|
-
var GIT_COMMIT_INFO = "
|
|
373777
|
+
var GIT_COMMIT_INFO = "a8ffbfc3";
|
|
373641
373778
|
|
|
373642
373779
|
// packages/cli/src/ui/commands/bugCommand.ts
|
|
373643
373780
|
init_dist2();
|
|
@@ -406028,7 +406165,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
406028
406165
|
const modelManager = getModelManager();
|
|
406029
406166
|
const dbAuthType = await modelManager.getCurrentAuthType();
|
|
406030
406167
|
if (dbAuthType) {
|
|
406031
|
-
console.log(
|
|
406168
|
+
console.log(`\u2705 Using database auth type as fallback: ${dbAuthType}`);
|
|
406032
406169
|
effectiveAuthType = dbAuthType;
|
|
406033
406170
|
}
|
|
406034
406171
|
}
|
|
@@ -407566,20 +407703,10 @@ async function main() {
|
|
|
407566
407703
|
config.setModelStateProvider(modelManager);
|
|
407567
407704
|
if (argv.provider || argv.model) {
|
|
407568
407705
|
try {
|
|
407569
|
-
|
|
407570
|
-
|
|
407571
|
-
if (argv.provider) {
|
|
407572
|
-
const authType = cliProviderToAuthType(argv.provider);
|
|
407573
|
-
authTypeValue = authType;
|
|
407574
|
-
} else {
|
|
407575
|
-
authTypeValue = currentConfig?.authType || AuthType.OLLAMA;
|
|
407576
|
-
}
|
|
407577
|
-
const model = argv.model || currentConfig?.modelName || "qwen3:4b";
|
|
407578
|
-
console.log(`Configuring model from CLI args: provider=${authTypeValue}, model=${model}`);
|
|
407579
|
-
await config.configureModel(authTypeValue, model);
|
|
407580
|
-
console.log(`\u2705 CLI model configuration applied: ${authTypeValue}/${model}`);
|
|
407706
|
+
console.log(`\u{1F527} CLI arguments detected: provider=${argv.provider}, model=${argv.model}`);
|
|
407707
|
+
console.log(`\u26A0\uFE0F CLI args will apply ONLY to this session, no persistent changes`);
|
|
407581
407708
|
} catch (error) {
|
|
407582
|
-
console.warn(`\u26A0\uFE0F Failed to
|
|
407709
|
+
console.warn(`\u26A0\uFE0F Failed to process CLI arguments:`, error);
|
|
407583
407710
|
}
|
|
407584
407711
|
}
|
|
407585
407712
|
if (config.getIdeMode()) {
|
|
@@ -407675,8 +407802,20 @@ ${input}`;
|
|
|
407675
407802
|
auth_type: config.getContentGeneratorConfig()?.authType,
|
|
407676
407803
|
prompt_length: input.length
|
|
407677
407804
|
});
|
|
407805
|
+
let effectiveAuthType = settings.merged.selectedAuthType;
|
|
407806
|
+
let effectiveModel = config.getModel();
|
|
407807
|
+
if (argv.provider || argv.model) {
|
|
407808
|
+
if (argv.provider) {
|
|
407809
|
+
effectiveAuthType = cliProviderToAuthType(argv.provider);
|
|
407810
|
+
console.log(`\u{1F527} CLI provider override: ${argv.provider} \u2192 ${effectiveAuthType}`);
|
|
407811
|
+
}
|
|
407812
|
+
if (argv.model) {
|
|
407813
|
+
effectiveModel = argv.model;
|
|
407814
|
+
console.log(`\u{1F527} CLI model override: ${argv.model}`);
|
|
407815
|
+
}
|
|
407816
|
+
}
|
|
407678
407817
|
const nonInteractiveConfig = await validateNonInteractiveAuth(
|
|
407679
|
-
|
|
407818
|
+
effectiveAuthType,
|
|
407680
407819
|
settings.merged.useExternalAuth,
|
|
407681
407820
|
config
|
|
407682
407821
|
);
|