@hienlh/ppm 0.13.12 → 0.13.14
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/.opencode/.env.example +98 -0
- package/.opencode/skills/ads-management/scripts/.env.example +13 -0
- package/.opencode/skills/ai-multimodal/.env.example +230 -0
- package/.opencode/skills/cip-design/.env.example +6 -0
- package/.opencode/skills/devops/.env.example +76 -0
- package/.opencode/skills/docs-seeker/.env.example +15 -0
- package/.opencode/skills/elevenlabs/.env.example +3 -0
- package/.opencode/skills/marketing-dashboard/.env.example +15 -0
- package/.opencode/skills/marketing-dashboard/app/.env.example +2 -0
- package/.opencode/skills/marketing-dashboard/server/.env.example +2 -0
- package/.opencode/skills/mcp-management/scripts/dist/analyze-tools.js +70 -0
- package/.opencode/skills/mcp-management/scripts/dist/cli.js +160 -0
- package/.opencode/skills/mcp-management/scripts/dist/mcp-client.js +183 -0
- package/.opencode/skills/payment-integration/scripts/.env.example +20 -0
- package/.opencode/skills/sequential-thinking/.env.example +8 -0
- package/CHANGELOG.md +10 -0
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/cli-reference.md +30 -4
- package/assets/skills/ppm/references/http-api.md +1 -1
- package/dist/web/assets/{ai-settings-section-ysK_Eixc.js → ai-settings-section-DR5BueEL.js} +1 -1
- package/dist/web/assets/{api-settings-D0_eiIYv.js → api-settings-DowGyuVy.js} +1 -1
- package/dist/web/assets/architecture-PBZL5I3N-7JKY4P1L.js +1 -0
- package/dist/web/assets/{audio-preview-BjoIjXlf.js → audio-preview-YOG6Biao.js} +1 -1
- package/dist/web/assets/chat-tab-DbdDJuLu.js +12 -0
- package/dist/web/assets/code-editor-C4nuAsy6.js +8 -0
- package/dist/web/assets/{conflict-editor-WxMZDucw.js → conflict-editor-DnGfriL5.js} +1 -1
- package/dist/web/assets/{csv-preview-7TsYBQI6.js → csv-preview-Bo-N3GHl.js} +1 -1
- package/dist/web/assets/{data-grid-overlay-editor-BjjuE4-G.js → data-grid-overlay-editor-DqcDQ9st.js} +1 -1
- package/dist/web/assets/{database-viewer-BRW8CMzC.js → database-viewer-AodppoTs.js} +1 -1
- package/dist/web/assets/diff-viewer-DykLUwna.js +4 -0
- package/dist/web/assets/{esm-zjerHxpO.js → esm-Dvc8oJly.js} +1 -1
- package/dist/web/assets/{extension-webview-DgfgR787.js → extension-webview-Bck7QuaB.js} +1 -1
- package/dist/web/assets/{file-store-BrbCNyLm.js → file-store-4BpOJthN.js} +1 -1
- package/dist/web/assets/gitGraph-HDMCJU4V-Daf9rhiF.js +1 -0
- package/dist/web/assets/{glide-data-grid-DIvkBUKj.js → glide-data-grid-BVt0mwcA.js} +7 -7
- package/dist/web/assets/{image-preview-BlBVP277.js → image-preview-DaSmrIvY.js} +1 -1
- package/dist/web/assets/index-CSK33ACc.css +2 -0
- package/dist/web/assets/index-gZKF1YKy.js +27 -0
- package/dist/web/assets/info-3K5VOQVL-gn0pjNiT.js +1 -0
- package/dist/web/assets/{input-ozrR2DAV.js → input-4ll___Gh.js} +1 -1
- package/dist/web/assets/keybindings-store-DBKLTPrk.js +1 -0
- package/dist/web/assets/{markdown-renderer-CJMJ5Qq0.js → markdown-renderer-B1me_hz2.js} +3 -3
- package/dist/web/assets/{number-overlay-editor-BoRxunFN.js → number-overlay-editor-XTjjEXtk.js} +1 -1
- package/dist/web/assets/packet-RMMSAZCW-Csaeizjc.js +1 -0
- package/dist/web/assets/{pdf-preview-D0JDPYYs.js → pdf-preview-Dci7TIL1.js} +1 -1
- package/dist/web/assets/pie-UPGHQEXC-DatkjxTH.js +1 -0
- package/dist/web/assets/port-forwarding-tab-BeM40G-J.js +1 -0
- package/dist/web/assets/{postgres-viewer-DkVKzTKJ.js → postgres-viewer-CGVBOwA9.js} +3 -3
- package/dist/web/assets/radar-KQ55EAFF-BnGB20hR.js +1 -0
- package/dist/web/assets/{scroll-area-7H-Q_k8c.js → scroll-area-iv39O3VN.js} +1 -1
- package/dist/web/assets/search-tM8K5zWU.js +1 -0
- package/dist/web/assets/{settings-store-Dvk8Lvwm.js → settings-store-D2MtC9tm.js} +2 -2
- package/dist/web/assets/settings-tab-CYS8VfNl.js +1 -0
- package/dist/web/assets/{sql-query-editor-BVn40O0T.js → sql-query-editor-DstPySPF.js} +1 -1
- package/dist/web/assets/sqlite-viewer-SUGEk_G1.js +1 -0
- package/dist/web/assets/{tab-store-0rGchMXr.js → tab-store-Dow2Ztto.js} +1 -1
- package/dist/web/assets/terminal-tab-CJvjF79J.js +1 -0
- package/dist/web/assets/treemap-KZPCXAKY-CgEYv38e.js +1 -0
- package/dist/web/assets/{use-blob-url-e9uTXjv5.js → use-blob-url-DGY5qKiT.js} +1 -1
- package/dist/web/assets/{use-monaco-theme-SyJzNaNN.js → use-monaco-theme-CugUkORI.js} +1 -1
- package/dist/web/assets/{vendor-mermaid-DsfY6y4f.js → vendor-mermaid-CPtQ2zua.js} +3 -3
- package/dist/web/assets/{video-preview-BEuZs1dG.js → video-preview-gJSKmPQr.js} +1 -1
- package/dist/web/index.html +16 -15
- package/dist/web/sw.js +1 -1
- package/docs/system-architecture.md +1 -0
- package/package.json +1 -1
- package/src/cli/commands/cloud.ts +53 -0
- package/src/cli/commands/db-cmd.ts +52 -0
- package/src/index.ts +0 -0
- package/src/providers/claude-agent-sdk.ts +12 -15
- package/src/services/cloud.service.ts +55 -0
- package/src/services/database/split-sql-statements.ts +95 -0
- package/src/services/postgres.service.ts +18 -0
- package/src/services/sqlite.service.ts +9 -0
- package/src/web/app.tsx +7 -0
- package/src/web/components/chat/chat-welcome.tsx +7 -140
- package/src/web/components/chat/session-list-panel.tsx +188 -0
- package/src/web/components/editor/diff-viewer.tsx +25 -26
- package/src/web/components/layout/editor-panel.tsx +10 -158
- package/bun.lock +0 -2135
- package/bunfig.toml +0 -2
- package/dist/web/assets/architecture-PBZL5I3N-DVlAZGlv.js +0 -1
- package/dist/web/assets/chat-tab-Cq8xYO7K.js +0 -12
- package/dist/web/assets/code-editor-DZ1e_sz0.js +0 -8
- package/dist/web/assets/diff-viewer-BOTb0dkG.js +0 -4
- package/dist/web/assets/gitGraph-HDMCJU4V-b3n-Tgk6.js +0 -1
- package/dist/web/assets/index-COOnLKGB.css +0 -2
- package/dist/web/assets/index-zP-OjEml.js +0 -27
- package/dist/web/assets/info-3K5VOQVL-fJy9dGkV.js +0 -1
- package/dist/web/assets/keybindings-store-Djjc6tPj.js +0 -1
- package/dist/web/assets/packet-RMMSAZCW-DMi06dVb.js +0 -1
- package/dist/web/assets/pie-UPGHQEXC-BECm43s6.js +0 -1
- package/dist/web/assets/port-forwarding-tab-DfaV6GPS.js +0 -1
- package/dist/web/assets/radar-KQ55EAFF-BwqCptkx.js +0 -1
- package/dist/web/assets/settings-tab-BFbe6ybw.js +0 -1
- package/dist/web/assets/sqlite-viewer-8oWf4JCB.js +0 -1
- package/dist/web/assets/terminal-tab-D_C7amDZ.js +0 -1
- package/dist/web/assets/treemap-KZPCXAKY-Da7U3Olf.js +0 -1
- /package/dist/web/assets/{api-client-Dvzcc_EO.js → api-client-DIhJ5qVW.js} +0 -0
- /package/dist/web/assets/{data-grid-types-BTQHYBUh.js → data-grid-types-DqqspyVw.js} +0 -0
- /package/dist/web/assets/{dist-0kPgRaVx.js → dist-D1SZxtVS.js} +0 -0
- /package/dist/web/assets/{dist-DGSkE2Ml.js → dist-_jZs3YZC.js} +0 -0
- /package/dist/web/assets/{file-exclamation-point-Baz81y5z.js → file-exclamation-point-BwzaQ50n.js} +0 -0
- /package/dist/web/assets/{katex-BuytEdO1.js → katex-DzXRfQ_m.js} +0 -0
- /package/dist/web/assets/{lib-DQHnkzGy.js → lib-Dub8DlCJ.js} +0 -0
- /package/dist/web/assets/{react-GqWghJ-L.js → react-DMIOAtcX.js} +0 -0
- /package/dist/web/assets/{refresh-cw-LlbZDJpO.js → refresh-cw-BjrAbUJe.js} +0 -0
- /package/dist/web/assets/{sparkles-fWUT5Vzq.js → sparkles-CulWHe4c.js} +0 -0
- /package/dist/web/assets/{table-tf7pRkME.js → table-BzjWcs87.js} +0 -0
- /package/dist/web/assets/{text-wrap-BV-R4Vvy.js → text-wrap-DJz9Bgpa.js} +0 -0
- /package/dist/web/assets/{utils-CTg5uAYR.js → utils-CQux7CsO.js} +0 -0
- /package/dist/web/assets/{vendor-xterm-CU2c3f0A.js → vendor-xterm-Dyfw49hJ.js} +0 -0
- /package/dist/web/assets/{x-CG-_0yIW.js → x-BPReZWnP.js} +0 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MCP Management CLI - Command-line interface for MCP operations
|
|
4
|
+
*/
|
|
5
|
+
import { MCPClientManager } from './mcp-client.js';
|
|
6
|
+
import { writeFileSync, mkdirSync } from 'fs';
|
|
7
|
+
import { dirname, join } from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
const GLOBAL_TIMEOUT_MS = parseInt(process.env.MCP_TIMEOUT || '120000', 10);
|
|
12
|
+
let globalManager = null;
|
|
13
|
+
function setupShutdownHandlers() {
|
|
14
|
+
const shutdown = async (signal) => {
|
|
15
|
+
console.log(`\nReceived ${signal}, cleaning up...`);
|
|
16
|
+
if (globalManager) {
|
|
17
|
+
await globalManager.cleanup();
|
|
18
|
+
}
|
|
19
|
+
process.exit(0);
|
|
20
|
+
};
|
|
21
|
+
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
22
|
+
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
23
|
+
process.on('SIGHUP', () => shutdown('SIGHUP'));
|
|
24
|
+
process.on('unhandledRejection', (reason) => {
|
|
25
|
+
console.error('Unhandled rejection:', reason);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async function main() {
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
const command = args[0];
|
|
32
|
+
// Setup shutdown handlers
|
|
33
|
+
setupShutdownHandlers();
|
|
34
|
+
// Check for help flags BEFORE connecting to servers
|
|
35
|
+
if (!command || command === '--help' || command === 'help') {
|
|
36
|
+
printUsage();
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}
|
|
39
|
+
// Global timeout
|
|
40
|
+
const timeoutHandle = setTimeout(() => {
|
|
41
|
+
console.error('Global timeout exceeded, forcing exit');
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}, GLOBAL_TIMEOUT_MS);
|
|
44
|
+
timeoutHandle.unref();
|
|
45
|
+
const manager = new MCPClientManager();
|
|
46
|
+
globalManager = manager;
|
|
47
|
+
try {
|
|
48
|
+
// Load config
|
|
49
|
+
await manager.loadConfig();
|
|
50
|
+
console.log('✓ Config loaded');
|
|
51
|
+
// Connect to all servers
|
|
52
|
+
await manager.connectAll();
|
|
53
|
+
console.log('✓ Connected to all MCP servers\n');
|
|
54
|
+
switch (command) {
|
|
55
|
+
case 'list-tools':
|
|
56
|
+
await listTools(manager);
|
|
57
|
+
break;
|
|
58
|
+
case 'list-prompts':
|
|
59
|
+
await listPrompts(manager);
|
|
60
|
+
break;
|
|
61
|
+
case 'list-resources':
|
|
62
|
+
await listResources(manager);
|
|
63
|
+
break;
|
|
64
|
+
case 'call-tool':
|
|
65
|
+
await callTool(manager, args[1], args[2], args[3]);
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
printUsage();
|
|
69
|
+
}
|
|
70
|
+
await manager.cleanup();
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.error('Error:', error);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function listTools(manager) {
|
|
79
|
+
const tools = await manager.getAllTools();
|
|
80
|
+
console.log(`Found ${tools.length} tools:\n`);
|
|
81
|
+
for (const tool of tools) {
|
|
82
|
+
console.log(`📦 ${tool.serverName} / ${tool.name}`);
|
|
83
|
+
console.log(` ${tool.description}`);
|
|
84
|
+
if (tool.inputSchema?.properties) {
|
|
85
|
+
console.log(` Parameters: ${Object.keys(tool.inputSchema.properties).join(', ')}`);
|
|
86
|
+
}
|
|
87
|
+
console.log('');
|
|
88
|
+
}
|
|
89
|
+
// Save tools to JSON file
|
|
90
|
+
const assetsDir = join(__dirname, '..', 'assets');
|
|
91
|
+
const toolsPath = join(assetsDir, 'tools.json');
|
|
92
|
+
try {
|
|
93
|
+
mkdirSync(assetsDir, { recursive: true });
|
|
94
|
+
writeFileSync(toolsPath, JSON.stringify(tools, null, 2));
|
|
95
|
+
console.log(`\n✓ Tools saved to ${toolsPath}`);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error(`\n✗ Failed to save tools: ${error}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function listPrompts(manager) {
|
|
102
|
+
const prompts = await manager.getAllPrompts();
|
|
103
|
+
console.log(`Found ${prompts.length} prompts:\n`);
|
|
104
|
+
for (const prompt of prompts) {
|
|
105
|
+
console.log(`💬 ${prompt.serverName} / ${prompt.name}`);
|
|
106
|
+
console.log(` ${prompt.description}`);
|
|
107
|
+
if (prompt.arguments && prompt.arguments.length > 0) {
|
|
108
|
+
console.log(` Arguments: ${prompt.arguments.map((a) => a.name).join(', ')}`);
|
|
109
|
+
}
|
|
110
|
+
console.log('');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function listResources(manager) {
|
|
114
|
+
const resources = await manager.getAllResources();
|
|
115
|
+
console.log(`Found ${resources.length} resources:\n`);
|
|
116
|
+
for (const resource of resources) {
|
|
117
|
+
console.log(`📄 ${resource.serverName} / ${resource.name}`);
|
|
118
|
+
console.log(` URI: ${resource.uri}`);
|
|
119
|
+
if (resource.description) {
|
|
120
|
+
console.log(` ${resource.description}`);
|
|
121
|
+
}
|
|
122
|
+
if (resource.mimeType) {
|
|
123
|
+
console.log(` Type: ${resource.mimeType}`);
|
|
124
|
+
}
|
|
125
|
+
console.log('');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async function callTool(manager, serverName, toolName, argsJson) {
|
|
129
|
+
if (!serverName || !toolName || !argsJson) {
|
|
130
|
+
console.error('Usage: cli.ts call-tool <server> <tool> <json-args>');
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
const args = JSON.parse(argsJson);
|
|
134
|
+
console.log(`Calling ${serverName}/${toolName}...`);
|
|
135
|
+
const result = await manager.callTool(serverName, toolName, args);
|
|
136
|
+
console.log('\nResult:');
|
|
137
|
+
console.log(JSON.stringify(result, null, 2));
|
|
138
|
+
}
|
|
139
|
+
function printUsage() {
|
|
140
|
+
console.log(`
|
|
141
|
+
MCP Management CLI
|
|
142
|
+
|
|
143
|
+
Usage:
|
|
144
|
+
cli.ts <command> [options]
|
|
145
|
+
|
|
146
|
+
Commands:
|
|
147
|
+
list-tools List all tools and save to assets/tools.json
|
|
148
|
+
list-prompts List all prompts from all MCP servers
|
|
149
|
+
list-resources List all resources from all MCP servers
|
|
150
|
+
call-tool <server> <tool> <json> Call a specific tool
|
|
151
|
+
|
|
152
|
+
Examples:
|
|
153
|
+
cli.ts list-tools
|
|
154
|
+
cli.ts call-tool memory create_entities '{"entities":[{"name":"Alice","entityType":"person"}]}'
|
|
155
|
+
cli.ts call-tool human-mcp playwright_screenshot_fullpage '{"url":"https://example.com"}'
|
|
156
|
+
|
|
157
|
+
Note: Tool analysis is done by the LLM reading assets/tools.json directly.
|
|
158
|
+
`);
|
|
159
|
+
}
|
|
160
|
+
main();
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MCP Client - Core client for interacting with MCP servers
|
|
4
|
+
*/
|
|
5
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
6
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
7
|
+
import { readFile } from 'fs/promises';
|
|
8
|
+
import { resolve } from 'path';
|
|
9
|
+
export class MCPClientManager {
|
|
10
|
+
config = null;
|
|
11
|
+
clients = new Map();
|
|
12
|
+
transports = new Map();
|
|
13
|
+
async loadConfig(configPath = '.claude/.mcp.json') {
|
|
14
|
+
const fullPath = resolve(process.cwd(), configPath);
|
|
15
|
+
const content = await readFile(fullPath, 'utf-8');
|
|
16
|
+
const config = JSON.parse(content);
|
|
17
|
+
this.config = config;
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
async connectToServer(serverName) {
|
|
21
|
+
if (!this.config?.mcpServers[serverName]) {
|
|
22
|
+
throw new Error(`Server ${serverName} not found in config`);
|
|
23
|
+
}
|
|
24
|
+
const serverConfig = this.config.mcpServers[serverName];
|
|
25
|
+
const transport = new StdioClientTransport({
|
|
26
|
+
command: serverConfig.command,
|
|
27
|
+
args: serverConfig.args,
|
|
28
|
+
env: serverConfig.env
|
|
29
|
+
});
|
|
30
|
+
const client = new Client({
|
|
31
|
+
name: `mcp-manager-${serverName}`,
|
|
32
|
+
version: '1.0.0'
|
|
33
|
+
}, { capabilities: {} });
|
|
34
|
+
await client.connect(transport);
|
|
35
|
+
this.clients.set(serverName, client);
|
|
36
|
+
this.transports.set(serverName, transport); // Track transport!
|
|
37
|
+
return client;
|
|
38
|
+
}
|
|
39
|
+
async connectAll() {
|
|
40
|
+
if (!this.config) {
|
|
41
|
+
throw new Error('Config not loaded. Call loadConfig() first.');
|
|
42
|
+
}
|
|
43
|
+
const serverNames = Object.keys(this.config.mcpServers);
|
|
44
|
+
console.log(`Connecting to ${serverNames.length} servers sequentially...`);
|
|
45
|
+
for (const serverName of serverNames) {
|
|
46
|
+
try {
|
|
47
|
+
await this.connectToServer(serverName);
|
|
48
|
+
console.log(`✓ ${serverName} connected`);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error(`✗ ${serverName} failed:`, error);
|
|
52
|
+
// Continue with other servers
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async getAllTools() {
|
|
57
|
+
const allTools = [];
|
|
58
|
+
for (const [serverName, client] of this.clients.entries()) {
|
|
59
|
+
try {
|
|
60
|
+
const response = await client.listTools({}, { timeout: 300000 });
|
|
61
|
+
for (const tool of response.tools) {
|
|
62
|
+
allTools.push({
|
|
63
|
+
serverName,
|
|
64
|
+
name: tool.name,
|
|
65
|
+
description: tool.description || '',
|
|
66
|
+
inputSchema: tool.inputSchema,
|
|
67
|
+
outputSchema: tool.outputSchema
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (error?.code === -32601) {
|
|
73
|
+
console.warn(`${serverName} does not support listTools`);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.error(`Error from ${serverName}:`, error);
|
|
77
|
+
}
|
|
78
|
+
// Continue with other servers!
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return allTools;
|
|
82
|
+
}
|
|
83
|
+
async getAllPrompts() {
|
|
84
|
+
const allPrompts = [];
|
|
85
|
+
for (const [serverName, client] of this.clients.entries()) {
|
|
86
|
+
try {
|
|
87
|
+
const response = await client.listPrompts({}, { timeout: 300000 });
|
|
88
|
+
for (const prompt of response.prompts) {
|
|
89
|
+
allPrompts.push({
|
|
90
|
+
serverName,
|
|
91
|
+
name: prompt.name,
|
|
92
|
+
description: prompt.description || '',
|
|
93
|
+
arguments: prompt.arguments
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (error?.code === -32601) {
|
|
99
|
+
console.warn(`${serverName} does not support listPrompts`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
console.error(`Error from ${serverName}:`, error);
|
|
103
|
+
}
|
|
104
|
+
// Continue with other servers!
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return allPrompts;
|
|
108
|
+
}
|
|
109
|
+
async getAllResources() {
|
|
110
|
+
const allResources = [];
|
|
111
|
+
for (const [serverName, client] of this.clients.entries()) {
|
|
112
|
+
try {
|
|
113
|
+
const response = await client.listResources({}, { timeout: 300000 });
|
|
114
|
+
for (const resource of response.resources) {
|
|
115
|
+
allResources.push({
|
|
116
|
+
serverName,
|
|
117
|
+
uri: resource.uri,
|
|
118
|
+
name: resource.name,
|
|
119
|
+
description: resource.description,
|
|
120
|
+
mimeType: resource.mimeType
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
if (error?.code === -32601) {
|
|
126
|
+
console.warn(`${serverName} does not support listResources`);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
console.error(`Error from ${serverName}:`, error);
|
|
130
|
+
}
|
|
131
|
+
// Continue with other servers!
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return allResources;
|
|
135
|
+
}
|
|
136
|
+
async callTool(serverName, toolName, args) {
|
|
137
|
+
const client = this.clients.get(serverName);
|
|
138
|
+
if (!client)
|
|
139
|
+
throw new Error(`Not connected to server: ${serverName}`);
|
|
140
|
+
return await client.callTool({ name: toolName, arguments: args }, undefined, { timeout: 300000 });
|
|
141
|
+
}
|
|
142
|
+
async getPrompt(serverName, promptName, args) {
|
|
143
|
+
const client = this.clients.get(serverName);
|
|
144
|
+
if (!client)
|
|
145
|
+
throw new Error(`Not connected to server: ${serverName}`);
|
|
146
|
+
return await client.getPrompt({ name: promptName, arguments: args }, { timeout: 300000 });
|
|
147
|
+
}
|
|
148
|
+
async readResource(serverName, uri) {
|
|
149
|
+
const client = this.clients.get(serverName);
|
|
150
|
+
if (!client)
|
|
151
|
+
throw new Error(`Not connected to server: ${serverName}`);
|
|
152
|
+
return await client.readResource({ uri }, { timeout: 300000 });
|
|
153
|
+
}
|
|
154
|
+
async cleanup() {
|
|
155
|
+
// Close clients with timeout
|
|
156
|
+
const cleanupPromises = [];
|
|
157
|
+
for (const [serverName, client] of this.clients.entries()) {
|
|
158
|
+
cleanupPromises.push((async () => {
|
|
159
|
+
try {
|
|
160
|
+
await client.close();
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.warn(`Warning closing ${serverName}:`, error);
|
|
164
|
+
}
|
|
165
|
+
})());
|
|
166
|
+
}
|
|
167
|
+
await Promise.race([
|
|
168
|
+
Promise.all(cleanupPromises),
|
|
169
|
+
new Promise((resolve) => setTimeout(resolve, 5000))
|
|
170
|
+
]);
|
|
171
|
+
// CRITICAL: Close transports to kill subprocesses
|
|
172
|
+
for (const [serverName, transport] of this.transports.entries()) {
|
|
173
|
+
try {
|
|
174
|
+
await transport.close();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
console.warn(`Warning closing ${serverName} transport:`, error);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
this.clients.clear();
|
|
181
|
+
this.transports.clear();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# SePay Configuration
|
|
2
|
+
SEPAY_MERCHANT_ID=SP-TEST-XXXXXXX
|
|
3
|
+
SEPAY_SECRET_KEY=spsk_test_xxxxxxxxxxxxx
|
|
4
|
+
SEPAY_ENV=sandbox # or 'production'
|
|
5
|
+
|
|
6
|
+
# SePay Webhook Configuration
|
|
7
|
+
SEPAY_WEBHOOK_AUTH_TYPE=api_key # or 'oauth2' or 'none'
|
|
8
|
+
SEPAY_WEBHOOK_API_KEY=your_webhook_api_key
|
|
9
|
+
|
|
10
|
+
# Polar Configuration
|
|
11
|
+
POLAR_ACCESS_TOKEN=polar_xxxxxxxxxxxxxxxx
|
|
12
|
+
POLAR_SERVER=sandbox # or 'production'
|
|
13
|
+
POLAR_ORG_ID=org_xxxxxxxxxxxxx
|
|
14
|
+
|
|
15
|
+
# Polar Webhook Configuration
|
|
16
|
+
POLAR_WEBHOOK_SECRET=base64_encoded_secret
|
|
17
|
+
|
|
18
|
+
# Optional: Database or other configuration
|
|
19
|
+
# DATABASE_URL=postgresql://user:password@localhost:5432/dbname
|
|
20
|
+
# REDIS_URL=redis://localhost:6379
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Sequential Thinking Configuration
|
|
2
|
+
|
|
3
|
+
# Disable thought logging output (useful for automated processing)
|
|
4
|
+
# Set to "true" to disable console logging
|
|
5
|
+
DISABLE_THOUGHT_LOGGING=false
|
|
6
|
+
|
|
7
|
+
# History file location (optional, defaults to scripts/.thought-history.json)
|
|
8
|
+
# THOUGHT_HISTORY_FILE=/path/to/custom/history.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.13.14] - 2026-04-24
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **DB CLI run multi-statement**: PostgreSQL `ppm db run` now splits SQL into individual statements and executes within `sql.begin()` transaction. Handles strings, comments, dollar-quoting. Strips user-supplied `BEGIN`/`COMMIT`/`ROLLBACK` to avoid conflicts with managed transaction
|
|
7
|
+
|
|
8
|
+
## [0.13.13] - 2026-04-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **DB CLI run command**: `ppm db run <name> <file.sql>` executes SQL files against saved connections. Supports multi-statement files and transactions (`BEGIN...COMMIT`). Respects readonly flag. Works with both SQLite (`db.exec()`) and PostgreSQL
|
|
12
|
+
|
|
3
13
|
## [0.13.12] - 2026-04-24
|
|
4
14
|
|
|
5
15
|
### Fixed
|
|
@@ -71,4 +71,4 @@ This skill covers the `ppm` CLI, its HTTP API, and its config DB. It does **not*
|
|
|
71
71
|
- Third-party extensions (inspect via `ppm ext list`).
|
|
72
72
|
- The Claude Agent SDK internals (separate skill).
|
|
73
73
|
|
|
74
|
-
<!-- Generated for PPM v0.13.
|
|
74
|
+
<!-- Generated for PPM v0.13.14 at build time. Re-run `ppm export skill --install` to refresh. -->
|
|
@@ -211,6 +211,26 @@ List all registered devices from cloud
|
|
|
211
211
|
**Options:**
|
|
212
212
|
- `--json` — Output as JSON
|
|
213
213
|
|
|
214
|
+
### `ppm cloud alias`
|
|
215
|
+
|
|
216
|
+
Manage machine alias (vanity URL slug)
|
|
217
|
+
|
|
218
|
+
**Usage:** `ppm cloud alias [options] [command]`
|
|
219
|
+
|
|
220
|
+
#### `ppm cloud alias set`
|
|
221
|
+
|
|
222
|
+
Set alias for this machine (e.g. ppm cloud alias set macbook)
|
|
223
|
+
|
|
224
|
+
**Usage:** `ppm cloud alias set [options] <slug>`
|
|
225
|
+
|
|
226
|
+
#### `ppm cloud alias get`
|
|
227
|
+
|
|
228
|
+
Show current alias for this machine
|
|
229
|
+
|
|
230
|
+
#### `ppm cloud alias remove`
|
|
231
|
+
|
|
232
|
+
Remove alias for this machine
|
|
233
|
+
|
|
214
234
|
## `ppm config`
|
|
215
235
|
|
|
216
236
|
Get or set PPM configuration
|
|
@@ -297,6 +317,12 @@ Execute a SQL query against a saved connection
|
|
|
297
317
|
|
|
298
318
|
**Usage:** `ppm db query [options] <name> <sql>`
|
|
299
319
|
|
|
320
|
+
### `ppm db run`
|
|
321
|
+
|
|
322
|
+
Execute a SQL file against a saved connection
|
|
323
|
+
|
|
324
|
+
**Usage:** `ppm db run [options] <name> <file>`
|
|
325
|
+
|
|
300
326
|
## `ppm down`
|
|
301
327
|
|
|
302
328
|
Fully shut down PPM (supervisor + server + tunnel)
|
|
@@ -663,7 +689,7 @@ Restart the server (keeps tunnel alive)
|
|
|
663
689
|
Manage and inspect discovered skills & commands
|
|
664
690
|
|
|
665
691
|
**Options:**
|
|
666
|
-
- `--project <path>` — Project path (default: `"/
|
|
692
|
+
- `--project <path>` — Project path (default: `"/home/hienlh/Projects/ppm"`)
|
|
667
693
|
|
|
668
694
|
**Usage:** `ppm skills [options] [command]`
|
|
669
695
|
|
|
@@ -673,7 +699,7 @@ List all discovered skills and commands
|
|
|
673
699
|
|
|
674
700
|
**Options:**
|
|
675
701
|
- `--json` — JSON output
|
|
676
|
-
- `--project <path>` — Project path (default: `"/
|
|
702
|
+
- `--project <path>` — Project path (default: `"/home/hienlh/Projects/ppm"`)
|
|
677
703
|
|
|
678
704
|
### `ppm skills search`
|
|
679
705
|
|
|
@@ -681,7 +707,7 @@ Fuzzy search skills and commands
|
|
|
681
707
|
|
|
682
708
|
**Options:**
|
|
683
709
|
- `--json` — JSON output
|
|
684
|
-
- `--project <path>` — Project path (default: `"/
|
|
710
|
+
- `--project <path>` — Project path (default: `"/home/hienlh/Projects/ppm"`)
|
|
685
711
|
|
|
686
712
|
**Usage:** `ppm skills search [options] <query>`
|
|
687
713
|
|
|
@@ -691,7 +717,7 @@ Show detailed info for a specific skill
|
|
|
691
717
|
|
|
692
718
|
**Options:**
|
|
693
719
|
- `--json` — JSON output
|
|
694
|
-
- `--project <path>` — Project path (default: `"/
|
|
720
|
+
- `--project <path>` — Project path (default: `"/home/hienlh/Projects/ppm"`)
|
|
695
721
|
|
|
696
722
|
**Usage:** `ppm skills info [options] <name>`
|
|
697
723
|
|
|
@@ -201,4 +201,4 @@ _Base URL: `http://localhost:8080` (default; override via `ppm config set port <
|
|
|
201
201
|
- `ws://<host>/ws/terminal` — PTY terminal multiplexer
|
|
202
202
|
- `ws://<host>/ws/extensions` — extension host channel
|
|
203
203
|
|
|
204
|
-
<!-- Generated from src/server/routes/ for PPM v0.13.
|
|
204
|
+
<!-- Generated from src/server/routes/ for PPM v0.13.14 -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{D as r,_ as i,b as a,c as o,d as s,f as c,g as l,h as u,m as d,p as f,s as p,u as m,v as h,x as g,y as _}from"./vendor-ui-B-89Uj8i.js";import{t as v}from"./createLucideIcon-BjHrJDVb.js";import{i as y}from"./dist-CaKCIxem.js";import{t as b}from"./input-ozrR2DAV.js";import{n as x}from"./x-CG-_0yIW.js";import{t as S}from"./refresh-cw-LlbZDJpO.js";import{i as C,t as w}from"./api-client-Dvzcc_EO.js";import{n as T}from"./utils-CTg5uAYR.js";import{a as E,h as D}from"./api-settings-D0_eiIYv.js";var O=v(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),k=v(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),A=v(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),j=v(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),M=v(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),N=v(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),P=v(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),F=e(n(),1),I=t();function L({className:e,...t}){return(0,I.jsx)(r,{"data-slot":`label`,className:T(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var R=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(p,{className:T(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,I.jsx)(o,{className:T(`pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));R.displayName=p.displayName;function z({...e}){return(0,I.jsx)(l,{"data-slot":`select`,...e})}function B({...e}){return(0,I.jsx)(a,{"data-slot":`select-value`,...e})}function V({className:e,size:t=`default`,children:n,...r}){return(0,I.jsxs)(_,{"data-slot":`select-trigger`,"data-size":t,className:T(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,I.jsx)(s,{asChild:!0,children:(0,I.jsx)(j,{className:`size-4 opacity-50`})})]})}function H({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,I.jsx)(u,{children:(0,I.jsxs)(m,{"data-slot":`select-content`,className:T(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,I.jsx)(W,{}),(0,I.jsx)(g,{className:T(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,I.jsx)(G,{})]})})}function U({className:e,children:t,...n}){return(0,I.jsxs)(c,{"data-slot":`select-item`,className:T(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,I.jsx)(f,{children:(0,I.jsx)(y,{className:`size-4`})})}),(0,I.jsx)(d,{children:t})]})}function W({className:e,...t}){return(0,I.jsx)(h,{"data-slot":`select-scroll-up-button`,className:T(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(M,{className:`size-4`})})}function G({className:e,...t}){return(0,I.jsx)(i,{"data-slot":`select-scroll-down-button`,className:T(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(j,{className:`size-4`})})}var K={claude:`C`,cursor:`▶`,codex:`◆`,gemini:`G`};function q({value:e,onChange:t,projectName:n}){let[r,i]=(0,F.useState)([]),[a,o]=(0,F.useState)(!1),s=(0,F.useRef)(null),c=(0,F.useRef)(0);(0,F.useEffect)(()=>{n&&w.get(`${C(n)}/chat/providers`).then(i).catch(()=>{})},[n]),(0,F.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,F.useEffect)(()=>{a&&(c.current=Math.max(0,r.findIndex(t=>t.id===e)))},[a,e,r]);let l=(0,F.useCallback)(e=>{if(e.key===`Escape`){o(!1);return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;c.current=(c.current+t+r.length)%r.length,(s.current?.querySelector(`[data-idx="${c.current}"]`))?.focus()}if(e.key===`Enter`){e.preventDefault();let n=r[c.current];n&&(t(n.id),o(!1))}},[t,r]);if(r.length<=1)return null;let u=r.find(t=>t.id===e),d=K[e]||`?`;return(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o(e=>!e)},className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[11px] text-text-subtle hover:text-text-primary hover:bg-surface-elevated transition-colors border border-transparent hover:border-border`,"aria-label":`AI Provider: ${u?.name??e}`,children:[(0,I.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 items-center justify-center rounded text-[9px] font-bold bg-surface-elevated shrink-0`,children:d}),(0,I.jsx)(`span`,{className:`max-w-[80px] truncate capitalize`,children:u?.name??e})]}),a&&(0,I.jsxs)(`div`,{ref:s,role:`listbox`,"aria-label":`AI Providers`,onKeyDown:l,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`absolute bottom-full left-0 mb-1 z-50 w-56 rounded-lg border border-border bg-surface shadow-lg`,children:[(0,I.jsx)(`div`,{className:`px-3 py-2 border-b border-border`,children:(0,I.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Provider`})}),(0,I.jsx)(`div`,{className:`py-1`,children:r.map((n,r)=>{let i=K[n.id]||`?`,a=n.id===e;return(0,I.jsxs)(`button`,{"data-idx":r,role:`option`,"aria-selected":a,tabIndex:0,onClick:()=>{t(n.id),o(!1)},className:`w-full flex items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-surface-elevated focus:bg-surface-elevated focus:outline-none ${a?`bg-surface-elevated`:``}`,children:[(0,I.jsx)(`span`,{className:`inline-flex h-5 w-5 items-center justify-center rounded text-[11px] font-bold bg-surface-elevated text-text-subtle shrink-0`,children:i}),(0,I.jsx)(`span`,{className:`flex-1 text-sm font-medium text-text-primary capitalize`,children:n.name}),a&&(0,I.jsx)(y,{className:`size-4 shrink-0 text-primary`})]},n.id)})})]})]})}function J({providerId:e}){return(0,I.jsx)(`span`,{className:`inline-flex h-4 w-4 items-center justify-center rounded text-[10px] font-bold bg-surface-elevated text-text-subtle shrink-0`,title:e,children:K[e]||`?`})}var Y=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}],X=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],Z={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function Q({compact:e}={}){let[t,n]=(0,F.useState)(null),[r,i]=(0,F.useState)(``),[a,o]=(0,F.useState)([]),[s,c]=(0,F.useState)(!1),[l,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)(null),[p,m]=(0,F.useState)(0);(0,F.useEffect)(()=>{E().then(e=>{n(e),i(e.default_provider??`claude`)}).catch(e=>f(e.message))},[]),(0,F.useEffect)(()=>{r&&(c(!0),w.get(`/api/settings/ai/providers/${r}/models`).then(o).catch(()=>o([])).finally(()=>c(!1)))},[r]);let h=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:Z[e]??e})):[],g=t?.providers[r],_=g?.type===`agent-sdk`||!g?.type&&r===`claude`,v=async(e,i)=>{if(t){u(!0),f(null);try{n(await D({providers:{[r]:{[e]:i}}})),m(e=>e+1)}catch(e){f(e.message)}finally{u(!1)}}},y=e?`text-[11px]`:`text-sm`,x=e?`text-xs`:`text-sm`,S=e?`space-y-2`:`space-y-4`,C=e?`space-y-1.5`:`space-y-3`,T=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,I.jsxs)(`div`,{className:C,children:[(0,I.jsx)(`h3`,{className:`${x} font-medium text-text-secondary`,children:`AI Settings`}),(0,I.jsx)(`p`,{className:`${y} text-text-subtle`,children:d?`Error: ${d}`:`Loading...`})]});let O=_?a:[{value:`__default__`,label:`Auto (default)`},...a];return(0,I.jsxs)(`div`,{className:S,children:[(0,I.jsx)(`h3`,{className:`${x} font-medium text-text-secondary`,children:`AI Settings`}),h.length>1&&(0,I.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:h.map(e=>(0,I.jsxs)(`button`,{onClick:()=>i(e.id),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-t transition-colors ${r===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,I.jsx)(J,{providerId:e.id}),(0,I.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,I.jsxs)(`div`,{className:C,children:[a.length>0&&(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-model`,className:e?y:void 0,children:`Model`}),(0,I.jsxs)(z,{value:_?g?.model??a[0]?.value:g?.model||`__default__`,onValueChange:e=>v(`model`,e===`__default__`?void 0:e),disabled:s,children:[(0,I.jsx)(V,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(B,{placeholder:s?`Loading models...`:`Select model`})}),(0,I.jsx)(H,{className:`max-h-[300px]`,children:O.map(e=>(0,I.jsx)(U,{value:e.value,children:e.label},e.value))})]})]}),_&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-base-url`,className:e?y:void 0,children:`Base URL`}),(0,I.jsx)(b,{id:`ai-base-url`,type:`url`,defaultValue:g?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{v(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${p}`)]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-api-key`,className:e?y:void 0,children:`API Key / Token`}),(0,I.jsx)(b,{id:`ai-api-key`,type:`password`,defaultValue:g?.api_key??``,placeholder:`sk-ant-... (optional, overrides accounts)`,className:e?`h-7 text-[11px] font-mono`:`font-mono`,onBlur:e=>{let t=e.target.value.trim();t.startsWith(`••••`)||v(`api_key`,t||void 0)}},`apikey-${r}-${p}`),(0,I.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Direct API key or OAuth token. Leave empty to use connected accounts.`})]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-effort`,className:e?y:void 0,children:`Effort`}),(0,I.jsxs)(z,{value:g?.effort??`high`,onValueChange:e=>v(`effort`,e),children:[(0,I.jsx)(V,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(B,{})}),(0,I.jsx)(H,{children:Y.map(e=>(0,I.jsx)(U,{value:e.value,children:e.label},e.value))})]})]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-max-turns`,className:e?y:void 0,children:`Max Turns (1-500)`}),(0,I.jsx)(b,{id:`ai-max-turns`,type:`number`,min:1,max:500,defaultValue:g?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);isNaN(t)||v(`max_turns`,t)}},`turns-${r}-${p}`)]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-budget`,className:e?y:void 0,children:`Max Budget (USD)`}),(0,I.jsx)(b,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:g?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);v(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${p}`)]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-thinking`,className:e?y:void 0,children:`Thinking Budget (tokens)`}),(0,I.jsx)(b,{id:`ai-thinking`,type:`number`,min:0,defaultValue:g?.thinking_budget_tokens??``,placeholder:`Disabled`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);v(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${p}`)]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(L,{htmlFor:`ai-agent-teams`,className:e?y:void 0,children:`Agent Teams`}),(0,I.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Experimental. Enables multi-agent collaboration with shared tasks and messaging. Uses ~7x more tokens.`})]}),(0,I.jsx)(R,{id:`ai-agent-teams`,checked:g?.agent_teams??!1,onCheckedChange:e=>v(`agent_teams`,e)})]}),g?.agent_teams&&(0,I.jsx)($,{compact:e})]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-permission-mode`,className:e?y:void 0,children:`Default Permission Mode`}),(0,I.jsxs)(z,{value:g?.permission_mode??`bypassPermissions`,onValueChange:e=>v(`permission_mode`,e),children:[(0,I.jsx)(V,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(B,{})}),(0,I.jsx)(H,{children:X.map(e=>(0,I.jsx)(U,{value:e.value,children:e.label},e.value))})]})]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-system-prompt`,className:e?y:void 0,children:`Additional Instructions`}),(0,I.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:g?.system_prompt??``,placeholder:`Enter additional instructions for ${r}...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{v(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${p}`)]})]}),l&&(0,I.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),d&&(0,I.jsx)(`p`,{className:`text-xs text-red-500`,children:d})]})}function $({compact:e}){let[t,n]=(0,F.useState)([]),[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(null),s=(0,F.useCallback)(async()=>{i(!0);try{n(await w.get(`/api/teams`)??[])}catch{}i(!1)},[]);(0,F.useEffect)(()=>{s()},[s]);let c=async e=>{try{await w.del(`/api/teams/${encodeURIComponent(e)}`),n(t=>t.filter(t=>t.name!==e)),o(null)}catch{}};return t.length===0&&!r?null:(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(L,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,I.jsx)(`button`,{onClick:s,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,I.jsx)(S,{className:`size-3 ${r?`animate-spin`:``}`})})]}),t.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,I.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,I.jsxs)(`div`,{className:`text-text-subtle`,children:[e.members?.length??e.memberCount??0,` members`,e.createdAt?` · ${new Date(e.createdAt).toLocaleDateString()}`:``]})]}),a===e.name?(0,I.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,I.jsx)(`button`,{onClick:()=>c(e.name),className:`px-2 py-1 bg-red-600 text-white rounded text-[10px]`,children:`Delete`}),(0,I.jsx)(`button`,{onClick:()=>o(null),className:`px-2 py-1 bg-zinc-600 text-white rounded text-[10px]`,children:`Cancel`})]}):(0,I.jsx)(`button`,{onClick:()=>o(e.name),className:`shrink-0 text-text-subtle hover:text-red-500 p-1 ml-2`,"aria-label":`Delete team ${e.name}`,children:(0,I.jsx)(x,{className:`size-3.5`})})]},e.name))]})}export{O as _,H as a,B as c,P as d,N as f,k as g,A as h,z as i,R as l,j as m,J as n,U as o,M as p,q as r,V as s,Q as t,L as u};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{D as r,_ as i,b as a,c as o,d as s,f as c,g as l,h as u,m as d,p as f,s as p,u as m,v as h,x as g,y as _}from"./vendor-ui-B-89Uj8i.js";import{t as v}from"./createLucideIcon-BjHrJDVb.js";import{i as y}from"./dist-CaKCIxem.js";import{t as b}from"./input-4ll___Gh.js";import{n as x}from"./x-BPReZWnP.js";import{t as S}from"./refresh-cw-BjrAbUJe.js";import{i as C,t as w}from"./api-client-DIhJ5qVW.js";import{n as T}from"./utils-CQux7CsO.js";import{a as E,h as D}from"./api-settings-DowGyuVy.js";var O=v(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),k=v(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),A=v(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),j=v(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),M=v(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),N=v(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),P=v(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),F=e(n(),1),I=t();function L({className:e,...t}){return(0,I.jsx)(r,{"data-slot":`label`,className:T(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var R=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(p,{className:T(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,I.jsx)(o,{className:T(`pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));R.displayName=p.displayName;function z({...e}){return(0,I.jsx)(l,{"data-slot":`select`,...e})}function B({...e}){return(0,I.jsx)(a,{"data-slot":`select-value`,...e})}function V({className:e,size:t=`default`,children:n,...r}){return(0,I.jsxs)(_,{"data-slot":`select-trigger`,"data-size":t,className:T(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,I.jsx)(s,{asChild:!0,children:(0,I.jsx)(j,{className:`size-4 opacity-50`})})]})}function H({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,I.jsx)(u,{children:(0,I.jsxs)(m,{"data-slot":`select-content`,className:T(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,I.jsx)(W,{}),(0,I.jsx)(g,{className:T(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,I.jsx)(G,{})]})})}function U({className:e,children:t,...n}){return(0,I.jsxs)(c,{"data-slot":`select-item`,className:T(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,I.jsx)(f,{children:(0,I.jsx)(y,{className:`size-4`})})}),(0,I.jsx)(d,{children:t})]})}function W({className:e,...t}){return(0,I.jsx)(h,{"data-slot":`select-scroll-up-button`,className:T(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(M,{className:`size-4`})})}function G({className:e,...t}){return(0,I.jsx)(i,{"data-slot":`select-scroll-down-button`,className:T(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(j,{className:`size-4`})})}var K={claude:`C`,cursor:`▶`,codex:`◆`,gemini:`G`};function q({value:e,onChange:t,projectName:n}){let[r,i]=(0,F.useState)([]),[a,o]=(0,F.useState)(!1),s=(0,F.useRef)(null),c=(0,F.useRef)(0);(0,F.useEffect)(()=>{n&&w.get(`${C(n)}/chat/providers`).then(i).catch(()=>{})},[n]),(0,F.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,F.useEffect)(()=>{a&&(c.current=Math.max(0,r.findIndex(t=>t.id===e)))},[a,e,r]);let l=(0,F.useCallback)(e=>{if(e.key===`Escape`){o(!1);return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;c.current=(c.current+t+r.length)%r.length,(s.current?.querySelector(`[data-idx="${c.current}"]`))?.focus()}if(e.key===`Enter`){e.preventDefault();let n=r[c.current];n&&(t(n.id),o(!1))}},[t,r]);if(r.length<=1)return null;let u=r.find(t=>t.id===e),d=K[e]||`?`;return(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o(e=>!e)},className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[11px] text-text-subtle hover:text-text-primary hover:bg-surface-elevated transition-colors border border-transparent hover:border-border`,"aria-label":`AI Provider: ${u?.name??e}`,children:[(0,I.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 items-center justify-center rounded text-[9px] font-bold bg-surface-elevated shrink-0`,children:d}),(0,I.jsx)(`span`,{className:`max-w-[80px] truncate capitalize`,children:u?.name??e})]}),a&&(0,I.jsxs)(`div`,{ref:s,role:`listbox`,"aria-label":`AI Providers`,onKeyDown:l,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`absolute bottom-full left-0 mb-1 z-50 w-56 rounded-lg border border-border bg-surface shadow-lg`,children:[(0,I.jsx)(`div`,{className:`px-3 py-2 border-b border-border`,children:(0,I.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Provider`})}),(0,I.jsx)(`div`,{className:`py-1`,children:r.map((n,r)=>{let i=K[n.id]||`?`,a=n.id===e;return(0,I.jsxs)(`button`,{"data-idx":r,role:`option`,"aria-selected":a,tabIndex:0,onClick:()=>{t(n.id),o(!1)},className:`w-full flex items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-surface-elevated focus:bg-surface-elevated focus:outline-none ${a?`bg-surface-elevated`:``}`,children:[(0,I.jsx)(`span`,{className:`inline-flex h-5 w-5 items-center justify-center rounded text-[11px] font-bold bg-surface-elevated text-text-subtle shrink-0`,children:i}),(0,I.jsx)(`span`,{className:`flex-1 text-sm font-medium text-text-primary capitalize`,children:n.name}),a&&(0,I.jsx)(y,{className:`size-4 shrink-0 text-primary`})]},n.id)})})]})]})}function J({providerId:e}){return(0,I.jsx)(`span`,{className:`inline-flex h-4 w-4 items-center justify-center rounded text-[10px] font-bold bg-surface-elevated text-text-subtle shrink-0`,title:e,children:K[e]||`?`})}var Y=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}],X=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],Z={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function Q({compact:e}={}){let[t,n]=(0,F.useState)(null),[r,i]=(0,F.useState)(``),[a,o]=(0,F.useState)([]),[s,c]=(0,F.useState)(!1),[l,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)(null),[p,m]=(0,F.useState)(0);(0,F.useEffect)(()=>{E().then(e=>{n(e),i(e.default_provider??`claude`)}).catch(e=>f(e.message))},[]),(0,F.useEffect)(()=>{r&&(c(!0),w.get(`/api/settings/ai/providers/${r}/models`).then(o).catch(()=>o([])).finally(()=>c(!1)))},[r]);let h=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:Z[e]??e})):[],g=t?.providers[r],_=g?.type===`agent-sdk`||!g?.type&&r===`claude`,v=async(e,i)=>{if(t){u(!0),f(null);try{n(await D({providers:{[r]:{[e]:i}}})),m(e=>e+1)}catch(e){f(e.message)}finally{u(!1)}}},y=e?`text-[11px]`:`text-sm`,x=e?`text-xs`:`text-sm`,S=e?`space-y-2`:`space-y-4`,C=e?`space-y-1.5`:`space-y-3`,T=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,I.jsxs)(`div`,{className:C,children:[(0,I.jsx)(`h3`,{className:`${x} font-medium text-text-secondary`,children:`AI Settings`}),(0,I.jsx)(`p`,{className:`${y} text-text-subtle`,children:d?`Error: ${d}`:`Loading...`})]});let O=_?a:[{value:`__default__`,label:`Auto (default)`},...a];return(0,I.jsxs)(`div`,{className:S,children:[(0,I.jsx)(`h3`,{className:`${x} font-medium text-text-secondary`,children:`AI Settings`}),h.length>1&&(0,I.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:h.map(e=>(0,I.jsxs)(`button`,{onClick:()=>i(e.id),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-t transition-colors ${r===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,I.jsx)(J,{providerId:e.id}),(0,I.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,I.jsxs)(`div`,{className:C,children:[a.length>0&&(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-model`,className:e?y:void 0,children:`Model`}),(0,I.jsxs)(z,{value:_?g?.model??a[0]?.value:g?.model||`__default__`,onValueChange:e=>v(`model`,e===`__default__`?void 0:e),disabled:s,children:[(0,I.jsx)(V,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(B,{placeholder:s?`Loading models...`:`Select model`})}),(0,I.jsx)(H,{className:`max-h-[300px]`,children:O.map(e=>(0,I.jsx)(U,{value:e.value,children:e.label},e.value))})]})]}),_&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-base-url`,className:e?y:void 0,children:`Base URL`}),(0,I.jsx)(b,{id:`ai-base-url`,type:`url`,defaultValue:g?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{v(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${p}`)]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-api-key`,className:e?y:void 0,children:`API Key / Token`}),(0,I.jsx)(b,{id:`ai-api-key`,type:`password`,defaultValue:g?.api_key??``,placeholder:`sk-ant-... (optional, overrides accounts)`,className:e?`h-7 text-[11px] font-mono`:`font-mono`,onBlur:e=>{let t=e.target.value.trim();t.startsWith(`••••`)||v(`api_key`,t||void 0)}},`apikey-${r}-${p}`),(0,I.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Direct API key or OAuth token. Leave empty to use connected accounts.`})]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-effort`,className:e?y:void 0,children:`Effort`}),(0,I.jsxs)(z,{value:g?.effort??`high`,onValueChange:e=>v(`effort`,e),children:[(0,I.jsx)(V,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(B,{})}),(0,I.jsx)(H,{children:Y.map(e=>(0,I.jsx)(U,{value:e.value,children:e.label},e.value))})]})]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-max-turns`,className:e?y:void 0,children:`Max Turns (1-500)`}),(0,I.jsx)(b,{id:`ai-max-turns`,type:`number`,min:1,max:500,defaultValue:g?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);isNaN(t)||v(`max_turns`,t)}},`turns-${r}-${p}`)]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-budget`,className:e?y:void 0,children:`Max Budget (USD)`}),(0,I.jsx)(b,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:g?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);v(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${p}`)]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-thinking`,className:e?y:void 0,children:`Thinking Budget (tokens)`}),(0,I.jsx)(b,{id:`ai-thinking`,type:`number`,min:0,defaultValue:g?.thinking_budget_tokens??``,placeholder:`Disabled`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);v(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${p}`)]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(L,{htmlFor:`ai-agent-teams`,className:e?y:void 0,children:`Agent Teams`}),(0,I.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Experimental. Enables multi-agent collaboration with shared tasks and messaging. Uses ~7x more tokens.`})]}),(0,I.jsx)(R,{id:`ai-agent-teams`,checked:g?.agent_teams??!1,onCheckedChange:e=>v(`agent_teams`,e)})]}),g?.agent_teams&&(0,I.jsx)($,{compact:e})]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-permission-mode`,className:e?y:void 0,children:`Default Permission Mode`}),(0,I.jsxs)(z,{value:g?.permission_mode??`bypassPermissions`,onValueChange:e=>v(`permission_mode`,e),children:[(0,I.jsx)(V,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(B,{})}),(0,I.jsx)(H,{children:X.map(e=>(0,I.jsx)(U,{value:e.value,children:e.label},e.value))})]})]}),(0,I.jsxs)(`div`,{className:T,children:[(0,I.jsx)(L,{htmlFor:`ai-system-prompt`,className:e?y:void 0,children:`Additional Instructions`}),(0,I.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:g?.system_prompt??``,placeholder:`Enter additional instructions for ${r}...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{v(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${p}`)]})]}),l&&(0,I.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),d&&(0,I.jsx)(`p`,{className:`text-xs text-red-500`,children:d})]})}function $({compact:e}){let[t,n]=(0,F.useState)([]),[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(null),s=(0,F.useCallback)(async()=>{i(!0);try{n(await w.get(`/api/teams`)??[])}catch{}i(!1)},[]);(0,F.useEffect)(()=>{s()},[s]);let c=async e=>{try{await w.del(`/api/teams/${encodeURIComponent(e)}`),n(t=>t.filter(t=>t.name!==e)),o(null)}catch{}};return t.length===0&&!r?null:(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(L,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,I.jsx)(`button`,{onClick:s,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,I.jsx)(S,{className:`size-3 ${r?`animate-spin`:``}`})})]}),t.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,I.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,I.jsxs)(`div`,{className:`text-text-subtle`,children:[e.members?.length??e.memberCount??0,` members`,e.createdAt?` · ${new Date(e.createdAt).toLocaleDateString()}`:``]})]}),a===e.name?(0,I.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,I.jsx)(`button`,{onClick:()=>c(e.name),className:`px-2 py-1 bg-red-600 text-white rounded text-[10px]`,children:`Delete`}),(0,I.jsx)(`button`,{onClick:()=>o(null),className:`px-2 py-1 bg-zinc-600 text-white rounded text-[10px]`,children:`Cancel`})]}):(0,I.jsx)(`button`,{onClick:()=>o(e.name),className:`shrink-0 text-text-subtle hover:text-red-500 p-1 ml-2`,"aria-label":`Delete team ${e.name}`,children:(0,I.jsx)(x,{className:`size-3.5`})})]},e.name))]})}export{O as _,H as a,B as c,P as d,N as f,k as g,A as h,z as i,R as l,j as m,J as n,U as o,M as p,q as r,V as s,Q as t,L as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-FhOqtrmT.js";import{t}from"./api-client-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-FhOqtrmT.js";import{t}from"./api-client-DIhJ5qVW.js";var n=e({addAccount:()=>a,deleteAccount:()=>o,exchangeOAuthCode:()=>d,getAISettings:()=>g,getAccountSettings:()=>c,getAccounts:()=>r,getActiveAccount:()=>i,getAllAccountUsages:()=>f,getOAuthUrl:()=>u,getProxySettings:()=>v,getUsageHistory:()=>p,importAccounts:()=>m,patchAccount:()=>s,updateAISettings:()=>_,updateAccountSettings:()=>l,updateDeviceName:()=>h,updateProxySettings:()=>y});function r(){return t.get(`/api/accounts`)}function i(){return t.get(`/api/accounts/active`)}function a(e){return t.post(`/api/accounts`,e)}function o(e){return t.del(`/api/accounts/${e}`)}function s(e,n){return t.patch(`/api/accounts/${e}`,n)}function c(){return t.get(`/api/accounts/settings`)}function l(e){return t.put(`/api/accounts/settings`,e)}function u(){return t.get(`/api/accounts/oauth/url`)}function d(e,n){return t.post(`/api/accounts/oauth/exchange`,{code:e,state:n})}function f(){return t.get(`/api/accounts/usage`)}function p(e){return t.get(`/api/accounts/${e}/usage-history`)}function m(e){return t.post(`/api/accounts/import`,e)}function h(e){return t.put(`/api/settings/device-name`,{device_name:e})}function g(){return t.get(`/api/settings/ai`)}function _(e){return t.put(`/api/settings/ai`,e)}function v(){return t.get(`/api/settings/proxy`)}function y(e){return t.put(`/api/settings/proxy`,e)}export{y as _,g as a,i as c,v as d,p as f,l as g,_ as h,d as i,f as l,s as m,n,c as o,m as p,o as r,r as s,a as t,u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e}from"./vendor-mermaid-CPtQ2zua.js";export{e as createArchitectureServices};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./vendor-markdown-0Mxgxy0L.js";import{t}from"./createLucideIcon-BjHrJDVb.js";import{t as n}from"./file-exclamation-point-
|
|
1
|
+
import{b as e}from"./vendor-markdown-0Mxgxy0L.js";import{t}from"./createLucideIcon-BjHrJDVb.js";import{t as n}from"./file-exclamation-point-BwzaQ50n.js";import"./api-client-DIhJ5qVW.js";import{t as r}from"./utils-CQux7CsO.js";import{B as i}from"./index-gZKF1YKy.js";import{t as a}from"./use-blob-url-DGY5qKiT.js";var o=t(`music`,[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),s=e();function c({filePath:e,projectName:t}){let{blobUrl:c,error:l}=a(e,t);return l?(0,s.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,s.jsx)(n,{className:`size-10 text-text-subtle`}),(0,s.jsx)(`p`,{className:`text-sm`,children:`Failed to load audio.`})]}):c?(0,s.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 p-4 bg-surface`,children:[(0,s.jsx)(o,{className:`size-16 text-text-subtle`}),(0,s.jsx)(`p`,{className:`text-sm text-text-secondary truncate max-w-xs`,children:r(e)}),(0,s.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`})]}):(0,s.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,s.jsx)(i,{className:`size-5 animate-spin text-text-subtle`})})}export{c as AudioPreview};
|