agentroam 0.2.0-preview.80 → 0.2.0-preview.81

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,9 +1,18 @@
1
1
  import { setTimeout as delay } from "node:timers/promises";
2
+ import { join } from "node:path";
3
+ import { pathToFileURL } from "node:url";
2
4
  import { resolveApprovalInput, terminalText } from "./device-pairing.js";
3
5
  import { localServiceRequest } from "./local-service-request.js";
6
+ import { resolvePlatformRuntime } from "./platform-packages.js";
4
7
  import { DesktopAuthorizationInterrupted, DesktopAuthorizationPrompt, withAuthorizationSignal } from "./desktop-authorization-prompt.js";
5
8
  import { withCliProgress, withoutCliProgress } from "../bin/cli-progress.mjs";
6
9
  const endpoint = "/api/remote-authorization";
10
+ async function prepareInstalledMacComponent(permission) {
11
+ const { runtimeRoot } = resolvePlatformRuntime("darwin-arm64");
12
+ const module = await import(pathToFileURL(join(runtimeRoot, "lib/remote-control/helper-manager.mjs")).href);
13
+ // An independently versioned older runtime can still serve its normal wizard.
14
+ await module.prepareMacRemoteComponent?.(undefined, permission);
15
+ }
7
16
  async function requestAuthorization(dataDir, body, signal) {
8
17
  const status = await localServiceRequest(dataDir, endpoint, {
9
18
  method: body ? "POST" : "GET", body, signal, timeoutMs: body?.action === "request-permission" ? 135_000 : 30_000,
@@ -66,14 +75,18 @@ export async function authorizeRemoteDesktop(dataDir, context = {}) {
66
75
  throw new Error("Remote desktop requires Apple Silicon with macOS 14 or later, or Windows 10/11 x64");
67
76
  if (!status.installed)
68
77
  throw new Error("This CLI does not include the authorization component. Upgrade the CLI");
78
+ const platform = context.platform ?? process.platform;
79
+ const prepare = context.prepareMacComponent ?? prepareInstalledMacComponent;
80
+ const alreadyEnabled = status.enabled;
69
81
  if (status.enabled) {
82
+ if (platform === "darwin")
83
+ await run(() => prepare());
70
84
  status = await check({ action: "recheck" });
71
85
  if (complete(status)) {
72
86
  log("✓ Remote desktop authorized and sharing enabled.");
73
87
  return true;
74
88
  }
75
89
  }
76
- const platform = context.platform ?? process.platform;
77
90
  const confirm = context.confirm ?? (() => prompt.confirm());
78
91
  const confirmed = await withoutCliProgress(() => run(confirm));
79
92
  if (!confirmed) {
@@ -81,6 +94,8 @@ export async function authorizeRemoteDesktop(dataDir, context = {}) {
81
94
  recoveryHint(log);
82
95
  return false;
83
96
  }
97
+ if (platform === "darwin" && !alreadyEnabled)
98
+ await run(() => prepare());
84
99
  status = await check({ action: "recheck" });
85
100
  const wait = context.wait ?? ((milliseconds) => delay(milliseconds, undefined, { signal: prompt.signal }));
86
101
  if (platform === "darwin") {
@@ -88,10 +103,11 @@ export async function authorizeRemoteDesktop(dataDir, context = {}) {
88
103
  if (status[permission])
89
104
  continue;
90
105
  const name = permission === "screen" ? "Screen Recording" : "Accessibility";
91
- // TCC grants belong to the bundle ID across all installed runtimes.
92
- // A false probe here must never revoke another runtime's permission.
106
+ // The shared helper handles signature changes before prompting. CLI
107
+ // polling only observes the currently installed component.
93
108
  log(`Requesting ${name} permission. Allow AgentRoam Remote Desktop in System Settings...`);
94
109
  status = await withCliProgress(`Waiting for ${name} permission; type s and Enter to skip`, async () => {
110
+ await run(() => prepare(permission));
95
111
  let current = await check({ action: "request-permission", permission });
96
112
  for (let attempt = 0; !current[permission] && attempt < (context.pollAttempts ?? 60); attempt++) {
97
113
  await run(() => wait(2000));
@@ -1 +1 @@
1
- {"url":"https://connect.kaiwuyouwei.com"}
1
+ {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentroam",
3
- "version": "0.2.0-preview.80",
3
+ "version": "0.2.0-preview.81",
4
4
  "description": "Zero-install mobile remote terminal and file console",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  "ws": "^8.21.3"
28
28
  },
29
29
  "optionalDependencies": {
30
- "agentroam-runtime-darwin-arm64": "0.2.0-preview.80",
31
- "agentroam-runtime-win32-x64": "0.2.0-preview.80",
30
+ "agentroam-runtime-darwin-arm64": "0.2.0-preview.81",
31
+ "agentroam-runtime-win32-x64": "0.2.0-preview.81",
32
32
  "agentroam-cloudflared-darwin-arm64": "0.2.0-preview.78",
33
33
  "agentroam-cloudflared-win32-x64": "0.2.0-preview.78",
34
34
  "agentroam-tailscale-darwin-arm64": "0.2.0-preview.77",