omnius 1.0.337 → 1.0.338
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 +223 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -589948,6 +589948,214 @@ var init_dedup_gate = __esm({
|
|
|
589948
589948
|
}
|
|
589949
589949
|
});
|
|
589950
589950
|
|
|
589951
|
+
// packages/orchestrator/dist/memory-consolidation.js
|
|
589952
|
+
function cosine3(a2, b) {
|
|
589953
|
+
if (!a2?.length || a2.length !== b.length)
|
|
589954
|
+
return 0;
|
|
589955
|
+
let dot = 0, na = 0, nb = 0;
|
|
589956
|
+
for (let i2 = 0; i2 < a2.length; i2++) {
|
|
589957
|
+
dot += a2[i2] * b[i2];
|
|
589958
|
+
na += a2[i2] ** 2;
|
|
589959
|
+
nb += b[i2] ** 2;
|
|
589960
|
+
}
|
|
589961
|
+
const d2 = Math.sqrt(na) * Math.sqrt(nb);
|
|
589962
|
+
return d2 ? dot / d2 : 0;
|
|
589963
|
+
}
|
|
589964
|
+
function retentionStrength(note, now2 = Date.now()) {
|
|
589965
|
+
const ageH = Math.max(0, (now2 - note.lastAccessedMs) / HOUR);
|
|
589966
|
+
const stability = 24 * (1 + Math.log1p(note.accessCount)) * (0.5 + note.importance / 20);
|
|
589967
|
+
const retention = Math.exp(-ageH / Math.max(1, stability));
|
|
589968
|
+
return Math.min(1, Math.max(note.importance / 10 * 0.2, retention));
|
|
589969
|
+
}
|
|
589970
|
+
function scoreNote(note, opts = {}) {
|
|
589971
|
+
const now2 = opts.now ?? Date.now();
|
|
589972
|
+
const w = opts.weights ?? DEFAULT_WEIGHTS;
|
|
589973
|
+
const recency = retentionStrength(note, now2);
|
|
589974
|
+
const importance = Math.min(1, Math.max(0, note.importance / 10));
|
|
589975
|
+
const relevance = opts.queryEmbedding && note.embedding ? Math.max(0, cosine3(note.embedding, opts.queryEmbedding)) : 0.5;
|
|
589976
|
+
const total = w.recency * recency + w.importance * importance + w.relevance * relevance;
|
|
589977
|
+
return Math.round(total / (w.recency + w.importance + w.relevance) * 1e4) / 1e4;
|
|
589978
|
+
}
|
|
589979
|
+
function selectTopNotes(notes, k, opts) {
|
|
589980
|
+
return [...notes].map((n2) => ({ n: n2, s: scoreNote(n2, opts) })).sort((a2, b) => b.s - a2.s).slice(0, Math.max(0, k)).map((x) => x.n);
|
|
589981
|
+
}
|
|
589982
|
+
function findDuplicateGroups(notes, simThreshold = 0.92) {
|
|
589983
|
+
const groups = [];
|
|
589984
|
+
const used = /* @__PURE__ */ new Set();
|
|
589985
|
+
for (let i2 = 0; i2 < notes.length; i2++) {
|
|
589986
|
+
const a2 = notes[i2];
|
|
589987
|
+
if (used.has(a2.id))
|
|
589988
|
+
continue;
|
|
589989
|
+
const group = [a2];
|
|
589990
|
+
used.add(a2.id);
|
|
589991
|
+
for (let j = i2 + 1; j < notes.length; j++) {
|
|
589992
|
+
const b = notes[j];
|
|
589993
|
+
if (used.has(b.id))
|
|
589994
|
+
continue;
|
|
589995
|
+
const sim = a2.embedding && b.embedding ? cosine3(a2.embedding, b.embedding) : keywordJaccard(a2.keywords, b.keywords);
|
|
589996
|
+
if (sim >= simThreshold) {
|
|
589997
|
+
group.push(b);
|
|
589998
|
+
used.add(b.id);
|
|
589999
|
+
}
|
|
590000
|
+
}
|
|
590001
|
+
if (group.length > 1)
|
|
590002
|
+
groups.push(group);
|
|
590003
|
+
}
|
|
590004
|
+
return groups;
|
|
590005
|
+
}
|
|
590006
|
+
function keywordJaccard(a2, b) {
|
|
590007
|
+
const sa = new Set(a2.map((s2) => s2.toLowerCase()));
|
|
590008
|
+
const sb = new Set(b.map((s2) => s2.toLowerCase()));
|
|
590009
|
+
if (sa.size < 2 || sb.size < 2)
|
|
590010
|
+
return 0;
|
|
590011
|
+
let inter = 0;
|
|
590012
|
+
for (const k of sa)
|
|
590013
|
+
if (sb.has(k))
|
|
590014
|
+
inter++;
|
|
590015
|
+
return inter / (sa.size + sb.size - inter);
|
|
590016
|
+
}
|
|
590017
|
+
function planConsolidation(notes, opts = {}) {
|
|
590018
|
+
const now2 = opts.now ?? Date.now();
|
|
590019
|
+
const pruneRetention = opts.pruneRetention ?? 0.15;
|
|
590020
|
+
const protectImportance = opts.protectImportance ?? 8;
|
|
590021
|
+
const distillMinAccess = opts.distillMinAccess ?? 2;
|
|
590022
|
+
const merge2 = findDuplicateGroups(notes, opts.simThreshold).map((g) => g.map((n2) => n2.id));
|
|
590023
|
+
const mergedAway = /* @__PURE__ */ new Set();
|
|
590024
|
+
for (const g of findDuplicateGroups(notes, opts.simThreshold)) {
|
|
590025
|
+
const sorted = [...g].sort((a2, b) => b.importance - a2.importance || b.accessCount - a2.accessCount);
|
|
590026
|
+
sorted.slice(1).forEach((n2) => mergedAway.add(n2.id));
|
|
590027
|
+
}
|
|
590028
|
+
const keep = [];
|
|
590029
|
+
const prune = [];
|
|
590030
|
+
const distill = [];
|
|
590031
|
+
for (const n2 of notes) {
|
|
590032
|
+
if (mergedAway.has(n2.id))
|
|
590033
|
+
continue;
|
|
590034
|
+
const retained = retentionStrength(n2, now2);
|
|
590035
|
+
const protectedNote = n2.tier === "semantic" || n2.importance >= protectImportance;
|
|
590036
|
+
if (!protectedNote && retained < pruneRetention && n2.accessCount === 0) {
|
|
590037
|
+
prune.push(n2.id);
|
|
590038
|
+
continue;
|
|
590039
|
+
}
|
|
590040
|
+
keep.push(n2.id);
|
|
590041
|
+
if (n2.tier === "episodic" && n2.accessCount >= distillMinAccess && n2.importance >= protectImportance - 2) {
|
|
590042
|
+
distill.push(n2.id);
|
|
590043
|
+
}
|
|
590044
|
+
}
|
|
590045
|
+
return { keep, prune, merge: merge2, distill };
|
|
590046
|
+
}
|
|
590047
|
+
var HOUR, ImportanceBudget, DEFAULT_WEIGHTS;
|
|
590048
|
+
var init_memory_consolidation = __esm({
|
|
590049
|
+
"packages/orchestrator/dist/memory-consolidation.js"() {
|
|
590050
|
+
"use strict";
|
|
590051
|
+
HOUR = 36e5;
|
|
590052
|
+
ImportanceBudget = class {
|
|
590053
|
+
threshold;
|
|
590054
|
+
sum = 0;
|
|
590055
|
+
constructor(threshold = 150) {
|
|
590056
|
+
this.threshold = threshold;
|
|
590057
|
+
}
|
|
590058
|
+
add(importance) {
|
|
590059
|
+
this.sum += Math.max(0, importance);
|
|
590060
|
+
}
|
|
590061
|
+
/** True when the accumulated importance warrants a consolidation pass. */
|
|
590062
|
+
shouldConsolidate() {
|
|
590063
|
+
return this.sum >= this.threshold;
|
|
590064
|
+
}
|
|
590065
|
+
current() {
|
|
590066
|
+
return Math.round(this.sum * 100) / 100;
|
|
590067
|
+
}
|
|
590068
|
+
/** Call after a consolidation pass runs. */
|
|
590069
|
+
reset() {
|
|
590070
|
+
this.sum = 0;
|
|
590071
|
+
}
|
|
590072
|
+
};
|
|
590073
|
+
DEFAULT_WEIGHTS = { recency: 1, importance: 1, relevance: 1 };
|
|
590074
|
+
}
|
|
590075
|
+
});
|
|
590076
|
+
|
|
590077
|
+
// packages/orchestrator/dist/exploration-fanout.js
|
|
590078
|
+
function detectExplorationIntent(s2) {
|
|
590079
|
+
const reads = s2.plannedReads ?? 0;
|
|
590080
|
+
const dirs = s2.distinctDirs ?? 0;
|
|
590081
|
+
if (reads >= 8 && dirs >= 3) {
|
|
590082
|
+
return { explore: true, reason: `broad read surface (${reads} reads across ${dirs} dirs)` };
|
|
590083
|
+
}
|
|
590084
|
+
if (EXPLORE_INTENT_RE.test(s2.intentText || "") && (reads >= 4 || dirs >= 2)) {
|
|
590085
|
+
return { explore: true, reason: "exploratory intent over multiple regions" };
|
|
590086
|
+
}
|
|
590087
|
+
return { explore: false, reason: "narrow/sequential — single agent is better" };
|
|
590088
|
+
}
|
|
590089
|
+
function classifyBreadth(s2) {
|
|
590090
|
+
const dirs = s2.distinctDirs ?? 0;
|
|
590091
|
+
const reads = s2.plannedReads ?? 0;
|
|
590092
|
+
if (dirs >= 6 || reads >= 20)
|
|
590093
|
+
return "broad";
|
|
590094
|
+
if (dirs >= 2 || reads >= 8)
|
|
590095
|
+
return "moderate";
|
|
590096
|
+
return "simple";
|
|
590097
|
+
}
|
|
590098
|
+
function recommendFanout(breadth) {
|
|
590099
|
+
if (breadth === "broad")
|
|
590100
|
+
return 5;
|
|
590101
|
+
if (breadth === "moderate")
|
|
590102
|
+
return 3;
|
|
590103
|
+
return 1;
|
|
590104
|
+
}
|
|
590105
|
+
function buildExplorerBriefs(objectivePrefix, regions) {
|
|
590106
|
+
const outputSchema = "Return JSON: { relevant: boolean, findings: [{ path, why_relevant, snippet? }], summary }. Return relevant=false with empty findings if your region has nothing pertinent (do NOT pad).";
|
|
590107
|
+
return regions.map((region) => ({
|
|
590108
|
+
objective: `${objectivePrefix} — limited to: ${region}`,
|
|
590109
|
+
scope: region,
|
|
590110
|
+
outputSchema,
|
|
590111
|
+
boundaries: [
|
|
590112
|
+
`Read ONLY within ${region}; do not wander into sibling regions.`,
|
|
590113
|
+
"Do NOT edit, write, or run mutating commands — exploration is read-only.",
|
|
590114
|
+
"Return a DISTILLED digest (paths + why-relevant + key snippets), never raw file dumps."
|
|
590115
|
+
],
|
|
590116
|
+
readOnly: true
|
|
590117
|
+
}));
|
|
590118
|
+
}
|
|
590119
|
+
function compressFindings(raw, opts = {}) {
|
|
590120
|
+
const maxFindings = opts.maxFindings ?? 8;
|
|
590121
|
+
const maxSnippet = opts.maxSnippet ?? 400;
|
|
590122
|
+
const findings = (raw.findings ?? []).filter((f2) => f2 && f2.path).slice(0, maxFindings).map((f2) => ({
|
|
590123
|
+
path: f2.path,
|
|
590124
|
+
whyRelevant: (f2.whyRelevant ?? "").slice(0, 200),
|
|
590125
|
+
...f2.snippet ? { snippet: f2.snippet.slice(0, maxSnippet) } : {}
|
|
590126
|
+
}));
|
|
590127
|
+
const relevant = raw.relevant !== false && findings.length > 0;
|
|
590128
|
+
return {
|
|
590129
|
+
region: raw.region,
|
|
590130
|
+
relevant,
|
|
590131
|
+
findings: relevant ? findings : [],
|
|
590132
|
+
summary: relevant ? (raw.summary ?? "").slice(0, 300) : ""
|
|
590133
|
+
};
|
|
590134
|
+
}
|
|
590135
|
+
function mergeDigests(digests) {
|
|
590136
|
+
const relevant = digests.filter((d2) => d2.relevant && d2.findings.length > 0);
|
|
590137
|
+
const emptyRegions = digests.filter((d2) => !d2.relevant || d2.findings.length === 0).map((d2) => d2.region);
|
|
590138
|
+
const seen = /* @__PURE__ */ new Set();
|
|
590139
|
+
const paths = [];
|
|
590140
|
+
for (const d2 of relevant) {
|
|
590141
|
+
for (const f2 of d2.findings) {
|
|
590142
|
+
if (!seen.has(f2.path)) {
|
|
590143
|
+
seen.add(f2.path);
|
|
590144
|
+
paths.push(f2.path);
|
|
590145
|
+
}
|
|
590146
|
+
}
|
|
590147
|
+
}
|
|
590148
|
+
const synthesis = relevant.length ? `${relevant.length} region(s) yielded ${paths.length} relevant path(s); ${emptyRegions.length} region(s) empty.` : `No relevant findings across ${digests.length} region(s).`;
|
|
590149
|
+
return { digests: relevant, paths, emptyRegions, synthesis };
|
|
590150
|
+
}
|
|
590151
|
+
var EXPLORE_INTENT_RE;
|
|
590152
|
+
var init_exploration_fanout = __esm({
|
|
590153
|
+
"packages/orchestrator/dist/exploration-fanout.js"() {
|
|
590154
|
+
"use strict";
|
|
590155
|
+
EXPLORE_INTENT_RE = /\b(explore|discover|find|locate|search|where\b|which file|map (out )?the|survey|audit|trace|understand the|gather|investigate|look (through|across)|grep|scan the (code|repo))\b/i;
|
|
590156
|
+
}
|
|
590157
|
+
});
|
|
590158
|
+
|
|
589951
590159
|
// packages/orchestrator/dist/index.js
|
|
589952
590160
|
var dist_exports3 = {};
|
|
589953
590161
|
__export(dist_exports3, {
|
|
@@ -589978,6 +590186,7 @@ __export(dist_exports3, {
|
|
|
589978
590186
|
FRONTEND_WORKER_SKILL: () => FRONTEND_WORKER_SKILL,
|
|
589979
590187
|
HookManager: () => HookManager,
|
|
589980
590188
|
INFRA_WORKER_SKILL: () => INFRA_WORKER_SKILL,
|
|
590189
|
+
ImportanceBudget: () => ImportanceBudget,
|
|
589981
590190
|
MergeRunner: () => MergeRunner,
|
|
589982
590191
|
NexusAgenticBackend: () => NexusAgenticBackend,
|
|
589983
590192
|
OllamaAgenticBackend: () => OllamaAgenticBackend,
|
|
@@ -590010,6 +590219,7 @@ __export(dist_exports3, {
|
|
|
590010
590219
|
buildCritiquePrompt: () => buildCritiquePrompt,
|
|
590011
590220
|
buildDecompositionDirective: () => buildDecompositionDirective,
|
|
590012
590221
|
buildDecompositionTodos: () => buildDecompositionTodos,
|
|
590222
|
+
buildExplorerBriefs: () => buildExplorerBriefs,
|
|
590013
590223
|
buildForkPrompt: () => buildForkPrompt,
|
|
590014
590224
|
buildLessonQuery: () => buildLessonQuery,
|
|
590015
590225
|
buildMetaCritiquePrompt: () => buildMetaCritiquePrompt,
|
|
@@ -590020,6 +590230,7 @@ __export(dist_exports3, {
|
|
|
590020
590230
|
checkMilestoneComplete: () => checkMilestoneComplete,
|
|
590021
590231
|
chooseCheapModelRoute: () => chooseCheapModelRoute,
|
|
590022
590232
|
claimAssertion: () => claimAssertion,
|
|
590233
|
+
classifyBreadth: () => classifyBreadth,
|
|
590023
590234
|
classifyHandoff: () => classifyHandoff,
|
|
590024
590235
|
classifyOllamaProcesses: () => classifyOllamaProcesses,
|
|
590025
590236
|
cleanForStorage: () => cleanForStorage,
|
|
@@ -590028,6 +590239,7 @@ __export(dist_exports3, {
|
|
|
590028
590239
|
clearTurnState: () => clearTurnState,
|
|
590029
590240
|
combineValidatorResults: () => combineValidatorResults,
|
|
590030
590241
|
compilePersonalityPrompt: () => compilePersonalityPrompt,
|
|
590242
|
+
compressFindings: () => compressFindings,
|
|
590031
590243
|
computeArc: () => computeArc,
|
|
590032
590244
|
computeStabilityHash: () => computeStabilityHash,
|
|
590033
590245
|
computeTodoReminder: () => computeTodoReminder,
|
|
@@ -590044,6 +590256,7 @@ __export(dist_exports3, {
|
|
|
590044
590256
|
decomposeSpec: () => decomposeSpec,
|
|
590045
590257
|
deleteAgentTaskSidecar: () => deleteAgentTaskSidecar,
|
|
590046
590258
|
deriveClaimsFromProposedText: () => deriveClaimsFromProposedText,
|
|
590259
|
+
detectExplorationIntent: () => detectExplorationIntent,
|
|
590047
590260
|
detectPressure: () => detectPressure,
|
|
590048
590261
|
detectTaskType: () => detectTaskType,
|
|
590049
590262
|
discoverPlugins: () => discoverPlugins3,
|
|
@@ -590055,6 +590268,7 @@ __export(dist_exports3, {
|
|
|
590055
590268
|
extractLessons: () => extractLessons,
|
|
590056
590269
|
extractMidTaskSteeringInput: () => extractMidTaskSteeringInput,
|
|
590057
590270
|
extractTaskCompleteSummary: () => extractTaskCompleteSummary,
|
|
590271
|
+
findDuplicateGroups: () => findDuplicateGroups,
|
|
590058
590272
|
fingerprintCall: () => fingerprintCall,
|
|
590059
590273
|
formatCompletionContract: () => formatCompletionContract,
|
|
590060
590274
|
formatHermesToolResponse: () => formatHermesToolResponse,
|
|
@@ -590105,6 +590319,8 @@ __export(dist_exports3, {
|
|
|
590105
590319
|
loadMemoryWeightingConfig: () => loadMemoryWeightingConfig,
|
|
590106
590320
|
loadStabilityIndex: () => loadStabilityIndex,
|
|
590107
590321
|
materializeMemoryItems: () => materializeMemoryItems,
|
|
590322
|
+
memoryCosine: () => cosine3,
|
|
590323
|
+
mergeDigests: () => mergeDigests,
|
|
590108
590324
|
normalizeCompletionKey: () => normalizeCompletionKey,
|
|
590109
590325
|
parseContextReferences: () => parseContextReferences,
|
|
590110
590326
|
parseCritique: () => parseCritique,
|
|
@@ -590113,6 +590329,7 @@ __export(dist_exports3, {
|
|
|
590113
590329
|
parseTextToolCalls: () => parseTextToolCalls,
|
|
590114
590330
|
partitionToolCalls: () => partitionToolCalls,
|
|
590115
590331
|
persistAgentTaskSidecar: () => persistAgentTaskSidecar,
|
|
590332
|
+
planConsolidation: () => planConsolidation,
|
|
590116
590333
|
preprocessContextReferences: () => preprocessContextReferences,
|
|
590117
590334
|
pressureCheck: () => pressureCheck,
|
|
590118
590335
|
profileIntensity: () => profileIntensity,
|
|
@@ -590126,6 +590343,7 @@ __export(dist_exports3, {
|
|
|
590126
590343
|
readValidatorResults: () => readValidatorResults,
|
|
590127
590344
|
readyTasks: () => readyTasks,
|
|
590128
590345
|
recencyScore: () => recencyScore2,
|
|
590346
|
+
recommendFanout: () => recommendFanout,
|
|
590129
590347
|
reconcileClaimsWithEvidence: () => reconcileClaimsWithEvidence,
|
|
590130
590348
|
recordCompletionCritique: () => recordCompletionCritique,
|
|
590131
590349
|
recordCompletionEvidence: () => recordCompletionEvidence,
|
|
@@ -590146,6 +590364,7 @@ __export(dist_exports3, {
|
|
|
590146
590364
|
resolveDefaultPoolConfig: () => resolveDefaultPoolConfig,
|
|
590147
590365
|
resolveModelProfile: () => resolveModelProfile,
|
|
590148
590366
|
restoreAgentTasks: () => restoreAgentTasks,
|
|
590367
|
+
retentionStrength: () => retentionStrength,
|
|
590149
590368
|
sanitizeInvisibleUnicode: () => sanitizeInvisibleUnicode,
|
|
590150
590369
|
saveCompletionLedger: () => saveCompletionLedger,
|
|
590151
590370
|
saveStabilityIndex: () => saveStabilityIndex,
|
|
@@ -590154,8 +590373,10 @@ __export(dist_exports3, {
|
|
|
590154
590373
|
scoreHandoff: () => scoreHandoff,
|
|
590155
590374
|
scoreMemoryItem: () => scoreMemoryItem,
|
|
590156
590375
|
scoreMemoryItems: () => scoreMemoryItems,
|
|
590376
|
+
scoreNote: () => scoreNote,
|
|
590157
590377
|
sealMilestone: () => sealMilestone,
|
|
590158
590378
|
sealMilestoneState: () => sealMilestoneState,
|
|
590379
|
+
selectTopNotes: () => selectTopNotes,
|
|
590159
590380
|
setOllamaPool: () => setOllamaPool,
|
|
590160
590381
|
shouldBlockCall: () => shouldBlockCall,
|
|
590161
590382
|
shouldForkSkill: () => shouldForkSkill,
|
|
@@ -590241,6 +590462,8 @@ var init_dist8 = __esm({
|
|
|
590241
590462
|
init_plugins();
|
|
590242
590463
|
init_project_arc();
|
|
590243
590464
|
init_dedup_gate();
|
|
590465
|
+
init_memory_consolidation();
|
|
590466
|
+
init_exploration_fanout();
|
|
590244
590467
|
}
|
|
590245
590468
|
});
|
|
590246
590469
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.338",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.338",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED