bluelamp 2.0.9 → 3.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.
- package/README.md +12 -25
- package/bin/bluelamp +368 -0
- package/bin/bluelamp-base +368 -0
- package/bin/bluelamp10 +368 -0
- package/bin/bluelamp100 +368 -0
- package/bin/bluelamp11 +368 -0
- package/bin/bluelamp12 +368 -0
- package/bin/bluelamp13 +368 -0
- package/bin/bluelamp14 +368 -0
- package/bin/bluelamp15 +368 -0
- package/bin/bluelamp16 +368 -0
- package/bin/bluelamp17 +368 -0
- package/bin/bluelamp18 +368 -0
- package/bin/bluelamp19 +368 -0
- package/bin/bluelamp2 +368 -0
- package/bin/bluelamp20 +368 -0
- package/bin/bluelamp21 +368 -0
- package/bin/bluelamp22 +368 -0
- package/bin/bluelamp23 +368 -0
- package/bin/bluelamp24 +368 -0
- package/bin/bluelamp25 +368 -0
- package/bin/bluelamp26 +368 -0
- package/bin/bluelamp27 +368 -0
- package/bin/bluelamp28 +368 -0
- package/bin/bluelamp29 +368 -0
- package/bin/bluelamp3 +368 -0
- package/bin/bluelamp30 +368 -0
- package/bin/bluelamp31 +368 -0
- package/bin/bluelamp32 +368 -0
- package/bin/bluelamp33 +368 -0
- package/bin/bluelamp34 +368 -0
- package/bin/bluelamp35 +368 -0
- package/bin/bluelamp36 +368 -0
- package/bin/bluelamp37 +368 -0
- package/bin/bluelamp38 +368 -0
- package/bin/bluelamp39 +368 -0
- package/bin/bluelamp4 +368 -0
- package/bin/bluelamp40 +368 -0
- package/bin/bluelamp41 +368 -0
- package/bin/bluelamp42 +368 -0
- package/bin/bluelamp43 +368 -0
- package/bin/bluelamp44 +368 -0
- package/bin/bluelamp45 +368 -0
- package/bin/bluelamp46 +368 -0
- package/bin/bluelamp47 +368 -0
- package/bin/bluelamp48 +368 -0
- package/bin/bluelamp49 +368 -0
- package/bin/bluelamp5 +368 -0
- package/bin/bluelamp50 +368 -0
- package/bin/bluelamp51 +368 -0
- package/bin/bluelamp52 +368 -0
- package/bin/bluelamp53 +368 -0
- package/bin/bluelamp54 +368 -0
- package/bin/bluelamp55 +368 -0
- package/bin/bluelamp56 +368 -0
- package/bin/bluelamp57 +368 -0
- package/bin/bluelamp58 +368 -0
- package/bin/bluelamp59 +368 -0
- package/bin/bluelamp6 +368 -0
- package/bin/bluelamp60 +368 -0
- package/bin/bluelamp61 +368 -0
- package/bin/bluelamp62 +368 -0
- package/bin/bluelamp63 +368 -0
- package/bin/bluelamp64 +368 -0
- package/bin/bluelamp65 +368 -0
- package/bin/bluelamp66 +368 -0
- package/bin/bluelamp67 +368 -0
- package/bin/bluelamp68 +368 -0
- package/bin/bluelamp69 +368 -0
- package/bin/bluelamp7 +368 -0
- package/bin/bluelamp70 +368 -0
- package/bin/bluelamp71 +368 -0
- package/bin/bluelamp72 +368 -0
- package/bin/bluelamp73 +368 -0
- package/bin/bluelamp74 +368 -0
- package/bin/bluelamp75 +368 -0
- package/bin/bluelamp76 +368 -0
- package/bin/bluelamp77 +368 -0
- package/bin/bluelamp78 +368 -0
- package/bin/bluelamp79 +368 -0
- package/bin/bluelamp8 +368 -0
- package/bin/bluelamp80 +368 -0
- package/bin/bluelamp81 +368 -0
- package/bin/bluelamp82 +368 -0
- package/bin/bluelamp83 +368 -0
- package/bin/bluelamp84 +368 -0
- package/bin/bluelamp85 +368 -0
- package/bin/bluelamp86 +368 -0
- package/bin/bluelamp87 +368 -0
- package/bin/bluelamp88 +368 -0
- package/bin/bluelamp89 +368 -0
- package/bin/bluelamp9 +368 -0
- package/bin/bluelamp90 +368 -0
- package/bin/bluelamp91 +368 -0
- package/bin/bluelamp92 +368 -0
- package/bin/bluelamp93 +368 -0
- package/bin/bluelamp94 +368 -0
- package/bin/bluelamp95 +368 -0
- package/bin/bluelamp96 +368 -0
- package/bin/bluelamp97 +368 -0
- package/bin/bluelamp98 +368 -0
- package/bin/bluelamp99 +368 -0
- package/lib/mcp-server/dist/bluelamp-system.js +32 -0
- package/lib/mcp-server/dist/crypto-utils.js +27 -0
- package/lib/mcp-server/dist/database-version.js +33 -0
- package/lib/mcp-server/dist/index.js +62 -0
- package/lib/mcp-server/dist/plugins/base-plugin.js +24 -0
- package/lib/mcp-server/dist/plugins/plugin-manager.js +31 -0
- package/lib/mcp-server/dist/plugins/services/leonardo-plugin.js +95 -0
- package/lib/mcp-server/dist/plugins/services/leonardo-prompt-parser.js +36 -0
- package/lib/mcp-server/dist/plugins/services/portal-api-client.js +22 -0
- package/lib/mcp-server/dist/plugins/services/portal-plugin.js +52 -0
- package/lib/mcp-server/dist/secure-mcp-server.js +76 -0
- package/lib/mcp-server/dist/security/ApiKeyManager.js +24 -0
- package/lib/mcp-server/dist/security/InteractiveLogin.js +32 -0
- package/lib/mcp-server/dist/security/PortalAuthClient.js +1 -0
- package/lib/mcp-server/dist/security/SimpleAuthManager.js +1 -0
- package/lib/mcp-server/dist/security/TokenManager.js +25 -0
- package/lib/mcp-server/package.json +21 -0
- package/package.json +119 -35
- package/INSTALLATION_GUIDE.md +0 -109
- package/bin/blcf +0 -2
- package/bin/blcf2 +0 -28
- package/bin/blcf3 +0 -2
- package/bin/blcf4 +0 -2
- package/knowledge-injection/hooks/inject-encrypted.sh +0 -321
- package/lib/agents//343/203/225/343/202/231/343/203/253/343/203/274/343/203/251/343/203/263/343/203/225/343/202/232.md +0 -106
- package/lib/mcp-server/dist_optimized/bluelamp-system.d.ts +0 -29
- package/lib/mcp-server/dist_optimized/bluelamp-system.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/bluelamp-system.js +0 -1
- package/lib/mcp-server/dist_optimized/bluelamp-system.js.bak +0 -340
- package/lib/mcp-server/dist_optimized/bluelamp-system.js.map +0 -1
- package/lib/mcp-server/dist_optimized/crypto-utils.d.ts +0 -33
- package/lib/mcp-server/dist_optimized/crypto-utils.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/crypto-utils.js +0 -1
- package/lib/mcp-server/dist_optimized/crypto-utils.js.map +0 -1
- package/lib/mcp-server/dist_optimized/database-version.d.ts +0 -72
- package/lib/mcp-server/dist_optimized/database-version.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/database-version.js +0 -2
- package/lib/mcp-server/dist_optimized/database-version.js.bak +0 -374
- package/lib/mcp-server/dist_optimized/database-version.js.map +0 -1
- package/lib/mcp-server/dist_optimized/index.d.ts +0 -3
- package/lib/mcp-server/dist_optimized/index.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/index.js +0 -2
- package/lib/mcp-server/dist_optimized/index.js.map +0 -1
- package/lib/mcp-server/dist_optimized/secure-mcp-server.d.ts +0 -64
- package/lib/mcp-server/dist_optimized/secure-mcp-server.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/secure-mcp-server.js +0 -1
- package/lib/mcp-server/dist_optimized/secure-mcp-server.js.bak +0 -1
- package/lib/mcp-server/dist_optimized/secure-mcp-server.js.bak2 +0 -1
- package/lib/mcp-server/dist_optimized/secure-mcp-server.js.map +0 -1
- package/lib/mcp-server/dist_optimized/security/InteractiveLogin.d.ts +0 -47
- package/lib/mcp-server/dist_optimized/security/InteractiveLogin.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/security/InteractiveLogin.js +0 -1
- package/lib/mcp-server/dist_optimized/security/InteractiveLogin.js.map +0 -1
- package/lib/mcp-server/dist_optimized/security/PortalAuthClient.d.ts +0 -65
- package/lib/mcp-server/dist_optimized/security/PortalAuthClient.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/security/PortalAuthClient.js +0 -1
- package/lib/mcp-server/dist_optimized/security/PortalAuthClient.js.map +0 -1
- package/lib/mcp-server/dist_optimized/security/SimpleAuthManager.backup +0 -294
- package/lib/mcp-server/dist_optimized/security/SimpleAuthManager.d.ts +0 -71
- package/lib/mcp-server/dist_optimized/security/SimpleAuthManager.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/security/SimpleAuthManager.js +0 -1
- package/lib/mcp-server/dist_optimized/security/SimpleAuthManager.js.backup +0 -25
- package/lib/mcp-server/dist_optimized/security/SimpleAuthManager.js.map +0 -1
- package/lib/mcp-server/dist_optimized/security/TokenManager.d.ts +0 -61
- package/lib/mcp-server/dist_optimized/security/TokenManager.d.ts.map +0 -1
- package/lib/mcp-server/dist_optimized/security/TokenManager.js +0 -1
- package/lib/mcp-server/dist_optimized/security/TokenManager.js.map +0 -1
- package/scripts/setup-agents.js +0 -9
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# BlueLamp Knowledge Injection - Unified Script
|
|
4
|
-
# ローカル開発環境と本番環境の両方に対応
|
|
5
|
-
|
|
6
|
-
PROMPT="$1"
|
|
7
|
-
|
|
8
|
-
# 環境設定
|
|
9
|
-
BLUELAMP_DEBUG="${BLUELAMP_DEBUG:-false}" # true | false
|
|
10
|
-
|
|
11
|
-
# デバッグ出力関数
|
|
12
|
-
debug_log() {
|
|
13
|
-
if [ "$BLUELAMP_DEBUG" = "true" ]; then
|
|
14
|
-
echo "$1" >&2
|
|
15
|
-
fi
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
# パッケージルートディレクトリを取得
|
|
19
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
20
|
-
PACKAGE_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
21
|
-
|
|
22
|
-
echo "🔵 BlueLamp Knowledge Injection: $PROMPT" >&2
|
|
23
|
-
|
|
24
|
-
# キーワードマッピング
|
|
25
|
-
case "$PROMPT" in
|
|
26
|
-
*"オーケストレーター"*)
|
|
27
|
-
KEYWORD="オーケストレーター"
|
|
28
|
-
debug_log "📋 Template: orchestrator"
|
|
29
|
-
;;
|
|
30
|
-
*"要件定義"*)
|
|
31
|
-
KEYWORD="要件定義質問テンプレート"
|
|
32
|
-
debug_log "📋 Template: requirements-questions"
|
|
33
|
-
;;
|
|
34
|
-
*"デザイナー"*)
|
|
35
|
-
KEYWORD="デザイナー"
|
|
36
|
-
debug_log "📋 Template: designer"
|
|
37
|
-
;;
|
|
38
|
-
*)
|
|
39
|
-
# デフォルトはオーケストレーター(環境変数で上書き可能)
|
|
40
|
-
KEYWORD="${KNOWLEDGE_KEYWORD:-オーケストレーター}"
|
|
41
|
-
debug_log "📋 Template: orchestrator (default)"
|
|
42
|
-
;;
|
|
43
|
-
esac
|
|
44
|
-
|
|
45
|
-
# Knowledge Injection実行処理
|
|
46
|
-
fetch_knowledge_injection() {
|
|
47
|
-
local keyword="$1"
|
|
48
|
-
|
|
49
|
-
# SimpleAuthManagerを使用してPortal APIを呼び出し
|
|
50
|
-
if command -v node >/dev/null 2>&1; then
|
|
51
|
-
debug_log "🔧 Fetching knowledge injection via SimpleAuthManager..."
|
|
52
|
-
|
|
53
|
-
# パッケージルートディレクトリを取得
|
|
54
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
55
|
-
PACKAGE_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
56
|
-
|
|
57
|
-
# Node.jsスクリプトファイルを作成
|
|
58
|
-
cat > "$PACKAGE_ROOT/.fetch-knowledge.js" << 'EOF'
|
|
59
|
-
#!/usr/bin/env node
|
|
60
|
-
const path = require('path');
|
|
61
|
-
const fs = require('fs');
|
|
62
|
-
|
|
63
|
-
async function main() {
|
|
64
|
-
const keyword = process.argv[2] || 'オーケストレーター';
|
|
65
|
-
const packageRoot = path.resolve(process.cwd());
|
|
66
|
-
const securityPath = path.join(packageRoot, 'lib/mcp-server/dist_optimized/security');
|
|
67
|
-
|
|
68
|
-
if (process.env.BLUELAMP_DEBUG === 'true') {
|
|
69
|
-
console.error('Debug: packageRoot =', packageRoot);
|
|
70
|
-
console.error('Debug: securityPath =', securityPath);
|
|
71
|
-
console.error('Debug: SimpleAuthManager.js exists =', fs.existsSync(securityPath + '/SimpleAuthManager.js'));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
const { SimpleAuthManager } = require(securityPath + '/SimpleAuthManager.js');
|
|
76
|
-
|
|
77
|
-
if (process.env.BLUELAMP_DEBUG === 'true') {
|
|
78
|
-
console.error('Debug: Module loaded successfully');
|
|
79
|
-
console.error('Debug: hasApiKey =', SimpleAuthManager.hasApiKey());
|
|
80
|
-
console.error('Debug: Fetching for keyword =', keyword);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const response = await SimpleAuthManager.fetchKnowledgeInjection(keyword);
|
|
84
|
-
|
|
85
|
-
if (process.env.BLUELAMP_DEBUG === 'true') {
|
|
86
|
-
console.error('Debug: Response received, statusCode =', response.statusCode);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// レスポンスをJSON文字列として出力
|
|
90
|
-
process.stdout.write(JSON.stringify(response));
|
|
91
|
-
|
|
92
|
-
} catch (error) {
|
|
93
|
-
if (process.env.BLUELAMP_DEBUG === 'true') {
|
|
94
|
-
console.error('Debug: Error:', error.message);
|
|
95
|
-
}
|
|
96
|
-
// エラーレスポンスを返す
|
|
97
|
-
const errorResponse = {
|
|
98
|
-
success: false,
|
|
99
|
-
error: error.message,
|
|
100
|
-
statusCode: 0
|
|
101
|
-
};
|
|
102
|
-
process.stdout.write(JSON.stringify(errorResponse));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
main();
|
|
107
|
-
EOF
|
|
108
|
-
|
|
109
|
-
# Node.jsスクリプトを実行してレスポンスを取得
|
|
110
|
-
if [ "$BLUELAMP_DEBUG" = "true" ]; then
|
|
111
|
-
debug_log "🔧 Executing Node.js script..."
|
|
112
|
-
RESPONSE=$(BLUELAMP_DEBUG=true node "$PACKAGE_ROOT/.fetch-knowledge.js" "$keyword" 2>/dev/null)
|
|
113
|
-
STDERR_OUTPUT=$(BLUELAMP_DEBUG=true node "$PACKAGE_ROOT/.fetch-knowledge.js" "$keyword" 2>&1 >/dev/null)
|
|
114
|
-
debug_log "🔧 stderr: $STDERR_OUTPUT"
|
|
115
|
-
else
|
|
116
|
-
RESPONSE=$(node "$PACKAGE_ROOT/.fetch-knowledge.js" "$keyword" 2>/dev/null)
|
|
117
|
-
fi
|
|
118
|
-
|
|
119
|
-
# 一時ファイル削除
|
|
120
|
-
rm -f "$PACKAGE_ROOT/.fetch-knowledge.js"
|
|
121
|
-
|
|
122
|
-
# レスポンスが空でないかチェック
|
|
123
|
-
if [ -z "$RESPONSE" ]; then
|
|
124
|
-
debug_log "🚨 Empty response from Node.js script"
|
|
125
|
-
return 1
|
|
126
|
-
fi
|
|
127
|
-
|
|
128
|
-
debug_log "🔧 Raw response: $RESPONSE"
|
|
129
|
-
echo "$RESPONSE"
|
|
130
|
-
return 0
|
|
131
|
-
fi
|
|
132
|
-
|
|
133
|
-
return 1
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
# Portal API呼び出し
|
|
137
|
-
debug_log "🚀 Portal API Request: $KEYWORD"
|
|
138
|
-
|
|
139
|
-
RESPONSE_JSON=$(fetch_knowledge_injection "$KEYWORD")
|
|
140
|
-
if [ $? -ne 0 ] || [ -z "$RESPONSE_JSON" ]; then
|
|
141
|
-
echo "❌ Knowledge injection request failed" >&2
|
|
142
|
-
echo "💡 Hint: Run 'blcf' command first to authenticate with Portal" >&2
|
|
143
|
-
exit 0
|
|
144
|
-
fi
|
|
145
|
-
|
|
146
|
-
# JSONレスポンスの解析
|
|
147
|
-
STATUS_CODE=$(echo "$RESPONSE_JSON" | python3 -c "
|
|
148
|
-
import sys, json
|
|
149
|
-
try:
|
|
150
|
-
data = json.load(sys.stdin)
|
|
151
|
-
print(data.get('statusCode', 0))
|
|
152
|
-
except:
|
|
153
|
-
print(0)
|
|
154
|
-
" 2>/dev/null)
|
|
155
|
-
|
|
156
|
-
SUCCESS=$(echo "$RESPONSE_JSON" | python3 -c "
|
|
157
|
-
import sys, json
|
|
158
|
-
try:
|
|
159
|
-
data = json.load(sys.stdin)
|
|
160
|
-
print('true' if data.get('success') else 'false')
|
|
161
|
-
except:
|
|
162
|
-
print('false')
|
|
163
|
-
" 2>/dev/null)
|
|
164
|
-
|
|
165
|
-
ERROR_MSG=$(echo "$RESPONSE_JSON" | python3 -c "
|
|
166
|
-
import sys, json
|
|
167
|
-
try:
|
|
168
|
-
data = json.load(sys.stdin)
|
|
169
|
-
if not data.get('success'):
|
|
170
|
-
print(data.get('error', 'Unknown error'))
|
|
171
|
-
except:
|
|
172
|
-
print('Parse error')
|
|
173
|
-
" 2>/dev/null)
|
|
174
|
-
|
|
175
|
-
debug_log "🔧 HTTP Status: $STATUS_CODE"
|
|
176
|
-
debug_log "🔧 Success: $SUCCESS"
|
|
177
|
-
|
|
178
|
-
# エラーチェック
|
|
179
|
-
if [ "$SUCCESS" != "true" ]; then
|
|
180
|
-
case $STATUS_CODE in
|
|
181
|
-
401)
|
|
182
|
-
echo "❌ Authentication Error: Invalid CLI Token" >&2
|
|
183
|
-
echo "💡 Hint: Check your token or run authentication setup" >&2
|
|
184
|
-
;;
|
|
185
|
-
403)
|
|
186
|
-
echo "❌ Access Denied: Knowledge Injection not available" >&2
|
|
187
|
-
;;
|
|
188
|
-
404)
|
|
189
|
-
echo "❌ Prompt Not Found: '$KEYWORD'" >&2
|
|
190
|
-
echo "💡 Hint: Check available keywords" >&2
|
|
191
|
-
;;
|
|
192
|
-
429)
|
|
193
|
-
echo "❌ Rate Limit Exceeded" >&2
|
|
194
|
-
echo "💡 Hint: Please wait and try again later" >&2
|
|
195
|
-
;;
|
|
196
|
-
500|503)
|
|
197
|
-
echo "❌ Server Error: Please try again later" >&2
|
|
198
|
-
;;
|
|
199
|
-
0)
|
|
200
|
-
echo "❌ Connection Error: $ERROR_MSG" >&2
|
|
201
|
-
echo "💡 Hint: Check your internet connection" >&2
|
|
202
|
-
;;
|
|
203
|
-
*)
|
|
204
|
-
echo "❌ Error: $ERROR_MSG" >&2
|
|
205
|
-
;;
|
|
206
|
-
esac
|
|
207
|
-
exit 0
|
|
208
|
-
fi
|
|
209
|
-
|
|
210
|
-
# レスポンスデータから実際のデータを取得
|
|
211
|
-
if [ "$BLUELAMP_DEBUG" = "true" ]; then
|
|
212
|
-
debug_log "🔧 Parsing response JSON..."
|
|
213
|
-
fi
|
|
214
|
-
|
|
215
|
-
HTTP_BODY=$(echo "$RESPONSE_JSON" | python3 -c "
|
|
216
|
-
import sys, json
|
|
217
|
-
try:
|
|
218
|
-
response = json.load(sys.stdin)
|
|
219
|
-
if response.get('success') and 'data' in response:
|
|
220
|
-
# dataフィールドがネストしている場合の処理
|
|
221
|
-
data = response['data']
|
|
222
|
-
if 'data' in data:
|
|
223
|
-
print(json.dumps(data['data']))
|
|
224
|
-
else:
|
|
225
|
-
print(json.dumps(data))
|
|
226
|
-
else:
|
|
227
|
-
print(json.dumps(response))
|
|
228
|
-
except Exception as e:
|
|
229
|
-
import sys
|
|
230
|
-
print(json.dumps({'error': 'Parse error: ' + str(e)}), file=sys.stderr)
|
|
231
|
-
print('{}')
|
|
232
|
-
" 2>/dev/null)
|
|
233
|
-
|
|
234
|
-
if [ "$BLUELAMP_DEBUG" = "true" ]; then
|
|
235
|
-
debug_log "🔧 HTTP_BODY: $HTTP_BODY"
|
|
236
|
-
fi
|
|
237
|
-
|
|
238
|
-
# プロンプト内容とタイトルを抽出
|
|
239
|
-
CONTENT=$(echo "$HTTP_BODY" | python3 -c "
|
|
240
|
-
import sys, json
|
|
241
|
-
try:
|
|
242
|
-
data = json.load(sys.stdin)
|
|
243
|
-
# SimpleAuthManagerからのレスポンス構造に合わせて修正
|
|
244
|
-
if 'content' in data:
|
|
245
|
-
print(data['content'])
|
|
246
|
-
elif 'data' in data and 'content' in data['data']:
|
|
247
|
-
print(data['data']['content'])
|
|
248
|
-
else:
|
|
249
|
-
print('Content not found')
|
|
250
|
-
except Exception as e:
|
|
251
|
-
print('Parse error: ' + str(e))
|
|
252
|
-
" 2>/dev/null)
|
|
253
|
-
|
|
254
|
-
TITLE=$(echo "$HTTP_BODY" | python3 -c "
|
|
255
|
-
import sys, json
|
|
256
|
-
try:
|
|
257
|
-
data = json.load(sys.stdin)
|
|
258
|
-
# SimpleAuthManagerからのレスポンス構造に合わせて修正
|
|
259
|
-
if 'title' in data:
|
|
260
|
-
print(data.get('title', 'Unknown'))
|
|
261
|
-
elif 'data' in data and 'title' in data['data']:
|
|
262
|
-
print(data['data'].get('title', 'Unknown'))
|
|
263
|
-
else:
|
|
264
|
-
print('Unknown')
|
|
265
|
-
except:
|
|
266
|
-
print('Unknown')
|
|
267
|
-
" 2>/dev/null)
|
|
268
|
-
|
|
269
|
-
if [ "$BLUELAMP_DEBUG" = "true" ]; then
|
|
270
|
-
debug_log "🔧 TITLE: $TITLE"
|
|
271
|
-
debug_log "🔧 CONTENT length: ${#CONTENT}"
|
|
272
|
-
fi
|
|
273
|
-
|
|
274
|
-
# 使用状況情報の取得(デバッグモード時のみ)
|
|
275
|
-
if [ "$BLUELAMP_DEBUG" = "true" ]; then
|
|
276
|
-
USAGE_INFO=$(echo "$HTTP_BODY" | python3 -c "
|
|
277
|
-
import sys, json
|
|
278
|
-
try:
|
|
279
|
-
data = json.load(sys.stdin)
|
|
280
|
-
if data.get('success') and 'usage' in data:
|
|
281
|
-
usage = data['usage']
|
|
282
|
-
limit = usage.get('limit')
|
|
283
|
-
used = usage.get('used', 0)
|
|
284
|
-
remaining = usage.get('remaining')
|
|
285
|
-
month = usage.get('month', 'Unknown')
|
|
286
|
-
|
|
287
|
-
if limit is None:
|
|
288
|
-
print(f'Usage: {used} times this month ({month}) - Unlimited plan')
|
|
289
|
-
else:
|
|
290
|
-
print(f'Usage: {used}/{limit} times this month ({month}) - {remaining} remaining')
|
|
291
|
-
else:
|
|
292
|
-
print('Usage information not available')
|
|
293
|
-
except:
|
|
294
|
-
print('Usage information not available')
|
|
295
|
-
" 2>/dev/null)
|
|
296
|
-
|
|
297
|
-
echo "📊 $USAGE_INFO" >&2
|
|
298
|
-
fi
|
|
299
|
-
|
|
300
|
-
# 内容チェック
|
|
301
|
-
if [ -z "$CONTENT" ]; then
|
|
302
|
-
echo "❌ Empty Prompt Content" >&2
|
|
303
|
-
exit 0
|
|
304
|
-
fi
|
|
305
|
-
|
|
306
|
-
echo "🎯 Knowledge Injection Complete: $TITLE" >&2
|
|
307
|
-
|
|
308
|
-
# 知識注入
|
|
309
|
-
echo "
|
|
310
|
-
<BlueLamp知識注入システム>
|
|
311
|
-
Portal APIから専門知識が取得され、注入されました。
|
|
312
|
-
キーワード: $KEYWORD
|
|
313
|
-
タイトル: $TITLE
|
|
314
|
-
|
|
315
|
-
--- 注入された専門知識 ---
|
|
316
|
-
$CONTENT
|
|
317
|
-
--- 知識終了 ---
|
|
318
|
-
|
|
319
|
-
この専門知識を活用して、詳細かつ具体的な回答を提供してください。
|
|
320
|
-
</BlueLamp知識注入システム>
|
|
321
|
-
"
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ブルーランプ
|
|
3
|
-
description: パフォーマーエージェント - オーケストレーターの指示に応じて適切な役割・ツールを選択・実行
|
|
4
|
-
model: sonnet
|
|
5
|
-
color: blue
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# ブルーランプエージェント
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
1. **初期化**:オーケストレーターから指示があった場合は、inject_knowledge(keyword: "キーワード")こちらで指示通りの知識を注入する(指示がなければ不要)
|
|
12
|
-
2. **オーケストレーター指示の確認**: タスク指示を解析し、実行内容を特定
|
|
13
|
-
3. **タスク実行**: 注入された専門知識に基づいて適切な処理を実行
|
|
14
|
-
|
|
15
|
-
## 🌟 基本理念
|
|
16
|
-
「シンプルさは究極の洗練である」- レオナルド・ダ・ヴィンチ
|
|
17
|
-
「プロジェクトでいまここに不要なコードは一文字も残さない」
|
|
18
|
-
「最高の仕様書はドキュメントではなく美しく整ったアーキテクチャのコードそのものである」
|
|
19
|
-
「秩序を保つことに責任を持つ。整理整頓された綺麗な部屋のようにコードやドキュメントの片付け整理を忘れない」
|
|
20
|
-
「ジョブスのように誰もみてない細部のコードの美しさにも職人のようにこだわる」
|
|
21
|
-
## 🎯 5つの核心原則
|
|
22
|
-
|
|
23
|
-
### 1. 最小性の原則(Principle of Minimalism)
|
|
24
|
-
**「必要最小限を超えない」**
|
|
25
|
-
- 新規作成より既存活用を優先する
|
|
26
|
-
- 解決策は常に最もシンプルなものを選ぶ
|
|
27
|
-
- あったらいいなはないほうがいい
|
|
28
|
-
|
|
29
|
-
### 2. 単一性の原則(Principle of Singularity)
|
|
30
|
-
**「真実の源は常に一つ」**
|
|
31
|
-
- SQLAlchemyモデルはbackend/app/models/__init__.pyに集約(DB定義の単一源)
|
|
32
|
-
- 実装計画はSCOPE_PROGRESS.mdに集約させる
|
|
33
|
-
- 仕様書やロジックなどはrequirements.mdに集約させる
|
|
34
|
-
|
|
35
|
-
### 3. 刹那性の原則(Principle of Ephemerality)
|
|
36
|
-
**「今、ここで必要なものだけを残す」**
|
|
37
|
-
- 役目を終えたものは即座に削除する
|
|
38
|
-
- 修正や変更により使わなくなったコードは即リファクタリング
|
|
39
|
-
- 後方互換の原則禁止(ただし修正時は安全を確保するよう慎重に)
|
|
40
|
-
- 未来の「もしかして」のために保持しない
|
|
41
|
-
- 生きているコードとドキュメントのみを維持する
|
|
42
|
-
|
|
43
|
-
### 4. 実証性の原則(Principle of Evidence)
|
|
44
|
-
**「事実こそが真実への唯一の道」**
|
|
45
|
-
- 環境変数やデータベースを積極的に確認する。
|
|
46
|
-
- 開発環境でもバックエンドは全て本番のAPIを使って検証テスト作成する。バックエンドのモック絶対禁止。
|
|
47
|
-
- デバッグで明確に原因がわからない場合はログを設置する。推測しない。
|
|
48
|
-
- 外部APIや比較的新しい技術はweb検索を積極的に活用する。仕様を推測しない。
|
|
49
|
-
- **Web検索前に必ず`date`コマンドで現在日時を確認し、現在の最新情報を検索する**
|
|
50
|
-
|
|
51
|
-
### 5. 潔癖性の原則(Principle of Fail-Fast)
|
|
52
|
-
**「失敗は隠すな、早く明確に、透明に失敗せよ」**
|
|
53
|
-
- エラーは即座に表面化させる
|
|
54
|
-
- フォールバックによる問題の隠蔽を禁止する
|
|
55
|
-
- そもそもフォールバック不要のシンプルで堅牢性の高い構造を作る
|
|
56
|
-
|
|
57
|
-
## ドキュメント管理の原則
|
|
58
|
-
|
|
59
|
-
単一の真実源の原則を守らせ、勝手なドキュメントを無作為に作らせないように制御してください。
|
|
60
|
-
- **docs/SCOPE_PROGRESS.md**: 今これからやるべき実装の計画
|
|
61
|
-
- **docs/requirements.md**: 今これからやるべき実装の詳細
|
|
62
|
-
- **docs/DEPLOYMENT.md**: デプロイ情報
|
|
63
|
-
- **docs/designsystem.md**: デザインシステム
|
|
64
|
-
- **docs/api-specs/[ページ名]-api.md**: API仕様書
|
|
65
|
-
|
|
66
|
-
例えばリサーチして何か知見があり、その結果としてドキュメント化したいのであれば
|
|
67
|
-
requirements.md(要件やロジック)
|
|
68
|
-
SCOPE_PROGRESS.md(実装計画)
|
|
69
|
-
|
|
70
|
-
こちらにのみ記載可能であり、こちらに記載する価値がなければ回答のみで報告してください。
|
|
71
|
-
これ以外のドキュメントはユーザーへの確認と明確な許諾や指示がない限り作成してはいけません。
|
|
72
|
-
|
|
73
|
-
requirements.md(要件やロジック)
|
|
74
|
-
SCOPE_PROGRESS.md(実装計画)
|
|
75
|
-
|
|
76
|
-
こちらは実装が完了しコードに落とし込まれている記載は積極的に削除し不要な記載はなくす。
|
|
77
|
-
|
|
78
|
-
## 🔧 FastAPI + SQLAlchemy開発の絶対原則
|
|
79
|
-
|
|
80
|
-
### 6. 環境変数の絶対原則
|
|
81
|
-
- **開発中は全ての場面で.env.localのみ使用**
|
|
82
|
-
- テストスクリプトは必ず.env.localを読み込ませる
|
|
83
|
-
- .env.test、.env.developmentなど作らない
|
|
84
|
-
- DATABASE_URLは.env.localの1箇所のみ
|
|
85
|
-
|
|
86
|
-
### 7. SQLAlchemy/DBの絶対原則
|
|
87
|
-
- **SQLAlchemyエラーが出たら`alembic upgrade head`を実行**
|
|
88
|
-
- スキーマ変更は`alembic revision --autogenerate`後に`alembic upgrade head`
|
|
89
|
-
- SQLAlchemyモデルはbackend/app/models/__init__.pyに集約
|
|
90
|
-
- **DBURLエラー時は環境変数エラーとして即報告**
|
|
91
|
-
|
|
92
|
-
### 8. テストも.env.localを使用
|
|
93
|
-
- テスト専用DBは作らない
|
|
94
|
-
- 同じDBで問題なし(開発段階)
|
|
95
|
-
- process.env.DATABASE_URLをそのまま使用
|
|
96
|
-
|
|
97
|
-
### 9. サーバー起動の絶対原則
|
|
98
|
-
- サーバーは1つ維持
|
|
99
|
-
- 再起動禁止(ホットリロードを使う)
|
|
100
|
-
- 既存サーバーがある場合はそれを使う
|
|
101
|
-
(理由:複数エージェントで同プロジェクトを扱うため、既存サーバーのほとんどは同じプロジェクト。失敗時のみ調査し、違う場合のみ新規起動)
|
|
102
|
-
|
|
103
|
-
### 10. エラー時の絶対原則
|
|
104
|
-
- **環境変数エラー** → 全タスク強制終了し即座に報告(試行錯誤禁止)
|
|
105
|
-
- **SQLAlchemy接続エラー** → `alembic upgrade head`後、1回だけ再試行
|
|
106
|
-
- **3回同じエラー** → Web検索を許可
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BlueLamp プロンプト保護システム
|
|
3
|
-
* サブエージェントのプロンプト保護とアクセス制御を実装
|
|
4
|
-
*/
|
|
5
|
-
declare class BlueLampProtectionSystem {
|
|
6
|
-
private server;
|
|
7
|
-
private validTokens;
|
|
8
|
-
private accessLogs;
|
|
9
|
-
constructor();
|
|
10
|
-
private initializeTokens;
|
|
11
|
-
private setupHandlers;
|
|
12
|
-
private validateToken;
|
|
13
|
-
private logAccess;
|
|
14
|
-
/**
|
|
15
|
-
* エージェント認証ハンドラー
|
|
16
|
-
*/
|
|
17
|
-
private handleAuthenticateAgent;
|
|
18
|
-
/**
|
|
19
|
-
* 保護されたプロンプト取得ハンドラー
|
|
20
|
-
*/
|
|
21
|
-
private handleGetProtectedPrompt;
|
|
22
|
-
/**
|
|
23
|
-
* 保護されたエージェント一覧ハンドラー
|
|
24
|
-
*/
|
|
25
|
-
private handleListProtectedAgents;
|
|
26
|
-
run(): Promise<void>;
|
|
27
|
-
}
|
|
28
|
-
export { BlueLampProtectionSystem };
|
|
29
|
-
//# sourceMappingURL=bluelamp-system.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bluelamp-system.d.ts","sourceRoot":"","sources":["../src/bluelamp-system.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgCH,cAAM,wBAAwB;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAAc;;IAqBhC,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,aAAa;IA4FrB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,SAAS;IAcjB;;OAEG;YACW,uBAAuB;IAgCrC;;OAEG;YACW,wBAAwB;IAkEtC;;OAEG;YACW,yBAAyB;IAyEjC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAI3B;AAOD,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e,t=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)},function(s){if(s&&s.__esModule)return s;var r={};if(null!=s)for(var o=e(s),i=0;i<o.length;i++)"default"!==o[i]&&t(r,s,o[i]);return n(r,s),r});Object.defineProperty(exports,"__esModule",{value:!0}),exports.BlueLampProtectionSystem=void 0;const r=require("@modelcontextprotocol/sdk/server/index.js"),o=require("@modelcontextprotocol/sdk/server/stdio.js"),i=require("@modelcontextprotocol/sdk/types.js"),c=s(require("fs")),a=s(require("path"));class p{constructor(){this.server=new r.Server({name:"bluelamp-protection-system",version:"1.0.0"},{capabilities:{tools:{}}}),this.validTokens=new Set,this.accessLogs=[],this.initializeTokens(),this.setupHandlers()}initializeTokens(){const e=process.env.BLUELAMP_TOKEN;e&&this.validTokens.add(e),this.validTokens.add("test-token-12345"),this.validTokens.add("bluelamp-secure-token-67890")}setupHandlers(){this.server.setRequestHandler(i.ListToolsRequestSchema,async()=>({tools:[{name:"authenticate_agent",description:"Authenticate access to protected agent",inputSchema:{type:"object",properties:{token:{type:"string",description:"Authentication token"},agentName:{type:"string",description:"Name of the agent to access"}},required:["token","agentName"]}},{name:"get_protected_prompt",description:"Get protected prompt for authenticated agent",inputSchema:{type:"object",properties:{token:{type:"string",description:"Authentication token"},agentName:{type:"string",description:"Name of the agent"},promptId:{type:"string",description:"ID of the prompt to retrieve"}},required:["token","agentName","promptId"]}},{name:"list_protected_agents",description:"List all protected agents available",inputSchema:{type:"object",properties:{token:{type:"string",description:"Authentication token"}},required:["token"]}}]})),this.server.setRequestHandler(i.CallToolRequestSchema,async e=>{const{name:t,arguments:n}=e.params;try{switch(t){case"authenticate_agent":return await this.handleAuthenticateAgent(n);case"get_protected_prompt":return await this.handleGetProtectedPrompt(n);case"list_protected_agents":return await this.handleListProtectedAgents(n);default:throw new i.McpError(i.ErrorCode.MethodNotFound,`Unknown tool: ${t}`)}}catch(e){if(e instanceof i.McpError)throw e;throw new i.McpError(i.ErrorCode.InternalError,`Tool execution failed: ${t}: ${e}`)}})}validateToken(e){return this.validTokens.has(e)}logAccess(e,t,n){this.accessLogs.push({timestamp:new Date,token:e.substring(0,8)+"...",agentName:t,success:n}),this.accessLogs.length>100&&(this.accessLogs=this.accessLogs.slice(-100))}async handleAuthenticateAgent(e){const{token:t,agentName:n}=e;return this.validateToken(t)?(this.logAccess(t,n,!0),{content:[{type:"text",text:JSON.stringify({success:!0,message:`Authentication successful for agent: ${n}`,sessionId:`session_${Date.now()}`,expiresAt:new Date(Date.now()+36e5).toISOString()})}]}):(this.logAccess(t,n,!1),{content:[{type:"text",text:JSON.stringify({success:!1,error:"Invalid authentication token",code:"AUTH_FAILED"})}]})}async handleGetProtectedPrompt(e){const{token:t,agentName:n,promptId:s}=e;if(!this.validateToken(t))return this.logAccess(t,n,!1),{content:[{type:"text",text:JSON.stringify({success:!1,error:"Invalid authentication token",code:"AUTH_FAILED"})}]};try{const e=a.join(process.cwd(),"protected-prompts",n),r=a.join(e,`${s}.md`);if(!c.existsSync(r))return{content:[{type:"text",text:JSON.stringify({success:!1,error:`Prompt not found: ${s} for agent: ${n}`,code:"PROMPT_NOT_FOUND"})}]};const o=c.readFileSync(r,"utf-8");return this.logAccess(t,n,!0),{content:[{type:"text",text:JSON.stringify({success:!0,agentName:n,promptId:s,content:o,retrievedAt:(new Date).toISOString()})}]}}catch(e){return this.logAccess(t,n,!1),{content:[{type:"text",text:JSON.stringify({success:!1,error:`Failed to retrieve prompt: ${e.message}`,code:"RETRIEVAL_ERROR"})}]}}}async handleListProtectedAgents(e){const{token:t}=e;if(!this.validateToken(t))return{content:[{type:"text",text:JSON.stringify({success:!1,error:"Invalid authentication token",code:"AUTH_FAILED"})}]};try{const e=a.join(process.cwd(),"protected-prompts");if(!c.existsSync(e))return{content:[{type:"text",text:JSON.stringify({success:!0,agents:[],message:"No protected agents directory found"})}]};const t=c.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(t=>{const n=a.join(e,t.name),s=c.readdirSync(n).filter(e=>e.endsWith(".md")).map(e=>e.replace(".md",""));return{name:t.name,promptCount:s.length,prompts:s}});return{content:[{type:"text",text:JSON.stringify({success:!0,agents:t,totalAgents:t.length,accessLogs:this.accessLogs.slice(-10)})}]}}catch(e){return{content:[{type:"text",text:JSON.stringify({success:!1,error:`Failed to list agents: ${e.message}`,code:"LIST_ERROR"})}]}}}async run(){const e=new o.StdioServerTransport;await this.server.connect(e)}}if(exports.BlueLampProtectionSystem=p,require.main===module){new p}
|