agentsmesh 0.31.0 → 0.32.0
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/dist/cli.js +211 -207
- package/dist/engine.d.ts +9 -1
- package/dist/engine.js +56 -2
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +355 -300
- package/dist/index.js.map +1 -1
- package/dist/{init-PvpXanVd.d.ts → init-CrZhoNTj.d.ts} +74 -74
- package/dist/lessons.d.ts +8 -4
- package/dist/lessons.js +687 -588
- package/dist/lessons.js.map +1 -1
- package/package.json +2 -2
package/dist/engine.d.ts
CHANGED
|
@@ -132,10 +132,14 @@ declare function formatDiffSummary(summary: DiffSummary): string;
|
|
|
132
132
|
*/
|
|
133
133
|
|
|
134
134
|
interface LockSyncReport {
|
|
135
|
-
/** True when
|
|
135
|
+
/** True when canonical state and checked generated outputs are all in sync. */
|
|
136
136
|
readonly inSync: boolean;
|
|
137
137
|
/** True when a `.lock` file was found at the canonical directory. */
|
|
138
138
|
readonly hasLock: boolean;
|
|
139
|
+
/** True when canonical files or extends differ from the lock. */
|
|
140
|
+
readonly canonicalDrift: boolean;
|
|
141
|
+
/** True when a generated output is modified, removed, or stale. */
|
|
142
|
+
readonly outputDrift: boolean;
|
|
139
143
|
/** Canonical files whose checksum differs from the lock. */
|
|
140
144
|
readonly modified: readonly string[];
|
|
141
145
|
/** Canonical files present now but not in the lock. */
|
|
@@ -153,6 +157,8 @@ interface LockSyncReport {
|
|
|
153
157
|
readonly outputsModified: readonly string[];
|
|
154
158
|
/** Generated outputs recorded in the lock but missing from disk. */
|
|
155
159
|
readonly outputsRemoved: readonly string[];
|
|
160
|
+
/** Managed generated outputs present on disk but absent from the lock. */
|
|
161
|
+
readonly outputsStale: readonly string[];
|
|
156
162
|
/**
|
|
157
163
|
* True when output drift was actually verified — requires `rootBase` and a
|
|
158
164
|
* lock with an `outputs` map. False for old-format locks or when no
|
|
@@ -171,6 +177,8 @@ interface CheckLockSyncOptions {
|
|
|
171
177
|
* verification is skipped (keeps the programmatic API backward compatible).
|
|
172
178
|
*/
|
|
173
179
|
readonly rootBase?: string;
|
|
180
|
+
/** Output-layout scope used when scanning managed locations for stale files. */
|
|
181
|
+
readonly scope?: TargetLayoutScope;
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
declare function importFrom(target: string, opts: {
|
package/dist/engine.js
CHANGED
|
@@ -27259,14 +27259,56 @@ async function diffOutputChecksums(rootBase, lockOutputs) {
|
|
|
27259
27259
|
return { outputsModified, outputsRemoved };
|
|
27260
27260
|
}
|
|
27261
27261
|
|
|
27262
|
+
// src/core/generate/stale-cleanup.ts
|
|
27263
|
+
init_fs();
|
|
27264
|
+
init_builtin_targets();
|
|
27265
|
+
async function listFiles2(root, base = root) {
|
|
27266
|
+
const entries = await readdir(root, { withFileTypes: true });
|
|
27267
|
+
const files = [];
|
|
27268
|
+
for (const entry of entries) {
|
|
27269
|
+
const abs = join(root, entry.name);
|
|
27270
|
+
if (entry.isDirectory()) {
|
|
27271
|
+
files.push(...await listFiles2(abs, base));
|
|
27272
|
+
continue;
|
|
27273
|
+
}
|
|
27274
|
+
files.push(relative(base, abs).replace(/\\/g, "/"));
|
|
27275
|
+
}
|
|
27276
|
+
return files;
|
|
27277
|
+
}
|
|
27278
|
+
async function findStaleGeneratedOutputs(args) {
|
|
27279
|
+
const expected = new Set(args.expectedPaths);
|
|
27280
|
+
const stale = /* @__PURE__ */ new Set();
|
|
27281
|
+
const scope = args.scope ?? "project";
|
|
27282
|
+
for (const target31 of args.targets) {
|
|
27283
|
+
const managed = getTargetManagedOutputs(target31, scope);
|
|
27284
|
+
if (!managed) continue;
|
|
27285
|
+
for (const file of managed.files) stale.add(file);
|
|
27286
|
+
for (const dir of managed.dirs) {
|
|
27287
|
+
const absDir = join(args.projectRoot, dir);
|
|
27288
|
+
if (!await exists(absDir)) continue;
|
|
27289
|
+
for (const file of await listFiles2(absDir)) {
|
|
27290
|
+
stale.add(`${dir}/${file}`.replace(/\/+/g, "/"));
|
|
27291
|
+
}
|
|
27292
|
+
}
|
|
27293
|
+
}
|
|
27294
|
+
const found = [];
|
|
27295
|
+
for (const relPath of stale) {
|
|
27296
|
+
if (expected.has(relPath)) continue;
|
|
27297
|
+
if (await exists(join(args.projectRoot, relPath))) found.push(relPath);
|
|
27298
|
+
}
|
|
27299
|
+
return found.sort();
|
|
27300
|
+
}
|
|
27301
|
+
|
|
27262
27302
|
// src/core/check/lock-sync.ts
|
|
27263
27303
|
async function checkLockSync(opts) {
|
|
27264
|
-
const { config, configDir, canonicalDir, rootBase } = opts;
|
|
27304
|
+
const { config, configDir, canonicalDir, rootBase, scope = "project" } = opts;
|
|
27265
27305
|
const lock = await readLock(canonicalDir);
|
|
27266
27306
|
if (lock === null) {
|
|
27267
27307
|
return {
|
|
27268
27308
|
inSync: false,
|
|
27269
27309
|
hasLock: false,
|
|
27310
|
+
canonicalDrift: false,
|
|
27311
|
+
outputDrift: false,
|
|
27270
27312
|
modified: [],
|
|
27271
27313
|
added: [],
|
|
27272
27314
|
removed: [],
|
|
@@ -27274,6 +27316,7 @@ async function checkLockSync(opts) {
|
|
|
27274
27316
|
lockedViolations: [],
|
|
27275
27317
|
outputsModified: [],
|
|
27276
27318
|
outputsRemoved: [],
|
|
27319
|
+
outputsStale: [],
|
|
27277
27320
|
outputsChecked: false
|
|
27278
27321
|
};
|
|
27279
27322
|
}
|
|
@@ -27312,10 +27355,20 @@ async function checkLockSync(opts) {
|
|
|
27312
27355
|
);
|
|
27313
27356
|
const outputsChecked = rootBase !== void 0 && lock.outputs !== void 0;
|
|
27314
27357
|
const { outputsModified, outputsRemoved } = outputsChecked ? await diffOutputChecksums(rootBase, lock.outputs ?? {}) : { outputsModified: [], outputsRemoved: [] };
|
|
27315
|
-
const
|
|
27358
|
+
const outputsStale = rootBase !== void 0 && lock.outputs !== void 0 ? await findStaleGeneratedOutputs({
|
|
27359
|
+
projectRoot: rootBase,
|
|
27360
|
+
targets: [...config.targets, ...config.pluginTargets ?? []],
|
|
27361
|
+
expectedPaths: Object.keys(lock.outputs),
|
|
27362
|
+
scope
|
|
27363
|
+
}) : [];
|
|
27364
|
+
const canonicalDrift = modified.length > 0 || added.length > 0 || removed.length > 0 || extendsModified.length > 0;
|
|
27365
|
+
const outputDrift = outputsModified.length > 0 || outputsRemoved.length > 0 || outputsStale.length > 0;
|
|
27366
|
+
const inSync = !canonicalDrift && !outputDrift;
|
|
27316
27367
|
return {
|
|
27317
27368
|
inSync,
|
|
27318
27369
|
hasLock: true,
|
|
27370
|
+
canonicalDrift,
|
|
27371
|
+
outputDrift,
|
|
27319
27372
|
modified,
|
|
27320
27373
|
added,
|
|
27321
27374
|
removed,
|
|
@@ -27323,6 +27376,7 @@ async function checkLockSync(opts) {
|
|
|
27323
27376
|
lockedViolations,
|
|
27324
27377
|
outputsModified,
|
|
27325
27378
|
outputsRemoved,
|
|
27379
|
+
outputsStale,
|
|
27326
27380
|
outputsChecked
|
|
27327
27381
|
};
|
|
27328
27382
|
}
|