agentosity 0.3.2 → 0.3.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +34 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentosity",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Agentosity — AI-native is a number now. Automatic attendance for your AI agents (stdio MCP lifecycle + activity probes) + human clock-out CLI.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -102,8 +102,13 @@ async function init(companyArg) {
102
102
  const results = installAllHarnesses();
103
103
  console.log(formatInstallResults(results) || " (未发现已安装的 harness)");
104
104
 
105
+ // 4. mac:顺手装菜单栏 App(登录态与 CLI 共用 ~/.agentosity/config.json,装好即已登录;
106
+ // 自带进程雷达,正在跑的 Agent 免重启当场收编)。跳过:--no-app
107
+ if (!process.argv.includes("--no-app")) await installMenubarApp();
108
+
105
109
  console.log(`
106
110
  ✅ 完成。从现在起,新开的 Agent 会话会自动考勤——模型零参与,只上报时长,不读任何内容。
111
+ ⚠️ 桌面 App(Codex App / Cursor / Windsurf 等)要完全退出重开一次才会加载配置。
107
112
  已开着的老会话不会被追踪(配置只对新会话生效),要收编它们:npx agentosity radar
108
113
 
109
114
  看榜:${apiBase()}/agents`);
@@ -132,6 +137,35 @@ async function login(email, code) {
132
137
  }
133
138
  }
134
139
 
140
+ async function installMenubarApp() {
141
+ if (process.platform !== "darwin") return;
142
+ const { spawnSync } = await import("node:child_process");
143
+ const { tmpdir } = await import("node:os");
144
+ const { existsSync } = await import("node:fs");
145
+ const { join } = await import("node:path");
146
+ const sh = (cmd, args) => spawnSync(cmd, args, { encoding: "utf8" });
147
+ const fallback = " 手动安装:https://agentosity.com/start(不影响命令行考勤,已经在工作了)";
148
+
149
+ if (existsSync("/Applications/Agentosity.app")) {
150
+ sh("open", ["-g", "-a", "Agentosity"]);
151
+ console.log("\n✓ 菜单栏 App 已安装并带起(登录状态与命令行共享)");
152
+ return;
153
+ }
154
+ console.log("\n⬇️ 安装菜单栏 App(实时看板 + 进程雷达,正在跑的 Agent 免重启收编)…");
155
+ const dmg = join(tmpdir(), `Agentosity-${Date.now()}.dmg`);
156
+ const dl = sh("curl", ["-fsSL", "-o", dmg,
157
+ "https://github.com/realethanyang/agentosity/releases/latest/download/Agentosity.dmg"]);
158
+ if (dl.status !== 0) return console.log(" 下载失败,跳过。\n" + fallback);
159
+ const att = sh("hdiutil", ["attach", "-nobrowse", "-readonly", dmg]);
160
+ const mount = (att.stdout.match(/\/Volumes\/[^\n]+/) || [])[0]?.trim();
161
+ if (!mount) return console.log(" 镜像挂载失败,跳过。\n" + fallback);
162
+ const cp = sh("ditto", [`${mount}/Agentosity.app`, "/Applications/Agentosity.app"]);
163
+ sh("hdiutil", ["detach", "-quiet", mount]);
164
+ if (cp.status !== 0) return console.log(" 拷贝失败(/Applications 无写权限?),跳过。\n" + fallback);
165
+ sh("open", ["-g", "-a", "Agentosity"]);
166
+ console.log("✅ 菜单栏 App 已装进 /Applications 并启动,登录状态自动同步(首次打开若系统弹确认,点「打开」)");
167
+ }
168
+
135
169
  async function openBrowser(url) {
136
170
  try {
137
171
  const { spawn } = await import("node:child_process");