mio-agent-runtime 0.15.0 → 0.16.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.
@@ -54,15 +54,7 @@ try {
54
54
 
55
55
  // Subdirectories that make up the pipeline. `observerStatus` counts files in
56
56
  // each, so adding a stage here also makes it show up in the status output.
57
- const OBSERVER_SUBDIRS = [
58
- 'observations',
59
- 'trends',
60
- 'topics',
61
- 'research',
62
- 'insights',
63
- 'world_model',
64
- 'essays',
65
- ]
57
+ const OBSERVER_SUBDIRS = ['observations', 'trends', 'topics', 'research', 'insights', 'world_model', 'essays']
66
58
 
67
59
  function isObserverAvailable() {
68
60
  return Boolean(ObserverStore)
@@ -91,11 +83,7 @@ function todayTaskId() {
91
83
  function readJsonlSafe(filePath) {
92
84
  if (!fs.existsSync(filePath)) return []
93
85
  try {
94
- const lines = fs
95
- .readFileSync(filePath, 'utf8')
96
- .trim()
97
- .split('\n')
98
- .filter(Boolean)
86
+ const lines = fs.readFileSync(filePath, 'utf8').trim().split('\n').filter(Boolean)
99
87
  const results = []
100
88
  for (let i = 0; i < lines.length; i++) {
101
89
  try {
@@ -113,8 +101,15 @@ function readJsonlSafe(filePath) {
113
101
  // Reads a directory of per-item JSON files, newest file name first.
114
102
  function readJsonDir(dirPath, limit) {
115
103
  if (!fs.existsSync(dirPath)) return []
116
- const files = fs.readdirSync(dirPath).filter((f) => f.endsWith('.json')).sort().reverse()
117
- return files.slice(0, limit).map((f) => readJsonSafe(path.join(dirPath, f))).filter(Boolean)
104
+ const files = fs
105
+ .readdirSync(dirPath)
106
+ .filter((f) => f.endsWith('.json'))
107
+ .sort()
108
+ .reverse()
109
+ return files
110
+ .slice(0, limit)
111
+ .map((f) => readJsonSafe(path.join(dirPath, f)))
112
+ .filter(Boolean)
118
113
  }
119
114
 
120
115
  function createObserverStore(options = {}) {
@@ -131,9 +126,7 @@ function createObserverStore(options = {}) {
131
126
  const result = {}
132
127
  for (const d of OBSERVER_SUBDIRS) {
133
128
  const dir = path.join(baseDir, d)
134
- result[d] = fs.existsSync(dir)
135
- ? fs.readdirSync(dir).filter((f) => !f.startsWith('.')).length
136
- : 0
129
+ result[d] = fs.existsSync(dir) ? fs.readdirSync(dir).filter((f) => !f.startsWith('.')).length : 0
137
130
  }
138
131
  return result
139
132
  }
@@ -172,7 +165,11 @@ function createObserverStore(options = {}) {
172
165
  const type = args.type || 'published'
173
166
  const essaysDir = path.join(baseDir, 'essays', type)
174
167
  if (!fs.existsSync(essaysDir)) return []
175
- const files = fs.readdirSync(essaysDir).filter((f) => f.endsWith('.md')).sort().reverse()
168
+ const files = fs
169
+ .readdirSync(essaysDir)
170
+ .filter((f) => f.endsWith('.md'))
171
+ .sort()
172
+ .reverse()
176
173
  return files.slice(0, args.limit || 10).map((f) => {
177
174
  const full = path.join(essaysDir, f)
178
175
  return {
@@ -212,7 +209,7 @@ function createObserverStore(options = {}) {
212
209
  // was dead on arrival for every caller. (collectorConfig was never read by
213
210
  // the package; it was invented here.)
214
211
  const service = new ObserverService(baseDirOf(args), observerLlmConfig())
215
- const sources = args.sources || ['bilibili', 'hackernews', 'github', 'douyin', 'rss']
212
+ const sources = args.sources || ['hackernews', 'github-trending', 'rss']
216
213
  const allObs = []
217
214
  for (const src of sources) {
218
215
  try {
@@ -354,7 +351,7 @@ function createObserverStore(options = {}) {
354
351
  const baseDir = baseDirOf(args)
355
352
  const llmConfig = observerLlmConfig()
356
353
  const schedule = {
357
- collectors: 'every source collects on start, then on its own interval (30m weibo / 1h rss,hn,douyin,bilibili / 4h github-trending)',
354
+ collectors: 'every source collects on start, then on its own interval (1h rss,hackernews / 4h github-trending)',
358
355
  pipelineTickMs: 60000,
359
356
  pipelineFirstTickMs: 5000,
360
357
  pipelineGate: "runs while today's DAG is not COMPLETED -- one full run per day, retried until it completes",