@bolloon/bolloon-agent 0.2.0 → 0.2.1

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.
@@ -1,60 +1,22 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getMainWindow = getMainWindow;
37
- exports.createMainWindow = createMainWindow;
38
- exports.focusMainWindow = focusMainWindow;
39
1
  /**
40
2
  * 主窗口工厂 — preload 路径解析 + dev/prod loadURL + 外部链接走系统浏览器
41
3
  */
42
- const electron_1 = require("electron");
43
- const path = __importStar(require("path"));
44
- const logger_1 = require("./logger");
45
- const config_1 = require("./config");
46
- const server_1 = require("./server");
4
+ import { BrowserWindow, shell } from 'electron';
5
+ import * as path from 'path';
6
+ import { log } from './logger';
7
+ import { isDev, MAIN_WINDOW_DEFAULT, MAIN_WINDOW_MIN, preferredPort } from './config';
8
+ import { startWebServer } from './server';
47
9
  let mainWindow = null;
48
- function getMainWindow() {
10
+ export function getMainWindow() {
49
11
  return mainWindow;
50
12
  }
51
- async function createMainWindow() {
52
- (0, logger_1.log)('创建主窗口...');
53
- mainWindow = new electron_1.BrowserWindow({
54
- width: config_1.MAIN_WINDOW_DEFAULT.width,
55
- height: config_1.MAIN_WINDOW_DEFAULT.height,
56
- minWidth: config_1.MAIN_WINDOW_MIN.width,
57
- minHeight: config_1.MAIN_WINDOW_MIN.height,
13
+ export async function createMainWindow() {
14
+ log('创建主窗口...');
15
+ mainWindow = new BrowserWindow({
16
+ width: MAIN_WINDOW_DEFAULT.width,
17
+ height: MAIN_WINDOW_DEFAULT.height,
18
+ minWidth: MAIN_WINDOW_MIN.width,
19
+ minHeight: MAIN_WINDOW_MIN.height,
58
20
  title: 'Bolloon Agent',
59
21
  webPreferences: {
60
22
  nodeIntegration: false,
@@ -64,40 +26,40 @@ async function createMainWindow() {
64
26
  },
65
27
  show: false,
66
28
  });
67
- if (config_1.isDev) {
29
+ if (isDev) {
68
30
  // dev:web 用 tsx 起 server, 端口固定 preferredPort, 不会 EADDRINUSE 自增
69
- const port = (0, config_1.preferredPort)();
31
+ const port = preferredPort();
70
32
  mainWindow.loadURL(`http://localhost:${port}`);
71
33
  mainWindow.webContents.openDevTools();
72
34
  }
73
35
  else {
74
36
  try {
75
- (0, logger_1.log)('启动内置 Web 服务器...');
76
- const { port: actualPort } = await (0, server_1.startWebServer)((0, config_1.preferredPort)());
37
+ log('启动内置 Web 服务器...');
38
+ const { port: actualPort } = await startWebServer(preferredPort());
77
39
  mainWindow.loadURL(`http://localhost:${actualPort}`);
78
40
  }
79
41
  catch (err) {
80
- (0, logger_1.log)(`启动服务器失败: ${err.message}`, 'error');
42
+ log(`启动服务器失败: ${err.message}`, 'error');
81
43
  console.error('启动服务器失败:', err);
82
44
  }
83
45
  }
84
46
  mainWindow.once('ready-to-show', () => {
85
47
  mainWindow?.show();
86
- (0, logger_1.log)('窗口已显示');
48
+ log('窗口已显示');
87
49
  });
88
50
  // 外部链接走系统浏览器, 不在 app 内开新窗口
89
51
  mainWindow.webContents.setWindowOpenHandler(({ url }) => {
90
52
  if (url.startsWith('http://') || url.startsWith('https://')) {
91
- electron_1.shell.openExternal(url);
53
+ shell.openExternal(url);
92
54
  }
93
55
  return { action: 'deny' };
94
56
  });
95
57
  mainWindow.on('closed', () => {
96
58
  mainWindow = null;
97
59
  });
98
- (0, logger_1.log)('窗口创建完成');
60
+ log('窗口创建完成');
99
61
  }
100
- function focusMainWindow() {
62
+ export function focusMainWindow() {
101
63
  if (!mainWindow)
102
64
  return;
103
65
  if (mainWindow.isMinimized())
@@ -105,4 +67,3 @@ function focusMainWindow() {
105
67
  mainWindow.show();
106
68
  mainWindow.focus();
107
69
  }
108
- //# sourceMappingURL=window.js.map
@@ -32,6 +32,10 @@ const TOOL_WHITELIST = new Set([
32
32
  'vitest_run', 'tsc_check',
33
33
  // 2026-06-19: Agent Mesh 通信工具 (跟 pi-sdk.ts registerTools 同步)
34
34
  'check_inbox', 'send_to_peer', 'p2p_broadcast', 'send_to_local_agent', 'list_local_agents', 'agent_call',
35
+ // 2026-06-24: Wallet + Polymarket + Safe 工具 (跟 pi-sdk.ts _registerWalletTools 同步)
36
+ 'wallet_create', 'wallet_import', 'wallet_get_balance', 'wallet_sign_message', 'wallet_send_tx', 'wallet_transfer_token', 'wallet_autopay',
37
+ 'polymarket_list_markets', 'polymarket_get_market', 'polymarket_get_orders', 'polymarket_create_order', 'polymarket_cancel_order',
38
+ 'safe_deploy',
35
39
  // MCP 注册的工具
36
40
  'mcp_tool',
37
41
  ]);