bluelamp 3.0.8 → 4.0.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.
Files changed (138) hide show
  1. package/README.md +68 -12
  2. package/bin/bluelamp-base +145 -330
  3. package/bin/bluelamp-hook +33 -0
  4. package/bin/bluelamp1 +2 -0
  5. package/bin/bluelamp10 +1 -373
  6. package/bin/bluelamp11 +1 -373
  7. package/bin/bluelamp12 +1 -373
  8. package/bin/bluelamp13 +1 -373
  9. package/bin/bluelamp14 +1 -373
  10. package/bin/bluelamp15 +1 -373
  11. package/bin/bluelamp16 +1 -373
  12. package/bin/bluelamp17 +1 -373
  13. package/bin/bluelamp18 +1 -373
  14. package/bin/bluelamp2 +1 -373
  15. package/bin/bluelamp3 +1 -373
  16. package/bin/bluelamp4 +1 -373
  17. package/bin/bluelamp5 +1 -373
  18. package/bin/bluelamp6 +1 -373
  19. package/bin/bluelamp7 +1 -373
  20. package/bin/bluelamp8 +1 -373
  21. package/bin/bluelamp9 +1 -373
  22. package/bin/docs/SCOPE_PROGRESS.md +222 -0
  23. package/lib/agents//343/203/226/343/203/253/343/203/274/343/203/251/343/203/263/343/203/227.md +106 -0
  24. package/lib/auth/InteractiveLogin.js +243 -0
  25. package/lib/auth/PortalAuthClient.js +187 -0
  26. package/lib/auth/TokenManager.js +258 -0
  27. package/lib/mcp-server/fetch-prompt.js +61 -0
  28. package/lib/mcp-server/index.cjs +164 -0
  29. package/lib/mcp-server/portal-api-client.cjs +210 -0
  30. package/package.json +24 -108
  31. package/scripts/build-release.js +426 -0
  32. package/scripts/generate-commands.js +40 -0
  33. package/scripts/setup-hook.js +98 -0
  34. package/bin/bluelamp +0 -374
  35. package/bin/bluelamp100 +0 -374
  36. package/bin/bluelamp19 +0 -374
  37. package/bin/bluelamp20 +0 -374
  38. package/bin/bluelamp21 +0 -374
  39. package/bin/bluelamp22 +0 -374
  40. package/bin/bluelamp23 +0 -374
  41. package/bin/bluelamp24 +0 -374
  42. package/bin/bluelamp25 +0 -374
  43. package/bin/bluelamp26 +0 -374
  44. package/bin/bluelamp27 +0 -374
  45. package/bin/bluelamp28 +0 -374
  46. package/bin/bluelamp29 +0 -374
  47. package/bin/bluelamp30 +0 -374
  48. package/bin/bluelamp31 +0 -374
  49. package/bin/bluelamp32 +0 -374
  50. package/bin/bluelamp33 +0 -374
  51. package/bin/bluelamp34 +0 -374
  52. package/bin/bluelamp35 +0 -374
  53. package/bin/bluelamp36 +0 -374
  54. package/bin/bluelamp37 +0 -374
  55. package/bin/bluelamp38 +0 -374
  56. package/bin/bluelamp39 +0 -374
  57. package/bin/bluelamp40 +0 -374
  58. package/bin/bluelamp41 +0 -374
  59. package/bin/bluelamp42 +0 -374
  60. package/bin/bluelamp43 +0 -374
  61. package/bin/bluelamp44 +0 -374
  62. package/bin/bluelamp45 +0 -374
  63. package/bin/bluelamp46 +0 -374
  64. package/bin/bluelamp47 +0 -374
  65. package/bin/bluelamp48 +0 -374
  66. package/bin/bluelamp49 +0 -374
  67. package/bin/bluelamp50 +0 -374
  68. package/bin/bluelamp51 +0 -374
  69. package/bin/bluelamp52 +0 -374
  70. package/bin/bluelamp53 +0 -374
  71. package/bin/bluelamp54 +0 -374
  72. package/bin/bluelamp55 +0 -374
  73. package/bin/bluelamp56 +0 -374
  74. package/bin/bluelamp57 +0 -374
  75. package/bin/bluelamp58 +0 -374
  76. package/bin/bluelamp59 +0 -374
  77. package/bin/bluelamp60 +0 -374
  78. package/bin/bluelamp61 +0 -374
  79. package/bin/bluelamp62 +0 -374
  80. package/bin/bluelamp63 +0 -374
  81. package/bin/bluelamp64 +0 -374
  82. package/bin/bluelamp65 +0 -374
  83. package/bin/bluelamp66 +0 -374
  84. package/bin/bluelamp67 +0 -374
  85. package/bin/bluelamp68 +0 -374
  86. package/bin/bluelamp69 +0 -374
  87. package/bin/bluelamp70 +0 -374
  88. package/bin/bluelamp71 +0 -374
  89. package/bin/bluelamp72 +0 -374
  90. package/bin/bluelamp73 +0 -374
  91. package/bin/bluelamp74 +0 -374
  92. package/bin/bluelamp75 +0 -374
  93. package/bin/bluelamp76 +0 -374
  94. package/bin/bluelamp77 +0 -374
  95. package/bin/bluelamp78 +0 -374
  96. package/bin/bluelamp79 +0 -374
  97. package/bin/bluelamp80 +0 -374
  98. package/bin/bluelamp81 +0 -374
  99. package/bin/bluelamp82 +0 -374
  100. package/bin/bluelamp83 +0 -374
  101. package/bin/bluelamp84 +0 -374
  102. package/bin/bluelamp85 +0 -374
  103. package/bin/bluelamp86 +0 -374
  104. package/bin/bluelamp87 +0 -374
  105. package/bin/bluelamp88 +0 -374
  106. package/bin/bluelamp89 +0 -374
  107. package/bin/bluelamp90 +0 -374
  108. package/bin/bluelamp91 +0 -374
  109. package/bin/bluelamp92 +0 -374
  110. package/bin/bluelamp93 +0 -374
  111. package/bin/bluelamp94 +0 -374
  112. package/bin/bluelamp95 +0 -374
  113. package/bin/bluelamp96 +0 -374
  114. package/bin/bluelamp97 +0 -374
  115. package/bin/bluelamp98 +0 -374
  116. package/bin/bluelamp99 +0 -374
  117. package/config/claude-config-template.json +0 -13
  118. package/lib/mcp-server/dist/InteractiveLogin.js +0 -27
  119. package/lib/mcp-server/dist/PortalAuthClient.js +0 -1
  120. package/lib/mcp-server/dist/TokenManager.js +0 -20
  121. package/lib/mcp-server/dist/bluelamp-system.js +0 -32
  122. package/lib/mcp-server/dist/crypto-utils.js +0 -27
  123. package/lib/mcp-server/dist/database-version.js +0 -33
  124. package/lib/mcp-server/dist/index.js +0 -62
  125. package/lib/mcp-server/dist/plugins/base-plugin.js +0 -24
  126. package/lib/mcp-server/dist/plugins/plugin-manager.js +0 -31
  127. package/lib/mcp-server/dist/plugins/services/leonardo-plugin.js +0 -95
  128. package/lib/mcp-server/dist/plugins/services/leonardo-prompt-parser.js +0 -36
  129. package/lib/mcp-server/dist/plugins/services/portal-api-client.js +0 -22
  130. package/lib/mcp-server/dist/plugins/services/portal-plugin.js +0 -52
  131. package/lib/mcp-server/dist/secure-mcp-server.js +0 -76
  132. package/lib/mcp-server/dist/security/ApiKeyManager.js +0 -24
  133. package/lib/mcp-server/dist/security/InteractiveLogin.js +0 -32
  134. package/lib/mcp-server/dist/security/PortalAuthClient.js +0 -1
  135. package/lib/mcp-server/dist/security/SimpleAuthManager.js +0 -1
  136. package/lib/mcp-server/dist/security/SlotAuthClient.js +0 -9
  137. package/lib/mcp-server/dist/security/TokenManager.js +0 -25
  138. package/lib/mcp-server/package.json +0 -21
package/bin/bluelamp70 DELETED
@@ -1,374 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * BlueLamp - AI Agent Orchestration System with Portal Authentication
5
- * Base script that handles slot-based command routing
6
- *
7
- * Features:
8
- * - Portal統合認証システム
9
- * - 3箇所分散保存によるセキュリティ強化
10
- * - bypassmode=true (--dangerously-skip-permissions)
11
- * - orchestrator Knowledge Injection
12
- * - 24 AI Agents available as sub-agents
13
- * - Auto slot detection from command name
14
- */
15
-
16
- const { spawn } = require('child_process');
17
- const path = require('path');
18
- const fs = require('fs');
19
- const os = require('os');
20
-
21
- // パッケージのルートディレクトリを取得
22
- const packageRoot = path.dirname(__dirname);
23
- const mcpServerPath = path.join(packageRoot, 'lib/mcp-server/dist/secure-mcp-server.js');
24
-
25
- // Portal認証モジュールのインポート(ES Modules対応)
26
- const securityPath = path.join(packageRoot, 'lib/mcp-server/dist/security');
27
-
28
- /**
29
- * コマンド名からスロット番号を自動判定
30
- */
31
- function detectSlotNumber() {
32
- try {
33
- // process.argv[1] から実行されたコマンドのパスを取得
34
- const commandPath = process.argv[1];
35
- const commandName = path.basename(commandPath);
36
-
37
- // コマンド名から数字部分を抽出
38
- if (commandName === 'bluelamp') {
39
- return 1; // デフォルトはスロット1
40
- }
41
-
42
- const match = commandName.match(/^bluelamp(\d+)$/);
43
- if (match) {
44
- const slotNumber = parseInt(match[1], 10);
45
- if (slotNumber >= 1 && slotNumber <= 100) {
46
- return slotNumber;
47
- }
48
- }
49
-
50
- throw new Error(`Invalid command name: ${commandName}. Expected format: bluelamp or bluelamp[1-100]`);
51
-
52
- } catch (error) {
53
- console.error('❌ スロット番号の自動判定に失敗しました:', error.message);
54
- console.error('');
55
- console.error('有効なコマンド名:');
56
- console.error('- bluelamp (スロット1)');
57
- console.error('- bluelamp2〜bluelamp100');
58
- process.exit(1);
59
- }
60
- }
61
-
62
- // スロット番号を取得
63
- const SLOT_NUMBER = detectSlotNumber();
64
-
65
- console.log(`🔵 BlueLamp - AIエージェント統合システム (スロット${SLOT_NUMBER})`);
66
- console.log(' ポータル統合認証 + 知識注入 + 24種類のAIエージェント');
67
- console.log('');
68
-
69
- /**
70
- * Portal認証の実行
71
- */
72
- async function performPortalAuth() {
73
- try {
74
- // 動的インポートでES Modulesを読み込み(遅延評価を保証)
75
- console.log('🔐 Portal認証を開始します...');
76
-
77
- // macOS対応のfile URLで InteractiveLogin を読み込み
78
- const { InteractiveLogin } = await import(`file://localhost${securityPath}/InteractiveLogin.js`);
79
-
80
- const authResult = await InteractiveLogin.performLogin();
81
-
82
- InteractiveLogin.displayLoginSuccess(authResult);
83
-
84
- return authResult.token;
85
-
86
- } catch (error) {
87
- console.error('❌ Portal認証エラー:', error.message);
88
- console.error('');
89
- console.error('解決方法:');
90
- console.error('1. インターネット接続を確認してください');
91
- console.error('2. Portal認証情報が正しいか確認してください');
92
- console.error('3. https://geniemon.vercel.app にアクセスできるか確認してください');
93
- process.exit(1);
94
- }
95
- }
96
-
97
- /**
98
- * シンプル保存システムの実行
99
- */
100
- async function performDistributedStorage(cliToken) {
101
- try {
102
- // SimpleAuthManagerを読み込み(dynamic import使用)
103
- const { SimpleAuthManager } = await import(`file://${securityPath}/SimpleAuthManager.js`);
104
-
105
- console.log('🔒 APIキーを安全に保存中...');
106
- const success = SimpleAuthManager.saveApiKey(cliToken);
107
-
108
- if (success) {
109
- console.log('✅ APIキー保存完了');
110
- console.log('🛡️ セキュリティレベル: 高');
111
- }
112
-
113
- return {
114
- success: success,
115
- distributionTime: 1
116
- };
117
-
118
- } catch (error) {
119
- console.error('❌ APIキー保存エラー:', error.message);
120
- return {
121
- success: false,
122
- error: error.message
123
- };
124
- }
125
- }
126
-
127
- /**
128
- * エージェントセットアップの確認と実行
129
- */
130
- function ensureAgentsSetup() {
131
- const agentsDir = path.join(os.homedir(), '.claude/agents');
132
- const blueLampAgent = path.join(agentsDir, 'ブルーランプ.md');
133
-
134
- // ブルーランプエージェントが存在しない場合はセットアップを実行
135
- if (!fs.existsSync(blueLampAgent)) {
136
- console.log('🔧 エージェントセットアップが必要です...');
137
-
138
- try {
139
- const setupScript = path.join(packageRoot, 'scripts/setup-agents.js');
140
- if (fs.existsSync(setupScript)) {
141
- require(setupScript);
142
- console.log('✅ エージェントセットアップ完了');
143
- } else {
144
- console.log('⚠️ セットアップスクリプトが見つかりません。スキップします。');
145
- }
146
- } catch (error) {
147
- console.warn('⚠️ エージェント自動セットアップに失敗しました:', error.message);
148
- console.warn('手動でセットアップを実行してください: npm run postinstall');
149
- }
150
- }
151
- }
152
-
153
- /**
154
- * スロット認証の実行
155
- */
156
- async function performSlotAuth(token) {
157
- try {
158
- const fetch = (await import('node-fetch')).default;
159
-
160
- console.log(`🎯 スロット${SLOT_NUMBER}の認証を実行中...`);
161
-
162
- const response = await fetch(`https://bluelamp-portal-6clpzmy5pa-an.a.run.app/api/slots/${SLOT_NUMBER}`, {
163
- method: 'GET',
164
- headers: {
165
- 'Content-Type': 'application/json',
166
- 'X-CLI-Token': token
167
- }
168
- });
169
-
170
- if (!response.ok) {
171
- throw new Error(`スロット認証失敗 (${response.status}): ${response.statusText}`);
172
- }
173
-
174
- const result = await response.json();
175
- console.log(`✅ スロット${SLOT_NUMBER}認証完了`);
176
-
177
- return result;
178
-
179
- } catch (error) {
180
- console.error(`❌ スロット${SLOT_NUMBER}認証エラー:`, error.message);
181
- console.error('');
182
- console.error('解決方法:');
183
- console.error('1. インターネット接続を確認してください');
184
- console.error('2. Portalでスロット権限があることを確認してください');
185
- console.error('3. しばらく待ってから再試行してください');
186
- process.exit(1);
187
- }
188
- }
189
-
190
- /**
191
- * メイン処理
192
- */
193
- async function main() {
194
- // コマンドライン引数の処理
195
- const args = process.argv.slice(2);
196
-
197
- // ログアウトコマンド
198
- if (args.includes('--logout')) {
199
- try {
200
- const { InteractiveLogin } = await import(`file://${securityPath}/InteractiveLogin.js`);
201
- await InteractiveLogin.logout();
202
- process.exit(0);
203
- } catch (error) {
204
- console.error('❌ ログアウトエラー:', error.message);
205
- process.exit(1);
206
- }
207
- }
208
-
209
- // ログイン状態確認コマンド
210
- if (args.includes('--status')) {
211
- try {
212
- const { InteractiveLogin } = await import(`file://${securityPath}/InteractiveLogin.js`);
213
- await InteractiveLogin.checkLoginStatus();
214
- process.exit(0);
215
- } catch (error) {
216
- console.error('❌ ステータス確認エラー:', error.message);
217
- process.exit(1);
218
- }
219
- }
220
-
221
- // エージェントセットアップの確認
222
- ensureAgentsSetup();
223
-
224
- // Portal認証の実行
225
- const cliToken = await performPortalAuth();
226
-
227
- // スロット認証の実行
228
- await performSlotAuth(cliToken);
229
-
230
- // シンプル保存システムの実行
231
- console.log('🔒 APIキーを保存中...');
232
- const distributed = await performDistributedStorage(cliToken);
233
-
234
- if (!distributed.success) {
235
- console.error('❌ APIキー保存に失敗しました:', distributed.error);
236
- console.error('フォールバックモードで起動します...');
237
- }
238
-
239
- // TTY検出とフォールバック処理
240
- const isTTY = process.stdout.isTTY && process.stdin.isTTY;
241
- if (!isTTY) {
242
- console.warn('⚠️ TTY環境が検出されませんでした。互換モードで起動します。');
243
- }
244
-
245
- // 環境変数の設定(スロット番号を追加)
246
- const env = {
247
- ...process.env,
248
- BLUELAMP_ENCRYPTION_KEY: process.env.BLUELAMP_ENCRYPTION_KEY || 'bluelamp-default-key-2024',
249
- BLUELAMP_TOKEN: cliToken, // Portal認証で取得した実際のCLIトークンを使用
250
- BLUELAMP_DISTRIBUTED: distributed.success ? 'true' : 'false',
251
- BLUELAMP_SLOT_NUMBER: SLOT_NUMBER.toString(), // スロット番号を環境変数として設定
252
- NODE_ENV: 'production'
253
- };
254
-
255
- // MCP設定ファイルの作成
256
- const tempConfigPath = path.join(os.tmpdir(), `bluelamp-mcp-slot${SLOT_NUMBER}-${Date.now()}.json`);
257
-
258
- const mcpConfig = {
259
- mcpServers: {
260
- "bluelamp-secure": {
261
- command: "node",
262
- args: [mcpServerPath],
263
- env: {
264
- BLUELAMP_ENCRYPTION_KEY: env.BLUELAMP_ENCRYPTION_KEY,
265
- BLUELAMP_TOKEN: env.BLUELAMP_TOKEN,
266
- BLUELAMP_SLOT_NUMBER: env.BLUELAMP_SLOT_NUMBER
267
- }
268
- }
269
- }
270
- // 自動フックは削除 - 起動プロンプトで手動実行を指示
271
- };
272
-
273
- fs.writeFileSync(tempConfigPath, JSON.stringify(mcpConfig, null, 2));
274
-
275
- // オーケストレーター起動プロンプト(スロット情報を追加)
276
- const orchestratorPrompt = `> オーケストレーターモードで起動 (スロット${SLOT_NUMBER})
277
-
278
- 🔵 BlueLamp 統合認証システム が有効化されました
279
-
280
- \x1b[34m╭─────────────────────────────────────────────────────────────────╮\x1b[0m
281
- \x1b[34m│ │\x1b[0m
282
- \x1b[34m│ B l u e L a m p │\x1b[0m
283
- \x1b[34m│ ───────────────── │\x1b[0m
284
- \x1b[34m│ スロット${SLOT_NUMBER.toString().padStart(2, ' ')} でお待ちしています │\x1b[0m
285
- \x1b[34m│ │\x1b[0m
286
- \x1b[34m╰─────────────────────────────────────────────────────────────────╯\x1b[0m
287
-
288
- **最初に必ずオーケストレーター専門知識を注入してください**
289
- inject_knowledge ツールで "オーケストレーター" を実行してから開始してください。(初回必須)
290
-
291
- 準備完了です。まず知識注入を実行してから、何を実装するか教えてください。`;
292
-
293
- // 一時プロンプトファイルの作成
294
- const tempPromptPath = path.join(os.tmpdir(), `bluelamp-prompt-slot${SLOT_NUMBER}-${Date.now()}.txt`);
295
- fs.writeFileSync(tempPromptPath, orchestratorPrompt);
296
-
297
- console.log('🚀 Claude Code起動中...');
298
- console.log(` - スロット番号: ${SLOT_NUMBER}`);
299
- console.log(' - Portal認証: ON');
300
- console.log(' - 単一ファイル保存: ON');
301
- console.log(' - bypassmode: ON (--dangerously-skip-permissions)');
302
- console.log(' - Knowledge Injection: ON');
303
- console.log(' - MCP Server: BlueLamp Secure');
304
- console.log(' - TTY互換モード: ON');
305
- console.log('');
306
-
307
- // Claude Codeを起動(claude-flow方式: プロンプト引数渡し + TTY維持)
308
- const claudeArgs = [
309
- orchestratorPrompt, // 初期プロンプトを第1引数で渡す(claude-flow方式)
310
- '--dangerously-skip-permissions', // bypassmode=true(開発モード)
311
- '--mcp-config', tempConfigPath, // MCP設定ファイル
312
- ];
313
-
314
- const child = spawn('claude', claudeArgs, {
315
- stdio: 'inherit', // TTY完全維持(claude-flow方式)
316
- env: env,
317
-
318
- // プロセス設定
319
- detached: false, // プロセスグループ分離を無効
320
- windowsHide: false, // Windows環境でのウィンドウ表示
321
- shell: false // シェル経由実行を無効化
322
- });
323
-
324
- // TTY維持によりsetRawMode不要(問題の原因を完全除去)
325
- // stdin操作も不要(引数でプロンプト渡し済み)
326
-
327
- // エラーハンドリング
328
- child.on('error', (error) => {
329
- console.error('❌ Claude Code起動エラー:', error.message);
330
- console.error('');
331
- console.error('解決方法:');
332
- console.error('1. Claude Codeがインストールされているか確認');
333
- console.error('2. PATHにclaudeコマンドが含まれているか確認');
334
- console.error('3. Claude Codeのバージョンが最新か確認');
335
-
336
- // 一時ファイルをクリーンアップ
337
- try {
338
- fs.unlinkSync(tempConfigPath);
339
- fs.unlinkSync(tempPromptPath);
340
- } catch (e) {
341
- // ignore cleanup errors
342
- }
343
-
344
- process.exit(1);
345
- });
346
-
347
- // 終了時のクリーンアップ
348
- child.on('exit', (code) => {
349
- console.log('');
350
- console.log(`🔵 BlueLamp セッション終了 (スロット${SLOT_NUMBER})`);
351
-
352
- // 一時ファイルをクリーンアップ
353
- try {
354
- fs.unlinkSync(tempConfigPath);
355
- fs.unlinkSync(tempPromptPath);
356
- } catch (e) {
357
- // ignore cleanup errors
358
- }
359
-
360
- process.exit(code || 0);
361
- });
362
-
363
- // SIGINT (Ctrl+C) ハンドリング
364
- process.on('SIGINT', () => {
365
- console.log(`\n🔵 BlueLamp を終了しています... (スロット${SLOT_NUMBER})`);
366
- child.kill('SIGINT');
367
- });
368
- }
369
-
370
- // メイン処理の実行
371
- main().catch((error) => {
372
- console.error('❌ 予期しないエラーが発生しました:', error.message);
373
- process.exit(1);
374
- });