mio-agent-runtime 0.7.0 → 0.8.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/README.md +2 -0
- package/bin/mio.js +73 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ mio creativity generate Generate hypotheses from 2+ --source "name|content"
|
|
|
58
58
|
mio creativity ferment Review and refine active hypotheses (calls an LLM)
|
|
59
59
|
mio insight status Insight counts: total, reported, unreported, high-value (needs @akemi-mio/insight)
|
|
60
60
|
mio insight list List insights (--unreported, --min-score N, --detector X, --limit N)
|
|
61
|
+
mio insight generate Generate insights from context (--memory "kind|content"/--summary "text"; calls an LLM)
|
|
61
62
|
mio insight mark-reported Mark insights as reported (--ids a,b)
|
|
62
63
|
mio observer <view> Observer research pipeline views (research pipeline, not the observe daemon):
|
|
63
64
|
status|world-model|trends|research|insights|essays|dag (--base-dir DIR)
|
|
@@ -442,6 +443,7 @@ LLM_API_URL=http://localhost:11434/v1/chat/completions mio creativity ferment
|
|
|
442
443
|
mio insight status
|
|
443
444
|
mio insight list --unreported --min-score 0.7
|
|
444
445
|
mio insight mark-reported --ids ins_1,ins_2
|
|
446
|
+
mio insight generate --memory "decision|把记忆解析抽到共享 store" --summary "刚发了 0.7.0"
|
|
445
447
|
|
|
446
448
|
# 观察研究管线(纯文件读取,不依赖可选包)
|
|
447
449
|
mio observer status
|
package/bin/mio.js
CHANGED
|
@@ -99,6 +99,19 @@ function flagPresent(args, name) {
|
|
|
99
99
|
return args.includes(name)
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
// Same option repeated: `mio insight generate --memory a --memory b`. A value
|
|
103
|
+
// that is itself another flag is skipped, so a trailing `--json` is not eaten
|
|
104
|
+
// as the value of an option that was left empty.
|
|
105
|
+
function optionValues(args, name) {
|
|
106
|
+
const values = []
|
|
107
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
108
|
+
if (args[i] !== name) continue
|
|
109
|
+
const raw = args[i + 1]
|
|
110
|
+
if (raw && !raw.startsWith('--')) values.push(raw)
|
|
111
|
+
}
|
|
112
|
+
return values
|
|
113
|
+
}
|
|
114
|
+
|
|
102
115
|
function parseJsonOption(args, name) {
|
|
103
116
|
const raw = optionValue(args, name)
|
|
104
117
|
if (raw === undefined) throw new Error(`${name} is required`)
|
|
@@ -1235,8 +1248,12 @@ function policyCommand(args, useJson) {
|
|
|
1235
1248
|
// commands delegate to the same shared store as the MCP tools, so the two
|
|
1236
1249
|
// cannot disagree.
|
|
1237
1250
|
//
|
|
1238
|
-
// `generate`
|
|
1239
|
-
// LLM
|
|
1251
|
+
// `generate` was deliberately not exposed when this command shipped: it needs
|
|
1252
|
+
// an LLM and the CLI had no LLM wiring. `mio config llm` (and creativity
|
|
1253
|
+
// generate before it) changed that, so it is exposed now — otherwise
|
|
1254
|
+
// mio.insight.generate was the only tool of the 48 with no terminal entry
|
|
1255
|
+
// point. Like creativity generate it calls an LLM and appends records, so it
|
|
1256
|
+
// warns when no LLM is configured and accepts --json like every other command.
|
|
1240
1257
|
// ═════════════════════════════════════════════════════════════
|
|
1241
1258
|
function cliInsightStore() {
|
|
1242
1259
|
return createInsightStore({ dataDir: MIO_HOME })
|
|
@@ -1246,6 +1263,7 @@ function insightUsage() {
|
|
|
1246
1263
|
console.log(`Usage:
|
|
1247
1264
|
mio insight status Insight counts: total, reported, unreported, high-value
|
|
1248
1265
|
mio insight list List insights
|
|
1266
|
+
mio insight generate Generate insights from context (calls an LLM)
|
|
1249
1267
|
mio insight mark-reported --ids a,b Mark insights as reported (acknowledged)
|
|
1250
1268
|
|
|
1251
1269
|
Options:
|
|
@@ -1253,6 +1271,8 @@ Options:
|
|
|
1253
1271
|
--min-score N Minimum score (list)
|
|
1254
1272
|
--detector name Filter by detector (list)
|
|
1255
1273
|
--limit N Max insights (list)
|
|
1274
|
+
--memory "kind|content" Context entry for generate (repeatable)
|
|
1275
|
+
--summary "text" Pre-summarised context for generate (repeatable)
|
|
1256
1276
|
--ids a,b Comma-separated insight ids (mark-reported)
|
|
1257
1277
|
--json Machine-readable output (same shape as mio.insight.*)
|
|
1258
1278
|
|
|
@@ -1294,12 +1314,16 @@ function insightCommand(args, useJson) {
|
|
|
1294
1314
|
if (!sub) process.exitCode = 1
|
|
1295
1315
|
return
|
|
1296
1316
|
}
|
|
1297
|
-
|
|
1317
|
+
const known = ['status', 'list', 'generate', 'mark-reported']
|
|
1318
|
+
if (!known.includes(sub)) {
|
|
1298
1319
|
console.error(`Unknown insight subcommand: ${sub}`)
|
|
1299
1320
|
insightUsage()
|
|
1300
1321
|
process.exitCode = 1
|
|
1301
1322
|
return
|
|
1302
1323
|
}
|
|
1324
|
+
// Handled before the store is touched: generate needs no readable store when
|
|
1325
|
+
// it fails on missing context, and it is async while the rest are not.
|
|
1326
|
+
if (sub === 'generate') return insightGenerateCommand(args, useJson)
|
|
1303
1327
|
|
|
1304
1328
|
const flags = args.slice(2)
|
|
1305
1329
|
const store = cliInsightStore()
|
|
@@ -1334,6 +1358,51 @@ function insightCommand(args, useJson) {
|
|
|
1334
1358
|
}
|
|
1335
1359
|
}
|
|
1336
1360
|
|
|
1361
|
+
// --memory "kind|content": the "|" is optional — without it the whole string is
|
|
1362
|
+
// the content and insight-store falls back to its default kind.
|
|
1363
|
+
function parseInsightMemory(raw) {
|
|
1364
|
+
const sep = raw.indexOf('|')
|
|
1365
|
+
if (sep === -1) return { content: raw }
|
|
1366
|
+
const kind = raw.slice(0, sep).trim()
|
|
1367
|
+
return kind ? { kind, content: raw.slice(sep + 1).trim() } : { content: raw.slice(sep + 1).trim() }
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
function insightGenerateCommand(args, useJson) {
|
|
1371
|
+
const flags = args.slice(2)
|
|
1372
|
+
const memories = optionValues(flags, '--memory').map(parseInsightMemory)
|
|
1373
|
+
const summaries = optionValues(flags, '--summary')
|
|
1374
|
+
|
|
1375
|
+
if (memories.length === 0 && summaries.length === 0) {
|
|
1376
|
+
console.error('mio insight generate needs context: --memory "kind|content" and/or --summary "text"')
|
|
1377
|
+
console.error('Example: mio insight generate --memory "decision|memory parsing moved into a shared store"')
|
|
1378
|
+
process.exitCode = 1
|
|
1379
|
+
return
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
if (!useJson) warnIfLlmUnconfigured()
|
|
1383
|
+
|
|
1384
|
+
let result
|
|
1385
|
+
try {
|
|
1386
|
+
result = cliInsightStore().generate({ memories, summaries })
|
|
1387
|
+
} catch (error) {
|
|
1388
|
+
console.error(error.message || error)
|
|
1389
|
+
process.exitCode = 1
|
|
1390
|
+
return
|
|
1391
|
+
}
|
|
1392
|
+
// generate is async in the store.
|
|
1393
|
+
return Promise.resolve(result).then((resolved) => {
|
|
1394
|
+
if (useJson) return jsonOrText(resolved, true)
|
|
1395
|
+
if (!resolved || resolved.generated === 0) {
|
|
1396
|
+
console.log(
|
|
1397
|
+
`No insights generated: ${(resolved && resolved.reason) || 'nothing notable in the given context'}`
|
|
1398
|
+
)
|
|
1399
|
+
return
|
|
1400
|
+
}
|
|
1401
|
+
console.log(`Generated ${resolved.generated} insight(s)`)
|
|
1402
|
+
printInsightList(resolved.insights || [])
|
|
1403
|
+
})
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1337
1406
|
// ═════════════════════════════════════════════════════════════
|
|
1338
1407
|
// mio observer — terminal entry point for the observer research pipeline
|
|
1339
1408
|
// (mio.observer.*). Not to be confused with `mio observe`, which is the
|
|
@@ -2772,6 +2841,7 @@ Usage:
|
|
|
2772
2841
|
mio creativity ferment Review and refine active hypotheses (calls an LLM)
|
|
2773
2842
|
mio insight status Insight counts: total, reported, unreported, high-value
|
|
2774
2843
|
mio insight list List insights (--unreported, --min-score N, --detector X, --limit N)
|
|
2844
|
+
mio insight generate Generate insights from context (--memory "kind|content"/--summary "text"; calls an LLM)
|
|
2775
2845
|
mio insight mark-reported Mark insights as reported (--ids a,b)
|
|
2776
2846
|
mio observer <view> Observer pipeline views (research pipeline, not the observe daemon):
|
|
2777
2847
|
status | world-model | trends | research | insights | essays | dag
|