@remnic/plugin-openclaw 9.63.0 → 9.63.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +74 -31
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4247,6 +4247,78 @@ import {
|
|
|
4247
4247
|
unlink,
|
|
4248
4248
|
writeFile
|
|
4249
4249
|
} from "fs/promises";
|
|
4250
|
+
|
|
4251
|
+
// ../../src/openclaw-flush-plan-serial-ingest.ts
|
|
4252
|
+
function isFailedIngestResult(result) {
|
|
4253
|
+
return Boolean(
|
|
4254
|
+
result && typeof result === "object" && typeof result.failedCount === "number" && result.failedCount > 0
|
|
4255
|
+
);
|
|
4256
|
+
}
|
|
4257
|
+
function partialIngestResultFromError(error) {
|
|
4258
|
+
if (!error || typeof error !== "object" || !("partialResult" in error)) {
|
|
4259
|
+
return void 0;
|
|
4260
|
+
}
|
|
4261
|
+
const partialResult = error.partialResult;
|
|
4262
|
+
if (!partialResult || typeof partialResult !== "object") return void 0;
|
|
4263
|
+
return partialResult;
|
|
4264
|
+
}
|
|
4265
|
+
var INGEST_RESULT_COUNTER_KEYS = [
|
|
4266
|
+
"attemptedTurnCount",
|
|
4267
|
+
"extractionCount",
|
|
4268
|
+
"persistedCount",
|
|
4269
|
+
"durableOutputCount",
|
|
4270
|
+
"skippedCount",
|
|
4271
|
+
"failedCount",
|
|
4272
|
+
"postPersistMetadataFailureCount",
|
|
4273
|
+
"processedTurnCount"
|
|
4274
|
+
];
|
|
4275
|
+
function emptyIngestResultCounters() {
|
|
4276
|
+
return {
|
|
4277
|
+
attemptedTurnCount: 0,
|
|
4278
|
+
extractionCount: 0,
|
|
4279
|
+
persistedCount: 0,
|
|
4280
|
+
durableOutputCount: 0,
|
|
4281
|
+
skippedCount: 0,
|
|
4282
|
+
failedCount: 0,
|
|
4283
|
+
postPersistMetadataFailureCount: 0,
|
|
4284
|
+
processedTurnCount: 0
|
|
4285
|
+
};
|
|
4286
|
+
}
|
|
4287
|
+
function mergeIngestResultCounters(aggregate, result) {
|
|
4288
|
+
if (!result || typeof result !== "object") return;
|
|
4289
|
+
for (const key of INGEST_RESULT_COUNTER_KEYS) {
|
|
4290
|
+
const value = result[key];
|
|
4291
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4292
|
+
aggregate[key] += value;
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
async function ingestFlushPlanImportTurns(params) {
|
|
4297
|
+
const aggregate = emptyIngestResultCounters();
|
|
4298
|
+
for (const turn of params.importTurns) {
|
|
4299
|
+
let result;
|
|
4300
|
+
try {
|
|
4301
|
+
result = await params.ingestor.ingestBulkImportBatch([turn], {
|
|
4302
|
+
...params.deadlineMs === void 0 ? {} : { deadlineMs: params.deadlineMs },
|
|
4303
|
+
failOnExtractionFailure: true,
|
|
4304
|
+
includeSourceValidAtContext: false
|
|
4305
|
+
});
|
|
4306
|
+
} catch (error) {
|
|
4307
|
+
mergeIngestResultCounters(aggregate, partialIngestResultFromError(error));
|
|
4308
|
+
if (aggregate.failedCount <= 0) aggregate.failedCount += 1;
|
|
4309
|
+
if (aggregate.processedTurnCount > 0) return aggregate;
|
|
4310
|
+
throw error;
|
|
4311
|
+
}
|
|
4312
|
+
mergeIngestResultCounters(aggregate, result);
|
|
4313
|
+
if (isFailedIngestResult(result)) return aggregate;
|
|
4314
|
+
if (!(typeof result?.processedTurnCount === "number" && result.processedTurnCount > 0)) {
|
|
4315
|
+
aggregate.processedTurnCount += 1;
|
|
4316
|
+
}
|
|
4317
|
+
}
|
|
4318
|
+
return aggregate;
|
|
4319
|
+
}
|
|
4320
|
+
|
|
4321
|
+
// ../../src/openclaw-flush-plan-lifecycle.ts
|
|
4250
4322
|
var DEFAULT_MAX_IMPORT_TURN_CHARS = 4e3;
|
|
4251
4323
|
var MARKER_WRITE_TEMP_ATTEMPTS = 8;
|
|
4252
4324
|
var CLEANUP_SNAPSHOT_PREFIX = "flush-plan.cleanup-";
|
|
@@ -4751,32 +4823,6 @@ function timestampForFlushPlanChunk(importedAt, chunkIndex) {
|
|
|
4751
4823
|
if (!Number.isFinite(importedAtMs)) return importedAt;
|
|
4752
4824
|
return new Date(importedAtMs + chunkIndex).toISOString();
|
|
4753
4825
|
}
|
|
4754
|
-
function isFailedIngestResult(result) {
|
|
4755
|
-
return Boolean(
|
|
4756
|
-
result && typeof result === "object" && typeof result.failedCount === "number" && result.failedCount > 0
|
|
4757
|
-
);
|
|
4758
|
-
}
|
|
4759
|
-
function partialIngestResultFromError(error) {
|
|
4760
|
-
if (!error || typeof error !== "object") return void 0;
|
|
4761
|
-
const partialResult = error.partialResult;
|
|
4762
|
-
if (!partialResult || typeof partialResult !== "object") return void 0;
|
|
4763
|
-
return partialResult;
|
|
4764
|
-
}
|
|
4765
|
-
async function ingestFlushPlanImportTurns(params) {
|
|
4766
|
-
try {
|
|
4767
|
-
return await params.ingestor.ingestBulkImportBatch(params.importTurns, {
|
|
4768
|
-
...params.deadlineMs === void 0 ? {} : { deadlineMs: params.deadlineMs },
|
|
4769
|
-
failOnExtractionFailure: true,
|
|
4770
|
-
includeSourceValidAtContext: false
|
|
4771
|
-
});
|
|
4772
|
-
} catch (error) {
|
|
4773
|
-
const partialResult = partialIngestResultFromError(error);
|
|
4774
|
-
if (partialResult && typeof partialResult.processedTurnCount === "number" && partialResult.processedTurnCount > 0) {
|
|
4775
|
-
return partialResult;
|
|
4776
|
-
}
|
|
4777
|
-
throw error;
|
|
4778
|
-
}
|
|
4779
|
-
}
|
|
4780
4826
|
function hasPostPersistMetadataFailure(result) {
|
|
4781
4827
|
return Boolean(
|
|
4782
4828
|
result && typeof result === "object" && typeof result.postPersistMetadataFailureCount === "number" && result.postPersistMetadataFailureCount > 0
|
|
@@ -11684,9 +11730,7 @@ Keep the reflection grounded in the evidence below.
|
|
|
11684
11730
|
logger_exports.log.debug(`LCM after_compaction error: ${lcmErr}`);
|
|
11685
11731
|
}
|
|
11686
11732
|
}
|
|
11687
|
-
|
|
11688
|
-
timeoutMs: cfg.beforeResetTimeoutMs
|
|
11689
|
-
});
|
|
11733
|
+
void queueOpenClawFlushPlanProcessing("after_compaction", workspaceDir);
|
|
11690
11734
|
if (!orchestrator.config.compactionResetEnabled) {
|
|
11691
11735
|
logger_exports.log.debug(
|
|
11692
11736
|
`compaction completed for ${sessionKey}, reset disabled \u2014 skipping`
|
|
@@ -12277,8 +12321,7 @@ Keep the reflection grounded in the evidence below.
|
|
|
12277
12321
|
);
|
|
12278
12322
|
void queueOpenClawFlushPlanProcessing(
|
|
12279
12323
|
"gateway_start",
|
|
12280
|
-
getOpenClawRuntimeWorkspaceDir(api)
|
|
12281
|
-
{ timeoutMs: cfg.beforeResetTimeoutMs }
|
|
12324
|
+
getOpenClawRuntimeWorkspaceDir(api)
|
|
12282
12325
|
);
|
|
12283
12326
|
} catch (err) {
|
|
12284
12327
|
try {
|