@geekbeer/minion 2.70.2 → 3.4.7

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.
@@ -66,19 +66,48 @@ async function chatRoutes(fastify) {
66
66
  reply.code(401)
67
67
  return { success: false, error: 'Unauthorized' }
68
68
  }
69
- const session = await chatStore.load()
69
+ const session = chatStore.load()
70
70
  if (!session) return { success: true, session: null }
71
71
  return {
72
72
  success: true,
73
73
  session: {
74
74
  session_id: session.session_id,
75
75
  messages: session.messages,
76
+ turn_count: session.turn_count,
76
77
  created_at: session.created_at,
77
78
  updated_at: session.updated_at,
78
79
  },
79
80
  }
80
81
  })
81
82
 
83
+ // GET /api/chat/sessions - List all sessions (metadata only)
84
+ fastify.get('/api/chat/sessions', async (request, reply) => {
85
+ if (!verifyToken(request)) {
86
+ reply.code(401)
87
+ return { success: false, error: 'Unauthorized' }
88
+ }
89
+
90
+ const limit = parseInt(request.query?.limit) || 50
91
+ const sessions = chatStore.listSessions(limit)
92
+ return { success: true, sessions }
93
+ })
94
+
95
+ // GET /api/chat/sessions/:sessionId - Get a specific session with messages
96
+ fastify.get('/api/chat/sessions/:sessionId', async (request, reply) => {
97
+ if (!verifyToken(request)) {
98
+ reply.code(401)
99
+ return { success: false, error: 'Unauthorized' }
100
+ }
101
+
102
+ const session = chatStore.loadById(request.params.sessionId)
103
+ if (!session) {
104
+ reply.code(404)
105
+ return { success: false, error: 'Session not found' }
106
+ }
107
+
108
+ return { success: true, session }
109
+ })
110
+
82
111
  fastify.post('/api/chat/clear', async (request, reply) => {
83
112
  if (!verifyToken(request)) {
84
113
  reply.code(401)
@@ -166,16 +195,34 @@ async function chatRoutes(fastify) {
166
195
  async function buildContextPrefix(message, context, sessionId) {
167
196
  const parts = []
168
197
 
169
- // Tell the LLM where to find memory and daily logs (content is NOT injected)
198
+ // Tell the LLM how to access memory and daily logs via API
170
199
  if (!sessionId) {
171
- const memoryDir = require('path').join(DATA_DIR, 'memory')
172
- const dailyLogDir = require('path').join(DATA_DIR, 'daily-logs')
200
+ const port = require('../../core/config').config.AGENT_PORT
201
+ const baseUrl = `http://localhost:${port}`
173
202
  parts.push(
174
203
  '[長期記憶・デイリーログについて]',
175
204
  'あなたには長期記憶(メモリ)とデイリーログがあります。内容は毎回読み込まれません。',
176
- '必要なときだけ以下のファイルを読んで参照してください:',
177
- `- メモリ索引: ${memoryDir}/MEMORY.md(概要一覧。詳細は個別の .md ファイルを読む)`,
178
- `- デイリーログ: ${dailyLogDir}/YYYY-MM-DD.md(日付別の作業記録)`,
205
+ '必要なときは以下のAPIで検索・取得してください(認証ヘッダー必須):',
206
+ '',
207
+ '```bash',
208
+ '# メモリ検索(キーワードで全文検索)',
209
+ `curl -H "Authorization: Bearer $API_TOKEN" "${baseUrl}/api/memory?search=キーワード"`,
210
+ '',
211
+ '# メモリ一覧',
212
+ `curl -H "Authorization: Bearer $API_TOKEN" ${baseUrl}/api/memory`,
213
+ '',
214
+ '# メモリ詳細(IDを指定)',
215
+ `curl -H "Authorization: Bearer $API_TOKEN" ${baseUrl}/api/memory/{id}`,
216
+ '',
217
+ '# デイリーログ検索',
218
+ `curl -H "Authorization: Bearer $API_TOKEN" "${baseUrl}/api/daily-logs?search=キーワード"`,
219
+ '',
220
+ '# デイリーログ一覧',
221
+ `curl -H "Authorization: Bearer $API_TOKEN" ${baseUrl}/api/daily-logs`,
222
+ '',
223
+ '# 特定日のデイリーログ取得',
224
+ `curl -H "Authorization: Bearer $API_TOKEN" ${baseUrl}/api/daily-logs/YYYY-MM-DD`,
225
+ '```',
179
226
  '',
180
227
  '参照すべきタイミング:',
181
228
  '- 過去の作業や決定事項を思い出す必要があるとき',
package/win/server.js CHANGED
@@ -99,6 +99,8 @@ async function shutdown(signal) {
99
99
  routineRunner.stopAll()
100
100
  stopTerminalServer()
101
101
  cleanupSessions()
102
+ const { closeDb } = require('../core/db')
103
+ closeDb()
102
104
  await fastify.close()
103
105
  process.exit(0)
104
106
  }
@@ -0,0 +1,13 @@
1
+ # NSSM (Non-Sucking Service Manager)
2
+
3
+ This directory contains `nssm.exe` for Windows Service management.
4
+
5
+ ## Download
6
+
7
+ Download NSSM 2.24 (64-bit) from https://nssm.cc/release/nssm-2.24.zip
8
+ and place `win64/nssm.exe` in this directory.
9
+
10
+ ## License
11
+
12
+ NSSM is public domain software.
13
+ See https://nssm.cc for details.
Binary file