finch-ego-lite 0.1.5 → 0.2.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 +6 -6
- package/dist/index.js +70 -14
- package/i18n/en-US.json +4 -4
- package/i18n/zh-CN.json +4 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -33,12 +33,12 @@ Task spaces are isolated from your everyday browser windows while still being ab
|
|
|
33
33
|
|
|
34
34
|
## Get started
|
|
35
35
|
|
|
36
|
-
1. Install and launch [Ego Lite](https://lite.ego.app/) on macOS. Ego Lite is a browser designed for collaboration between people and AI Agents, and provides the web environment used by this mini tool.
|
|
37
|
-
2.
|
|
36
|
+
1. Install and launch [Ego Lite](https://lite.ego.app/) on macOS or Windows. Ego Lite is a browser designed for collaboration between people and AI Agents, and provides the web environment used by this mini tool.
|
|
37
|
+
2. Finish Ego Lite's first-time setup so it registers the `ego-browser` command, then enable this mini tool in Finch. If Finch was already running while you installed Ego Lite, restart Finch so it picks up the new command.
|
|
38
38
|
3. Tell Finch which website to visit and what you want done.
|
|
39
39
|
4. Use the Ego button beside the Composer to follow progress, open pages, or take control.
|
|
40
40
|
|
|
41
|
-
> Ego Lite currently
|
|
41
|
+
> Ego Lite currently runs on macOS and Windows. On other platforms, this mini tool explains that the platform is not supported and provides a link to the Ego Lite website.
|
|
42
42
|
|
|
43
43
|
## About Finch
|
|
44
44
|
|
|
@@ -83,12 +83,12 @@ Finch 会在 Ego Lite 的独立任务空间中打开网页。你不需要学习
|
|
|
83
83
|
|
|
84
84
|
## 开始使用
|
|
85
85
|
|
|
86
|
-
1. 在 macOS 上安装并启动 [Ego Lite](https://lite.ego.app/)。Ego Lite 是专为人与 AI Agent 协作设计的浏览器,也是本小工具连接网页的运行环境。
|
|
87
|
-
2.
|
|
86
|
+
1. 在 macOS 或 Windows 上安装并启动 [Ego Lite](https://lite.ego.app/)。Ego Lite 是专为人与 AI Agent 协作设计的浏览器,也是本小工具连接网页的运行环境。
|
|
87
|
+
2. 完成 Ego Lite 的首次引导,让它注册 `ego-browser` 命令,然后在 Finch 中启用本小工具。如果安装 Ego Lite 时 Finch 已经开着,重启一次 Finch 才能读到新命令。
|
|
88
88
|
3. 直接告诉 Finch 想访问的网站和要完成的事情。
|
|
89
89
|
4. 通过输入框旁的 Ego 按钮查看进度、打开页面或接管操作。
|
|
90
90
|
|
|
91
|
-
> Ego Lite
|
|
91
|
+
> Ego Lite 目前可在 macOS 和 Windows 上运行。其他平台上,本小工具会提示平台暂不支持,并提供 Ego Lite 官网入口。
|
|
92
92
|
|
|
93
93
|
## 关于 Finch
|
|
94
94
|
|
package/dist/index.js
CHANGED
|
@@ -2,22 +2,59 @@
|
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
|
-
import { join } from "node:path";
|
|
5
|
+
import { delimiter, join } from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
var execFileAsync = promisify(execFile);
|
|
8
8
|
var WEBSITE = "https://lite.ego.app/";
|
|
9
9
|
var STATUS_MARKER = "__EGO_STATUS__";
|
|
10
10
|
var OFFLINE_CONFIRMATIONS = 2;
|
|
11
11
|
var commandQueue = Promise.resolve();
|
|
12
|
+
var SUPPORTED_PLATFORMS = /* @__PURE__ */ new Set(["darwin", "win32"]);
|
|
13
|
+
function isSupportedPlatform() {
|
|
14
|
+
return SUPPORTED_PLATFORMS.has(process.platform);
|
|
15
|
+
}
|
|
16
|
+
function localBinDir() {
|
|
17
|
+
return join(homedir(), ".local", "bin");
|
|
18
|
+
}
|
|
12
19
|
function egoBinary() {
|
|
13
|
-
const
|
|
14
|
-
|
|
20
|
+
const names = process.platform === "win32" ? ["ego-browser.exe", "ego-browser"] : ["ego-browser"];
|
|
21
|
+
for (const name of names) {
|
|
22
|
+
const local = join(localBinDir(), name);
|
|
23
|
+
if (existsSync(local)) return local;
|
|
24
|
+
}
|
|
15
25
|
return "ego-browser";
|
|
16
26
|
}
|
|
27
|
+
function egoAppPath() {
|
|
28
|
+
if (process.platform !== "win32") return void 0;
|
|
29
|
+
const env = process.env;
|
|
30
|
+
const roots = [
|
|
31
|
+
env.ProgramFiles,
|
|
32
|
+
env["ProgramFiles(x86)"],
|
|
33
|
+
env.LOCALAPPDATA ? join(env.LOCALAPPDATA, "Programs") : void 0,
|
|
34
|
+
env.LOCALAPPDATA
|
|
35
|
+
].filter((root) => Boolean(root));
|
|
36
|
+
const layouts = [
|
|
37
|
+
["Citro Labs", "ego lite", "Application", "ego.exe"],
|
|
38
|
+
["ego lite", "Application", "ego.exe"],
|
|
39
|
+
["Citro Labs", "ego lite", "ego.exe"],
|
|
40
|
+
["ego lite", "ego.exe"]
|
|
41
|
+
];
|
|
42
|
+
for (const root of roots) {
|
|
43
|
+
for (const layout of layouts) {
|
|
44
|
+
const candidate = join(root, ...layout);
|
|
45
|
+
if (existsSync(candidate)) return candidate;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
17
50
|
async function processRunning() {
|
|
18
|
-
if (
|
|
51
|
+
if (!isSupportedPlatform()) return false;
|
|
19
52
|
const probe = async () => {
|
|
20
53
|
try {
|
|
54
|
+
if (process.platform === "win32") {
|
|
55
|
+
const { stdout } = await execFileAsync("tasklist", ["/FI", "IMAGENAME eq ego.exe", "/NH"], { timeout: 3e3 });
|
|
56
|
+
return /\bego\.exe\b/i.test(stdout);
|
|
57
|
+
}
|
|
21
58
|
await execFileAsync("pgrep", ["-f", "/ego lite.app/Contents/MacOS/ego lite"], { timeout: 2e3 });
|
|
22
59
|
return true;
|
|
23
60
|
} catch {
|
|
@@ -34,7 +71,7 @@ async function runCommand(file, args, timeout = 2e4) {
|
|
|
34
71
|
const child = execFile(file, args, {
|
|
35
72
|
timeout,
|
|
36
73
|
maxBuffer: 10 * 1024 * 1024,
|
|
37
|
-
env: { ...process.env, PATH: `${
|
|
74
|
+
env: { ...process.env, PATH: `${localBinDir()}${delimiter}${process.env.PATH ?? ""}` }
|
|
38
75
|
}, (error, stdout, stderr) => {
|
|
39
76
|
const output = [stdout, stderr].filter(Boolean).join("\n").trim();
|
|
40
77
|
if (error) {
|
|
@@ -115,7 +152,7 @@ function parseSpaces(output) {
|
|
|
115
152
|
return JSON.parse(json);
|
|
116
153
|
}
|
|
117
154
|
async function getStatus(detailed = false) {
|
|
118
|
-
if (
|
|
155
|
+
if (!isSupportedPlatform()) {
|
|
119
156
|
return { supported: false, installed: false, running: false, spaces: [], pageCount: 0 };
|
|
120
157
|
}
|
|
121
158
|
const binary = egoBinary();
|
|
@@ -139,7 +176,7 @@ async function getStatus(detailed = false) {
|
|
|
139
176
|
}
|
|
140
177
|
}
|
|
141
178
|
async function probeStatus(previous) {
|
|
142
|
-
if (
|
|
179
|
+
if (!isSupportedPlatform()) {
|
|
143
180
|
return { supported: false, installed: false, running: false, spaces: [], pageCount: 0 };
|
|
144
181
|
}
|
|
145
182
|
const running = await processRunning();
|
|
@@ -155,13 +192,32 @@ async function probeStatus(previous) {
|
|
|
155
192
|
};
|
|
156
193
|
}
|
|
157
194
|
async function launchEgo() {
|
|
158
|
-
if (process.platform
|
|
159
|
-
|
|
195
|
+
if (process.platform === "darwin") {
|
|
196
|
+
await execFileAsync("open", ["-a", "ego lite"], { timeout: 5e3 });
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (process.platform === "win32") {
|
|
200
|
+
const exe = egoAppPath();
|
|
201
|
+
if (!exe) {
|
|
202
|
+
throw new Error(`The ego lite app was not found on this PC. Open it from the Start menu, or reinstall it from ${WEBSITE}.`);
|
|
203
|
+
}
|
|
204
|
+
await execFileAsync("cmd", ["/c", "start", "", exe], { timeout: 5e3 });
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
throw new Error(`Ego Lite does not run on this platform (${process.platform}).`);
|
|
160
208
|
}
|
|
161
209
|
async function focusEgo() {
|
|
162
|
-
if (process.platform
|
|
163
|
-
|
|
164
|
-
|
|
210
|
+
if (process.platform === "darwin") {
|
|
211
|
+
await execFileAsync("open", ["-a", "ego lite"], { timeout: 5e3 }).catch(() => {
|
|
212
|
+
});
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (process.platform === "win32") {
|
|
216
|
+
const exe = egoAppPath();
|
|
217
|
+
if (!exe) return;
|
|
218
|
+
await execFileAsync("cmd", ["/c", "start", "", exe], { timeout: 5e3 }).catch(() => {
|
|
219
|
+
});
|
|
220
|
+
}
|
|
165
221
|
}
|
|
166
222
|
async function openWebsite() {
|
|
167
223
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
@@ -655,14 +711,14 @@ Reuse task spaces, respect user ownership, verify meaningful actions, and comple
|
|
|
655
711
|
if (actionName === "switch_tab" && !request.target_id) {
|
|
656
712
|
return { content: [{ type: "text", text: "action=switch_tab requires target_id from action=status." }], isError: true };
|
|
657
713
|
}
|
|
658
|
-
if (
|
|
714
|
+
if (!isSupportedPlatform()) {
|
|
659
715
|
return { content: [{ type: "text", text: t("status.unsupported", { platform: process.platform }) }], isError: true };
|
|
660
716
|
}
|
|
661
717
|
const binary = egoBinary();
|
|
662
718
|
const version = await probeVersion(binary);
|
|
663
719
|
if (!version && !await processRunning()) {
|
|
664
720
|
return {
|
|
665
|
-
content: [{ type: "text", text:
|
|
721
|
+
content: [{ type: "text", text: t("status.notInstalled", { website: WEBSITE }) }],
|
|
666
722
|
isError: true
|
|
667
723
|
};
|
|
668
724
|
}
|
package/i18n/en-US.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"badge": {
|
|
14
14
|
"online": "Ego online",
|
|
15
15
|
"offline": "Ego offline",
|
|
16
|
-
"unsupported": "
|
|
16
|
+
"unsupported": "Not supported"
|
|
17
17
|
},
|
|
18
18
|
"menu": {
|
|
19
19
|
"checking": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"label": "Learn about Ego Lite"
|
|
28
28
|
},
|
|
29
29
|
"unsupported": {
|
|
30
|
-
"label": "Ego Lite
|
|
30
|
+
"label": "Ego Lite needs macOS or Windows",
|
|
31
31
|
"description": "This device is not supported",
|
|
32
|
-
"hover": "Ego Lite currently runs on macOS
|
|
32
|
+
"hover": "Ego Lite currently runs on macOS and Windows. Current platform: {platform}."
|
|
33
33
|
},
|
|
34
34
|
"install": {
|
|
35
35
|
"label": "Install Ego Lite",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"user": "User control"
|
|
73
73
|
},
|
|
74
74
|
"status": {
|
|
75
|
-
"unsupported": "Ego Lite currently supports macOS
|
|
75
|
+
"unsupported": "Ego Lite currently supports macOS and Windows. Current platform: {platform}.",
|
|
76
76
|
"notInstalled": "Ego Lite is not installed. Install it from {website} and finish first-time setup.",
|
|
77
77
|
"notRunning": "Ego Lite {version} is installed but not running.",
|
|
78
78
|
"error": "Ego Lite is running, but its status could not be read: {error}"
|
package/i18n/zh-CN.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"badge": {
|
|
14
14
|
"online": "Ego 在线",
|
|
15
15
|
"offline": "Ego 离线",
|
|
16
|
-
"unsupported": "
|
|
16
|
+
"unsupported": "平台不支持"
|
|
17
17
|
},
|
|
18
18
|
"menu": {
|
|
19
19
|
"checking": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"label": "了解 Ego Lite"
|
|
28
28
|
},
|
|
29
29
|
"unsupported": {
|
|
30
|
-
"label": "Ego Lite
|
|
30
|
+
"label": "Ego Lite 支持 macOS 与 Windows",
|
|
31
31
|
"description": "当前设备暂不可用",
|
|
32
|
-
"hover": "Ego Lite
|
|
32
|
+
"hover": "Ego Lite 目前可在 macOS 和 Windows 上运行。当前平台:{platform}。"
|
|
33
33
|
},
|
|
34
34
|
"install": {
|
|
35
35
|
"label": "安装 Ego Lite",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"user": "用户控制"
|
|
73
73
|
},
|
|
74
74
|
"status": {
|
|
75
|
-
"unsupported": "Ego Lite
|
|
75
|
+
"unsupported": "Ego Lite 目前支持 macOS 和 Windows。当前平台:{platform}。",
|
|
76
76
|
"notInstalled": "Ego Lite 未安装。请从 {website} 安装并完成首次引导。",
|
|
77
77
|
"notRunning": "Ego Lite 已安装({version}),当前未运行。",
|
|
78
78
|
"error": "Ego Lite 正在运行,但状态读取失败:{error}"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "finch-ego-lite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Let Finch browse the web in isolated Ego Lite task spaces while you follow every page it opens.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "PuterJam",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --target=node18 --outfile=dist/index.js",
|
|
23
23
|
"typecheck": "tsc --noEmit",
|
|
24
|
+
"smoke": "node tools/smoke.mjs",
|
|
24
25
|
"prepublishOnly": "npm run typecheck && npm run build && npx @finchtoys/minitools doctor ."
|
|
25
26
|
},
|
|
26
27
|
"finch": {
|