fss-link 1.0.60 → 1.0.62
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 +1028 -644
- package/package.json +2 -1
package/bundle/fss-link.js
CHANGED
|
@@ -8321,8 +8321,194 @@ var init_constants = __esm({
|
|
|
8321
8321
|
}
|
|
8322
8322
|
});
|
|
8323
8323
|
|
|
8324
|
+
// packages/core/dist/src/telemetry/fallback-metrics.js
|
|
8325
|
+
var FallbackMetricsCollector, fallbackMetrics;
|
|
8326
|
+
var init_fallback_metrics = __esm({
|
|
8327
|
+
"packages/core/dist/src/telemetry/fallback-metrics.js"() {
|
|
8328
|
+
"use strict";
|
|
8329
|
+
FallbackMetricsCollector = class {
|
|
8330
|
+
metrics = {
|
|
8331
|
+
toolCalls: {
|
|
8332
|
+
total: 0,
|
|
8333
|
+
success: 0,
|
|
8334
|
+
failure: 0,
|
|
8335
|
+
byName: {}
|
|
8336
|
+
},
|
|
8337
|
+
tokens: {
|
|
8338
|
+
input: 0,
|
|
8339
|
+
output: 0,
|
|
8340
|
+
cached: 0,
|
|
8341
|
+
thoughts: 0,
|
|
8342
|
+
tool: 0,
|
|
8343
|
+
total: 0,
|
|
8344
|
+
byModel: {}
|
|
8345
|
+
},
|
|
8346
|
+
api: {
|
|
8347
|
+
requests: 0,
|
|
8348
|
+
errors: 0,
|
|
8349
|
+
totalLatencyMs: 0,
|
|
8350
|
+
byModel: {}
|
|
8351
|
+
},
|
|
8352
|
+
files: {
|
|
8353
|
+
operations: 0,
|
|
8354
|
+
linesAdded: 0,
|
|
8355
|
+
linesRemoved: 0
|
|
8356
|
+
},
|
|
8357
|
+
sessions: {
|
|
8358
|
+
started: 0,
|
|
8359
|
+
compressed: 0
|
|
8360
|
+
}
|
|
8361
|
+
};
|
|
8362
|
+
recordToolCall(functionName, durationMs, success, decision) {
|
|
8363
|
+
this.metrics.toolCalls.total++;
|
|
8364
|
+
if (success) {
|
|
8365
|
+
this.metrics.toolCalls.success++;
|
|
8366
|
+
} else {
|
|
8367
|
+
this.metrics.toolCalls.failure++;
|
|
8368
|
+
}
|
|
8369
|
+
if (!this.metrics.toolCalls.byName[functionName]) {
|
|
8370
|
+
this.metrics.toolCalls.byName[functionName] = {
|
|
8371
|
+
count: 0,
|
|
8372
|
+
success: 0,
|
|
8373
|
+
durationMs: 0,
|
|
8374
|
+
decisions: {
|
|
8375
|
+
accept: 0,
|
|
8376
|
+
reject: 0,
|
|
8377
|
+
modify: 0,
|
|
8378
|
+
auto_accept: 0
|
|
8379
|
+
}
|
|
8380
|
+
};
|
|
8381
|
+
}
|
|
8382
|
+
const toolStats = this.metrics.toolCalls.byName[functionName];
|
|
8383
|
+
toolStats.count++;
|
|
8384
|
+
toolStats.durationMs += durationMs;
|
|
8385
|
+
if (success) {
|
|
8386
|
+
toolStats.success++;
|
|
8387
|
+
}
|
|
8388
|
+
if (decision) {
|
|
8389
|
+
toolStats.decisions[decision]++;
|
|
8390
|
+
}
|
|
8391
|
+
}
|
|
8392
|
+
recordTokenUsage(model, tokenCount, type2) {
|
|
8393
|
+
const propName = type2 === "thought" ? "thoughts" : type2 === "cache" ? "cached" : type2;
|
|
8394
|
+
if (propName === "input")
|
|
8395
|
+
this.metrics.tokens.input += tokenCount;
|
|
8396
|
+
else if (propName === "output")
|
|
8397
|
+
this.metrics.tokens.output += tokenCount;
|
|
8398
|
+
else if (propName === "cached")
|
|
8399
|
+
this.metrics.tokens.cached += tokenCount;
|
|
8400
|
+
else if (propName === "thoughts")
|
|
8401
|
+
this.metrics.tokens.thoughts += tokenCount;
|
|
8402
|
+
else if (propName === "tool")
|
|
8403
|
+
this.metrics.tokens.tool += tokenCount;
|
|
8404
|
+
this.metrics.tokens.total += tokenCount;
|
|
8405
|
+
if (!this.metrics.tokens.byModel[model]) {
|
|
8406
|
+
this.metrics.tokens.byModel[model] = {
|
|
8407
|
+
input: 0,
|
|
8408
|
+
output: 0,
|
|
8409
|
+
cached: 0,
|
|
8410
|
+
thoughts: 0,
|
|
8411
|
+
tool: 0
|
|
8412
|
+
};
|
|
8413
|
+
}
|
|
8414
|
+
this.metrics.tokens.byModel[model][propName] += tokenCount;
|
|
8415
|
+
}
|
|
8416
|
+
recordApiResponse(model, durationMs, error = false) {
|
|
8417
|
+
this.metrics.api.requests++;
|
|
8418
|
+
this.metrics.api.totalLatencyMs += durationMs;
|
|
8419
|
+
if (error) {
|
|
8420
|
+
this.metrics.api.errors++;
|
|
8421
|
+
}
|
|
8422
|
+
if (!this.metrics.api.byModel[model]) {
|
|
8423
|
+
this.metrics.api.byModel[model] = {
|
|
8424
|
+
requests: 0,
|
|
8425
|
+
errors: 0,
|
|
8426
|
+
latencyMs: 0
|
|
8427
|
+
};
|
|
8428
|
+
}
|
|
8429
|
+
this.metrics.api.byModel[model].requests++;
|
|
8430
|
+
this.metrics.api.byModel[model].latencyMs += durationMs;
|
|
8431
|
+
if (error) {
|
|
8432
|
+
this.metrics.api.byModel[model].errors++;
|
|
8433
|
+
}
|
|
8434
|
+
}
|
|
8435
|
+
recordFileOperation(diffStat) {
|
|
8436
|
+
this.metrics.files.operations++;
|
|
8437
|
+
if (diffStat) {
|
|
8438
|
+
this.metrics.files.linesAdded += diffStat.ai_added_lines || 0;
|
|
8439
|
+
this.metrics.files.linesRemoved += diffStat.ai_removed_lines || 0;
|
|
8440
|
+
}
|
|
8441
|
+
}
|
|
8442
|
+
recordSession() {
|
|
8443
|
+
this.metrics.sessions.started++;
|
|
8444
|
+
}
|
|
8445
|
+
recordChatCompression() {
|
|
8446
|
+
this.metrics.sessions.compressed++;
|
|
8447
|
+
}
|
|
8448
|
+
getMetrics() {
|
|
8449
|
+
return { ...this.metrics };
|
|
8450
|
+
}
|
|
8451
|
+
// Welcome Back system integration
|
|
8452
|
+
getEfficiencyMetrics() {
|
|
8453
|
+
const toolSuccessRate = this.metrics.toolCalls.total > 0 ? this.metrics.toolCalls.success / this.metrics.toolCalls.total * 100 : 0;
|
|
8454
|
+
const avgToolLatency = this.metrics.toolCalls.total > 0 ? Object.values(this.metrics.toolCalls.byName).reduce((sum, tool) => sum + tool.durationMs, 0) / this.metrics.toolCalls.total : 0;
|
|
8455
|
+
const apiErrorRate = this.metrics.api.requests > 0 ? this.metrics.api.errors / this.metrics.api.requests * 100 : 0;
|
|
8456
|
+
const totalInteractions = this.metrics.toolCalls.total + this.metrics.api.requests;
|
|
8457
|
+
return {
|
|
8458
|
+
toolSuccessRate,
|
|
8459
|
+
avgToolLatency,
|
|
8460
|
+
apiErrorRate,
|
|
8461
|
+
totalInteractions
|
|
8462
|
+
};
|
|
8463
|
+
}
|
|
8464
|
+
getTokenEfficiencyString() {
|
|
8465
|
+
const totalTokens = this.metrics.tokens.total;
|
|
8466
|
+
const totalInteractions = this.metrics.toolCalls.total + this.metrics.api.requests;
|
|
8467
|
+
if (totalTokens === 0)
|
|
8468
|
+
return "No token usage recorded";
|
|
8469
|
+
const tokenStr = totalTokens > 1e3 ? `${Math.round(totalTokens / 1e3)}k tokens` : `${totalTokens} tokens`;
|
|
8470
|
+
return `${tokenStr} \u2192 ${totalInteractions} interactions`;
|
|
8471
|
+
}
|
|
8472
|
+
reset() {
|
|
8473
|
+
this.metrics = {
|
|
8474
|
+
toolCalls: {
|
|
8475
|
+
total: 0,
|
|
8476
|
+
success: 0,
|
|
8477
|
+
failure: 0,
|
|
8478
|
+
byName: {}
|
|
8479
|
+
},
|
|
8480
|
+
tokens: {
|
|
8481
|
+
input: 0,
|
|
8482
|
+
output: 0,
|
|
8483
|
+
cached: 0,
|
|
8484
|
+
thoughts: 0,
|
|
8485
|
+
tool: 0,
|
|
8486
|
+
total: 0,
|
|
8487
|
+
byModel: {}
|
|
8488
|
+
},
|
|
8489
|
+
api: {
|
|
8490
|
+
requests: 0,
|
|
8491
|
+
errors: 0,
|
|
8492
|
+
totalLatencyMs: 0,
|
|
8493
|
+
byModel: {}
|
|
8494
|
+
},
|
|
8495
|
+
files: {
|
|
8496
|
+
operations: 0,
|
|
8497
|
+
linesAdded: 0,
|
|
8498
|
+
linesRemoved: 0
|
|
8499
|
+
},
|
|
8500
|
+
sessions: {
|
|
8501
|
+
started: 0,
|
|
8502
|
+
compressed: 0
|
|
8503
|
+
}
|
|
8504
|
+
};
|
|
8505
|
+
}
|
|
8506
|
+
};
|
|
8507
|
+
fallbackMetrics = new FallbackMetricsCollector();
|
|
8508
|
+
}
|
|
8509
|
+
});
|
|
8510
|
+
|
|
8324
8511
|
// packages/core/dist/src/telemetry/metrics.js
|
|
8325
|
-
import { metrics, ValueType } from "@opentelemetry/api";
|
|
8326
8512
|
function getCommonAttributes(config) {
|
|
8327
8513
|
return {
|
|
8328
8514
|
"session.id": config.getSessionId()
|
|
@@ -8337,6 +8523,11 @@ function getMeter() {
|
|
|
8337
8523
|
function initializeMetrics(config) {
|
|
8338
8524
|
if (isMetricsInitialized)
|
|
8339
8525
|
return;
|
|
8526
|
+
if (!openTelemetryAvailable) {
|
|
8527
|
+
fallbackMetrics.recordSession();
|
|
8528
|
+
isMetricsInitialized = true;
|
|
8529
|
+
return;
|
|
8530
|
+
}
|
|
8340
8531
|
const meter = getMeter();
|
|
8341
8532
|
if (!meter)
|
|
8342
8533
|
return;
|
|
@@ -8390,6 +8581,10 @@ function initializeMetrics(config) {
|
|
|
8390
8581
|
isMetricsInitialized = true;
|
|
8391
8582
|
}
|
|
8392
8583
|
function recordChatCompressionMetrics(config, args) {
|
|
8584
|
+
if (!openTelemetryAvailable) {
|
|
8585
|
+
fallbackMetrics.recordChatCompression();
|
|
8586
|
+
return;
|
|
8587
|
+
}
|
|
8393
8588
|
if (!chatCompressionCounter || !isMetricsInitialized)
|
|
8394
8589
|
return;
|
|
8395
8590
|
chatCompressionCounter.add(1, {
|
|
@@ -8398,6 +8593,10 @@ function recordChatCompressionMetrics(config, args) {
|
|
|
8398
8593
|
});
|
|
8399
8594
|
}
|
|
8400
8595
|
function recordToolCallMetrics(config, functionName, durationMs, success, decision, tool_type) {
|
|
8596
|
+
if (!openTelemetryAvailable) {
|
|
8597
|
+
fallbackMetrics.recordToolCall(functionName, durationMs, success, decision);
|
|
8598
|
+
return;
|
|
8599
|
+
}
|
|
8401
8600
|
if (!toolCallCounter || !toolCallLatencyHistogram || !isMetricsInitialized)
|
|
8402
8601
|
return;
|
|
8403
8602
|
const metricAttributes = {
|
|
@@ -8414,6 +8613,10 @@ function recordToolCallMetrics(config, functionName, durationMs, success, decisi
|
|
|
8414
8613
|
});
|
|
8415
8614
|
}
|
|
8416
8615
|
function recordTokenUsageMetrics(config, model, tokenCount, type2) {
|
|
8616
|
+
if (!openTelemetryAvailable) {
|
|
8617
|
+
fallbackMetrics.recordTokenUsage(model, tokenCount, type2);
|
|
8618
|
+
return;
|
|
8619
|
+
}
|
|
8417
8620
|
if (!tokenUsageCounter || !isMetricsInitialized)
|
|
8418
8621
|
return;
|
|
8419
8622
|
tokenUsageCounter.add(tokenCount, {
|
|
@@ -8423,6 +8626,10 @@ function recordTokenUsageMetrics(config, model, tokenCount, type2) {
|
|
|
8423
8626
|
});
|
|
8424
8627
|
}
|
|
8425
8628
|
function recordApiResponseMetrics(config, model, durationMs, statusCode, error) {
|
|
8629
|
+
if (!openTelemetryAvailable) {
|
|
8630
|
+
fallbackMetrics.recordApiResponse(model, durationMs, !!error);
|
|
8631
|
+
return;
|
|
8632
|
+
}
|
|
8426
8633
|
if (!apiRequestCounter || !apiRequestLatencyHistogram || !isMetricsInitialized)
|
|
8427
8634
|
return;
|
|
8428
8635
|
const metricAttributes = {
|
|
@@ -8437,6 +8644,10 @@ function recordApiResponseMetrics(config, model, durationMs, statusCode, error)
|
|
|
8437
8644
|
});
|
|
8438
8645
|
}
|
|
8439
8646
|
function recordApiErrorMetrics(config, model, durationMs, statusCode, errorType) {
|
|
8647
|
+
if (!openTelemetryAvailable) {
|
|
8648
|
+
fallbackMetrics.recordApiResponse(model, durationMs, true);
|
|
8649
|
+
return;
|
|
8650
|
+
}
|
|
8440
8651
|
if (!apiRequestCounter || !apiRequestLatencyHistogram || !isMetricsInitialized)
|
|
8441
8652
|
return;
|
|
8442
8653
|
const metricAttributes = {
|
|
@@ -8452,6 +8663,10 @@ function recordApiErrorMetrics(config, model, durationMs, statusCode, errorType)
|
|
|
8452
8663
|
});
|
|
8453
8664
|
}
|
|
8454
8665
|
function recordFileOperationMetric(config, operation, lines, mimetype, extension, diffStat) {
|
|
8666
|
+
if (!openTelemetryAvailable) {
|
|
8667
|
+
fallbackMetrics.recordFileOperation(diffStat);
|
|
8668
|
+
return;
|
|
8669
|
+
}
|
|
8455
8670
|
if (!fileOperationCounter || !isMetricsInitialized)
|
|
8456
8671
|
return;
|
|
8457
8672
|
const attributes = {
|
|
@@ -8487,11 +8702,24 @@ function recordContentRetryFailure(config) {
|
|
|
8487
8702
|
return;
|
|
8488
8703
|
contentRetryFailureCounter.add(1, getCommonAttributes(config));
|
|
8489
8704
|
}
|
|
8490
|
-
var FileOperation, cliMeter, toolCallCounter, toolCallLatencyHistogram, apiRequestCounter, apiRequestLatencyHistogram, tokenUsageCounter, fileOperationCounter, chatCompressionCounter, invalidChunkCounter, contentRetryCounter, contentRetryFailureCounter, isMetricsInitialized;
|
|
8705
|
+
var metrics, ValueType, openTelemetryAvailable, FileOperation, cliMeter, toolCallCounter, toolCallLatencyHistogram, apiRequestCounter, apiRequestLatencyHistogram, tokenUsageCounter, fileOperationCounter, chatCompressionCounter, invalidChunkCounter, contentRetryCounter, contentRetryFailureCounter, isMetricsInitialized;
|
|
8491
8706
|
var init_metrics = __esm({
|
|
8492
8707
|
"packages/core/dist/src/telemetry/metrics.js"() {
|
|
8493
8708
|
"use strict";
|
|
8494
8709
|
init_constants();
|
|
8710
|
+
init_fallback_metrics();
|
|
8711
|
+
openTelemetryAvailable = false;
|
|
8712
|
+
try {
|
|
8713
|
+
const otelApi = __require("@opentelemetry/api");
|
|
8714
|
+
metrics = otelApi.metrics;
|
|
8715
|
+
ValueType = otelApi.ValueType;
|
|
8716
|
+
openTelemetryAvailable = true;
|
|
8717
|
+
} catch (error) {
|
|
8718
|
+
console.debug("OpenTelemetry unavailable, using fallback metrics system");
|
|
8719
|
+
openTelemetryAvailable = false;
|
|
8720
|
+
metrics = { getMeter: () => null };
|
|
8721
|
+
ValueType = { INT: "int" };
|
|
8722
|
+
}
|
|
8495
8723
|
(function(FileOperation2) {
|
|
8496
8724
|
FileOperation2["CREATE"] = "create";
|
|
8497
8725
|
FileOperation2["READ"] = "read";
|
|
@@ -10644,8 +10872,6 @@ var init_qwen_logger = __esm({
|
|
|
10644
10872
|
|
|
10645
10873
|
// packages/core/dist/src/telemetry/file-exporters.js
|
|
10646
10874
|
import * as fs3 from "node:fs";
|
|
10647
|
-
import { ExportResultCode } from "@opentelemetry/core";
|
|
10648
|
-
import { AggregationTemporality } from "@opentelemetry/sdk-metrics";
|
|
10649
10875
|
var FileExporter, FileSpanExporter, FileLogExporter, FileMetricExporter;
|
|
10650
10876
|
var init_file_exporters = __esm({
|
|
10651
10877
|
"packages/core/dist/src/telemetry/file-exporters.js"() {
|
|
@@ -10666,38 +10892,20 @@ var init_file_exporters = __esm({
|
|
|
10666
10892
|
};
|
|
10667
10893
|
FileSpanExporter = class extends FileExporter {
|
|
10668
10894
|
export(spans, resultCallback) {
|
|
10669
|
-
|
|
10670
|
-
this.writeStream.write(data, (err) => {
|
|
10671
|
-
resultCallback({
|
|
10672
|
-
code: err ? ExportResultCode.FAILED : ExportResultCode.SUCCESS,
|
|
10673
|
-
error: err || void 0
|
|
10674
|
-
});
|
|
10675
|
-
});
|
|
10895
|
+
resultCallback({ code: 0 });
|
|
10676
10896
|
}
|
|
10677
10897
|
};
|
|
10678
10898
|
FileLogExporter = class extends FileExporter {
|
|
10679
10899
|
export(logs2, resultCallback) {
|
|
10680
|
-
|
|
10681
|
-
this.writeStream.write(data, (err) => {
|
|
10682
|
-
resultCallback({
|
|
10683
|
-
code: err ? ExportResultCode.FAILED : ExportResultCode.SUCCESS,
|
|
10684
|
-
error: err || void 0
|
|
10685
|
-
});
|
|
10686
|
-
});
|
|
10900
|
+
resultCallback({ code: 0 });
|
|
10687
10901
|
}
|
|
10688
10902
|
};
|
|
10689
10903
|
FileMetricExporter = class extends FileExporter {
|
|
10690
10904
|
export(metrics2, resultCallback) {
|
|
10691
|
-
|
|
10692
|
-
this.writeStream.write(data, (err) => {
|
|
10693
|
-
resultCallback({
|
|
10694
|
-
code: err ? ExportResultCode.FAILED : ExportResultCode.SUCCESS,
|
|
10695
|
-
error: err || void 0
|
|
10696
|
-
});
|
|
10697
|
-
});
|
|
10905
|
+
resultCallback({ code: 0 });
|
|
10698
10906
|
}
|
|
10699
10907
|
getPreferredAggregationTemporality() {
|
|
10700
|
-
return
|
|
10908
|
+
return "cumulative";
|
|
10701
10909
|
}
|
|
10702
10910
|
async forceFlush() {
|
|
10703
10911
|
return Promise.resolve();
|
|
@@ -10707,21 +10915,6 @@ var init_file_exporters = __esm({
|
|
|
10707
10915
|
});
|
|
10708
10916
|
|
|
10709
10917
|
// packages/core/dist/src/telemetry/sdk.js
|
|
10710
|
-
import { DiagConsoleLogger, DiagLogLevel, diag } from "@opentelemetry/api";
|
|
10711
|
-
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
|
|
10712
|
-
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-grpc";
|
|
10713
|
-
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-grpc";
|
|
10714
|
-
import { OTLPTraceExporter as OTLPTraceExporterHttp } from "@opentelemetry/exporter-trace-otlp-http";
|
|
10715
|
-
import { OTLPLogExporter as OTLPLogExporterHttp } from "@opentelemetry/exporter-logs-otlp-http";
|
|
10716
|
-
import { OTLPMetricExporter as OTLPMetricExporterHttp } from "@opentelemetry/exporter-metrics-otlp-http";
|
|
10717
|
-
import { CompressionAlgorithm } from "@opentelemetry/otlp-exporter-base";
|
|
10718
|
-
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
10719
|
-
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
10720
|
-
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
10721
|
-
import { BatchSpanProcessor, ConsoleSpanExporter } from "@opentelemetry/sdk-trace-node";
|
|
10722
|
-
import { BatchLogRecordProcessor, ConsoleLogRecordExporter } from "@opentelemetry/sdk-logs";
|
|
10723
|
-
import { ConsoleMetricExporter, PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
|
|
10724
|
-
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
|
|
10725
10918
|
function isTelemetrySdkInitialized() {
|
|
10726
10919
|
return telemetryInitialized;
|
|
10727
10920
|
}
|
|
@@ -10737,12 +10930,16 @@ function parseOtlpEndpoint(otlpEndpointSetting, protocol) {
|
|
|
10737
10930
|
}
|
|
10738
10931
|
return url2.href;
|
|
10739
10932
|
} catch (error) {
|
|
10740
|
-
|
|
10933
|
+
if (openTelemetryAvailable2 && diag) {
|
|
10934
|
+
diag.error("Invalid OTLP endpoint URL provided:", trimmedEndpoint, error);
|
|
10935
|
+
} else {
|
|
10936
|
+
console.error("Invalid OTLP endpoint URL provided:", trimmedEndpoint, error);
|
|
10937
|
+
}
|
|
10741
10938
|
return void 0;
|
|
10742
10939
|
}
|
|
10743
10940
|
}
|
|
10744
10941
|
function initializeTelemetry(config) {
|
|
10745
|
-
if (telemetryInitialized || !config.getTelemetryEnabled()) {
|
|
10942
|
+
if (telemetryInitialized || !config.getTelemetryEnabled() || !openTelemetryAvailable2) {
|
|
10746
10943
|
return;
|
|
10747
10944
|
}
|
|
10748
10945
|
const resource = resourceFromAttributes({
|
|
@@ -10843,14 +11040,58 @@ async function shutdownTelemetry(config) {
|
|
|
10843
11040
|
telemetryInitialized = false;
|
|
10844
11041
|
}
|
|
10845
11042
|
}
|
|
10846
|
-
var sdk, telemetryInitialized;
|
|
11043
|
+
var openTelemetryAvailable2, DiagConsoleLogger, DiagLogLevel, diag, OTLPTraceExporter, OTLPLogExporter, OTLPMetricExporter, OTLPTraceExporterHttp, OTLPLogExporterHttp, OTLPMetricExporterHttp, CompressionAlgorithm, NodeSDK, SemanticResourceAttributes, resourceFromAttributes, BatchSpanProcessor, ConsoleSpanExporter, BatchLogRecordProcessor, ConsoleLogRecordExporter, ConsoleMetricExporter, PeriodicExportingMetricReader, HttpInstrumentation, sdk, telemetryInitialized;
|
|
10847
11044
|
var init_sdk = __esm({
|
|
10848
11045
|
"packages/core/dist/src/telemetry/sdk.js"() {
|
|
10849
11046
|
"use strict";
|
|
10850
11047
|
init_constants();
|
|
10851
11048
|
init_metrics();
|
|
10852
11049
|
init_file_exporters();
|
|
10853
|
-
|
|
11050
|
+
openTelemetryAvailable2 = false;
|
|
11051
|
+
try {
|
|
11052
|
+
const otelApi = __require("@opentelemetry/api");
|
|
11053
|
+
const otelTraceGrpc = __require("@opentelemetry/exporter-trace-otlp-grpc");
|
|
11054
|
+
const otelLogsGrpc = __require("@opentelemetry/exporter-logs-otlp-grpc");
|
|
11055
|
+
const otelMetricsGrpc = __require("@opentelemetry/exporter-metrics-otlp-grpc");
|
|
11056
|
+
const otelTraceHttp = __require("@opentelemetry/exporter-trace-otlp-http");
|
|
11057
|
+
const otelLogsHttp = __require("@opentelemetry/exporter-logs-otlp-http");
|
|
11058
|
+
const otelMetricsHttp = __require("@opentelemetry/exporter-metrics-otlp-http");
|
|
11059
|
+
const otelExporterBase = __require("@opentelemetry/otlp-exporter-base");
|
|
11060
|
+
const otelSdkNode = __require("@opentelemetry/sdk-node");
|
|
11061
|
+
const otelSemanticConventions = __require("@opentelemetry/semantic-conventions");
|
|
11062
|
+
const otelResources = __require("@opentelemetry/resources");
|
|
11063
|
+
const otelSdkTraceNode = __require("@opentelemetry/sdk-trace-node");
|
|
11064
|
+
const otelSdkLogs = __require("@opentelemetry/sdk-logs");
|
|
11065
|
+
const otelSdkMetrics = __require("@opentelemetry/sdk-metrics");
|
|
11066
|
+
const otelInstrumentationHttp = __require("@opentelemetry/instrumentation-http");
|
|
11067
|
+
DiagConsoleLogger = otelApi.DiagConsoleLogger;
|
|
11068
|
+
DiagLogLevel = otelApi.DiagLogLevel;
|
|
11069
|
+
diag = otelApi.diag;
|
|
11070
|
+
OTLPTraceExporter = otelTraceGrpc.OTLPTraceExporter;
|
|
11071
|
+
OTLPLogExporter = otelLogsGrpc.OTLPLogExporter;
|
|
11072
|
+
OTLPMetricExporter = otelMetricsGrpc.OTLPMetricExporter;
|
|
11073
|
+
OTLPTraceExporterHttp = otelTraceHttp.OTLPTraceExporter;
|
|
11074
|
+
OTLPLogExporterHttp = otelLogsHttp.OTLPLogExporter;
|
|
11075
|
+
OTLPMetricExporterHttp = otelMetricsHttp.OTLPMetricExporter;
|
|
11076
|
+
CompressionAlgorithm = otelExporterBase.CompressionAlgorithm;
|
|
11077
|
+
NodeSDK = otelSdkNode.NodeSDK;
|
|
11078
|
+
SemanticResourceAttributes = otelSemanticConventions.SemanticResourceAttributes;
|
|
11079
|
+
resourceFromAttributes = otelResources.resourceFromAttributes;
|
|
11080
|
+
BatchSpanProcessor = otelSdkTraceNode.BatchSpanProcessor;
|
|
11081
|
+
ConsoleSpanExporter = otelSdkTraceNode.ConsoleSpanExporter;
|
|
11082
|
+
BatchLogRecordProcessor = otelSdkLogs.BatchLogRecordProcessor;
|
|
11083
|
+
ConsoleLogRecordExporter = otelSdkLogs.ConsoleLogRecordExporter;
|
|
11084
|
+
ConsoleMetricExporter = otelSdkMetrics.ConsoleMetricExporter;
|
|
11085
|
+
PeriodicExportingMetricReader = otelSdkMetrics.PeriodicExportingMetricReader;
|
|
11086
|
+
HttpInstrumentation = otelInstrumentationHttp.HttpInstrumentation;
|
|
11087
|
+
openTelemetryAvailable2 = true;
|
|
11088
|
+
} catch (error) {
|
|
11089
|
+
console.debug("OpenTelemetry SDK unavailable, telemetry disabled");
|
|
11090
|
+
openTelemetryAvailable2 = false;
|
|
11091
|
+
}
|
|
11092
|
+
if (openTelemetryAvailable2 && diag && DiagConsoleLogger && DiagLogLevel) {
|
|
11093
|
+
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);
|
|
11094
|
+
}
|
|
10854
11095
|
telemetryInitialized = false;
|
|
10855
11096
|
}
|
|
10856
11097
|
});
|
|
@@ -11007,8 +11248,6 @@ var init_uiTelemetry = __esm({
|
|
|
11007
11248
|
});
|
|
11008
11249
|
|
|
11009
11250
|
// packages/core/dist/src/telemetry/loggers.js
|
|
11010
|
-
import { logs } from "@opentelemetry/api-logs";
|
|
11011
|
-
import { SemanticAttributes } from "@opentelemetry/semantic-conventions";
|
|
11012
11251
|
function getCommonAttributes2(config) {
|
|
11013
11252
|
return {
|
|
11014
11253
|
"session.id": config.getSessionId()
|
|
@@ -11347,7 +11586,7 @@ function logContentRetryFailure(config, event) {
|
|
|
11347
11586
|
logger6.emit(logRecord);
|
|
11348
11587
|
recordContentRetryFailure(config);
|
|
11349
11588
|
}
|
|
11350
|
-
var shouldLogUserPrompts;
|
|
11589
|
+
var LogAttributes, LogRecord, logs, SemanticAttributes, openTelemetryAvailable3, shouldLogUserPrompts;
|
|
11351
11590
|
var init_loggers = __esm({
|
|
11352
11591
|
"packages/core/dist/src/telemetry/loggers.js"() {
|
|
11353
11592
|
"use strict";
|
|
@@ -11357,6 +11596,25 @@ var init_loggers = __esm({
|
|
|
11357
11596
|
init_sdk();
|
|
11358
11597
|
init_uiTelemetry();
|
|
11359
11598
|
init_safeJsonStringify();
|
|
11599
|
+
openTelemetryAvailable3 = false;
|
|
11600
|
+
try {
|
|
11601
|
+
const otelApiLogs = __require("@opentelemetry/api-logs");
|
|
11602
|
+
const otelSemanticConventions = __require("@opentelemetry/semantic-conventions");
|
|
11603
|
+
LogAttributes = otelApiLogs.LogAttributes;
|
|
11604
|
+
LogRecord = otelApiLogs.LogRecord;
|
|
11605
|
+
logs = otelApiLogs.logs;
|
|
11606
|
+
SemanticAttributes = otelSemanticConventions.SemanticAttributes;
|
|
11607
|
+
openTelemetryAvailable3 = true;
|
|
11608
|
+
} catch (error) {
|
|
11609
|
+
console.debug("OpenTelemetry loggers unavailable, using stubs");
|
|
11610
|
+
openTelemetryAvailable3 = false;
|
|
11611
|
+
LogAttributes = {};
|
|
11612
|
+
LogRecord = class {
|
|
11613
|
+
};
|
|
11614
|
+
logs = { getLogger: () => ({ emit: () => {
|
|
11615
|
+
} }) };
|
|
11616
|
+
SemanticAttributes = {};
|
|
11617
|
+
}
|
|
11360
11618
|
shouldLogUserPrompts = (config) => config.getTelemetryLogPromptsEnabled();
|
|
11361
11619
|
}
|
|
11362
11620
|
});
|
|
@@ -17563,8 +17821,8 @@ var init_uploads3 = __esm({
|
|
|
17563
17821
|
var allSettledWithThrow;
|
|
17564
17822
|
var init_Util = __esm({
|
|
17565
17823
|
"node_modules/openai/lib/Util.mjs"() {
|
|
17566
|
-
allSettledWithThrow = async (
|
|
17567
|
-
const results = await Promise.allSettled(
|
|
17824
|
+
allSettledWithThrow = async (promises4) => {
|
|
17825
|
+
const results = await Promise.allSettled(promises4);
|
|
17568
17826
|
const rejected = results.filter((result) => result.status === "rejected");
|
|
17569
17827
|
if (rejected.length) {
|
|
17570
17828
|
for (const result of rejected) {
|
|
@@ -19454,465 +19712,6 @@ var init_safeJsonParse = __esm({
|
|
|
19454
19712
|
}
|
|
19455
19713
|
});
|
|
19456
19714
|
|
|
19457
|
-
// node_modules/tiktoken/tiktoken_bg.cjs
|
|
19458
|
-
var require_tiktoken_bg = __commonJS({
|
|
19459
|
-
"node_modules/tiktoken/tiktoken_bg.cjs"(exports, module) {
|
|
19460
|
-
var wasm2;
|
|
19461
|
-
module.exports.__wbg_set_wasm = function(val) {
|
|
19462
|
-
wasm2 = val;
|
|
19463
|
-
};
|
|
19464
|
-
var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
|
|
19465
|
-
var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
19466
|
-
cachedTextDecoder.decode();
|
|
19467
|
-
var cachedUint8ArrayMemory0 = null;
|
|
19468
|
-
function getUint8ArrayMemory0() {
|
|
19469
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
19470
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm2.memory.buffer);
|
|
19471
|
-
}
|
|
19472
|
-
return cachedUint8ArrayMemory0;
|
|
19473
|
-
}
|
|
19474
|
-
function getStringFromWasm0(ptr, len) {
|
|
19475
|
-
ptr = ptr >>> 0;
|
|
19476
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
19477
|
-
}
|
|
19478
|
-
var heap = new Array(128).fill(void 0);
|
|
19479
|
-
heap.push(void 0, null, true, false);
|
|
19480
|
-
var heap_next = heap.length;
|
|
19481
|
-
function addHeapObject(obj) {
|
|
19482
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
19483
|
-
const idx = heap_next;
|
|
19484
|
-
heap_next = heap[idx];
|
|
19485
|
-
heap[idx] = obj;
|
|
19486
|
-
return idx;
|
|
19487
|
-
}
|
|
19488
|
-
function handleError(f, args) {
|
|
19489
|
-
try {
|
|
19490
|
-
return f.apply(this, args);
|
|
19491
|
-
} catch (e2) {
|
|
19492
|
-
wasm2.__wbindgen_export_0(addHeapObject(e2));
|
|
19493
|
-
}
|
|
19494
|
-
}
|
|
19495
|
-
function getObject(idx) {
|
|
19496
|
-
return heap[idx];
|
|
19497
|
-
}
|
|
19498
|
-
function dropObject(idx) {
|
|
19499
|
-
if (idx < 132) return;
|
|
19500
|
-
heap[idx] = heap_next;
|
|
19501
|
-
heap_next = idx;
|
|
19502
|
-
}
|
|
19503
|
-
function takeObject(idx) {
|
|
19504
|
-
const ret = getObject(idx);
|
|
19505
|
-
dropObject(idx);
|
|
19506
|
-
return ret;
|
|
19507
|
-
}
|
|
19508
|
-
var WASM_VECTOR_LEN = 0;
|
|
19509
|
-
var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
|
|
19510
|
-
var cachedTextEncoder = new lTextEncoder("utf-8");
|
|
19511
|
-
var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
|
|
19512
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
19513
|
-
} : function(arg, view) {
|
|
19514
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
19515
|
-
view.set(buf);
|
|
19516
|
-
return {
|
|
19517
|
-
read: arg.length,
|
|
19518
|
-
written: buf.length
|
|
19519
|
-
};
|
|
19520
|
-
};
|
|
19521
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
19522
|
-
if (realloc === void 0) {
|
|
19523
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
19524
|
-
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
19525
|
-
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
19526
|
-
WASM_VECTOR_LEN = buf.length;
|
|
19527
|
-
return ptr2;
|
|
19528
|
-
}
|
|
19529
|
-
let len = arg.length;
|
|
19530
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
19531
|
-
const mem = getUint8ArrayMemory0();
|
|
19532
|
-
let offset = 0;
|
|
19533
|
-
for (; offset < len; offset++) {
|
|
19534
|
-
const code = arg.charCodeAt(offset);
|
|
19535
|
-
if (code > 127) break;
|
|
19536
|
-
mem[ptr + offset] = code;
|
|
19537
|
-
}
|
|
19538
|
-
if (offset !== len) {
|
|
19539
|
-
if (offset !== 0) {
|
|
19540
|
-
arg = arg.slice(offset);
|
|
19541
|
-
}
|
|
19542
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
19543
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
19544
|
-
const ret = encodeString(arg, view);
|
|
19545
|
-
offset += ret.written;
|
|
19546
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
19547
|
-
}
|
|
19548
|
-
WASM_VECTOR_LEN = offset;
|
|
19549
|
-
return ptr;
|
|
19550
|
-
}
|
|
19551
|
-
function isLikeNone(x) {
|
|
19552
|
-
return x === void 0 || x === null;
|
|
19553
|
-
}
|
|
19554
|
-
var cachedDataViewMemory0 = null;
|
|
19555
|
-
function getDataViewMemory0() {
|
|
19556
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm2.memory.buffer) {
|
|
19557
|
-
cachedDataViewMemory0 = new DataView(wasm2.memory.buffer);
|
|
19558
|
-
}
|
|
19559
|
-
return cachedDataViewMemory0;
|
|
19560
|
-
}
|
|
19561
|
-
var cachedUint32ArrayMemory0 = null;
|
|
19562
|
-
function getUint32ArrayMemory0() {
|
|
19563
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
19564
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm2.memory.buffer);
|
|
19565
|
-
}
|
|
19566
|
-
return cachedUint32ArrayMemory0;
|
|
19567
|
-
}
|
|
19568
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
19569
|
-
ptr = ptr >>> 0;
|
|
19570
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
19571
|
-
}
|
|
19572
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
19573
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
19574
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
19575
|
-
WASM_VECTOR_LEN = arg.length;
|
|
19576
|
-
return ptr;
|
|
19577
|
-
}
|
|
19578
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
19579
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
19580
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
19581
|
-
WASM_VECTOR_LEN = arg.length;
|
|
19582
|
-
return ptr;
|
|
19583
|
-
}
|
|
19584
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
19585
|
-
ptr = ptr >>> 0;
|
|
19586
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
19587
|
-
}
|
|
19588
|
-
module.exports.get_encoding = function(encoding, extend_special_tokens) {
|
|
19589
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19590
|
-
try {
|
|
19591
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19592
|
-
const ptr0 = passStringToWasm0(encoding, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19593
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19594
|
-
wasm2.get_encoding(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
|
|
19595
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19596
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19597
|
-
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
19598
|
-
if (r22) {
|
|
19599
|
-
throw takeObject(r1);
|
|
19600
|
-
}
|
|
19601
|
-
return Tiktoken.__wrap(r0);
|
|
19602
|
-
} finally {
|
|
19603
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19604
|
-
}
|
|
19605
|
-
};
|
|
19606
|
-
module.exports.encoding_for_model = function(model, extend_special_tokens) {
|
|
19607
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19608
|
-
try {
|
|
19609
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19610
|
-
const ptr0 = passStringToWasm0(model, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19611
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19612
|
-
wasm2.encoding_for_model(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
|
|
19613
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19614
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19615
|
-
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
19616
|
-
if (r22) {
|
|
19617
|
-
throw takeObject(r1);
|
|
19618
|
-
}
|
|
19619
|
-
return Tiktoken.__wrap(r0);
|
|
19620
|
-
} finally {
|
|
19621
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19622
|
-
}
|
|
19623
|
-
};
|
|
19624
|
-
module.exports.get_encoding_name_for_model = function(model) {
|
|
19625
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19626
|
-
let deferred3_0;
|
|
19627
|
-
let deferred3_1;
|
|
19628
|
-
try {
|
|
19629
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19630
|
-
const ptr0 = passStringToWasm0(model, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19631
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19632
|
-
wasm2.get_encoding_name_for_model(retptr, ptr0, len0);
|
|
19633
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19634
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19635
|
-
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
19636
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
19637
|
-
var ptr2 = r0;
|
|
19638
|
-
var len2 = r1;
|
|
19639
|
-
if (r3) {
|
|
19640
|
-
ptr2 = 0;
|
|
19641
|
-
len2 = 0;
|
|
19642
|
-
throw takeObject(r22);
|
|
19643
|
-
}
|
|
19644
|
-
deferred3_0 = ptr2;
|
|
19645
|
-
deferred3_1 = len2;
|
|
19646
|
-
return getStringFromWasm0(ptr2, len2);
|
|
19647
|
-
} finally {
|
|
19648
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19649
|
-
wasm2.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
19650
|
-
}
|
|
19651
|
-
};
|
|
19652
|
-
var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
19653
|
-
}, unregister: () => {
|
|
19654
|
-
} } : new FinalizationRegistry((ptr) => wasm2.__wbg_tiktoken_free(ptr >>> 0, 1));
|
|
19655
|
-
var Tiktoken = class _Tiktoken {
|
|
19656
|
-
/**
|
|
19657
|
-
* @param {string} tiktoken_bfe
|
|
19658
|
-
* @param {any} special_tokens
|
|
19659
|
-
* @param {string} pat_str
|
|
19660
|
-
*/
|
|
19661
|
-
constructor(tiktoken_bfe, special_tokens, pat_str) {
|
|
19662
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19663
|
-
const ptr0 = passStringToWasm0(tiktoken_bfe, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19664
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19665
|
-
const ptr1 = passStringToWasm0(pat_str, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19666
|
-
const len1 = WASM_VECTOR_LEN;
|
|
19667
|
-
const ret = wasm2.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
|
|
19668
|
-
this.__wbg_ptr = ret >>> 0;
|
|
19669
|
-
TiktokenFinalization.register(this, this.__wbg_ptr, this);
|
|
19670
|
-
return this;
|
|
19671
|
-
}
|
|
19672
|
-
/** @returns {string | undefined} */
|
|
19673
|
-
get name() {
|
|
19674
|
-
try {
|
|
19675
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19676
|
-
wasm2.tiktoken_name(retptr, this.__wbg_ptr);
|
|
19677
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19678
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19679
|
-
let v1;
|
|
19680
|
-
if (r0 !== 0) {
|
|
19681
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
19682
|
-
wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
19683
|
-
}
|
|
19684
|
-
return v1;
|
|
19685
|
-
} finally {
|
|
19686
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19687
|
-
}
|
|
19688
|
-
}
|
|
19689
|
-
static __wrap(ptr) {
|
|
19690
|
-
ptr = ptr >>> 0;
|
|
19691
|
-
const obj = Object.create(_Tiktoken.prototype);
|
|
19692
|
-
obj.__wbg_ptr = ptr;
|
|
19693
|
-
TiktokenFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
19694
|
-
return obj;
|
|
19695
|
-
}
|
|
19696
|
-
__destroy_into_raw() {
|
|
19697
|
-
const ptr = this.__wbg_ptr;
|
|
19698
|
-
this.__wbg_ptr = 0;
|
|
19699
|
-
TiktokenFinalization.unregister(this);
|
|
19700
|
-
return ptr;
|
|
19701
|
-
}
|
|
19702
|
-
free() {
|
|
19703
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19704
|
-
const ptr = this.__destroy_into_raw();
|
|
19705
|
-
wasm2.__wbg_tiktoken_free(ptr, 0);
|
|
19706
|
-
}
|
|
19707
|
-
/**
|
|
19708
|
-
* @param {string} text
|
|
19709
|
-
* @param {any} allowed_special
|
|
19710
|
-
* @param {any} disallowed_special
|
|
19711
|
-
* @returns {Uint32Array}
|
|
19712
|
-
*/
|
|
19713
|
-
encode(text, allowed_special, disallowed_special) {
|
|
19714
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19715
|
-
try {
|
|
19716
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19717
|
-
const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19718
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19719
|
-
wasm2.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
|
|
19720
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19721
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19722
|
-
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
19723
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
19724
|
-
if (r3) {
|
|
19725
|
-
throw takeObject(r22);
|
|
19726
|
-
}
|
|
19727
|
-
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
19728
|
-
wasm2.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
19729
|
-
return v2;
|
|
19730
|
-
} finally {
|
|
19731
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19732
|
-
}
|
|
19733
|
-
}
|
|
19734
|
-
/**
|
|
19735
|
-
* @param {string} text
|
|
19736
|
-
* @returns {Uint32Array}
|
|
19737
|
-
*/
|
|
19738
|
-
encode_ordinary(text) {
|
|
19739
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19740
|
-
try {
|
|
19741
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19742
|
-
const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19743
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19744
|
-
wasm2.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
|
|
19745
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19746
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19747
|
-
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
19748
|
-
wasm2.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
19749
|
-
return v2;
|
|
19750
|
-
} finally {
|
|
19751
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19752
|
-
}
|
|
19753
|
-
}
|
|
19754
|
-
/**
|
|
19755
|
-
* @param {string} text
|
|
19756
|
-
* @param {any} allowed_special
|
|
19757
|
-
* @param {any} disallowed_special
|
|
19758
|
-
* @returns {any}
|
|
19759
|
-
*/
|
|
19760
|
-
encode_with_unstable(text, allowed_special, disallowed_special) {
|
|
19761
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19762
|
-
try {
|
|
19763
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19764
|
-
const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19765
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19766
|
-
wasm2.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
|
|
19767
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19768
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19769
|
-
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
19770
|
-
if (r22) {
|
|
19771
|
-
throw takeObject(r1);
|
|
19772
|
-
}
|
|
19773
|
-
return takeObject(r0);
|
|
19774
|
-
} finally {
|
|
19775
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19776
|
-
}
|
|
19777
|
-
}
|
|
19778
|
-
/**
|
|
19779
|
-
* @param {Uint8Array} bytes
|
|
19780
|
-
* @returns {number}
|
|
19781
|
-
*/
|
|
19782
|
-
encode_single_token(bytes) {
|
|
19783
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19784
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm2.__wbindgen_export_1);
|
|
19785
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19786
|
-
const ret = wasm2.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
|
|
19787
|
-
return ret >>> 0;
|
|
19788
|
-
}
|
|
19789
|
-
/**
|
|
19790
|
-
* @param {Uint32Array} tokens
|
|
19791
|
-
* @returns {Uint8Array}
|
|
19792
|
-
*/
|
|
19793
|
-
decode(tokens) {
|
|
19794
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19795
|
-
try {
|
|
19796
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19797
|
-
const ptr0 = passArray32ToWasm0(tokens, wasm2.__wbindgen_export_1);
|
|
19798
|
-
const len0 = WASM_VECTOR_LEN;
|
|
19799
|
-
wasm2.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
|
|
19800
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19801
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19802
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
19803
|
-
wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
19804
|
-
return v2;
|
|
19805
|
-
} finally {
|
|
19806
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19807
|
-
}
|
|
19808
|
-
}
|
|
19809
|
-
/**
|
|
19810
|
-
* @param {number} token
|
|
19811
|
-
* @returns {Uint8Array}
|
|
19812
|
-
*/
|
|
19813
|
-
decode_single_token_bytes(token2) {
|
|
19814
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19815
|
-
try {
|
|
19816
|
-
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
19817
|
-
wasm2.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token2);
|
|
19818
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19819
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19820
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
19821
|
-
wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
19822
|
-
return v1;
|
|
19823
|
-
} finally {
|
|
19824
|
-
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
19825
|
-
}
|
|
19826
|
-
}
|
|
19827
|
-
/** @returns {any} */
|
|
19828
|
-
token_byte_values() {
|
|
19829
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19830
|
-
const ret = wasm2.tiktoken_token_byte_values(this.__wbg_ptr);
|
|
19831
|
-
return takeObject(ret);
|
|
19832
|
-
}
|
|
19833
|
-
};
|
|
19834
|
-
module.exports.Tiktoken = Tiktoken;
|
|
19835
|
-
module.exports.__wbg_parse_def2e24ef1252aff = function() {
|
|
19836
|
-
return handleError(function(arg0, arg1) {
|
|
19837
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
19838
|
-
return addHeapObject(ret);
|
|
19839
|
-
}, arguments);
|
|
19840
|
-
};
|
|
19841
|
-
module.exports.__wbg_stringify_f7ed6987935b4a24 = function() {
|
|
19842
|
-
return handleError(function(arg0) {
|
|
19843
|
-
const ret = JSON.stringify(getObject(arg0));
|
|
19844
|
-
return addHeapObject(ret);
|
|
19845
|
-
}, arguments);
|
|
19846
|
-
};
|
|
19847
|
-
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
19848
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
19849
|
-
return addHeapObject(ret);
|
|
19850
|
-
};
|
|
19851
|
-
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
19852
|
-
const ret = getObject(arg0) === void 0;
|
|
19853
|
-
return ret;
|
|
19854
|
-
};
|
|
19855
|
-
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
19856
|
-
takeObject(arg0);
|
|
19857
|
-
};
|
|
19858
|
-
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
19859
|
-
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
19860
|
-
const obj = getObject(arg1);
|
|
19861
|
-
const ret = typeof obj === "string" ? obj : void 0;
|
|
19862
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
19863
|
-
var len1 = WASM_VECTOR_LEN;
|
|
19864
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
19865
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
19866
|
-
};
|
|
19867
|
-
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
19868
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
19869
|
-
};
|
|
19870
|
-
}
|
|
19871
|
-
});
|
|
19872
|
-
|
|
19873
|
-
// node_modules/tiktoken/tiktoken.cjs
|
|
19874
|
-
var require_tiktoken = __commonJS({
|
|
19875
|
-
"node_modules/tiktoken/tiktoken.cjs"(exports) {
|
|
19876
|
-
var wasm2 = require_tiktoken_bg();
|
|
19877
|
-
var imports = {};
|
|
19878
|
-
imports["./tiktoken_bg.js"] = wasm2;
|
|
19879
|
-
var path81 = __require("path");
|
|
19880
|
-
var fs70 = __require("fs");
|
|
19881
|
-
var candidates = __dirname.split(path81.sep).reduce((memo, _, index, array) => {
|
|
19882
|
-
const prefix = array.slice(0, index + 1).join(path81.sep) + path81.sep;
|
|
19883
|
-
if (!prefix.includes("node_modules" + path81.sep)) {
|
|
19884
|
-
memo.unshift(
|
|
19885
|
-
path81.join(
|
|
19886
|
-
prefix,
|
|
19887
|
-
"node_modules",
|
|
19888
|
-
"tiktoken",
|
|
19889
|
-
"",
|
|
19890
|
-
"./tiktoken_bg.wasm"
|
|
19891
|
-
)
|
|
19892
|
-
);
|
|
19893
|
-
}
|
|
19894
|
-
return memo;
|
|
19895
|
-
}, []);
|
|
19896
|
-
candidates.unshift(path81.join(__dirname, "./tiktoken_bg.wasm"));
|
|
19897
|
-
var bytes = null;
|
|
19898
|
-
for (const candidate of candidates) {
|
|
19899
|
-
try {
|
|
19900
|
-
bytes = fs70.readFileSync(candidate);
|
|
19901
|
-
break;
|
|
19902
|
-
} catch {
|
|
19903
|
-
}
|
|
19904
|
-
}
|
|
19905
|
-
if (bytes == null) throw new Error("Missing tiktoken_bg.wasm");
|
|
19906
|
-
var wasmModule = new WebAssembly.Module(bytes);
|
|
19907
|
-
var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
19908
|
-
wasm2.__wbg_set_wasm(wasmInstance.exports);
|
|
19909
|
-
exports["get_encoding"] = wasm2["get_encoding"];
|
|
19910
|
-
exports["encoding_for_model"] = wasm2["encoding_for_model"];
|
|
19911
|
-
exports["get_encoding_name_for_model"] = wasm2["get_encoding_name_for_model"];
|
|
19912
|
-
exports["Tiktoken"] = wasm2["Tiktoken"];
|
|
19913
|
-
}
|
|
19914
|
-
});
|
|
19915
|
-
|
|
19916
19715
|
// packages/core/dist/src/core/openaiContentGenerator.js
|
|
19917
19716
|
var openaiContentGenerator_exports = {};
|
|
19918
19717
|
__export(openaiContentGenerator_exports, {
|
|
@@ -20327,7 +20126,7 @@ Streaming setup timeout troubleshooting:
|
|
|
20327
20126
|
const content = JSON.stringify(request2.contents);
|
|
20328
20127
|
let totalTokens = 0;
|
|
20329
20128
|
try {
|
|
20330
|
-
const { get_encoding } = await
|
|
20129
|
+
const { get_encoding } = await import("tiktoken");
|
|
20331
20130
|
const encoding = get_encoding("cl100k_base");
|
|
20332
20131
|
totalTokens = encoding.encode(content).length;
|
|
20333
20132
|
encoding.free();
|
|
@@ -22121,7 +21920,7 @@ function createContentGeneratorConfig(config, authType) {
|
|
|
22121
21920
|
return contentGeneratorConfig;
|
|
22122
21921
|
}
|
|
22123
21922
|
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
22124
|
-
const version = "1.0.
|
|
21923
|
+
const version = "1.0.62";
|
|
22125
21924
|
const userAgent = `FSS-Link/${version} (${process.platform}; ${process.arch})`;
|
|
22126
21925
|
const baseHeaders = {
|
|
22127
21926
|
"User-Agent": userAgent
|
|
@@ -30666,14 +30465,14 @@ var init_esm5 = __esm({
|
|
|
30666
30465
|
if (er)
|
|
30667
30466
|
return results.emit("error", er);
|
|
30668
30467
|
if (follow && !didRealpaths) {
|
|
30669
|
-
const
|
|
30468
|
+
const promises4 = [];
|
|
30670
30469
|
for (const e2 of entries) {
|
|
30671
30470
|
if (e2.isSymbolicLink()) {
|
|
30672
|
-
|
|
30471
|
+
promises4.push(e2.realpath().then((r3) => r3?.isUnknown() ? r3.lstat() : r3));
|
|
30673
30472
|
}
|
|
30674
30473
|
}
|
|
30675
|
-
if (
|
|
30676
|
-
Promise.all(
|
|
30474
|
+
if (promises4.length) {
|
|
30475
|
+
Promise.all(promises4).then(() => onReaddir(null, entries, true));
|
|
30677
30476
|
return;
|
|
30678
30477
|
}
|
|
30679
30478
|
}
|
|
@@ -38311,8 +38110,8 @@ var init_edit = __esm({
|
|
|
38311
38110
|
let currentContent = null;
|
|
38312
38111
|
let fileExists = false;
|
|
38313
38112
|
let isNewFile = false;
|
|
38314
|
-
|
|
38315
|
-
|
|
38113
|
+
const finalNewString = params.new_string;
|
|
38114
|
+
const finalOldString = params.old_string;
|
|
38316
38115
|
let occurrences = 0;
|
|
38317
38116
|
let error = void 0;
|
|
38318
38117
|
try {
|
|
@@ -38342,22 +38141,77 @@ var init_edit = __esm({
|
|
|
38342
38141
|
type: ToolErrorType.ATTEMPT_TO_CREATE_EXISTING_FILE
|
|
38343
38142
|
};
|
|
38344
38143
|
} else if (occurrences === 0) {
|
|
38144
|
+
const oldStringPreview = params.old_string.length > 100 ? params.old_string.substring(0, 97) + "..." : params.old_string;
|
|
38145
|
+
const hasEscapeChars = /\\[ntr"'`\\]/.test(params.old_string);
|
|
38146
|
+
const hasSpecialWhitespace = /[\u0000-\u001F\u007F-\u009F]/.test(params.old_string);
|
|
38147
|
+
const diagnosticHints = [];
|
|
38148
|
+
if (hasEscapeChars) {
|
|
38149
|
+
diagnosticHints.push("String contains escape characters (\\n, \\t, etc.) - these must match exactly");
|
|
38150
|
+
}
|
|
38151
|
+
if (hasSpecialWhitespace) {
|
|
38152
|
+
diagnosticHints.push("String contains special whitespace or control characters");
|
|
38153
|
+
}
|
|
38154
|
+
if (params.old_string.includes("\n")) {
|
|
38155
|
+
diagnosticHints.push("Multi-line string - verify line endings and indentation match exactly");
|
|
38156
|
+
}
|
|
38157
|
+
if (params.old_string.trim() !== params.old_string) {
|
|
38158
|
+
diagnosticHints.push("String has leading/trailing whitespace - this must match file content exactly");
|
|
38159
|
+
}
|
|
38160
|
+
const diagnostics = diagnosticHints.length > 0 ? "\n\nDiagnostics:\n" + diagnosticHints.join("\n") : "";
|
|
38345
38161
|
error = {
|
|
38346
|
-
display: `Failed to edit
|
|
38347
|
-
raw: `Failed to edit
|
|
38162
|
+
display: `Failed to edit: target string not found in file.`,
|
|
38163
|
+
raw: `Failed to edit: 0 occurrences found for old_string in ${params.file_path}.
|
|
38164
|
+
|
|
38165
|
+
Target string (${params.old_string.length} chars): "${oldStringPreview}"
|
|
38166
|
+
|
|
38167
|
+
The exact text was not found. Common causes:
|
|
38168
|
+
\u2022 Whitespace differences (spaces, tabs, line endings)
|
|
38169
|
+
\u2022 Escape character issues (\\n vs actual newlines)
|
|
38170
|
+
\u2022 Case sensitivity mismatches
|
|
38171
|
+
\u2022 Text has been modified since last read
|
|
38172
|
+
|
|
38173
|
+
Recommended actions:
|
|
38174
|
+
1. Use ${ReadFileTool.Name} to verify current file content
|
|
38175
|
+
2. Copy the exact text from the file (including whitespace)
|
|
38176
|
+
3. Check for hidden characters or encoding issues${diagnostics}`,
|
|
38348
38177
|
type: ToolErrorType.EDIT_NO_OCCURRENCE_FOUND
|
|
38349
38178
|
};
|
|
38350
38179
|
} else if (occurrences !== expectedReplacements) {
|
|
38351
38180
|
const occurrenceTerm = expectedReplacements === 1 ? "occurrence" : "occurrences";
|
|
38181
|
+
const foundTerm = occurrences === 1 ? "occurrence" : "occurrences";
|
|
38182
|
+
const oldStringPreview = params.old_string.length > 100 ? params.old_string.substring(0, 97) + "..." : params.old_string;
|
|
38352
38183
|
error = {
|
|
38353
|
-
display: `
|
|
38354
|
-
raw: `
|
|
38184
|
+
display: `Edit safety check failed: found ${occurrences} matches, expected ${expectedReplacements}.`,
|
|
38185
|
+
raw: `Edit safety check failed in ${params.file_path}:
|
|
38186
|
+
|
|
38187
|
+
Expected: ${expectedReplacements} ${occurrenceTerm}
|
|
38188
|
+
Found: ${occurrences} ${foundTerm}
|
|
38189
|
+
|
|
38190
|
+
Target string: "${oldStringPreview}"
|
|
38191
|
+
|
|
38192
|
+
This safety check prevents unintended bulk replacements. Solutions:
|
|
38193
|
+
\u2022 If you want to replace all ${occurrences} instances, set expected_replacements: ${occurrences}
|
|
38194
|
+
\u2022 If you want to replace only specific instances, make your old_string more specific
|
|
38195
|
+
\u2022 Use ${ReadFileTool.Name} to see all occurrences and their context
|
|
38196
|
+
\u2022 Consider using line-specific context to make the target unique
|
|
38197
|
+
|
|
38198
|
+
Safety first: FSS Link prevents accidental mass replacements.`,
|
|
38355
38199
|
type: ToolErrorType.EDIT_EXPECTED_OCCURRENCE_MISMATCH
|
|
38356
38200
|
};
|
|
38357
38201
|
} else if (finalOldString === finalNewString) {
|
|
38358
38202
|
error = {
|
|
38359
|
-
display: `No changes to apply
|
|
38360
|
-
raw: `No changes to apply
|
|
38203
|
+
display: `No changes to apply: old_string and new_string are identical.`,
|
|
38204
|
+
raw: `No changes to apply in ${params.file_path}:
|
|
38205
|
+
|
|
38206
|
+
The old_string and new_string are identical:
|
|
38207
|
+
"${params.old_string}"
|
|
38208
|
+
|
|
38209
|
+
This might indicate:
|
|
38210
|
+
\u2022 The change has already been applied
|
|
38211
|
+
\u2022 Copy-paste error where old and new text are the same
|
|
38212
|
+
\u2022 Unintended duplicate content
|
|
38213
|
+
|
|
38214
|
+
Verify your intended changes and ensure old_string \u2260 new_string.`,
|
|
38361
38215
|
type: ToolErrorType.EDIT_NO_CHANGE
|
|
38362
38216
|
};
|
|
38363
38217
|
}
|
|
@@ -38485,11 +38339,13 @@ var init_edit = __esm({
|
|
|
38485
38339
|
try {
|
|
38486
38340
|
this.ensureParentDirectoriesExist(this.params.file_path);
|
|
38487
38341
|
await this.config.getFileSystemService().writeTextFile(this.params.file_path, editData.newContent);
|
|
38342
|
+
const fileName = path19.basename(this.params.file_path);
|
|
38343
|
+
const originallyProposedContent = this.params.ai_proposed_string || this.params.new_string;
|
|
38344
|
+
const diffStat = getDiffStat(fileName, editData.currentContent ?? "", originallyProposedContent, this.params.new_string);
|
|
38488
38345
|
let displayResult;
|
|
38489
38346
|
if (editData.isNewFile) {
|
|
38490
38347
|
displayResult = `Created ${shortenPath(makeRelative(this.params.file_path, this.config.getTargetDir()))}`;
|
|
38491
38348
|
} else {
|
|
38492
|
-
const fileName = path19.basename(this.params.file_path);
|
|
38493
38349
|
const fileDiff = createPatch(
|
|
38494
38350
|
fileName,
|
|
38495
38351
|
editData.currentContent ?? "",
|
|
@@ -38499,8 +38355,6 @@ var init_edit = __esm({
|
|
|
38499
38355
|
"Proposed",
|
|
38500
38356
|
DEFAULT_DIFF_OPTIONS
|
|
38501
38357
|
);
|
|
38502
|
-
const originallyProposedContent = this.params.ai_proposed_string || this.params.new_string;
|
|
38503
|
-
const diffStat = getDiffStat(fileName, editData.currentContent ?? "", originallyProposedContent, this.params.new_string);
|
|
38504
38358
|
displayResult = {
|
|
38505
38359
|
fileDiff,
|
|
38506
38360
|
fileName,
|
|
@@ -38509,11 +38363,36 @@ var init_edit = __esm({
|
|
|
38509
38363
|
diffStat
|
|
38510
38364
|
};
|
|
38511
38365
|
}
|
|
38366
|
+
const oldLines = (editData.currentContent ?? "").split("\n").length;
|
|
38367
|
+
const newLines = editData.newContent.split("\n").length;
|
|
38368
|
+
const lineDelta = newLines - oldLines;
|
|
38369
|
+
const findChangeLineNumber = (content, target) => {
|
|
38370
|
+
if (!content || editData.isNewFile)
|
|
38371
|
+
return 1;
|
|
38372
|
+
const lines = content.split("\n");
|
|
38373
|
+
for (let i = 0; i < lines.length; i++) {
|
|
38374
|
+
if (lines[i].includes(target.split("\n")[0])) {
|
|
38375
|
+
return i + 1;
|
|
38376
|
+
}
|
|
38377
|
+
}
|
|
38378
|
+
return 1;
|
|
38379
|
+
};
|
|
38380
|
+
const changeLineNumber = findChangeLineNumber(editData.currentContent ?? "", this.params.old_string);
|
|
38381
|
+
const oldChars = (editData.currentContent ?? "").length;
|
|
38382
|
+
const newChars = editData.newContent.length;
|
|
38383
|
+
const charDelta = newChars - oldChars;
|
|
38384
|
+
const oldWords = (editData.currentContent ?? "").split(/\s+/).filter((w) => w.length > 0).length;
|
|
38385
|
+
const newWords = editData.newContent.split(/\s+/).filter((w) => w.length > 0).length;
|
|
38386
|
+
const wordDelta = newWords - oldWords;
|
|
38512
38387
|
const llmSuccessMessageParts = [
|
|
38513
|
-
editData.isNewFile ? `Created new file: ${this.params.file_path}
|
|
38388
|
+
editData.isNewFile ? `Created new file: ${this.params.file_path}
|
|
38389
|
+
Content: ${newLines} lines, ${newChars} characters, ${newWords} words` : `Successfully modified: ${this.params.file_path}
|
|
38390
|
+
Location: line ${changeLineNumber} (${editData.occurrences} replacement${editData.occurrences === 1 ? "" : "s"})
|
|
38391
|
+
Changes: ${diffStat.ai_added_lines > 0 ? `+${diffStat.ai_added_lines}` : ""}${diffStat.ai_removed_lines > 0 ? ` -${diffStat.ai_removed_lines}` : ""} lines${lineDelta !== 0 ? ` (${lineDelta > 0 ? "+" : ""}${lineDelta} net)` : ""}
|
|
38392
|
+
File size: ${oldLines} \u2192 ${newLines} lines, ${oldChars} \u2192 ${newChars} chars${charDelta !== 0 ? ` (${charDelta > 0 ? "+" : ""}${charDelta})` : ""}${wordDelta !== 0 ? `, ${wordDelta > 0 ? "+" : ""}${wordDelta} words` : ""}`
|
|
38514
38393
|
];
|
|
38515
38394
|
if (this.params.modified_by_user) {
|
|
38516
|
-
llmSuccessMessageParts.push(`User modified the
|
|
38395
|
+
llmSuccessMessageParts.push(`User modified the content during confirmation.`);
|
|
38517
38396
|
}
|
|
38518
38397
|
return {
|
|
38519
38398
|
llmContent: llmSuccessMessageParts.join(" "),
|
|
@@ -49029,11 +48908,20 @@ var init_write_file = __esm({
|
|
|
49029
48908
|
const fileDiff = createPatch(fileName, currentContentForDiff, fileContent, "Original", "Written", DEFAULT_DIFF_OPTIONS);
|
|
49030
48909
|
const originallyProposedContent = ai_proposed_content || content;
|
|
49031
48910
|
const diffStat = getDiffStat(fileName, currentContentForDiff, originallyProposedContent, content);
|
|
48911
|
+
const totalLines = fileContent.split("\n").length;
|
|
48912
|
+
const chars = fileContent.length;
|
|
48913
|
+
const words = fileContent.split(/\s+/).filter((w) => w.length > 0).length;
|
|
48914
|
+
const bytes = Buffer.byteLength(fileContent, "utf8");
|
|
48915
|
+
const oldSize = originalContent.length;
|
|
48916
|
+
const sizeDelta = chars - oldSize;
|
|
49032
48917
|
const llmSuccessMessageParts = [
|
|
49033
|
-
isNewFile ? `
|
|
48918
|
+
isNewFile ? `Created new file: ${file_path}
|
|
48919
|
+
Content: ${totalLines} lines, ${chars} characters, ${words} words (${bytes} bytes)` : `Overwrote file: ${file_path}
|
|
48920
|
+
Content: ${totalLines} lines, ${chars} characters, ${words} words (${bytes} bytes)${sizeDelta !== 0 ? `
|
|
48921
|
+
Size change: ${sizeDelta > 0 ? "+" : ""}${sizeDelta} characters (${oldSize} \u2192 ${chars})` : ""}`
|
|
49034
48922
|
];
|
|
49035
48923
|
if (modified_by_user) {
|
|
49036
|
-
llmSuccessMessageParts.push(`User modified the
|
|
48924
|
+
llmSuccessMessageParts.push(`User modified the content during confirmation.`);
|
|
49037
48925
|
}
|
|
49038
48926
|
const displayResult = {
|
|
49039
48927
|
fileDiff,
|
|
@@ -93540,7 +93428,7 @@ var require_xlsx = __commonJS({
|
|
|
93540
93428
|
}
|
|
93541
93429
|
return ws2;
|
|
93542
93430
|
}
|
|
93543
|
-
var
|
|
93431
|
+
var utils2 = {
|
|
93544
93432
|
encode_col,
|
|
93545
93433
|
encode_row,
|
|
93546
93434
|
encode_cell,
|
|
@@ -93739,7 +93627,7 @@ var require_xlsx = __commonJS({
|
|
|
93739
93627
|
XLSX3.writeFile = writeFileSync7;
|
|
93740
93628
|
XLSX3.writeFileSync = writeFileSync7;
|
|
93741
93629
|
XLSX3.writeFileAsync = writeFileAsync;
|
|
93742
|
-
XLSX3.utils =
|
|
93630
|
+
XLSX3.utils = utils2;
|
|
93743
93631
|
XLSX3.writeXLSX = writeSyncXLSX;
|
|
93744
93632
|
XLSX3.writeFileXLSX = writeFileSyncXLSX;
|
|
93745
93633
|
XLSX3.SSF = SSF;
|
|
@@ -98072,23 +97960,124 @@ var init_safety_manager = __esm({
|
|
|
98072
97960
|
}
|
|
98073
97961
|
});
|
|
98074
97962
|
|
|
97963
|
+
// packages/core/dist/src/parsers/excel/memory-tracker.js
|
|
97964
|
+
var MemoryTracker;
|
|
97965
|
+
var init_memory_tracker = __esm({
|
|
97966
|
+
"packages/core/dist/src/parsers/excel/memory-tracker.js"() {
|
|
97967
|
+
"use strict";
|
|
97968
|
+
MemoryTracker = class {
|
|
97969
|
+
maxMemoryMB;
|
|
97970
|
+
startTime;
|
|
97971
|
+
lastCheckTime;
|
|
97972
|
+
checkInterval = 1e3;
|
|
97973
|
+
// Check every second
|
|
97974
|
+
constructor(maxMemoryMB) {
|
|
97975
|
+
this.maxMemoryMB = maxMemoryMB;
|
|
97976
|
+
this.startTime = Date.now();
|
|
97977
|
+
this.lastCheckTime = this.startTime;
|
|
97978
|
+
}
|
|
97979
|
+
/**
|
|
97980
|
+
* Get current memory usage in MB
|
|
97981
|
+
*/
|
|
97982
|
+
getCurrentUsage() {
|
|
97983
|
+
const memUsage = process.memoryUsage();
|
|
97984
|
+
return Math.round(memUsage.heapUsed / 1024 / 1024 * 100) / 100;
|
|
97985
|
+
}
|
|
97986
|
+
/**
|
|
97987
|
+
* Get peak memory usage since start
|
|
97988
|
+
*/
|
|
97989
|
+
getPeakUsage() {
|
|
97990
|
+
const memUsage = process.memoryUsage();
|
|
97991
|
+
return Math.round(memUsage.heapTotal / 1024 / 1024 * 100) / 100;
|
|
97992
|
+
}
|
|
97993
|
+
/**
|
|
97994
|
+
* Check if we're approaching memory limits
|
|
97995
|
+
*/
|
|
97996
|
+
isMemoryLimitApproached() {
|
|
97997
|
+
const currentUsage = this.getCurrentUsage();
|
|
97998
|
+
return currentUsage > this.maxMemoryMB * 0.8;
|
|
97999
|
+
}
|
|
98000
|
+
/**
|
|
98001
|
+
* Check if memory limit has been exceeded
|
|
98002
|
+
*/
|
|
98003
|
+
isMemoryLimitExceeded() {
|
|
98004
|
+
const currentUsage = this.getCurrentUsage();
|
|
98005
|
+
return currentUsage > this.maxMemoryMB;
|
|
98006
|
+
}
|
|
98007
|
+
/**
|
|
98008
|
+
* Get memory status for progress reporting
|
|
98009
|
+
*/
|
|
98010
|
+
getMemoryStatus() {
|
|
98011
|
+
const currentUsage = this.getCurrentUsage();
|
|
98012
|
+
return {
|
|
98013
|
+
currentMB: currentUsage,
|
|
98014
|
+
maxMB: this.maxMemoryMB,
|
|
98015
|
+
percentageUsed: Math.round(currentUsage / this.maxMemoryMB * 100),
|
|
98016
|
+
isApproachingLimit: this.isMemoryLimitApproached(),
|
|
98017
|
+
isExceeded: this.isMemoryLimitExceeded()
|
|
98018
|
+
};
|
|
98019
|
+
}
|
|
98020
|
+
/**
|
|
98021
|
+
* Force garbage collection if available (V8 specific)
|
|
98022
|
+
*/
|
|
98023
|
+
async forceGC() {
|
|
98024
|
+
if (global.gc) {
|
|
98025
|
+
global.gc();
|
|
98026
|
+
await new Promise((resolve19) => setTimeout(resolve19, 10));
|
|
98027
|
+
}
|
|
98028
|
+
}
|
|
98029
|
+
/**
|
|
98030
|
+
* Get elapsed time since tracking started
|
|
98031
|
+
*/
|
|
98032
|
+
getElapsedTime() {
|
|
98033
|
+
return Date.now() - this.startTime;
|
|
98034
|
+
}
|
|
98035
|
+
/**
|
|
98036
|
+
* Reset tracking (useful for new operations)
|
|
98037
|
+
*/
|
|
98038
|
+
reset() {
|
|
98039
|
+
this.startTime = Date.now();
|
|
98040
|
+
this.lastCheckTime = this.startTime;
|
|
98041
|
+
}
|
|
98042
|
+
/**
|
|
98043
|
+
* Log memory status for debugging
|
|
98044
|
+
*/
|
|
98045
|
+
logMemoryStatus(context = "") {
|
|
98046
|
+
const status = this.getMemoryStatus();
|
|
98047
|
+
const prefix = context ? `[${context}] ` : "";
|
|
98048
|
+
console.log(`${prefix}Memory: ${status.currentMB}MB / ${status.maxMB}MB (${status.percentageUsed}%)`);
|
|
98049
|
+
if (status.isApproachingLimit) {
|
|
98050
|
+
console.warn(`${prefix}Warning: Approaching memory limit!`);
|
|
98051
|
+
}
|
|
98052
|
+
if (status.isExceeded) {
|
|
98053
|
+
console.error(`${prefix}Error: Memory limit exceeded!`);
|
|
98054
|
+
}
|
|
98055
|
+
}
|
|
98056
|
+
};
|
|
98057
|
+
}
|
|
98058
|
+
});
|
|
98059
|
+
|
|
98075
98060
|
// packages/core/dist/src/parsers/excel/excel-parser.js
|
|
98076
98061
|
var excel_parser_exports = {};
|
|
98077
98062
|
__export(excel_parser_exports, {
|
|
98078
98063
|
ExcelParser: () => ExcelParser
|
|
98079
98064
|
});
|
|
98080
98065
|
import * as fs24 from "fs";
|
|
98081
|
-
var
|
|
98066
|
+
var XLSX, ExcelParser;
|
|
98082
98067
|
var init_excel_parser = __esm({
|
|
98083
98068
|
"packages/core/dist/src/parsers/excel/excel-parser.js"() {
|
|
98084
98069
|
"use strict";
|
|
98085
|
-
|
|
98070
|
+
XLSX = __toESM(require_xlsx(), 1);
|
|
98086
98071
|
init_lib2();
|
|
98087
98072
|
init_js_yaml();
|
|
98088
98073
|
init_safety_manager();
|
|
98074
|
+
init_memory_tracker();
|
|
98089
98075
|
ExcelParser = class {
|
|
98090
98076
|
config;
|
|
98091
98077
|
safetyManager;
|
|
98078
|
+
progressCallback;
|
|
98079
|
+
abortController;
|
|
98080
|
+
memoryTracker;
|
|
98092
98081
|
constructor(config = {}) {
|
|
98093
98082
|
this.config = {
|
|
98094
98083
|
readAllSheets: true,
|
|
@@ -98097,16 +98086,96 @@ var init_excel_parser = __esm({
|
|
|
98097
98086
|
safetyChecks: true,
|
|
98098
98087
|
preserveFormulas: false,
|
|
98099
98088
|
includeFormatting: false,
|
|
98089
|
+
maxMemoryUsage: 512,
|
|
98090
|
+
// 512MB default
|
|
98091
|
+
chunkSize: 1e3,
|
|
98092
|
+
// 1000 rows per chunk
|
|
98093
|
+
enableProgress: true,
|
|
98094
|
+
enableCancellation: true,
|
|
98100
98095
|
...config
|
|
98101
98096
|
};
|
|
98102
98097
|
this.safetyManager = new SafetyManager();
|
|
98098
|
+
this.memoryTracker = new MemoryTracker(this.config.maxMemoryUsage);
|
|
98099
|
+
}
|
|
98100
|
+
// Set progress callback for streaming operations
|
|
98101
|
+
setProgressCallback(callback2) {
|
|
98102
|
+
this.progressCallback = callback2;
|
|
98103
|
+
}
|
|
98104
|
+
// Enable cancellation for long-running operations
|
|
98105
|
+
enableCancellation(controller) {
|
|
98106
|
+
this.abortController = controller;
|
|
98107
|
+
}
|
|
98108
|
+
// StreamingParser interface implementation
|
|
98109
|
+
getProgressCallback() {
|
|
98110
|
+
return (progress) => {
|
|
98111
|
+
if (this.progressCallback) {
|
|
98112
|
+
this.progressCallback({
|
|
98113
|
+
phase: "processing",
|
|
98114
|
+
currentSheet: "",
|
|
98115
|
+
sheetsProcessed: 0,
|
|
98116
|
+
totalSheets: 1,
|
|
98117
|
+
rowsProcessed: Math.floor(progress * 100),
|
|
98118
|
+
totalRows: 100,
|
|
98119
|
+
memoryUsage: this.memoryTracker.getCurrentUsage(),
|
|
98120
|
+
elapsedTime: Date.now()
|
|
98121
|
+
});
|
|
98122
|
+
}
|
|
98123
|
+
};
|
|
98124
|
+
}
|
|
98125
|
+
async processChunk(chunk, index) {
|
|
98126
|
+
const chunkStr = chunk.toString();
|
|
98127
|
+
const rows = [];
|
|
98128
|
+
const lines = chunkStr.split("\n");
|
|
98129
|
+
lines.forEach((line) => {
|
|
98130
|
+
const cells = line.split(",").map((value) => ({
|
|
98131
|
+
value: value.trim(),
|
|
98132
|
+
type: "string"
|
|
98133
|
+
}));
|
|
98134
|
+
rows.push(cells);
|
|
98135
|
+
});
|
|
98136
|
+
return {
|
|
98137
|
+
rows,
|
|
98138
|
+
startRow: index * this.config.chunkSize,
|
|
98139
|
+
endRow: (index + 1) * this.config.chunkSize - 1,
|
|
98140
|
+
sheetName: "Chunk" + index,
|
|
98141
|
+
isLastChunk: false
|
|
98142
|
+
// This would be determined by the calling context
|
|
98143
|
+
};
|
|
98144
|
+
}
|
|
98145
|
+
async mergeResults(chunks) {
|
|
98146
|
+
const workbookData = {
|
|
98147
|
+
sheets: {}
|
|
98148
|
+
};
|
|
98149
|
+
chunks.forEach((chunk) => {
|
|
98150
|
+
if (!workbookData.sheets[chunk.sheetName]) {
|
|
98151
|
+
workbookData.sheets[chunk.sheetName] = {
|
|
98152
|
+
name: chunk.sheetName,
|
|
98153
|
+
data: [],
|
|
98154
|
+
range: "",
|
|
98155
|
+
rowCount: 0,
|
|
98156
|
+
columnCount: 0
|
|
98157
|
+
};
|
|
98158
|
+
}
|
|
98159
|
+
const sheet = workbookData.sheets[chunk.sheetName];
|
|
98160
|
+
sheet.data.push(...chunk.rows);
|
|
98161
|
+
sheet.rowCount += chunk.rows.length;
|
|
98162
|
+
sheet.columnCount = Math.max(sheet.columnCount, chunk.rows[0]?.length || 0);
|
|
98163
|
+
});
|
|
98164
|
+
return {
|
|
98165
|
+
success: true,
|
|
98166
|
+
data: workbookData
|
|
98167
|
+
};
|
|
98103
98168
|
}
|
|
98104
98169
|
async parseFile(filePath) {
|
|
98105
98170
|
const startTime = Date.now();
|
|
98171
|
+
this.memoryTracker.reset();
|
|
98106
98172
|
const result = {
|
|
98107
98173
|
success: false,
|
|
98108
98174
|
warnings: [],
|
|
98109
|
-
errors: []
|
|
98175
|
+
errors: [],
|
|
98176
|
+
chunksProcessed: 0,
|
|
98177
|
+
peakMemoryUsage: 0,
|
|
98178
|
+
averageChunkTime: 0
|
|
98110
98179
|
};
|
|
98111
98180
|
try {
|
|
98112
98181
|
if (this.config.safetyChecks) {
|
|
@@ -98116,8 +98185,17 @@ var init_excel_parser = __esm({
|
|
|
98116
98185
|
return result;
|
|
98117
98186
|
}
|
|
98118
98187
|
}
|
|
98188
|
+
const stats = await fs24.promises.stat(filePath);
|
|
98189
|
+
const fileSizeMB = stats.size / 1024 / 1024;
|
|
98190
|
+
const shouldStream = fileSizeMB > 50;
|
|
98191
|
+
if (shouldStream && this.config.enableProgress) {
|
|
98192
|
+
console.log(`\u{1F4CA} Large file detected (${fileSizeMB.toFixed(1)}MB), using streaming mode...`);
|
|
98193
|
+
}
|
|
98119
98194
|
const extension = filePath.toLowerCase().split(".").pop();
|
|
98120
98195
|
let workbookData;
|
|
98196
|
+
if (this.config.enableProgress) {
|
|
98197
|
+
this.reportProgress("reading", "", 0, 1, 0, 0);
|
|
98198
|
+
}
|
|
98121
98199
|
switch (extension) {
|
|
98122
98200
|
case "xlsx":
|
|
98123
98201
|
case "xls":
|
|
@@ -98139,11 +98217,88 @@ var init_excel_parser = __esm({
|
|
|
98139
98217
|
}
|
|
98140
98218
|
result.success = true;
|
|
98141
98219
|
result.processingTime = Date.now() - startTime;
|
|
98220
|
+
result.peakMemoryUsage = this.memoryTracker.getPeakUsage();
|
|
98221
|
+
if (this.config.enableProgress) {
|
|
98222
|
+
this.reportProgress("complete", "", 1, 1, 1, 1);
|
|
98223
|
+
}
|
|
98142
98224
|
} catch (error) {
|
|
98143
98225
|
result.errors?.push(`Parsing failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
98226
|
+
if (this.memoryTracker.isMemoryLimitExceeded()) {
|
|
98227
|
+
result.errors?.push(`Memory limit exceeded: ${this.memoryTracker.getCurrentUsage()}MB > ${this.config.maxMemoryUsage}MB`);
|
|
98228
|
+
}
|
|
98144
98229
|
}
|
|
98145
98230
|
return result;
|
|
98146
98231
|
}
|
|
98232
|
+
// Enhanced streaming Excel file parser
|
|
98233
|
+
async parseExcelFileStreaming(filePath) {
|
|
98234
|
+
this.reportProgress("reading", filePath, 0, 1, 0, 0);
|
|
98235
|
+
const workbook = XLSX.readFile(filePath, {
|
|
98236
|
+
bookProps: true,
|
|
98237
|
+
bookSheets: true,
|
|
98238
|
+
sheetRows: 0
|
|
98239
|
+
// Don't load data yet
|
|
98240
|
+
});
|
|
98241
|
+
const workbookData = {
|
|
98242
|
+
sheets: {},
|
|
98243
|
+
metadata: this.extractWorkbookMetadata(workbook),
|
|
98244
|
+
revisionHistory: this.extractRevisionHistory(workbook),
|
|
98245
|
+
lastAuthors: this.extractLastAuthors(workbook)
|
|
98246
|
+
};
|
|
98247
|
+
const sheetsToProcess = this.config.readAllSheets ? workbook.SheetNames : [workbook.SheetNames[0]];
|
|
98248
|
+
for (let i = 0; i < sheetsToProcess.length; i++) {
|
|
98249
|
+
const sheetName = sheetsToProcess[i];
|
|
98250
|
+
this.reportProgress("processing", sheetName, i, sheetsToProcess.length, 0, 0);
|
|
98251
|
+
if (this.abortController?.signal.aborted) {
|
|
98252
|
+
throw new Error("Operation cancelled by user");
|
|
98253
|
+
}
|
|
98254
|
+
if (this.memoryTracker.isMemoryLimitExceeded()) {
|
|
98255
|
+
await this.memoryTracker.forceGC();
|
|
98256
|
+
if (this.memoryTracker.isMemoryLimitExceeded()) {
|
|
98257
|
+
throw new Error(`Memory limit exceeded: ${this.memoryTracker.getCurrentUsage()}MB`);
|
|
98258
|
+
}
|
|
98259
|
+
}
|
|
98260
|
+
const enhancedSheet = await this.processWorksheetStreaming(workbook, sheetName, filePath);
|
|
98261
|
+
workbookData.sheets[sheetName] = enhancedSheet;
|
|
98262
|
+
this.reportProgress("processing", sheetName, i + 1, sheetsToProcess.length, 0, 0);
|
|
98263
|
+
}
|
|
98264
|
+
return workbookData;
|
|
98265
|
+
}
|
|
98266
|
+
// Process worksheet with streaming and enhanced features
|
|
98267
|
+
async processWorksheetStreaming(workbook, sheetName, filePath) {
|
|
98268
|
+
const sheetWorkbook = XLSX.readFile(filePath, {
|
|
98269
|
+
sheets: [sheetName],
|
|
98270
|
+
cellFormula: this.config.preserveFormulas,
|
|
98271
|
+
cellStyles: this.config.includeFormatting
|
|
98272
|
+
});
|
|
98273
|
+
const worksheet = sheetWorkbook.Sheets[sheetName];
|
|
98274
|
+
if (!worksheet) {
|
|
98275
|
+
throw new Error(`Sheet ${sheetName} not found`);
|
|
98276
|
+
}
|
|
98277
|
+
const baseSheetData = this.processWorksheet(worksheet, sheetName);
|
|
98278
|
+
const enhancedSheetData = {
|
|
98279
|
+
...baseSheetData,
|
|
98280
|
+
formulaRelationships: this.config.preserveFormulas ? this.extractFormulaRelationships(worksheet) : void 0,
|
|
98281
|
+
tables: this.extractTableInfo(worksheet),
|
|
98282
|
+
charts: this.extractChartInfo(worksheet),
|
|
98283
|
+
revisionHistory: this.extractSheetRevisionHistory(worksheet)
|
|
98284
|
+
};
|
|
98285
|
+
return enhancedSheetData;
|
|
98286
|
+
}
|
|
98287
|
+
// Helper method for progress reporting
|
|
98288
|
+
reportProgress(phase, currentSheet, sheetsProcessed, totalSheets, rowsProcessed, totalRows) {
|
|
98289
|
+
if (this.progressCallback && this.config.enableProgress) {
|
|
98290
|
+
this.progressCallback({
|
|
98291
|
+
phase,
|
|
98292
|
+
currentSheet,
|
|
98293
|
+
sheetsProcessed,
|
|
98294
|
+
totalSheets,
|
|
98295
|
+
rowsProcessed,
|
|
98296
|
+
totalRows,
|
|
98297
|
+
memoryUsage: this.memoryTracker.getCurrentUsage(),
|
|
98298
|
+
elapsedTime: this.memoryTracker.getElapsedTime()
|
|
98299
|
+
});
|
|
98300
|
+
}
|
|
98301
|
+
}
|
|
98147
98302
|
async parseExcelFile(filePath) {
|
|
98148
98303
|
const options3 = {};
|
|
98149
98304
|
if (this.config.preserveFormulas !== void 0)
|
|
@@ -98152,7 +98307,7 @@ var init_excel_parser = __esm({
|
|
|
98152
98307
|
options3.cellStyles = this.config.includeFormatting;
|
|
98153
98308
|
if (this.config.includeMetadata !== void 0)
|
|
98154
98309
|
options3.bookProps = this.config.includeMetadata;
|
|
98155
|
-
const workbook =
|
|
98310
|
+
const workbook = XLSX.readFile(filePath, options3);
|
|
98156
98311
|
const workbookData = {
|
|
98157
98312
|
sheets: {}
|
|
98158
98313
|
};
|
|
@@ -98187,16 +98342,16 @@ var init_excel_parser = __esm({
|
|
|
98187
98342
|
const targetRange = this.config.range || sheetRange;
|
|
98188
98343
|
let range;
|
|
98189
98344
|
try {
|
|
98190
|
-
range =
|
|
98345
|
+
range = XLSX.utils.decode_range(targetRange);
|
|
98191
98346
|
} catch (_error) {
|
|
98192
98347
|
console.warn(`Invalid range specified: ${targetRange}, falling back to full sheet`);
|
|
98193
|
-
range =
|
|
98348
|
+
range = XLSX.utils.decode_range(sheetRange);
|
|
98194
98349
|
}
|
|
98195
98350
|
const data = [];
|
|
98196
98351
|
for (let row = range.s.r; row <= range.e.r; row++) {
|
|
98197
98352
|
const rowData = [];
|
|
98198
98353
|
for (let col = range.s.c; col <= range.e.c; col++) {
|
|
98199
|
-
const cellAddress =
|
|
98354
|
+
const cellAddress = XLSX.utils.encode_cell({ r: row, c: col });
|
|
98200
98355
|
const cell = worksheet[cellAddress];
|
|
98201
98356
|
if (cell) {
|
|
98202
98357
|
const cellData = {
|
|
@@ -98257,7 +98412,7 @@ var init_excel_parser = __esm({
|
|
|
98257
98412
|
const sheetData = {
|
|
98258
98413
|
name: "Sheet1",
|
|
98259
98414
|
data,
|
|
98260
|
-
range: `A1:${
|
|
98415
|
+
range: `A1:${XLSX.utils.encode_cell({ r: data.length - 1, c: Math.max(0, (data[0]?.length || 1) - 1) })}`,
|
|
98261
98416
|
rowCount: data.length,
|
|
98262
98417
|
columnCount: data[0]?.length || 0
|
|
98263
98418
|
};
|
|
@@ -98348,12 +98503,221 @@ var init_excel_parser = __esm({
|
|
|
98348
98503
|
});
|
|
98349
98504
|
return markdown2;
|
|
98350
98505
|
}
|
|
98506
|
+
// Enhanced metadata extraction with version tracking
|
|
98507
|
+
extractWorkbookMetadata(workbook) {
|
|
98508
|
+
if (!this.config.includeMetadata || !workbook.Props) {
|
|
98509
|
+
return void 0;
|
|
98510
|
+
}
|
|
98511
|
+
const metadata = {};
|
|
98512
|
+
if (workbook.Props.Title)
|
|
98513
|
+
metadata.title = workbook.Props.Title;
|
|
98514
|
+
if (workbook.Props.Author)
|
|
98515
|
+
metadata.author = workbook.Props.Author;
|
|
98516
|
+
if (workbook.Props.Subject)
|
|
98517
|
+
metadata.subject = workbook.Props.Subject;
|
|
98518
|
+
if (workbook.Props.CreatedDate)
|
|
98519
|
+
metadata.created = workbook.Props.CreatedDate;
|
|
98520
|
+
if (workbook.Props.ModifiedDate)
|
|
98521
|
+
metadata.modified = workbook.Props.ModifiedDate;
|
|
98522
|
+
if (workbook.Props.Application)
|
|
98523
|
+
metadata.application = workbook.Props.Application;
|
|
98524
|
+
metadata.sheetNames = workbook.SheetNames;
|
|
98525
|
+
return metadata;
|
|
98526
|
+
}
|
|
98527
|
+
// Extract revision history from workbook properties
|
|
98528
|
+
extractRevisionHistory(workbook) {
|
|
98529
|
+
if (!workbook.Props)
|
|
98530
|
+
return void 0;
|
|
98531
|
+
const revisions = [];
|
|
98532
|
+
if (workbook.Props.LastAuthor) {
|
|
98533
|
+
revisions.push({
|
|
98534
|
+
author: workbook.Props.LastAuthor,
|
|
98535
|
+
timestamp: workbook.Props.ModifiedDate,
|
|
98536
|
+
description: "Last modification"
|
|
98537
|
+
});
|
|
98538
|
+
}
|
|
98539
|
+
return revisions.length > 0 ? revisions : void 0;
|
|
98540
|
+
}
|
|
98541
|
+
// Extract last authors from document properties
|
|
98542
|
+
extractLastAuthors(workbook) {
|
|
98543
|
+
if (!workbook.Props)
|
|
98544
|
+
return void 0;
|
|
98545
|
+
const authors = [];
|
|
98546
|
+
if (workbook.Props.Author)
|
|
98547
|
+
authors.push(workbook.Props.Author);
|
|
98548
|
+
if (workbook.Props.LastAuthor && workbook.Props.LastAuthor !== workbook.Props.Author) {
|
|
98549
|
+
authors.push(workbook.Props.LastAuthor);
|
|
98550
|
+
}
|
|
98551
|
+
return authors.length > 0 ? authors : void 0;
|
|
98552
|
+
}
|
|
98553
|
+
// Extract formula relationships for enhanced formula preservation
|
|
98554
|
+
extractFormulaRelationships(worksheet) {
|
|
98555
|
+
const relationships = [];
|
|
98556
|
+
const cellAddresses = Object.keys(worksheet).filter((addr) => addr.match(/^[A-Z]+\d+$/));
|
|
98557
|
+
for (const cellAddr of cellAddresses) {
|
|
98558
|
+
const cell = worksheet[cellAddr];
|
|
98559
|
+
if (cell && cell.f) {
|
|
98560
|
+
const dependencies = this.extractFormulaDependencies(cell.f);
|
|
98561
|
+
const targetCells = this.findReferencingCells(worksheet, cellAddr);
|
|
98562
|
+
relationships.push({
|
|
98563
|
+
sourceCell: cellAddr,
|
|
98564
|
+
targetCells,
|
|
98565
|
+
formula: cell.f,
|
|
98566
|
+
dependencies
|
|
98567
|
+
});
|
|
98568
|
+
}
|
|
98569
|
+
}
|
|
98570
|
+
return relationships;
|
|
98571
|
+
}
|
|
98572
|
+
// Extract dependencies from formula string
|
|
98573
|
+
extractFormulaDependencies(formula) {
|
|
98574
|
+
const cellRefRegex = /\b[A-Z]+\d+\b/g;
|
|
98575
|
+
const matches = formula.match(cellRefRegex);
|
|
98576
|
+
return matches ? Array.from(new Set(matches)) : [];
|
|
98577
|
+
}
|
|
98578
|
+
// Find cells that reference the given cell
|
|
98579
|
+
findReferencingCells(worksheet, targetCell) {
|
|
98580
|
+
const referencingCells = [];
|
|
98581
|
+
const cellAddresses = Object.keys(worksheet).filter((addr) => addr.match(/^[A-Z]+\d+$/));
|
|
98582
|
+
for (const cellAddr of cellAddresses) {
|
|
98583
|
+
const cell = worksheet[cellAddr];
|
|
98584
|
+
if (cell && cell.f) {
|
|
98585
|
+
const dependencies = this.extractFormulaDependencies(cell.f);
|
|
98586
|
+
if (dependencies.includes(targetCell)) {
|
|
98587
|
+
referencingCells.push(cellAddr);
|
|
98588
|
+
}
|
|
98589
|
+
}
|
|
98590
|
+
}
|
|
98591
|
+
return referencingCells;
|
|
98592
|
+
}
|
|
98593
|
+
// Extract table information from worksheet
|
|
98594
|
+
extractTableInfo(worksheet) {
|
|
98595
|
+
const tables = [];
|
|
98596
|
+
if (worksheet["!ref"]) {
|
|
98597
|
+
const range = XLSX.utils.decode_range(worksheet["!ref"]);
|
|
98598
|
+
const hasHeaders = this.detectHeaders(worksheet, range);
|
|
98599
|
+
if (hasHeaders) {
|
|
98600
|
+
const headers = this.extractTableHeaders(worksheet, range);
|
|
98601
|
+
tables.push({
|
|
98602
|
+
range: worksheet["!ref"],
|
|
98603
|
+
headers,
|
|
98604
|
+
columnCount: range.e.c - range.s.c + 1,
|
|
98605
|
+
rowCount: range.e.r - range.s.r + 1,
|
|
98606
|
+
hasFilters: false,
|
|
98607
|
+
// Could be enhanced to detect actual filters
|
|
98608
|
+
hasTotalsRow: false
|
|
98609
|
+
// Could be enhanced to detect totals
|
|
98610
|
+
});
|
|
98611
|
+
}
|
|
98612
|
+
}
|
|
98613
|
+
return tables;
|
|
98614
|
+
}
|
|
98615
|
+
// Extract chart information (basic implementation)
|
|
98616
|
+
extractChartInfo(worksheet) {
|
|
98617
|
+
return [];
|
|
98618
|
+
}
|
|
98619
|
+
// Extract sheet-level revision history
|
|
98620
|
+
extractSheetRevisionHistory(worksheet) {
|
|
98621
|
+
return void 0;
|
|
98622
|
+
}
|
|
98623
|
+
// Detect if worksheet has headers
|
|
98624
|
+
detectHeaders(worksheet, range) {
|
|
98625
|
+
for (let col = range.s.c; col <= range.e.c; col++) {
|
|
98626
|
+
const cellAddr = XLSX.utils.encode_cell({ r: range.s.r, c: col });
|
|
98627
|
+
const cell = worksheet[cellAddr];
|
|
98628
|
+
if (cell && typeof cell.v === "string") {
|
|
98629
|
+
return true;
|
|
98630
|
+
}
|
|
98631
|
+
}
|
|
98632
|
+
return false;
|
|
98633
|
+
}
|
|
98634
|
+
// Extract table headers from first row
|
|
98635
|
+
extractTableHeaders(worksheet, range) {
|
|
98636
|
+
const headers = [];
|
|
98637
|
+
for (let col = range.s.c; col <= range.e.c; col++) {
|
|
98638
|
+
const cellAddr = XLSX.utils.encode_cell({ r: range.s.r, c: col });
|
|
98639
|
+
const cell = worksheet[cellAddr];
|
|
98640
|
+
headers.push(cell ? String(cell.v || `Column ${col + 1}`) : `Column ${col + 1}`);
|
|
98641
|
+
}
|
|
98642
|
+
return headers;
|
|
98643
|
+
}
|
|
98644
|
+
// Streaming CSV parser for large files
|
|
98645
|
+
async parseCsvFileStreaming(filePath, delimiter2 = ",") {
|
|
98646
|
+
return new Promise((resolve19, reject) => {
|
|
98647
|
+
const data = [];
|
|
98648
|
+
const fileStream = fs24.createReadStream(filePath);
|
|
98649
|
+
let rowCount = 0;
|
|
98650
|
+
const chunkSize = this.config.chunkSize || 1e3;
|
|
98651
|
+
fileStream.pipe(parse3({
|
|
98652
|
+
delimiter: delimiter2,
|
|
98653
|
+
skip_empty_lines: true,
|
|
98654
|
+
trim: true
|
|
98655
|
+
})).on("data", (row) => {
|
|
98656
|
+
if (rowCount % chunkSize === 0) {
|
|
98657
|
+
this.reportProgress("processing", "CSV Data", 0, 1, rowCount, rowCount);
|
|
98658
|
+
if (this.memoryTracker.isMemoryLimitApproached()) {
|
|
98659
|
+
this.memoryTracker.forceGC();
|
|
98660
|
+
}
|
|
98661
|
+
if (this.memoryTracker.isMemoryLimitExceeded()) {
|
|
98662
|
+
reject(new Error(`Memory limit exceeded while processing CSV: ${this.memoryTracker.getCurrentUsage()}MB`));
|
|
98663
|
+
return;
|
|
98664
|
+
}
|
|
98665
|
+
}
|
|
98666
|
+
const rowData = row.map((cell) => ({
|
|
98667
|
+
value: this.parseValue(cell),
|
|
98668
|
+
type: this.inferType(cell)
|
|
98669
|
+
}));
|
|
98670
|
+
data.push(rowData);
|
|
98671
|
+
rowCount++;
|
|
98672
|
+
}).on("end", () => {
|
|
98673
|
+
const sheetData = {
|
|
98674
|
+
name: "Sheet1",
|
|
98675
|
+
data,
|
|
98676
|
+
range: `A1:${XLSX.utils.encode_cell({ r: data.length - 1, c: Math.max(0, (data[0]?.length || 1) - 1) })}`,
|
|
98677
|
+
rowCount: data.length,
|
|
98678
|
+
columnCount: data[0]?.length || 0
|
|
98679
|
+
};
|
|
98680
|
+
resolve19({
|
|
98681
|
+
sheets: { "Sheet1": sheetData }
|
|
98682
|
+
});
|
|
98683
|
+
}).on("error", reject);
|
|
98684
|
+
});
|
|
98685
|
+
}
|
|
98351
98686
|
updateConfig(newConfig) {
|
|
98352
98687
|
this.config = { ...this.config, ...newConfig };
|
|
98353
98688
|
}
|
|
98354
98689
|
getConfig() {
|
|
98355
98690
|
return { ...this.config };
|
|
98356
98691
|
}
|
|
98692
|
+
// New method: Generate Excel file (round-trip functionality)
|
|
98693
|
+
async generateExcel(data, outputPath) {
|
|
98694
|
+
const workbook = XLSX.utils.book_new();
|
|
98695
|
+
for (const [sheetName, sheetData] of Object.entries(data.sheets)) {
|
|
98696
|
+
const worksheet = XLSX.utils.aoa_to_sheet(sheetData.data.map((row) => row.map((cell) => cell.value)));
|
|
98697
|
+
if (sheetData.data.some((row) => row.some((cell) => cell.formula))) {
|
|
98698
|
+
sheetData.data.forEach((row, rowIndex) => {
|
|
98699
|
+
row.forEach((cell, colIndex) => {
|
|
98700
|
+
if (cell.formula) {
|
|
98701
|
+
const cellAddr = XLSX.utils.encode_cell({ r: rowIndex, c: colIndex });
|
|
98702
|
+
worksheet[cellAddr] = { ...worksheet[cellAddr], f: cell.formula };
|
|
98703
|
+
}
|
|
98704
|
+
});
|
|
98705
|
+
});
|
|
98706
|
+
}
|
|
98707
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, sheetName);
|
|
98708
|
+
}
|
|
98709
|
+
if (data.metadata) {
|
|
98710
|
+
workbook.Props = {
|
|
98711
|
+
Title: data.metadata.title,
|
|
98712
|
+
Author: data.metadata.author,
|
|
98713
|
+
Subject: data.metadata.subject,
|
|
98714
|
+
CreatedDate: data.metadata.created,
|
|
98715
|
+
ModifiedDate: data.metadata.modified,
|
|
98716
|
+
Application: data.metadata.application
|
|
98717
|
+
};
|
|
98718
|
+
}
|
|
98719
|
+
XLSX.writeFile(workbook, outputPath);
|
|
98720
|
+
}
|
|
98357
98721
|
};
|
|
98358
98722
|
}
|
|
98359
98723
|
});
|
|
@@ -117857,11 +118221,11 @@ var require_pdf_worker = __commonJS({
|
|
|
117857
118221
|
cleanup: function Catalog_cleanup() {
|
|
117858
118222
|
var _this = this;
|
|
117859
118223
|
this.pageKidsCountCache.clear();
|
|
117860
|
-
var
|
|
118224
|
+
var promises4 = [];
|
|
117861
118225
|
this.fontCache.forEach(function(promise2) {
|
|
117862
|
-
|
|
118226
|
+
promises4.push(promise2);
|
|
117863
118227
|
});
|
|
117864
|
-
return Promise.all(
|
|
118228
|
+
return Promise.all(promises4).then(function(translatedFonts) {
|
|
117865
118229
|
for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
|
|
117866
118230
|
var font = translatedFonts[i].dict;
|
|
117867
118231
|
delete font.translated;
|
|
@@ -180061,11 +180425,11 @@ var require_pdf_worker2 = __commonJS({
|
|
|
180061
180425
|
cleanup: function Catalog_cleanup() {
|
|
180062
180426
|
var _this = this;
|
|
180063
180427
|
this.pageKidsCountCache.clear();
|
|
180064
|
-
var
|
|
180428
|
+
var promises4 = [];
|
|
180065
180429
|
this.fontCache.forEach(function(promise2) {
|
|
180066
|
-
|
|
180430
|
+
promises4.push(promise2);
|
|
180067
180431
|
});
|
|
180068
|
-
return Promise.all(
|
|
180432
|
+
return Promise.all(promises4).then(function(translatedFonts) {
|
|
180069
180433
|
for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
|
|
180070
180434
|
var font = translatedFonts[i].dict;
|
|
180071
180435
|
delete font.translated;
|
|
@@ -252287,11 +252651,11 @@ var require_pdf_worker3 = __commonJS({
|
|
|
252287
252651
|
cleanup: function Catalog_cleanup() {
|
|
252288
252652
|
var _this = this;
|
|
252289
252653
|
this.pageKidsCountCache.clear();
|
|
252290
|
-
var
|
|
252654
|
+
var promises4 = [];
|
|
252291
252655
|
this.fontCache.forEach(function(promise2) {
|
|
252292
|
-
|
|
252656
|
+
promises4.push(promise2);
|
|
252293
252657
|
});
|
|
252294
|
-
return Promise.all(
|
|
252658
|
+
return Promise.all(promises4).then(function(translatedFonts) {
|
|
252295
252659
|
for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
|
|
252296
252660
|
var font = translatedFonts[i].dict;
|
|
252297
252661
|
delete font.translated;
|
|
@@ -270802,13 +271166,13 @@ var require_pdf_worker3 = __commonJS({
|
|
|
270802
271166
|
this._reject(e2);
|
|
270803
271167
|
}
|
|
270804
271168
|
};
|
|
270805
|
-
Promise2.all = function Promise_all(
|
|
271169
|
+
Promise2.all = function Promise_all(promises4) {
|
|
270806
271170
|
var resolveAll, rejectAll;
|
|
270807
271171
|
var deferred = new Promise2(function(resolve20, reject2) {
|
|
270808
271172
|
resolveAll = resolve20;
|
|
270809
271173
|
rejectAll = reject2;
|
|
270810
271174
|
});
|
|
270811
|
-
var unresolved =
|
|
271175
|
+
var unresolved = promises4.length;
|
|
270812
271176
|
var results = [];
|
|
270813
271177
|
if (unresolved === 0) {
|
|
270814
271178
|
resolveAll(results);
|
|
@@ -270821,8 +271185,8 @@ var require_pdf_worker3 = __commonJS({
|
|
|
270821
271185
|
results = [];
|
|
270822
271186
|
rejectAll(reason);
|
|
270823
271187
|
}
|
|
270824
|
-
for (var i = 0, ii =
|
|
270825
|
-
var promise2 =
|
|
271188
|
+
for (var i = 0, ii = promises4.length; i < ii; ++i) {
|
|
271189
|
+
var promise2 = promises4[i];
|
|
270826
271190
|
var resolve19 = /* @__PURE__ */ (function(i2) {
|
|
270827
271191
|
return function(value) {
|
|
270828
271192
|
if (deferred._status === STATUS_REJECTED) {
|
|
@@ -284368,13 +284732,13 @@ var require_pdf3 = __commonJS({
|
|
|
284368
284732
|
this._reject(e2);
|
|
284369
284733
|
}
|
|
284370
284734
|
};
|
|
284371
|
-
Promise2.all = function Promise_all(
|
|
284735
|
+
Promise2.all = function Promise_all(promises4) {
|
|
284372
284736
|
var resolveAll, rejectAll;
|
|
284373
284737
|
var deferred = new Promise2(function(resolve20, reject2) {
|
|
284374
284738
|
resolveAll = resolve20;
|
|
284375
284739
|
rejectAll = reject2;
|
|
284376
284740
|
});
|
|
284377
|
-
var unresolved =
|
|
284741
|
+
var unresolved = promises4.length;
|
|
284378
284742
|
var results = [];
|
|
284379
284743
|
if (unresolved === 0) {
|
|
284380
284744
|
resolveAll(results);
|
|
@@ -284387,8 +284751,8 @@ var require_pdf3 = __commonJS({
|
|
|
284387
284751
|
results = [];
|
|
284388
284752
|
rejectAll(reason);
|
|
284389
284753
|
}
|
|
284390
|
-
for (var i = 0, ii =
|
|
284391
|
-
var promise2 =
|
|
284754
|
+
for (var i = 0, ii = promises4.length; i < ii; ++i) {
|
|
284755
|
+
var promise2 = promises4[i];
|
|
284392
284756
|
var resolve19 = /* @__PURE__ */ (function(i2) {
|
|
284393
284757
|
return function(value) {
|
|
284394
284758
|
if (deferred._status === STATUS_REJECTED) {
|
|
@@ -294178,11 +294542,11 @@ var require_pdf_worker4 = __commonJS({
|
|
|
294178
294542
|
cleanup: function Catalog_cleanup() {
|
|
294179
294543
|
var _this = this;
|
|
294180
294544
|
this.pageKidsCountCache.clear();
|
|
294181
|
-
var
|
|
294545
|
+
var promises4 = [];
|
|
294182
294546
|
this.fontCache.forEach(function(promise2) {
|
|
294183
|
-
|
|
294547
|
+
promises4.push(promise2);
|
|
294184
294548
|
});
|
|
294185
|
-
return Promise.all(
|
|
294549
|
+
return Promise.all(promises4).then(function(translatedFonts) {
|
|
294186
294550
|
for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
|
|
294187
294551
|
var font = translatedFonts[i].dict;
|
|
294188
294552
|
delete font.translated;
|
|
@@ -349522,9 +349886,7 @@ var init_gitService = __esm({
|
|
|
349522
349886
|
});
|
|
349523
349887
|
|
|
349524
349888
|
// packages/core/dist/src/telemetry/index.js
|
|
349525
|
-
|
|
349526
|
-
import { SemanticAttributes as SemanticAttributes2 } from "@opentelemetry/semantic-conventions";
|
|
349527
|
-
var TelemetryTarget, DEFAULT_TELEMETRY_TARGET, DEFAULT_OTLP_ENDPOINT;
|
|
349889
|
+
var TelemetryTarget, DEFAULT_TELEMETRY_TARGET, DEFAULT_OTLP_ENDPOINT, SpanStatusCode, ValueType2, SemanticAttributes2;
|
|
349528
349890
|
var init_telemetry = __esm({
|
|
349529
349891
|
"packages/core/dist/src/telemetry/index.js"() {
|
|
349530
349892
|
"use strict";
|
|
@@ -349539,6 +349901,20 @@ var init_telemetry = __esm({
|
|
|
349539
349901
|
})(TelemetryTarget || (TelemetryTarget = {}));
|
|
349540
349902
|
DEFAULT_TELEMETRY_TARGET = TelemetryTarget.LOCAL;
|
|
349541
349903
|
DEFAULT_OTLP_ENDPOINT = "http://localhost:4317";
|
|
349904
|
+
try {
|
|
349905
|
+
const otelApi = __require("@opentelemetry/api");
|
|
349906
|
+
SpanStatusCode = otelApi.SpanStatusCode;
|
|
349907
|
+
ValueType2 = otelApi.ValueType;
|
|
349908
|
+
} catch (error) {
|
|
349909
|
+
SpanStatusCode = { OK: 1, ERROR: 2 };
|
|
349910
|
+
ValueType2 = { INT: "int", DOUBLE: "double" };
|
|
349911
|
+
}
|
|
349912
|
+
try {
|
|
349913
|
+
const otelSemanticConventions = __require("@opentelemetry/semantic-conventions");
|
|
349914
|
+
SemanticAttributes2 = otelSemanticConventions.SemanticAttributes;
|
|
349915
|
+
} catch (error) {
|
|
349916
|
+
SemanticAttributes2 = {};
|
|
349917
|
+
}
|
|
349542
349918
|
}
|
|
349543
349919
|
});
|
|
349544
349920
|
|
|
@@ -351599,6 +351975,7 @@ var init_projectSummary = __esm({
|
|
|
351599
351975
|
"packages/core/dist/src/utils/projectSummary.js"() {
|
|
351600
351976
|
"use strict";
|
|
351601
351977
|
init_paths();
|
|
351978
|
+
init_fallback_metrics();
|
|
351602
351979
|
execAsync2 = promisify3(exec3);
|
|
351603
351980
|
ProjectSummaryParser = class {
|
|
351604
351981
|
gitStatusCache = /* @__PURE__ */ new Map();
|
|
@@ -351612,7 +351989,7 @@ var init_projectSummary = __esm({
|
|
|
351612
351989
|
*/
|
|
351613
351990
|
async getProjectSummary(workingDir = process.cwd()) {
|
|
351614
351991
|
const projectHash = getProjectHash(workingDir);
|
|
351615
|
-
const projectDir =
|
|
351992
|
+
const projectDir = getProjectTempDir(workingDir);
|
|
351616
351993
|
try {
|
|
351617
351994
|
const logsFile = path43.join(projectDir, "logs.json");
|
|
351618
351995
|
const logsExist = await this.fileExists(logsFile);
|
|
@@ -351806,13 +352183,26 @@ var init_projectSummary = __esm({
|
|
|
351806
352183
|
return void 0;
|
|
351807
352184
|
}
|
|
351808
352185
|
/**
|
|
351809
|
-
* Calculate efficiency rating based on session patterns
|
|
352186
|
+
* Calculate efficiency rating based on session patterns and metrics data
|
|
351810
352187
|
*/
|
|
351811
352188
|
calculateEfficiency(sessions, activeSessions) {
|
|
351812
352189
|
if (sessions.length === 0)
|
|
351813
352190
|
return "normal";
|
|
351814
352191
|
const avgMessagesPerSession = sessions.reduce((acc, s2) => acc + s2.messageCount, 0) / sessions.length;
|
|
351815
352192
|
const recentActivityRatio = activeSessions / Math.max(sessions.length, 1);
|
|
352193
|
+
try {
|
|
352194
|
+
const efficiencyMetrics = fallbackMetrics.getEfficiencyMetrics();
|
|
352195
|
+
if (efficiencyMetrics.totalInteractions > 0) {
|
|
352196
|
+
const toolSuccessRate = efficiencyMetrics.toolSuccessRate;
|
|
352197
|
+
const apiErrorRate = efficiencyMetrics.apiErrorRate;
|
|
352198
|
+
if (toolSuccessRate > 80 && apiErrorRate < 5 && recentActivityRatio > 0.5)
|
|
352199
|
+
return "high";
|
|
352200
|
+
if (toolSuccessRate < 50 || apiErrorRate > 20)
|
|
352201
|
+
return "low";
|
|
352202
|
+
return recentActivityRatio > 0.2 ? "normal" : "low";
|
|
352203
|
+
}
|
|
352204
|
+
} catch (error) {
|
|
352205
|
+
}
|
|
351816
352206
|
if (avgMessagesPerSession > 10 && recentActivityRatio > 0.5)
|
|
351817
352207
|
return "high";
|
|
351818
352208
|
if (avgMessagesPerSession < 3 || recentActivityRatio < 0.1)
|
|
@@ -351820,9 +352210,25 @@ var init_projectSummary = __esm({
|
|
|
351820
352210
|
return "normal";
|
|
351821
352211
|
}
|
|
351822
352212
|
/**
|
|
351823
|
-
* Generate recent activity summary
|
|
352213
|
+
* Generate recent activity summary with enhanced metrics awareness
|
|
351824
352214
|
*/
|
|
351825
352215
|
generateRecentActivity(activeSessions, totalSessions, timeAgo) {
|
|
352216
|
+
try {
|
|
352217
|
+
const metrics2 = fallbackMetrics.getMetrics();
|
|
352218
|
+
const totalTools = metrics2.toolCalls.total;
|
|
352219
|
+
const totalApiCalls = metrics2.api.requests;
|
|
352220
|
+
if (activeSessions > 1) {
|
|
352221
|
+
const toolInfo = totalTools > 0 ? `, ${totalTools} tools used` : "";
|
|
352222
|
+
return `${activeSessions} agents active${toolInfo}, last work ${timeAgo || "recently"}`;
|
|
352223
|
+
} else if (activeSessions === 1) {
|
|
352224
|
+
const activityInfo = totalApiCalls > 0 ? `, ${totalApiCalls} API calls` : "";
|
|
352225
|
+
return `1 active session${activityInfo}, last work ${timeAgo || "recently"}`;
|
|
352226
|
+
} else {
|
|
352227
|
+
const sessionInfo = totalSessions > 1 ? `${totalSessions} total sessions` : "Previous session";
|
|
352228
|
+
return `${sessionInfo}, last work ${timeAgo || "some time ago"}`;
|
|
352229
|
+
}
|
|
352230
|
+
} catch (error) {
|
|
352231
|
+
}
|
|
351826
352232
|
if (activeSessions > 1) {
|
|
351827
352233
|
return `${activeSessions} agents active, last work ${timeAgo || "recently"}`;
|
|
351828
352234
|
} else if (activeSessions === 1) {
|
|
@@ -351832,9 +352238,16 @@ var init_projectSummary = __esm({
|
|
|
351832
352238
|
}
|
|
351833
352239
|
}
|
|
351834
352240
|
/**
|
|
351835
|
-
* Generate token efficiency summary
|
|
352241
|
+
* Generate token efficiency summary using real metrics data when available
|
|
351836
352242
|
*/
|
|
351837
352243
|
generateTokenEfficiency(logs2) {
|
|
352244
|
+
try {
|
|
352245
|
+
const tokenEfficiencyStr = fallbackMetrics.getTokenEfficiencyString();
|
|
352246
|
+
if (tokenEfficiencyStr !== "No token usage recorded") {
|
|
352247
|
+
return tokenEfficiencyStr;
|
|
352248
|
+
}
|
|
352249
|
+
} catch (error) {
|
|
352250
|
+
}
|
|
351838
352251
|
const messageCount = logs2.length;
|
|
351839
352252
|
const estimatedTokens = messageCount * 50;
|
|
351840
352253
|
if (messageCount === 0)
|
|
@@ -354868,7 +355281,7 @@ var require_utils3 = __commonJS({
|
|
|
354868
355281
|
var require_scan = __commonJS({
|
|
354869
355282
|
"node_modules/picomatch/lib/scan.js"(exports, module) {
|
|
354870
355283
|
"use strict";
|
|
354871
|
-
var
|
|
355284
|
+
var utils2 = require_utils3();
|
|
354872
355285
|
var {
|
|
354873
355286
|
CHAR_ASTERISK: CHAR_ASTERISK2,
|
|
354874
355287
|
/* * */
|
|
@@ -355129,9 +355542,9 @@ var require_scan = __commonJS({
|
|
|
355129
355542
|
}
|
|
355130
355543
|
}
|
|
355131
355544
|
if (opts.unescape === true) {
|
|
355132
|
-
if (glob2) glob2 =
|
|
355545
|
+
if (glob2) glob2 = utils2.removeBackslashes(glob2);
|
|
355133
355546
|
if (base && backslashes === true) {
|
|
355134
|
-
base =
|
|
355547
|
+
base = utils2.removeBackslashes(base);
|
|
355135
355548
|
}
|
|
355136
355549
|
}
|
|
355137
355550
|
const state = {
|
|
@@ -355199,7 +355612,7 @@ var require_parse2 = __commonJS({
|
|
|
355199
355612
|
"node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
355200
355613
|
"use strict";
|
|
355201
355614
|
var constants2 = require_constants();
|
|
355202
|
-
var
|
|
355615
|
+
var utils2 = require_utils3();
|
|
355203
355616
|
var {
|
|
355204
355617
|
MAX_LENGTH,
|
|
355205
355618
|
POSIX_REGEX_SOURCE,
|
|
@@ -355216,7 +355629,7 @@ var require_parse2 = __commonJS({
|
|
|
355216
355629
|
try {
|
|
355217
355630
|
new RegExp(value);
|
|
355218
355631
|
} catch (ex) {
|
|
355219
|
-
return args.map((v) =>
|
|
355632
|
+
return args.map((v) => utils2.escapeRegex(v)).join("..");
|
|
355220
355633
|
}
|
|
355221
355634
|
return value;
|
|
355222
355635
|
};
|
|
@@ -355282,7 +355695,7 @@ var require_parse2 = __commonJS({
|
|
|
355282
355695
|
globstar: false,
|
|
355283
355696
|
tokens
|
|
355284
355697
|
};
|
|
355285
|
-
input =
|
|
355698
|
+
input = utils2.removePrefix(input, state);
|
|
355286
355699
|
len = input.length;
|
|
355287
355700
|
const extglobs = [];
|
|
355288
355701
|
const braces = [];
|
|
@@ -355421,7 +355834,7 @@ var require_parse2 = __commonJS({
|
|
|
355421
355834
|
state.output = input;
|
|
355422
355835
|
return state;
|
|
355423
355836
|
}
|
|
355424
|
-
state.output =
|
|
355837
|
+
state.output = utils2.wrapOutput(output, state, options3);
|
|
355425
355838
|
return state;
|
|
355426
355839
|
}
|
|
355427
355840
|
while (!eos()) {
|
|
@@ -355497,7 +355910,7 @@ var require_parse2 = __commonJS({
|
|
|
355497
355910
|
continue;
|
|
355498
355911
|
}
|
|
355499
355912
|
if (state.quotes === 1 && value !== '"') {
|
|
355500
|
-
value =
|
|
355913
|
+
value = utils2.escapeRegex(value);
|
|
355501
355914
|
prev.value += value;
|
|
355502
355915
|
append({ value });
|
|
355503
355916
|
continue;
|
|
@@ -355558,10 +355971,10 @@ var require_parse2 = __commonJS({
|
|
|
355558
355971
|
}
|
|
355559
355972
|
prev.value += value;
|
|
355560
355973
|
append({ value });
|
|
355561
|
-
if (opts.literalBrackets === false ||
|
|
355974
|
+
if (opts.literalBrackets === false || utils2.hasRegexChars(prevValue)) {
|
|
355562
355975
|
continue;
|
|
355563
355976
|
}
|
|
355564
|
-
const escaped =
|
|
355977
|
+
const escaped = utils2.escapeRegex(prev.value);
|
|
355565
355978
|
state.output = state.output.slice(0, -prev.value.length);
|
|
355566
355979
|
if (opts.literalBrackets === true) {
|
|
355567
355980
|
state.output += escaped;
|
|
@@ -355866,17 +356279,17 @@ var require_parse2 = __commonJS({
|
|
|
355866
356279
|
}
|
|
355867
356280
|
while (state.brackets > 0) {
|
|
355868
356281
|
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
355869
|
-
state.output =
|
|
356282
|
+
state.output = utils2.escapeLast(state.output, "[");
|
|
355870
356283
|
decrement("brackets");
|
|
355871
356284
|
}
|
|
355872
356285
|
while (state.parens > 0) {
|
|
355873
356286
|
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
355874
|
-
state.output =
|
|
356287
|
+
state.output = utils2.escapeLast(state.output, "(");
|
|
355875
356288
|
decrement("parens");
|
|
355876
356289
|
}
|
|
355877
356290
|
while (state.braces > 0) {
|
|
355878
356291
|
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
355879
|
-
state.output =
|
|
356292
|
+
state.output = utils2.escapeLast(state.output, "{");
|
|
355880
356293
|
decrement("braces");
|
|
355881
356294
|
}
|
|
355882
356295
|
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
@@ -355951,7 +356364,7 @@ var require_parse2 = __commonJS({
|
|
|
355951
356364
|
}
|
|
355952
356365
|
}
|
|
355953
356366
|
};
|
|
355954
|
-
const output =
|
|
356367
|
+
const output = utils2.removePrefix(input, state);
|
|
355955
356368
|
let source2 = create(output);
|
|
355956
356369
|
if (source2 && opts.strictSlashes !== true) {
|
|
355957
356370
|
source2 += `${SLASH_LITERAL}?`;
|
|
@@ -355968,7 +356381,7 @@ var require_picomatch = __commonJS({
|
|
|
355968
356381
|
"use strict";
|
|
355969
356382
|
var scan = require_scan();
|
|
355970
356383
|
var parse6 = require_parse2();
|
|
355971
|
-
var
|
|
356384
|
+
var utils2 = require_utils3();
|
|
355972
356385
|
var constants2 = require_constants();
|
|
355973
356386
|
var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
355974
356387
|
var picomatch3 = (glob2, options3, returnState = false) => {
|
|
@@ -356032,7 +356445,7 @@ var require_picomatch = __commonJS({
|
|
|
356032
356445
|
return { isMatch: false, output: "" };
|
|
356033
356446
|
}
|
|
356034
356447
|
const opts = options3 || {};
|
|
356035
|
-
const format = opts.format || (posix2 ?
|
|
356448
|
+
const format = opts.format || (posix2 ? utils2.toPosixSlashes : null);
|
|
356036
356449
|
let match2 = input === glob2;
|
|
356037
356450
|
let output = match2 && format ? format(input) : input;
|
|
356038
356451
|
if (match2 === false) {
|
|
@@ -356050,7 +356463,7 @@ var require_picomatch = __commonJS({
|
|
|
356050
356463
|
};
|
|
356051
356464
|
picomatch3.matchBase = (input, glob2, options3) => {
|
|
356052
356465
|
const regex = glob2 instanceof RegExp ? glob2 : picomatch3.makeRe(glob2, options3);
|
|
356053
|
-
return regex.test(
|
|
356466
|
+
return regex.test(utils2.basename(input));
|
|
356054
356467
|
};
|
|
356055
356468
|
picomatch3.isMatch = (str3, patterns, options3) => picomatch3(patterns, options3)(str3);
|
|
356056
356469
|
picomatch3.parse = (pattern, options3) => {
|
|
@@ -356107,10 +356520,10 @@ var require_picomatch2 = __commonJS({
|
|
|
356107
356520
|
"node_modules/picomatch/index.js"(exports, module) {
|
|
356108
356521
|
"use strict";
|
|
356109
356522
|
var pico = require_picomatch();
|
|
356110
|
-
var
|
|
356523
|
+
var utils2 = require_utils3();
|
|
356111
356524
|
function picomatch3(glob2, options3, returnState = false) {
|
|
356112
356525
|
if (options3 && (options3.windows === null || options3.windows === void 0)) {
|
|
356113
|
-
options3 = { ...options3, windows:
|
|
356526
|
+
options3 = { ...options3, windows: utils2.isWindows() };
|
|
356114
356527
|
}
|
|
356115
356528
|
return pico(glob2, options3, returnState);
|
|
356116
356529
|
}
|
|
@@ -368890,9 +369303,7 @@ var QueryOptimizer = class {
|
|
|
368890
369303
|
* Execute a query and return a single result
|
|
368891
369304
|
*/
|
|
368892
369305
|
async executeQuerySingle(db, query, params = []) {
|
|
368893
|
-
return this.executeOptimized(db, query, params, (stmt) =>
|
|
368894
|
-
return stmt.step() ? stmt.getAsObject() : null;
|
|
368895
|
-
});
|
|
369306
|
+
return this.executeOptimized(db, query, params, (stmt) => stmt.step() ? stmt.getAsObject() : null);
|
|
368896
369307
|
}
|
|
368897
369308
|
/**
|
|
368898
369309
|
* Execute a modification query (INSERT, UPDATE, DELETE)
|
|
@@ -369959,9 +370370,7 @@ var DatabaseSchemaValidator = class {
|
|
|
369959
370370
|
* Check if column types are compatible
|
|
369960
370371
|
*/
|
|
369961
370372
|
isTypeCompatible(expected, actual) {
|
|
369962
|
-
const normalizeType = (type2) =>
|
|
369963
|
-
return type2.toUpperCase().replace(/\(\d+\)/g, "").replace(/\s+/g, " ").trim();
|
|
369964
|
-
};
|
|
370373
|
+
const normalizeType = (type2) => type2.toUpperCase().replace(/\(\d+\)/g, "").replace(/\s+/g, " ").trim();
|
|
369965
370374
|
const expectedNorm = normalizeType(expected);
|
|
369966
370375
|
const actualNorm = normalizeType(actual);
|
|
369967
370376
|
if (expectedNorm === actualNorm) return true;
|
|
@@ -370507,7 +370916,7 @@ var FSSLinkDatabase = class {
|
|
|
370507
370916
|
defaultGeminiConfig.created_at
|
|
370508
370917
|
]);
|
|
370509
370918
|
const defaultLMStudioConfig = {
|
|
370510
|
-
auth_type: "
|
|
370919
|
+
auth_type: "lm-studio",
|
|
370511
370920
|
model_name: "qwen3-coder:latest",
|
|
370512
370921
|
endpoint_url: "http://localhost:1234/v1",
|
|
370513
370922
|
api_key: null,
|
|
@@ -370590,11 +370999,11 @@ var FSSLinkDatabase = class {
|
|
|
370590
370999
|
if ((activeResult?.count || 0) === 0) {
|
|
370591
371000
|
const bestModel = safeQueryFirst(this.db, `
|
|
370592
371001
|
SELECT id FROM model_configs
|
|
370593
|
-
WHERE auth_type IN ('ollama', '
|
|
371002
|
+
WHERE auth_type IN ('ollama', 'lm-studio', 'gemini-api-key', 'openai-api-key')
|
|
370594
371003
|
ORDER BY
|
|
370595
371004
|
CASE auth_type
|
|
370596
371005
|
WHEN 'ollama' THEN 1
|
|
370597
|
-
WHEN '
|
|
371006
|
+
WHEN 'lm-studio' THEN 2
|
|
370598
371007
|
WHEN 'gemini-api-key' THEN 3
|
|
370599
371008
|
WHEN 'openai-api-key' THEN 4
|
|
370600
371009
|
ELSE 5
|
|
@@ -370837,18 +371246,14 @@ var FSSLinkDatabase = class {
|
|
|
370837
371246
|
*/
|
|
370838
371247
|
async getSchemaVersion() {
|
|
370839
371248
|
await this.ensureInitialized();
|
|
370840
|
-
return await this.pool.withConnection(async (db) =>
|
|
370841
|
-
return this.migrationManager.getCurrentVersion(db);
|
|
370842
|
-
});
|
|
371249
|
+
return await this.pool.withConnection(async (db) => this.migrationManager.getCurrentVersion(db));
|
|
370843
371250
|
}
|
|
370844
371251
|
/**
|
|
370845
371252
|
* Get migration history
|
|
370846
371253
|
*/
|
|
370847
371254
|
async getMigrationHistory() {
|
|
370848
371255
|
await this.ensureInitialized();
|
|
370849
|
-
return await this.pool.withConnection(async (db) =>
|
|
370850
|
-
return this.migrationManager.getMigrationHistory(db);
|
|
370851
|
-
});
|
|
371256
|
+
return await this.pool.withConnection(async (db) => this.migrationManager.getMigrationHistory(db));
|
|
370852
371257
|
}
|
|
370853
371258
|
/**
|
|
370854
371259
|
* Force database migration (for debugging/maintenance)
|
|
@@ -370874,18 +371279,14 @@ var FSSLinkDatabase = class {
|
|
|
370874
371279
|
*/
|
|
370875
371280
|
async createBackup(description) {
|
|
370876
371281
|
await this.ensureInitialized();
|
|
370877
|
-
return await this.pool.withConnection(async (db) =>
|
|
370878
|
-
return this.backupManager.createManualBackup(db, description);
|
|
370879
|
-
});
|
|
371282
|
+
return await this.pool.withConnection(async (db) => this.backupManager.createManualBackup(db, description));
|
|
370880
371283
|
}
|
|
370881
371284
|
/**
|
|
370882
371285
|
* Create an automatic backup
|
|
370883
371286
|
*/
|
|
370884
371287
|
async createAutoBackup() {
|
|
370885
371288
|
await this.ensureInitialized();
|
|
370886
|
-
return await this.pool.withConnection(async (db) =>
|
|
370887
|
-
return this.backupManager.createAutoBackup(db);
|
|
370888
|
-
});
|
|
371289
|
+
return await this.pool.withConnection(async (db) => this.backupManager.createAutoBackup(db));
|
|
370889
371290
|
}
|
|
370890
371291
|
/**
|
|
370891
371292
|
* List all available backups
|
|
@@ -371174,9 +371575,7 @@ var FSSLinkDatabase = class {
|
|
|
371174
371575
|
* Get comprehensive database statistics
|
|
371175
371576
|
*/
|
|
371176
371577
|
async getDatabaseStats() {
|
|
371177
|
-
return await this.pool.withConnection(async (db) =>
|
|
371178
|
-
return await this.queryOptimizer.getDatabaseStats(db);
|
|
371179
|
-
});
|
|
371578
|
+
return await this.pool.withConnection(async (db) => await this.queryOptimizer.getDatabaseStats(db));
|
|
371180
371579
|
}
|
|
371181
371580
|
/**
|
|
371182
371581
|
* Run VACUUM to reclaim space and defragment
|
|
@@ -371190,14 +371589,12 @@ var FSSLinkDatabase = class {
|
|
|
371190
371589
|
* Collect comprehensive database metrics
|
|
371191
371590
|
*/
|
|
371192
371591
|
async collectMetrics() {
|
|
371193
|
-
return await this.pool.withConnection(async (db) =>
|
|
371194
|
-
|
|
371195
|
-
|
|
371196
|
-
|
|
371197
|
-
|
|
371198
|
-
|
|
371199
|
-
);
|
|
371200
|
-
});
|
|
371592
|
+
return await this.pool.withConnection(async (db) => await this.metricsCollector.collectMetrics(
|
|
371593
|
+
db,
|
|
371594
|
+
this.queryOptimizer,
|
|
371595
|
+
this.pool,
|
|
371596
|
+
this.backupManager
|
|
371597
|
+
));
|
|
371201
371598
|
}
|
|
371202
371599
|
/**
|
|
371203
371600
|
* Get historical metrics for trend analysis
|
|
@@ -371290,41 +371687,31 @@ var FSSLinkDatabase = class {
|
|
|
371290
371687
|
* Validate database schema against expected structure
|
|
371291
371688
|
*/
|
|
371292
371689
|
async validateSchema() {
|
|
371293
|
-
return await this.pool.withConnection(async (db) =>
|
|
371294
|
-
return await this.schemaValidator.validateSchema(db);
|
|
371295
|
-
});
|
|
371690
|
+
return await this.pool.withConnection(async (db) => await this.schemaValidator.validateSchema(db));
|
|
371296
371691
|
}
|
|
371297
371692
|
/**
|
|
371298
371693
|
* Validate specific table schema
|
|
371299
371694
|
*/
|
|
371300
371695
|
async validateTableSchema(tableName) {
|
|
371301
|
-
return await this.pool.withConnection(async (db) =>
|
|
371302
|
-
return await this.schemaValidator.validateTableSchema(db, tableName);
|
|
371303
|
-
});
|
|
371696
|
+
return await this.pool.withConnection(async (db) => await this.schemaValidator.validateTableSchema(db, tableName));
|
|
371304
371697
|
}
|
|
371305
371698
|
/**
|
|
371306
371699
|
* Check if database needs migration based on schema validation
|
|
371307
371700
|
*/
|
|
371308
371701
|
async needsSchemaMigration() {
|
|
371309
|
-
return await this.pool.withConnection(async (db) =>
|
|
371310
|
-
return await this.schemaValidator.needsMigration(db);
|
|
371311
|
-
});
|
|
371702
|
+
return await this.pool.withConnection(async (db) => await this.schemaValidator.needsMigration(db));
|
|
371312
371703
|
}
|
|
371313
371704
|
/**
|
|
371314
371705
|
* Get missing tables from schema
|
|
371315
371706
|
*/
|
|
371316
371707
|
async getMissingTables() {
|
|
371317
|
-
return await this.pool.withConnection(async (db) =>
|
|
371318
|
-
return await this.schemaValidator.getMissingTables(db);
|
|
371319
|
-
});
|
|
371708
|
+
return await this.pool.withConnection(async (db) => await this.schemaValidator.getMissingTables(db));
|
|
371320
371709
|
}
|
|
371321
371710
|
/**
|
|
371322
371711
|
* Get missing indexes from schema
|
|
371323
371712
|
*/
|
|
371324
371713
|
async getMissingIndexes() {
|
|
371325
|
-
return await this.pool.withConnection(async (db) =>
|
|
371326
|
-
return await this.schemaValidator.getMissingIndexes(db);
|
|
371327
|
-
});
|
|
371714
|
+
return await this.pool.withConnection(async (db) => await this.schemaValidator.getMissingIndexes(db));
|
|
371328
371715
|
}
|
|
371329
371716
|
/**
|
|
371330
371717
|
* Get formatted schema validation report
|
|
@@ -372392,13 +372779,13 @@ import {
|
|
|
372392
372779
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
372393
372780
|
import path59 from "path";
|
|
372394
372781
|
var __filename = fileURLToPath3(import.meta.url);
|
|
372395
|
-
var
|
|
372782
|
+
var __dirname = path59.dirname(__filename);
|
|
372396
372783
|
var packageJson;
|
|
372397
372784
|
async function getPackageJson() {
|
|
372398
372785
|
if (packageJson) {
|
|
372399
372786
|
return packageJson;
|
|
372400
372787
|
}
|
|
372401
|
-
const result = await readPackageUp({ cwd:
|
|
372788
|
+
const result = await readPackageUp({ cwd: __dirname });
|
|
372402
372789
|
if (!result) {
|
|
372403
372790
|
return;
|
|
372404
372791
|
}
|
|
@@ -372409,7 +372796,7 @@ async function getPackageJson() {
|
|
|
372409
372796
|
// packages/cli/src/utils/version.ts
|
|
372410
372797
|
async function getCliVersion() {
|
|
372411
372798
|
const pkgJson = await getPackageJson();
|
|
372412
|
-
return "1.0.
|
|
372799
|
+
return "1.0.62";
|
|
372413
372800
|
}
|
|
372414
372801
|
|
|
372415
372802
|
// packages/cli/src/ui/commands/aboutCommand.ts
|
|
@@ -372461,7 +372848,7 @@ import open4 from "open";
|
|
|
372461
372848
|
import process11 from "node:process";
|
|
372462
372849
|
|
|
372463
372850
|
// packages/cli/src/generated/git-commit.ts
|
|
372464
|
-
var GIT_COMMIT_INFO = "
|
|
372851
|
+
var GIT_COMMIT_INFO = "81a9bcbc";
|
|
372465
372852
|
|
|
372466
372853
|
// packages/cli/src/ui/commands/bugCommand.ts
|
|
372467
372854
|
init_dist2();
|
|
@@ -394053,8 +394440,8 @@ function ok() {
|
|
|
394053
394440
|
}
|
|
394054
394441
|
|
|
394055
394442
|
// node_modules/highlight.js/es/core.js
|
|
394056
|
-
var
|
|
394057
|
-
var core_default =
|
|
394443
|
+
var import_core = __toESM(require_core3(), 1);
|
|
394444
|
+
var core_default = import_core.default;
|
|
394058
394445
|
|
|
394059
394446
|
// node_modules/lowlight/lib/index.js
|
|
394060
394447
|
var emptyOptions = {};
|
|
@@ -403901,7 +404288,7 @@ import { exec as exec7, execSync as execSync6, spawn as spawn6 } from "node:chil
|
|
|
403901
404288
|
import os29 from "node:os";
|
|
403902
404289
|
import path78 from "node:path";
|
|
403903
404290
|
import fs66 from "node:fs";
|
|
403904
|
-
import { readFile as
|
|
404291
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
403905
404292
|
import { promisify as promisify6 } from "util";
|
|
403906
404293
|
var execAsync5 = promisify6(exec7);
|
|
403907
404294
|
function getContainerPath(hostPath) {
|
|
@@ -403936,7 +404323,7 @@ async function shouldUseCurrentUserInSandbox() {
|
|
|
403936
404323
|
}
|
|
403937
404324
|
if (os29.platform() === "linux") {
|
|
403938
404325
|
try {
|
|
403939
|
-
const osReleaseContent = await
|
|
404326
|
+
const osReleaseContent = await readFile12("/etc/os-release", "utf8");
|
|
403940
404327
|
if (osReleaseContent.includes("ID=debian") || osReleaseContent.includes("ID=ubuntu") || osReleaseContent.match(/^ID_LIKE=.*debian.*/m) || // Covers derivatives
|
|
403941
404328
|
osReleaseContent.match(/^ID_LIKE=.*ubuntu.*/m)) {
|
|
403942
404329
|
console.error(
|
|
@@ -404867,9 +405254,6 @@ async function checkForUpdates() {
|
|
|
404867
405254
|
}
|
|
404868
405255
|
}
|
|
404869
405256
|
|
|
404870
|
-
// packages/cli/src/gemini.tsx
|
|
404871
|
-
init_dist2();
|
|
404872
|
-
|
|
404873
405257
|
// packages/cli/src/zed-integration/zedIntegration.ts
|
|
404874
405258
|
init_dist2();
|
|
404875
405259
|
|