@phnx-labs/agents-cli 1.22.92 → 1.22.94

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 (55) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +5 -0
  3. package/dist/commands/browser.d.ts +1 -0
  4. package/dist/commands/browser.js +145 -11
  5. package/dist/lib/browser/arc-discovery.d.ts +60 -0
  6. package/dist/lib/browser/arc-discovery.js +187 -0
  7. package/dist/lib/browser/arc-dom.d.ts +14 -0
  8. package/dist/lib/browser/arc-dom.js +121 -0
  9. package/dist/lib/browser/drivers/arc.d.ts +57 -0
  10. package/dist/lib/browser/drivers/arc.js +281 -0
  11. package/dist/lib/browser/profiles.d.ts +5 -1
  12. package/dist/lib/browser/profiles.js +94 -9
  13. package/dist/lib/browser/refs.d.ts +2 -0
  14. package/dist/lib/browser/refs.js +2 -1
  15. package/dist/lib/browser/resolve-target.d.ts +2 -0
  16. package/dist/lib/browser/resolve-target.js +8 -0
  17. package/dist/lib/browser/runtime-state.js +9 -1
  18. package/dist/lib/browser/service.d.ts +37 -3
  19. package/dist/lib/browser/service.js +571 -41
  20. package/dist/lib/browser/types.d.ts +55 -1
  21. package/dist/lib/claude-account-token.d.ts +13 -0
  22. package/dist/lib/claude-account-token.js +29 -0
  23. package/dist/lib/daemon/attention-notify-service.d.ts +5 -2
  24. package/dist/lib/daemon/attention-notify-service.js +9 -2
  25. package/dist/lib/exec.js +11 -0
  26. package/dist/lib/feed/answer.js +9 -0
  27. package/dist/lib/feed/attention.d.ts +18 -2
  28. package/dist/lib/feed/attention.js +0 -0
  29. package/dist/lib/feed/feed.d.ts +6 -2
  30. package/dist/lib/feed/feed.js +10 -4
  31. package/dist/lib/harness/adapter.d.ts +23 -0
  32. package/dist/lib/harness/adapter.js +29 -0
  33. package/dist/lib/harness/adapters/claude.js +5 -3
  34. package/dist/lib/harness/adapters/copilot.js +4 -2
  35. package/dist/lib/harness/adapters/grok.js +4 -2
  36. package/dist/lib/harness/adapters/kimi.js +4 -2
  37. package/dist/lib/harness/adapters/muse.js +4 -3
  38. package/dist/lib/harness/adapters/opencode.js +4 -2
  39. package/dist/lib/helper-download.js +1 -1
  40. package/dist/lib/helper-versions.js +1 -1
  41. package/dist/lib/installations/shims.d.ts +2 -2
  42. package/dist/lib/installations/shims.js +16 -8
  43. package/dist/lib/menubar/download-menubar.js +4 -1
  44. package/dist/lib/menubar/install-menubar.d.ts +10 -9
  45. package/dist/lib/menubar/install-menubar.js +17 -15
  46. package/dist/lib/secrets-policy.d.ts +5 -2
  47. package/dist/lib/secrets-policy.js +18 -4
  48. package/dist/lib/session/active.d.ts +18 -11
  49. package/dist/lib/session/active.js +52 -44
  50. package/dist/lib/session/session-cache.d.ts +1 -1
  51. package/dist/lib/session/session-cache.js +1 -0
  52. package/dist/lib/session/state.d.ts +26 -0
  53. package/dist/lib/session/state.js +43 -27
  54. package/dist/lib/types.d.ts +7 -0
  55. package/package.json +1 -1
@@ -6,6 +6,7 @@ export function describeRefs(nodeMap) {
6
6
  role: n.role,
7
7
  name: n.name,
8
8
  attrs: n.attrs.slice(),
9
+ selector: n.selector,
9
10
  }));
10
11
  }
11
12
  /**
@@ -57,7 +58,7 @@ export function healRef(descriptor, freshNodeMap) {
57
58
  // Lexicographic key, all "higher is better":
58
59
  // [ DOM-backed, attribute similarity, -distance-to-original-ref ].
59
60
  const key = [
60
- node.backendNodeId !== undefined ? 1 : 0,
61
+ node.backendNodeId !== undefined || node.selector !== undefined ? 1 : 0,
61
62
  attrScore(node),
62
63
  -Math.abs(node.ref - ref),
63
64
  ];
@@ -24,6 +24,8 @@ export interface ResolvedBrowserTarget {
24
24
  * surfaces this so the caller knows WHERE the browser actually lives.
25
25
  */
26
26
  picked?: string;
27
+ /** Native endpoints cannot be tunnelled; the CLI must re-exec on this device. */
28
+ commandDispatch?: boolean;
27
29
  }
28
30
  /** Fork only fungible Electron profiles; identity-bearing ones share one connection. */
29
31
  export declare function shouldForkProfile(kind: 'identity' | 'fungible', conn: {
@@ -35,11 +35,14 @@ export function profileFromDeclaration(name, declaration) {
35
35
  targetFilter: config.targetFilter,
36
36
  endpoints: config.endpoints,
37
37
  defaultEndpoint: config.defaultEndpoint,
38
+ launchPolicy: config.launchPolicy,
39
+ userDataDir: config.userDataDir,
38
40
  chrome: config.chrome,
39
41
  secrets: config.secrets,
40
42
  viewport: config.viewport,
41
43
  logDir: config.logDir,
42
44
  logHost: config.logHost,
45
+ arc: config.arc,
43
46
  };
44
47
  }
45
48
  /** Runtime key: profile name plus the resolved device. Drops `@endpoint-N`. */
@@ -125,6 +128,10 @@ export function sshEndpointForDeclaration(device, config, endpointName, os) {
125
128
  const resolved = resolveEndpoint(profile, endpointName);
126
129
  if (resolved.target.startsWith('ssh:'))
127
130
  return resolved.target;
131
+ // Native Arc endpoints (arc-native:) must NOT be rewritten into SSH tunnels
132
+ // (PHNX-2399). They dispatch the whole command to the owner device instead.
133
+ if (resolved.target.startsWith('arc-native:'))
134
+ return resolved.target;
128
135
  const parsed = parseEndpointUrl(resolved.target);
129
136
  const port = parsed?.port ?? 9222;
130
137
  const osQuery = isWindowsOs(os) ? '&os=windows' : '';
@@ -202,6 +209,7 @@ export function resolveBrowserTarget(name, opts = {}) {
202
209
  targetFilter: resolved.targetFilter,
203
210
  },
204
211
  picked,
212
+ commandDispatch: resolved.target.startsWith('arc-native:'),
205
213
  };
206
214
  }
207
215
  throw unreachableDeclaringDevicesError(name, devices, failures);
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { execFileSync } from 'child_process';
4
- import { getProfileRuntimeDir, getBrowserRuntimeDir, getEndpointPresets, listProfiles, getConfiguredDefaultProfileName, isProfileLaunchableHere, deleteProfile, DEFAULT_BROWSER_PROFILE_NAME, LEGACY_DEFAULT_BROWSER_PROFILE_NAME, } from './profiles.js';
4
+ import { getProfileRuntimeDir, getBrowserRuntimeDir, getEndpointPresets, listProfiles, getConfiguredDefaultProfileName, isProfileLaunchableHere, isProfileDeclaredHere, deleteProfile, DEFAULT_BROWSER_PROFILE_NAME, LEGACY_DEFAULT_BROWSER_PROFILE_NAME, } from './profiles.js';
5
5
  import { keyBelongsToProfile } from './types.js';
6
6
  import { declaringDevices, profileKind } from './registry.js';
7
7
  import { machineId } from '../machine-id.js';
@@ -405,6 +405,14 @@ export async function buildProfilePrunePlan() {
405
405
  for (const profile of profiles) {
406
406
  const scope = profile.devices.length > 1 ? 'fungible' : 'identity';
407
407
  const misfiled = identityLoopbackMismatch(profile);
408
+ if (profile.arc && !isProfileDeclaredHere(profile.name)) {
409
+ peerKept.push({
410
+ name: profile.name,
411
+ scope,
412
+ why: 'read-only native Arc discovery; no agents-cli alias to prune',
413
+ });
414
+ continue;
415
+ }
408
416
  if (profile.devices.includes(current)) {
409
417
  declaredHere.push({
410
418
  name: profile.name,
@@ -4,7 +4,7 @@ import { type ResolvedDomainSkill } from './domain-skills.js';
4
4
  import { type Task, type TabInfo, type ProfileStatus, type BrowserType, type HistoricalTask, type ReapResult, type ProfileName, type ConnectionKey } from './types.js';
5
5
  import { type ReapOptions } from './hygiene.js';
6
6
  import { type RefOpts, type RefNode } from './refs.js';
7
- import type { TargetFilter, PageOpenResult } from './types.js';
7
+ import type { TargetFilter, PageOpenResult, ArcNativeProfileIdentity } from './types.js';
8
8
  export type UploadMode = 'auto' | 'input' | 'drop' | 'chooser';
9
9
  export declare function resolveScreenshotOutputPath(outputPath: string | undefined, automaticPath: string): string;
10
10
  /**
@@ -46,8 +46,7 @@ export declare function pickWindowTarget<T extends {
46
46
  export declare function parseSinceUntil(s: string): Date;
47
47
  export declare function readNewestMatchingRemoteFileCommand(dir: string, prefix: string, tailLines: number): string;
48
48
  export declare function readNewestMatchingFile(dir: string, prefix: string, tailLines: number): string;
49
- interface ProfileConnection {
50
- cdp: CDPClient;
49
+ interface BaseProfileConnection {
51
50
  port: number;
52
51
  pid: number;
53
52
  electron?: boolean;
@@ -86,6 +85,17 @@ interface ProfileConnection {
86
85
  */
87
86
  cleanup?: () => void;
88
87
  }
88
+ interface CdpProfileConnection extends BaseProfileConnection {
89
+ /** Omitted only by legacy/in-process callers; absence means the CDP path. */
90
+ backend?: 'cdp';
91
+ cdp: CDPClient;
92
+ }
93
+ interface ArcProfileConnection extends BaseProfileConnection {
94
+ backend: 'arc-native';
95
+ browserType: 'arc';
96
+ arcProfile: ArcNativeProfileIdentity;
97
+ }
98
+ type ProfileConnection = CdpProfileConnection | ArcProfileConnection;
89
99
  /** Join error lines so callers get a next command, not a dead-end message. */
90
100
  export declare function actionable(...lines: string[]): string;
91
101
  /**
@@ -178,6 +188,8 @@ export interface StartResult {
178
188
  */
179
189
  firstOpen?: PageOpenResult;
180
190
  }
191
+ export declare function arcCreateMarker(): string;
192
+ export declare function isArcCreateMarker(url: string): boolean;
181
193
  export declare class BrowserService {
182
194
  private static readonly SOURCE_PREFIX;
183
195
  /**
@@ -613,6 +625,7 @@ export declare class BrowserService {
613
625
  * a minute, well inside the 30-minute idle window.
614
626
  */
615
627
  private touchTask;
628
+ private prepareTask;
616
629
  private findTask;
617
630
  /**
618
631
  * Soft-attach to an already-running browser for a runtime dir.
@@ -680,6 +693,27 @@ export declare class BrowserService {
680
693
  * browser started before the key collapse is not abandoned.
681
694
  */
682
695
  private reuseProfileConnection;
696
+ /**
697
+ * Bind a task to the profile's Space in the visible Arc window that holds it.
698
+ * The Space is the profile (PHNX-2399); only its live window id is looked up.
699
+ */
700
+ private resolveArcSpace;
701
+ private requireArcTask;
702
+ private reconcileArcCreateIntents;
703
+ private createArcOwnedTab;
704
+ private navigateArcNative;
705
+ /**
706
+ * Execute JavaScript in a native Arc tab. Sync JS only, isolated world —
707
+ * async/promise evaluation fails honestly with an AppleScript error.
708
+ */
709
+ private evaluateArcNative;
710
+ private listArcTaskTabs;
711
+ /**
712
+ * Close native Arc tabs owned by a task. Only closes tabs the task created
713
+ * (not borrowed ones). Never kills Arc. Identifies tabs only by stable ids in
714
+ * the original window and Space.
715
+ */
716
+ private closeArcNativeTabs;
683
717
  /** Connect a profile at `target`, register it under `key`, and arm downloads. */
684
718
  private openConnection;
685
719
  /**