@yemi33/minions 0.1.2153 → 0.1.2154
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/engine/consolidation.js +5 -7
- package/engine/shared.js +74 -18
- package/package.json +1 -1
package/engine/consolidation.js
CHANGED
|
@@ -802,13 +802,11 @@ function consolidateWithLLM(items, existingNotes, files, config) {
|
|
|
802
802
|
const dupCheck = checkDuplicateHash(items);
|
|
803
803
|
if (dupCheck.isDuplicate) {
|
|
804
804
|
log('info', `Skipped LLM consolidation: ${dupCheck.count}/${dupCheck.total} items are duplicates (hash: ${dupCheck.hash.slice(0, 8)})`);
|
|
805
|
-
// Archive duplicate files
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
} catch (err) { log('warn', `Inbox archive (dup skip): ${err.message}`); }
|
|
811
|
-
}
|
|
805
|
+
// Archive duplicate files through the shared helper so WI references +
|
|
806
|
+
// completion-report artifact links get repointed to the archive path too
|
|
807
|
+
// (W-mq1j85cj00055a8f) — the inline rename here used to skip that rewrite,
|
|
808
|
+
// leaving dup-note links dangling.
|
|
809
|
+
archiveInboxFiles(files);
|
|
812
810
|
for (const f of files) _processingFiles.delete(f);
|
|
813
811
|
_consolidationInFlight = false;
|
|
814
812
|
_consolidationStartedAt = 0;
|
package/engine/shared.js
CHANGED
|
@@ -5297,10 +5297,18 @@ function extractStructuredWorkItemPrRef(item) {
|
|
|
5297
5297
|
// work-items.json + the central one to the new canonical location.
|
|
5298
5298
|
//
|
|
5299
5299
|
// Match semantics (intentionally narrow per the WI scope):
|
|
5300
|
-
// -
|
|
5301
|
-
//
|
|
5302
|
-
//
|
|
5303
|
-
//
|
|
5300
|
+
// - item.references[]: string 'notes/inbox/<inboxName>' (anchored on start
|
|
5301
|
+
// or '/') or object { url | path | href }. Other keys (label, kind, …)
|
|
5302
|
+
// are preserved. Description prose is NOT scanned.
|
|
5303
|
+
// - item._artifacts.notes[] (completion-report note links, written by
|
|
5304
|
+
// lifecycle.promoteCompletionArtifacts): the work-item renderer resolves
|
|
5305
|
+
// the clickable pill from note.file — a prefixed basename ('archive:<base>'
|
|
5306
|
+
// / 'kb:<cat>/<file>' / bare inbox base) — so we re-encode `file` for the
|
|
5307
|
+
// destination via _artifactNoteFileToken AND rewrite the `path` field.
|
|
5308
|
+
// This is the link shape agent completions actually populate, so it's the
|
|
5309
|
+
// one that must survive auto-archive.
|
|
5310
|
+
// - item.artifacts[] (raw completion artifacts): the `path` field is
|
|
5311
|
+
// rewritten the same way as references.
|
|
5304
5312
|
// - Trailing `?query` or `#fragment` is tolerated; substring overlaps in
|
|
5305
5313
|
// unrelated path segments (e.g. .../notes/inbox/foobar for foo.md) are
|
|
5306
5314
|
// NOT rewritten.
|
|
@@ -5319,12 +5327,29 @@ function extractStructuredWorkItemPrRef(item) {
|
|
|
5319
5327
|
// take the default (the in-file `mutateWorkItems` closure reference). Tests
|
|
5320
5328
|
// inject a wrapper to exercise the per-file try/catch boundary without
|
|
5321
5329
|
// having to manufacture a real SQL-store failure.
|
|
5330
|
+
|
|
5331
|
+
// Map a consolidation destination to the prefixed `file` token the work-item
|
|
5332
|
+
// artifact renderer (dashboard/js/render-work-items.js) uses for note pills:
|
|
5333
|
+
// notes/archive/<base> → 'archive:<base>' (openInboxNote resolves in archive)
|
|
5334
|
+
// knowledge/<cat>/<file> → 'kb:<cat>/<file>' (kbOpenItem)
|
|
5335
|
+
// notes.md / anything else → null (no per-note anchor — leave file as-is)
|
|
5336
|
+
function _artifactNoteFileToken(newLocation) {
|
|
5337
|
+
const nl = String(newLocation).replace(/\\/g, '/');
|
|
5338
|
+
if (/(?:^|\/)notes\/archive\//.test(nl)) return 'archive:' + nl.replace(/^.*\//, '');
|
|
5339
|
+
const kb = nl.match(/(?:^|\/)knowledge\/([^/]+)\/(.+)$/);
|
|
5340
|
+
if (kb) return 'kb:' + kb[1] + '/' + kb[2];
|
|
5341
|
+
return null;
|
|
5342
|
+
}
|
|
5343
|
+
|
|
5322
5344
|
function rewriteInboxRefsAcrossProjects(inboxName, newLocation, opts = {}) {
|
|
5323
5345
|
if (!inboxName || typeof newLocation !== 'string' || !newLocation) return 0;
|
|
5324
5346
|
const baseName = String(inboxName).replace(/^.*[/\\]/, '').trim();
|
|
5325
5347
|
if (!baseName) return 0;
|
|
5326
5348
|
const escaped = baseName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
5327
5349
|
const inboxRefRe = new RegExp(`(?:^|/)notes/inbox/${escaped}(?=$|[?#])`);
|
|
5350
|
+
// The note-pill `file` token for the destination (archive:/kb:/…). Computed
|
|
5351
|
+
// once — it depends only on newLocation, not the item being scanned.
|
|
5352
|
+
const fileToken = _artifactNoteFileToken(newLocation);
|
|
5328
5353
|
const _mutate = (opts && typeof opts._mutate === 'function') ? opts._mutate : mutateWorkItems;
|
|
5329
5354
|
|
|
5330
5355
|
let rewritten = 0;
|
|
@@ -5342,22 +5367,53 @@ function rewriteInboxRefsAcrossProjects(inboxName, newLocation, opts = {}) {
|
|
|
5342
5367
|
_mutate(wiPath, items => {
|
|
5343
5368
|
if (!Array.isArray(items)) return items;
|
|
5344
5369
|
for (const item of items) {
|
|
5345
|
-
if (!item
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
} else if (ref && typeof ref === 'object') {
|
|
5354
|
-
for (const key of ['url', 'path', 'href']) {
|
|
5355
|
-
const v = ref[key];
|
|
5356
|
-
if (typeof v === 'string' && inboxRefRe.test(v)) {
|
|
5357
|
-
ref[key] = newLocation;
|
|
5370
|
+
if (!item) continue;
|
|
5371
|
+
// references[] — string | { url | path | href }.
|
|
5372
|
+
if (Array.isArray(item.references)) {
|
|
5373
|
+
for (let i = 0; i < item.references.length; i++) {
|
|
5374
|
+
const ref = item.references[i];
|
|
5375
|
+
if (typeof ref === 'string') {
|
|
5376
|
+
if (inboxRefRe.test(ref)) {
|
|
5377
|
+
item.references[i] = newLocation;
|
|
5358
5378
|
rewritten++;
|
|
5359
|
-
break;
|
|
5360
5379
|
}
|
|
5380
|
+
} else if (ref && typeof ref === 'object') {
|
|
5381
|
+
for (const key of ['url', 'path', 'href']) {
|
|
5382
|
+
const v = ref[key];
|
|
5383
|
+
if (typeof v === 'string' && inboxRefRe.test(v)) {
|
|
5384
|
+
ref[key] = newLocation;
|
|
5385
|
+
rewritten++;
|
|
5386
|
+
break;
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
}
|
|
5390
|
+
}
|
|
5391
|
+
}
|
|
5392
|
+
// _artifacts.notes[] — completion-report note links. Match on the
|
|
5393
|
+
// inbox `path` (object form) or the bare basename `file` (the inbox
|
|
5394
|
+
// pill token), then re-encode `file` for the destination and fix
|
|
5395
|
+
// `path`. The renderer keys the clickable pill off `file`, so the
|
|
5396
|
+
// re-encode is what actually un-dangles the link.
|
|
5397
|
+
const notes = item._artifacts && item._artifacts.notes;
|
|
5398
|
+
if (Array.isArray(notes)) {
|
|
5399
|
+
for (let i = 0; i < notes.length; i++) {
|
|
5400
|
+
const n = notes[i];
|
|
5401
|
+
if (typeof n === 'string') {
|
|
5402
|
+
if (n === baseName && fileToken) { notes[i] = fileToken; rewritten++; }
|
|
5403
|
+
} else if (n && typeof n === 'object') {
|
|
5404
|
+
let hit = false;
|
|
5405
|
+
if (typeof n.path === 'string' && inboxRefRe.test(n.path)) { n.path = newLocation; hit = true; }
|
|
5406
|
+
if (n.file === baseName && fileToken) { n.file = fileToken; hit = true; }
|
|
5407
|
+
if (hit) rewritten++;
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
}
|
|
5411
|
+
// artifacts[] — raw completion artifacts ({ type, path, … }).
|
|
5412
|
+
if (Array.isArray(item.artifacts)) {
|
|
5413
|
+
for (const a of item.artifacts) {
|
|
5414
|
+
if (a && typeof a === 'object' && typeof a.path === 'string' && inboxRefRe.test(a.path)) {
|
|
5415
|
+
a.path = newLocation;
|
|
5416
|
+
rewritten++;
|
|
5361
5417
|
}
|
|
5362
5418
|
}
|
|
5363
5419
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2154",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|