@pmate/cli 0.44.4 → 0.44.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.
|
@@ -3,12 +3,12 @@ const { existsSync, mkdirSync } = require('node:fs')
|
|
|
3
3
|
const { homedir } = require('node:os')
|
|
4
4
|
const path = require('node:path')
|
|
5
5
|
const methods = ['capabilities','workspaces.list','agents.list','agents.create','agents.update','plugins.list','plugins.configure','runtime.checkEnvironment','runtime.install','runtime.status','scripts.run']
|
|
6
|
-
function createAgentRuntime({ platform = process.platform, home = homedir(), execute, fetcher = fetch } = {}) {
|
|
6
|
+
function createAgentRuntime({ platform = process.platform, home = homedir(), execute, fetcher = fetch, environment = process.env } = {}) {
|
|
7
7
|
let identityEpoch=0
|
|
8
8
|
let identity, installation, progress = { phase: 'idle' }
|
|
9
9
|
const root = path.join(home, '.pmate', 'merry-runtime')
|
|
10
10
|
const run = execute || ((file, args, cwd) => new Promise((resolve, reject) => {
|
|
11
|
-
execFile(file, args, { cwd, timeout: 600000, maxBuffer: 1024 * 1024, env: { ...
|
|
11
|
+
execFile(file, args, { cwd, timeout: 600000, maxBuffer: 1024 * 1024, env: { ...environment, PATH: [path.join(home,'.local/bin'),path.join(home,'.bun/bin'),environment.PNPM_HOME,path.join(home,'Library/pnpm'),path.join(home,'.local/share/pnpm'),'/opt/homebrew/bin','/usr/local/bin',environment.PATH].filter(Boolean).join(':'), GIT_TERMINAL_PROMPT: '0' } }, (error, stdout) => error ? reject(new Error(`${path.basename(file)} 执行失败,请检查本地安装和仓库访问权限`)) : resolve(stdout.trim()))
|
|
12
12
|
}))
|
|
13
13
|
const installed = async () => {
|
|
14
14
|
if(existsSync(path.join(root,'packages/pmate-agent-tools/src/cli.ts'))){try{await run('bun',['packages/pmate-agent-tools/src/cli.ts','plugin','--help'],root);return true}catch{return false}}
|
|
@@ -71,6 +71,7 @@ else {
|
|
|
71
71
|
})
|
|
72
72
|
desktopApps = installDesktopApps({ ipcMain, BrowserWindow, session: desktopSession, config, installNavigationRestrictions,
|
|
73
73
|
openExternal: url => shell.openExternal(url), trusted: event => desktopNotifications.trusted(event) })
|
|
74
|
+
if (config.app === 'pmate:merry') installAgentRuntime({ ipcMain, trusted: event => desktopNotifications.trusted(event), runtime: agentRuntime })
|
|
74
75
|
updateController = installUpdateHandlers({ ipcMain, app, shell, appId: config.app, trusted: event => desktopNotifications.trusted(event), updater: require('electron-updater').autoUpdater, getWindow: () => mainWindow })
|
|
75
76
|
const instanceId = desktopInstanceId(app.getPath('userData'))
|
|
76
77
|
const rendererReach = createRendererReach({ ipcMain, getWindow: () => mainWindow, trusted: event => desktopNotifications.trusted(event) })
|