@gguf/pigbot 0.0.4 → 0.0.6

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.
@@ -6,7 +6,7 @@
6
6
  <title>Moltbot Control</title>
7
7
  <meta name="color-scheme" content="dark light" />
8
8
  <link rel="icon" href="./favicon.ico" sizes="any" />
9
- <script type="module" crossorigin src="./assets/index-44XdgZT4.js"></script>
9
+ <script type="module" crossorigin src="./assets/index-CxLFx0Ae.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-BAFzd9IE.css">
11
11
  </head>
12
12
  <body>
@@ -0,0 +1,70 @@
1
+ import * as vscode from 'vscode';
2
+ import * as os from 'os';
3
+ let statusBarItem;
4
+ let terminal;
5
+ export function activate(context) {
6
+ console.log('Moltbot extension is now active');
7
+ // Create status bar item
8
+ statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100);
9
+ statusBarItem.command = 'moltbot.connect';
10
+ // statusBarItem.text = '$(plug) Moltbot - Not connected (click to connect)';
11
+ statusBarItem.text = '$(plug) Moltbot';
12
+ statusBarItem.tooltip = 'Click to connect to Moltbot';
13
+ statusBarItem.show();
14
+ context.subscriptions.push(statusBarItem);
15
+ // Register connect command
16
+ let connectCommand = vscode.commands.registerCommand('moltbot.connect', async () => {
17
+ await connect();
18
+ });
19
+ context.subscriptions.push(connectCommand);
20
+ // Check auto-connect setting
21
+ const config = vscode.workspace.getConfiguration('moltbot');
22
+ const autoConnect = config.get('autoConnect', false);
23
+ if (autoConnect) {
24
+ // Auto-connect on startup
25
+ setTimeout(() => {
26
+ connect();
27
+ }, 1000); // Small delay to ensure everything is initialized
28
+ }
29
+ // Listen for terminal close events
30
+ vscode.window.onDidCloseTerminal((closedTerminal) => {
31
+ if (terminal && closedTerminal === terminal) {
32
+ terminal = undefined;
33
+ statusBarItem.text = '$(plug) Moltbot';
34
+ statusBarItem.tooltip = 'Click to connect to Moltbot';
35
+ }
36
+ });
37
+ }
38
+ async function connect() {
39
+ try {
40
+ // Update status to connecting
41
+ statusBarItem.text = '$(sync~spin) Connecting...';
42
+ statusBarItem.tooltip = 'Connection in progress';
43
+ // Detect OS
44
+ const platform = os.platform();
45
+ const isWindows = platform === 'win32';
46
+ // Determine command based on OS
47
+ const command = isWindows ? 'moltbot status' : 'moltbot status';
48
+ // Create or reuse terminal
49
+ if (!terminal) {
50
+ terminal = vscode.window.createTerminal('Moltbot');
51
+ }
52
+ // Show terminal and send command
53
+ terminal.show(true); // true = preserve focus
54
+ terminal.sendText(command);
55
+ // Update status to connected
56
+ statusBarItem.text = '$(check) Moltbot';
57
+ statusBarItem.tooltip = 'Connected to Moltbot';
58
+ vscode.window.showInformationMessage('Connected to Moltbot');
59
+ }
60
+ catch (error) {
61
+ statusBarItem.text = '$(plug) Moltbot';
62
+ statusBarItem.tooltip = 'Click to connect to Moltbot';
63
+ vscode.window.showErrorMessage(`Failed to connect: ${error}`);
64
+ }
65
+ }
66
+ export function deactivate() {
67
+ if (terminal) {
68
+ terminal.dispose();
69
+ }
70
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gguf/pigbot",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Assistant anywhere - WhatsApp gateway CLI with Pi RPC",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",