mio-agent-runtime 0.5.0 → 0.5.1
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/package.json
CHANGED
|
@@ -2001,22 +2001,40 @@ function recordTaskOutcome(args = {}) {
|
|
|
2001
2001
|
|
|
2002
2002
|
async function handleIdeaGenerate(args = {}) {
|
|
2003
2003
|
const { goal, context = '', constraints = [], numIdeas = 3 } = args
|
|
2004
|
+
// Memory-grounding: reuse related prior decisions/problems from Mio so ideas
|
|
2005
|
+
// are informed by the Agent Control Plane's accumulated experience.
|
|
2006
|
+
let related = []
|
|
2007
|
+
try {
|
|
2008
|
+
const mem = await queryMemory({ query: goal, limit: 3 })
|
|
2009
|
+
if (mem && Array.isArray(mem.results)) related = mem.results
|
|
2010
|
+
} catch (e) {
|
|
2011
|
+
related = []
|
|
2012
|
+
}
|
|
2013
|
+
const grounding = related
|
|
2014
|
+
.filter((r) => r && (r.content || r.kind))
|
|
2015
|
+
.map((r) => '- [' + (r.kind || 'note') + '] ' + String(r.content || '').slice(0, 240))
|
|
2016
|
+
.join('\n')
|
|
2004
2017
|
const ideas = []
|
|
2005
2018
|
for (let i = 0; i < numIdeas; i++) {
|
|
2019
|
+
const blocks = [
|
|
2020
|
+
'Goal: ' + goal,
|
|
2021
|
+
context ? 'Context: ' + context : '',
|
|
2022
|
+
constraints.length ? 'Constraints: ' + constraints.join(', ') : '',
|
|
2023
|
+
related.length
|
|
2024
|
+
? 'Related Mio memory:\n' + grounding
|
|
2025
|
+
: 'No related Mio memory found yet; record outcomes to grow the experience base.',
|
|
2026
|
+
'Suggestion: Consider prototyping the idea and measuring its impact against prior decisions.'
|
|
2027
|
+
].filter(Boolean)
|
|
2006
2028
|
ideas.push({
|
|
2007
2029
|
id: 'idea_' + Date.now() + '_' + i,
|
|
2008
2030
|
title: 'Idea #' + (i + 1) + ': ' + goal,
|
|
2009
|
-
description:
|
|
2010
|
-
'Goal: ' + goal,
|
|
2011
|
-
context ? 'Context: ' + context : '',
|
|
2012
|
-
constraints.length ? 'Constraints: ' + constraints.join(', ') : '',
|
|
2013
|
-
'Suggestion: Consider prototyping the idea and measuring its impact.'
|
|
2014
|
-
].filter(Boolean).join('\n\n')
|
|
2031
|
+
description: blocks.join('\n\n')
|
|
2015
2032
|
})
|
|
2016
2033
|
}
|
|
2017
2034
|
return {
|
|
2018
2035
|
ideas: ideas,
|
|
2019
|
-
generatedAt: new Date().toISOString()
|
|
2036
|
+
generatedAt: new Date().toISOString(),
|
|
2037
|
+
groundedWith: related.length
|
|
2020
2038
|
}
|
|
2021
2039
|
}
|
|
2022
2040
|
|