@cleocode/core 2026.9.11 → 2026.9.12
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/docs/export-document.js +50 -11
- package/dist/docs/export-document.js.map +1 -1
- package/dist/llm/plugin-facade.js +50 -11
- package/dist/llm/plugin-facade.js.map +2 -2
- package/dist/paths.d.ts +8 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +57 -4
- package/dist/paths.js.map +1 -1
- package/dist/selfimprove/fix-gen.js +50 -11
- package/dist/selfimprove/fix-gen.js.map +2 -2
- package/dist/shutdown-deadline.d.ts +3 -1
- package/dist/shutdown-deadline.d.ts.map +1 -1
- package/dist/shutdown-deadline.js +11 -1
- package/dist/shutdown-deadline.js.map +1 -1
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +10 -3
- package/dist/shutdown.js.map +1 -1
- package/dist/store/background-ops.d.ts +51 -5
- package/dist/store/background-ops.d.ts.map +1 -1
- package/dist/store/background-ops.js +72 -6
- package/dist/store/background-ops.js.map +1 -1
- package/dist/store/schema/background-jobs.d.ts +1 -1
- package/dist/store/schema/cleo-project/lifecycle.d.ts +2 -2
- package/dist/store/schema/cleo-project/provenance-rest.d.ts +1 -1
- package/dist/store/schema/cleo-project/runtime.d.ts +2 -2
- package/dist/store/schema/cleo-project/tasks-core-batch2.d.ts +1 -1
- package/dist/store/schema/cleo-project/tasks-core.d.ts +1 -1
- package/dist/store/schema/cleo-shared/brain.d.ts +2 -2
- package/dist/store/schema/lifecycle.d.ts +2 -2
- package/dist/store/schema/memory-schema.d.ts +2 -2
- package/dist/store/schema/provenance/releases.d.ts +1 -1
- package/dist/store/schema/tasks.d.ts +1 -1
- package/dist/store/validation-schemas.d.ts +12 -12
- package/package.json +13 -13
|
@@ -18371,6 +18371,9 @@ var init_project_scope = __esm({
|
|
|
18371
18371
|
});
|
|
18372
18372
|
|
|
18373
18373
|
// packages/core/src/teardown-signal.ts
|
|
18374
|
+
function isShuttingDown() {
|
|
18375
|
+
return _shuttingDown;
|
|
18376
|
+
}
|
|
18374
18377
|
function registerTeardownAbort(controller) {
|
|
18375
18378
|
if (_shuttingDown) {
|
|
18376
18379
|
try {
|
|
@@ -18396,6 +18399,9 @@ var init_teardown_signal = __esm({
|
|
|
18396
18399
|
// packages/core/src/store/background-ops.ts
|
|
18397
18400
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
18398
18401
|
import { isAbsolute } from "node:path";
|
|
18402
|
+
function recordProducerOutcome(disposition) {
|
|
18403
|
+
producerLedger[disposition] += 1;
|
|
18404
|
+
}
|
|
18399
18405
|
function trackBackgroundOp(op, execution) {
|
|
18400
18406
|
const completion = Promise.withResolvers();
|
|
18401
18407
|
const tracked = completion.promise;
|
|
@@ -18403,8 +18409,14 @@ function trackBackgroundOp(op, execution) {
|
|
|
18403
18409
|
void tracked.then(() => inFlight.delete(tracked));
|
|
18404
18410
|
const settle = (work) => {
|
|
18405
18411
|
void work.then(
|
|
18406
|
-
() =>
|
|
18407
|
-
|
|
18412
|
+
() => {
|
|
18413
|
+
recordProducerOutcome("fulfilled");
|
|
18414
|
+
completion.resolve({ status: "fulfilled", value: void 0 });
|
|
18415
|
+
},
|
|
18416
|
+
(reason) => {
|
|
18417
|
+
recordProducerOutcome(isExpectedTeardownRejection(reason) ? "cancelled" : "failed");
|
|
18418
|
+
completion.resolve({ status: "rejected", reason });
|
|
18419
|
+
}
|
|
18408
18420
|
);
|
|
18409
18421
|
};
|
|
18410
18422
|
if (typeof op !== "function") {
|
|
@@ -18436,6 +18448,7 @@ function trackBackgroundOp(op, execution) {
|
|
|
18436
18448
|
discard(error48) {
|
|
18437
18449
|
if (started) return;
|
|
18438
18450
|
started = true;
|
|
18451
|
+
recordProducerOutcome("discarded");
|
|
18439
18452
|
completion.resolve({ status: "rejected", reason: error48 });
|
|
18440
18453
|
}
|
|
18441
18454
|
};
|
|
@@ -18451,6 +18464,9 @@ function trackBackgroundOp(op, execution) {
|
|
|
18451
18464
|
else operation.start();
|
|
18452
18465
|
return tracked;
|
|
18453
18466
|
}
|
|
18467
|
+
function isExpectedTeardownRejection(reason) {
|
|
18468
|
+
return reason instanceof OperationExecutionError && (reason.code === "E_OPERATION_CANCELLED" || reason.code === "E_OPERATION_CLOSED" || reason.code === "E_OPERATION_DEADLINE");
|
|
18469
|
+
}
|
|
18454
18470
|
function createOperationExecutionContext(identity, options = {}) {
|
|
18455
18471
|
for (const key of ["projectId", "projectRoot", "actor", "operation", "idempotencyKey"]) {
|
|
18456
18472
|
const value = identity[key];
|
|
@@ -18590,12 +18606,18 @@ function observeOperation(context, work) {
|
|
|
18590
18606
|
if (context.signal.aborted) abort();
|
|
18591
18607
|
});
|
|
18592
18608
|
}
|
|
18593
|
-
var inFlight, backgroundCommitBoundary, OperationExecutionError;
|
|
18609
|
+
var inFlight, producerLedger, backgroundCommitBoundary, OperationExecutionError;
|
|
18594
18610
|
var init_background_ops = __esm({
|
|
18595
18611
|
"packages/core/src/store/background-ops.ts"() {
|
|
18596
18612
|
"use strict";
|
|
18597
18613
|
init_teardown_signal();
|
|
18598
18614
|
inFlight = /* @__PURE__ */ new Set();
|
|
18615
|
+
producerLedger = {
|
|
18616
|
+
fulfilled: 0,
|
|
18617
|
+
failed: 0,
|
|
18618
|
+
cancelled: 0,
|
|
18619
|
+
discarded: 0
|
|
18620
|
+
};
|
|
18599
18621
|
backgroundCommitBoundary = new AsyncLocalStorage2();
|
|
18600
18622
|
OperationExecutionError = class extends Error {
|
|
18601
18623
|
/** Machine-readable reason that a new stage was refused. */
|
|
@@ -31832,13 +31854,7 @@ function getCleoDirAbsolute(cwd, opts) {
|
|
|
31832
31854
|
const project = _pathsResolveProjectByCwd(cwd);
|
|
31833
31855
|
if (project !== null) {
|
|
31834
31856
|
if (process.env["CLEO_DISABLE_PROJECT_AUTOREGISTER"] !== "1") {
|
|
31835
|
-
|
|
31836
|
-
project.projectRoot,
|
|
31837
|
-
project.legacyUUID ?? project.projectId
|
|
31838
|
-
).catch((error48) => {
|
|
31839
|
-
process.stderr.write(`[cleo] Project encounter registration failed: ${error48.message}
|
|
31840
|
-
`);
|
|
31841
|
-
});
|
|
31857
|
+
scheduleProjectEncounter(project.projectRoot, project.legacyUUID ?? project.projectId);
|
|
31842
31858
|
}
|
|
31843
31859
|
try {
|
|
31844
31860
|
const projectRoot = getProjectRoot(cwd);
|
|
@@ -32012,6 +32028,26 @@ function _readProjectNameFromInfo(projectRoot) {
|
|
|
32012
32028
|
const data = JSON.parse(raw);
|
|
32013
32029
|
return typeof data.name === "string" && data.name.length > 0 ? data.name : void 0;
|
|
32014
32030
|
}
|
|
32031
|
+
function scheduleProjectEncounter(projectRoot, infoProjectId) {
|
|
32032
|
+
if (isShuttingDown()) return;
|
|
32033
|
+
const key = `${getCleoHome()}\0${infoProjectId}\0${projectRoot}`;
|
|
32034
|
+
const previous = _encountersScheduled.get(key);
|
|
32035
|
+
const now = Date.now();
|
|
32036
|
+
if (previous !== void 0 && now - previous < PROJECT_ENCOUNTER_REFRESH_MS) return;
|
|
32037
|
+
_encountersScheduled.set(key, now);
|
|
32038
|
+
registerProjectOnEncounter(projectRoot, infoProjectId).catch((error48) => {
|
|
32039
|
+
if (isExpectedTeardownRejection(error48)) {
|
|
32040
|
+
if (process.env["CLEO_DEBUG"])
|
|
32041
|
+
process.stderr.write(
|
|
32042
|
+
`[cleo][debug] Project encounter abandoned by teardown: ${error48.message}
|
|
32043
|
+
`
|
|
32044
|
+
);
|
|
32045
|
+
return;
|
|
32046
|
+
}
|
|
32047
|
+
process.stderr.write(`[cleo] Project encounter registration failed: ${error48.message}
|
|
32048
|
+
`);
|
|
32049
|
+
});
|
|
32050
|
+
}
|
|
32015
32051
|
async function registerProjectOnEncounter(projectRoot, infoProjectId) {
|
|
32016
32052
|
const scope = captureProjectScope(projectRoot, worktreeScope.getStore());
|
|
32017
32053
|
const capturedHome = getCleoHome();
|
|
@@ -32117,7 +32153,7 @@ async function registerProjectOnEncounter(projectRoot, infoProjectId) {
|
|
|
32117
32153
|
if (ownedExecution) execution.close();
|
|
32118
32154
|
}
|
|
32119
32155
|
}
|
|
32120
|
-
var _getCleoDirAbsoluteDeprecatedWarned;
|
|
32156
|
+
var _getCleoDirAbsoluteDeprecatedWarned, PROJECT_ENCOUNTER_REFRESH_MS, _encountersScheduled;
|
|
32121
32157
|
var init_paths = __esm({
|
|
32122
32158
|
"packages/core/src/paths.ts"() {
|
|
32123
32159
|
"use strict";
|
|
@@ -32127,7 +32163,10 @@ var init_paths = __esm({
|
|
|
32127
32163
|
init_project_scope();
|
|
32128
32164
|
init_background_ops();
|
|
32129
32165
|
init_platform_paths();
|
|
32166
|
+
init_teardown_signal();
|
|
32130
32167
|
_getCleoDirAbsoluteDeprecatedWarned = false;
|
|
32168
|
+
PROJECT_ENCOUNTER_REFRESH_MS = 5 * 6e4;
|
|
32169
|
+
_encountersScheduled = /* @__PURE__ */ new Map();
|
|
32131
32170
|
}
|
|
32132
32171
|
});
|
|
32133
32172
|
|