@ganglion/xacpx 0.23.0-beta.1 → 0.23.0-beta.2

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/dist/cli.js CHANGED
@@ -57751,7 +57751,7 @@ import { execFile as execFile2, spawn as spawn17 } from "node:child_process";
57751
57751
  import { promisify as promisify2 } from "node:util";
57752
57752
  import { homedir as homedir14 } from "node:os";
57753
57753
  import { readdir as readdir9, realpath as realpath6, stat as stat7, open as open10, readFile as readFile23, writeFile as writeFile9, mkdir as mkdir14, rename as fsRename, cp, rm as rm13 } from "node:fs/promises";
57754
- import { basename as basename7, dirname as dirname22, isAbsolute as isAbsolute7, relative as relative3, resolve as resolve7, sep as sep4 } from "node:path";
57754
+ import { basename as basename7, dirname as dirname22, isAbsolute as isAbsolute7, join as join33, relative as relative3, resolve as resolve7, sep as sep4 } from "node:path";
57755
57755
  import writeFileAtomic3 from "write-file-atomic";
57756
57756
  function expandHome2(p) {
57757
57757
  if (p === "~")
@@ -57760,6 +57760,44 @@ function expandHome2(p) {
57760
57760
  return resolve7(homedir14(), p.slice(2));
57761
57761
  return p;
57762
57762
  }
57763
+ async function browseDirectories(input) {
57764
+ const raw = (input ?? "").trim();
57765
+ const dir = resolve7(homedir14(), expandHome2(raw));
57766
+ const dirents = await readdir9(dir, { withFileTypes: true });
57767
+ const out = [];
57768
+ for (const d of dirents) {
57769
+ if (d.isDirectory()) {
57770
+ out.push({ name: d.name, path: join33(dir, d.name) });
57771
+ continue;
57772
+ }
57773
+ if (d.isSymbolicLink()) {
57774
+ try {
57775
+ if ((await stat7(join33(dir, d.name))).isDirectory()) {
57776
+ out.push({ name: d.name, path: join33(dir, d.name) });
57777
+ }
57778
+ } catch {}
57779
+ }
57780
+ }
57781
+ out.sort((a, b) => {
57782
+ const la = a.name.toLowerCase(), lb = b.name.toLowerCase();
57783
+ return la < lb ? -1 : la > lb ? 1 : a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
57784
+ });
57785
+ const truncated = out.length > MAX_BROWSE_ENTRIES;
57786
+ if (truncated)
57787
+ out.length = MAX_BROWSE_ENTRIES;
57788
+ const parent = dirname22(dir);
57789
+ return {
57790
+ path: dir,
57791
+ sep: sepChar(),
57792
+ parent: parent === dir ? null : parent,
57793
+ home: homedir14(),
57794
+ dirs: out,
57795
+ truncated
57796
+ };
57797
+ }
57798
+ function sepChar() {
57799
+ return sep4 === "\\" ? "\\" : "/";
57800
+ }
57763
57801
 
57764
57802
  class WorkspaceFs {
57765
57803
  listWorkspaces;
@@ -58358,7 +58396,7 @@ function globToRegExp(glob) {
58358
58396
  return /$^/;
58359
58397
  }
58360
58398
  }
58361
- var execFileAsync2, MAX_ENTRIES = 2000, FILE_READ_CAP, DIFF_CAP, GIT_MAX_BUFFER, SEARCH_MAX_RESULTS = 200, SEARCH_MAX_SCAN = 20000, SEARCH_SKIP_DIRS, SEARCH_CONTENT_MAX_HITS = 500, SEARCH_CONTENT_MAX_FILE, LINE_MATCH_CAP = 2000, DOWNLOAD_MAX, GIT_TIMEOUT_MS = 1e4, SEARCH_DEADLINE_MS = 4000, MIME_BY_EXT;
58399
+ var execFileAsync2, MAX_ENTRIES = 2000, FILE_READ_CAP, DIFF_CAP, GIT_MAX_BUFFER, SEARCH_MAX_RESULTS = 200, SEARCH_MAX_SCAN = 20000, SEARCH_SKIP_DIRS, SEARCH_CONTENT_MAX_HITS = 500, SEARCH_CONTENT_MAX_FILE, LINE_MATCH_CAP = 2000, DOWNLOAD_MAX, GIT_TIMEOUT_MS = 1e4, SEARCH_DEADLINE_MS = 4000, MAX_BROWSE_ENTRIES = 1000, MIME_BY_EXT;
58362
58400
  var init_workspace_fs = __esm(() => {
58363
58401
  execFileAsync2 = promisify2(execFile2);
58364
58402
  FILE_READ_CAP = 256 * 1024;
@@ -58393,7 +58431,7 @@ import { execFile as execFile3 } from "node:child_process";
58393
58431
  import { createHash as createHash11 } from "node:crypto";
58394
58432
  import { lstat, mkdir as mkdir15, realpath as realpath7 } from "node:fs/promises";
58395
58433
  import { homedir as homedir15 } from "node:os";
58396
- import { basename as basename8, isAbsolute as isAbsolute8, join as join33, resolve as resolve8, sep as sep5, win32 as win324 } from "node:path";
58434
+ import { basename as basename8, isAbsolute as isAbsolute8, join as join34, resolve as resolve8, sep as sep5, win32 as win324 } from "node:path";
58397
58435
  import { promisify as promisify3 } from "node:util";
58398
58436
  function expandHome3(path14) {
58399
58437
  if (path14 === "~")
@@ -58441,7 +58479,7 @@ class WorkspaceGit {
58441
58479
  writeTails = new Map;
58442
58480
  constructor(listWorkspaces, options = {}) {
58443
58481
  this.listWorkspaces = listWorkspaces;
58444
- this.managedWorktreesRoot = options.managedWorktreesRoot ?? join33(homedir15(), ".xacpx", "worktrees");
58482
+ this.managedWorktreesRoot = options.managedWorktreesRoot ?? join34(homedir15(), ".xacpx", "worktrees");
58445
58483
  this.platform = options.platform ?? process.platform;
58446
58484
  this.runGitOverride = options.runGit;
58447
58485
  }
@@ -58673,7 +58711,7 @@ class WorkspaceGit {
58673
58711
  const repoKey = `${basename8(top)}-${createHash11("sha256").update(commonDir).digest("hex").slice(0, 8)}`;
58674
58712
  const branchSlug = branch.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "branch";
58675
58713
  const branchKey = `${branchSlug}-${createHash11("sha256").update(branch).digest("hex").slice(0, 6)}`;
58676
- const repoDir = join33(managedRoot, repoKey);
58714
+ const repoDir = join34(managedRoot, repoKey);
58677
58715
  try {
58678
58716
  const existing = await lstat(repoDir);
58679
58717
  if (!existing.isDirectory() || existing.isSymbolicLink())
@@ -58686,7 +58724,7 @@ class WorkspaceGit {
58686
58724
  const realRepoDir = await realpath7(repoDir);
58687
58725
  if (!worktreePathIsWithin(managedRoot, realRepoDir, this.platform))
58688
58726
  throw new Error("worktree-path-unsafe");
58689
- const target = join33(realRepoDir, branchKey);
58727
+ const target = join34(realRepoDir, branchKey);
58690
58728
  try {
58691
58729
  await lstat(target);
58692
58730
  throw new Error("worktree-path-exists");
@@ -59535,6 +59573,9 @@ class ControlService {
59535
59573
  listDirectory(workspace3, path15) {
59536
59574
  return this.workspaceFs.listDirectory(workspace3, path15);
59537
59575
  }
59576
+ browseDirectories(path15) {
59577
+ return browseDirectories(path15);
59578
+ }
59538
59579
  readWorkspaceFile(workspace3, path15) {
59539
59580
  return this.workspaceFs.readFile(workspace3, path15);
59540
59581
  }
@@ -60910,9 +60951,9 @@ __export(exports_acpx_agent_overlay, {
60910
60951
  ACPX_MANAGED_ALIAS_PREFIX: () => ACPX_MANAGED_ALIAS_PREFIX
60911
60952
  });
60912
60953
  import { chmod as chmod5, readFile as readFile24, stat as stat9 } from "node:fs/promises";
60913
- import { join as join34 } from "node:path";
60954
+ import { join as join35 } from "node:path";
60914
60955
  function acpxConfigPath(home) {
60915
- return join34(home, ".acpx", "config.json");
60956
+ return join35(home, ".acpx", "config.json");
60916
60957
  }
60917
60958
  function computeAgentOverlayEntries(config4) {
60918
60959
  const entries = [];
@@ -61104,7 +61145,7 @@ __export(exports_main, {
61104
61145
  });
61105
61146
  import { randomUUID as randomUUID15 } from "node:crypto";
61106
61147
  import { homedir as homedir17 } from "node:os";
61107
- import { dirname as dirname24, join as join35 } from "node:path";
61148
+ import { dirname as dirname24, join as join36 } from "node:path";
61108
61149
  import { fileURLToPath as fileURLToPath7 } from "node:url";
61109
61150
  async function defaultProvisionAgentOverlays(config4, logger) {
61110
61151
  const entries = computeAgentOverlayEntries(config4);
@@ -61243,7 +61284,7 @@ async function buildApp(paths, deps = {}) {
61243
61284
  }
61244
61285
  });
61245
61286
  const runtimeRoot = dirname24(paths.configPath);
61246
- const messagingNodeIdentity = await new MessagingNodeIdentityStore(join35(runtimeRoot, "agent-messaging", "node.json")).loadOrCreate();
61287
+ const messagingNodeIdentity = await new MessagingNodeIdentityStore(join36(runtimeRoot, "agent-messaging", "node.json")).loadOrCreate();
61247
61288
  const sessions = new SessionService(config4, debouncedStateStore, state, {
61248
61289
  stateMutex,
61249
61290
  runtimeRoot
@@ -61310,7 +61351,7 @@ async function buildApp(paths, deps = {}) {
61310
61351
  sessionInitTimeoutMs: config4.transport.sessionInitTimeoutMs
61311
61352
  } : {},
61312
61353
  ...deps.orphanRegistry ? {
61313
- generationFilePath: join35(deps.orphanRegistry.root, "generation.json")
61354
+ generationFilePath: join36(deps.orphanRegistry.root, "generation.json")
61314
61355
  } : {},
61315
61356
  onMalformedLine: (line) => {
61316
61357
  logger.error("bridge.protocol.malformed_line", "dropped undecodable bridge output line", {
@@ -62091,8 +62132,8 @@ async function main() {
62091
62132
  }
62092
62133
  }
62093
62134
  async function prepareChannelMedia(configPath, config4) {
62094
- const runtimeDir = join35(dirname24(configPath), "runtime");
62095
- const mediaRootDir = join35(runtimeDir, "media");
62135
+ const runtimeDir = join36(dirname24(configPath), "runtime");
62136
+ const mediaRootDir = join36(runtimeDir, "media");
62096
62137
  const mediaStore = new RuntimeMediaStore({ rootDir: mediaRootDir });
62097
62138
  await mediaStore.cleanupExpired().catch((error2) => {
62098
62139
  console.error("[xacpx] media cleanup failed:", error2 instanceof Error ? error2.message : String(error2));
@@ -62105,12 +62146,12 @@ function resolveRuntimePaths() {
62105
62146
  if (!home) {
62106
62147
  throw new Error("Unable to resolve the current user home directory");
62107
62148
  }
62108
- const configPath = coreEnv("CONFIG") ?? join35(coreHomeDir(home), "config.json");
62109
- const runtimeDir = join35(dirname24(configPath), "runtime");
62149
+ const configPath = coreEnv("CONFIG") ?? join36(coreHomeDir(home), "config.json");
62150
+ const runtimeDir = join36(dirname24(configPath), "runtime");
62110
62151
  return {
62111
62152
  configPath,
62112
- statePath: coreEnv("STATE") ?? join35(coreHomeDir(home), "state.json"),
62113
- perfLogPath: join35(runtimeDir, "perf.log"),
62153
+ statePath: coreEnv("STATE") ?? join36(coreHomeDir(home), "state.json"),
62154
+ perfLogPath: join36(runtimeDir, "perf.log"),
62114
62155
  orchestrationSocketPath: coreEnv("ORCHESTRATION_SOCKET") ?? resolveDaemonOrchestrationSocketPath(runtimeDir)
62115
62156
  };
62116
62157
  }
@@ -62122,13 +62163,13 @@ function resolveBridgeEntryPath() {
62122
62163
  }
62123
62164
  function resolveAppLogPath(configPath) {
62124
62165
  const rootDir = dirname24(configPath);
62125
- const runtimeDir = join35(rootDir, "runtime");
62126
- return join35(runtimeDir, "app.log");
62166
+ const runtimeDir = join36(rootDir, "runtime");
62167
+ return join36(runtimeDir, "app.log");
62127
62168
  }
62128
62169
  function resolvePerfLogPath(configPath) {
62129
62170
  const rootDir = dirname24(configPath);
62130
- const runtimeDir = join35(rootDir, "runtime");
62131
- return join35(runtimeDir, "perf.log");
62171
+ const runtimeDir = join36(rootDir, "runtime");
62172
+ return join36(runtimeDir, "perf.log");
62132
62173
  }
62133
62174
  function resolveOrchestrationSocketPathFromConfigPath(configPath) {
62134
62175
  const runtimeDir = resolveRuntimeDirFromConfigPath(configPath);
@@ -62810,7 +62851,7 @@ var init_config_check = __esm(() => {
62810
62851
  import { readdir as readdir11, readFile as readFile25, rm as rm15 } from "node:fs/promises";
62811
62852
  import { fileURLToPath as fileURLToPath8 } from "node:url";
62812
62853
  import { homedir as homedir18 } from "node:os";
62813
- import { join as join36 } from "node:path";
62854
+ import { join as join37 } from "node:path";
62814
62855
  async function checkDaemon(options = {}) {
62815
62856
  const home = options.home ?? process.env.HOME ?? homedir18();
62816
62857
  const runtimeDir = options.configPath ? resolveRuntimeDirFromConfigPath(options.configPath) : undefined;
@@ -62912,7 +62953,7 @@ async function detectStaleConsumerLockFix(runtimeDir, deps) {
62912
62953
  if (fileName === RUNTIME_CONSUMER_LOCK_FILE || !fileName.endsWith(CONSUMER_LOCK_SUFFIX2)) {
62913
62954
  continue;
62914
62955
  }
62915
- const lockPath = join36(runtimeDir, fileName);
62956
+ const lockPath = join37(runtimeDir, fileName);
62916
62957
  const lock2 = await deps.readConsumerLock(lockPath);
62917
62958
  if (lock2 && !deps.isProcessRunning(lock2.pid)) {
62918
62959
  stalePaths.push(lockPath);
@@ -62977,7 +63018,7 @@ var init_daemon_check = __esm(() => {
62977
63018
 
62978
63019
  // src/doctor/checks/logs-check.ts
62979
63020
  import { stat as stat10, readdir as readdir12 } from "node:fs/promises";
62980
- import { basename as basename10, join as join37 } from "node:path";
63021
+ import { basename as basename10, join as join38 } from "node:path";
62981
63022
  import { homedir as homedir19 } from "node:os";
62982
63023
  async function checkLogs(options = {}) {
62983
63024
  const home = options.home ?? process.env.HOME ?? homedir19();
@@ -63012,7 +63053,7 @@ async function checkLogs(options = {}) {
63012
63053
  const matched = entries.filter((entry) => isTrackedLogName(entry, tracked));
63013
63054
  const files = [];
63014
63055
  for (const name of matched) {
63015
- const path16 = join37(paths.runtimeDir, name);
63056
+ const path16 = join38(paths.runtimeDir, name);
63016
63057
  try {
63017
63058
  const fileStat = await probe.stat(path16);
63018
63059
  if (fileStat.isDirectory()) {
@@ -64043,7 +64084,7 @@ var init_render_doctor = __esm(() => {
64043
64084
 
64044
64085
  // src/doctor/doctor.ts
64045
64086
  import { homedir as homedir22 } from "node:os";
64046
- import { join as join38 } from "node:path";
64087
+ import { join as join39 } from "node:path";
64047
64088
  async function runDoctor(options = {}, deps = {}) {
64048
64089
  const home = deps.home ?? process.env.HOME ?? homedir22();
64049
64090
  const runtimePaths = resolveDoctorRuntimePaths(home, deps.resolveRuntimePaths);
@@ -64204,8 +64245,8 @@ function resolveDoctorRuntimePaths(home, resolver) {
64204
64245
  return resolveRuntimePaths();
64205
64246
  }
64206
64247
  return {
64207
- configPath: join38(coreHomeDir(home), "config.json"),
64208
- statePath: join38(coreHomeDir(home), "state.json")
64248
+ configPath: join39(coreHomeDir(home), "config.json"),
64249
+ statePath: join39(coreHomeDir(home), "state.json")
64209
64250
  };
64210
64251
  }
64211
64252
  function depsUseExplicitRuntimeOverrides() {
@@ -64408,7 +64449,7 @@ __export(exports_cli, {
64408
64449
  });
64409
64450
  import { randomUUID as randomUUID16 } from "node:crypto";
64410
64451
  import { homedir as homedir23 } from "node:os";
64411
- import { dirname as dirname26, join as join39, sep as sep6 } from "node:path";
64452
+ import { dirname as dirname26, join as join40, sep as sep6 } from "node:path";
64412
64453
  import { fileURLToPath as fileURLToPath9 } from "node:url";
64413
64454
  async function prepareMcpCoordinatorStartup(input) {
64414
64455
  const coordinatorSession = input.coordinatorSession.trim();
@@ -65094,14 +65135,14 @@ function createAdapterCliDeps(input) {
65094
65135
  const runtimeRoot = dirname26(resolveConfigPathForCurrentEnv());
65095
65136
  let orphanRegistry;
65096
65137
  if (process.platform === "win32") {
65097
- orphanRegistry = new OrphanRegistry(join39(runtimeRoot, "runtime"));
65138
+ orphanRegistry = new OrphanRegistry(join40(runtimeRoot, "runtime"));
65098
65139
  await orphanRegistry.initialize();
65099
65140
  }
65100
65141
  const [result] = await garbageCollectAdapterReleases({
65101
65142
  runtimeRoot,
65102
65143
  id,
65103
65144
  releaseId,
65104
- statePath: coreEnv("STATE") ?? join39(runtimeRoot, "state.json"),
65145
+ statePath: coreEnv("STATE") ?? join40(runtimeRoot, "state.json"),
65105
65146
  ...orphanRegistry ? { orphanRegistry } : {}
65106
65147
  });
65107
65148
  return result.disposition;
@@ -65520,7 +65561,7 @@ function safeDaemonLogPaths() {
65520
65561
  const configPath = resolveConfigPathForCurrentEnv();
65521
65562
  const paths = resolveDaemonPathsForCurrentConfig();
65522
65563
  return {
65523
- appLog: join39(dirname26(configPath), "runtime", "app.log"),
65564
+ appLog: join40(dirname26(configPath), "runtime", "app.log"),
65524
65565
  stderrLog: paths.stderrLog
65525
65566
  };
65526
65567
  } catch {
@@ -8,7 +8,7 @@ import type { CancelTaskInput, OrchestrationService, OrchestrationTaskFilter } f
8
8
  import type { OrchestrationTaskRecord } from "../orchestration/orchestration-types";
9
9
  import type { ControlEventBus } from "./control-event-bus";
10
10
  import type { AgentCatalogEntry } from "../config/agent-catalog";
11
- import { type DirListing, type FileContent, type SearchOptions, type SearchResult, type WorkspaceDiff } from "./workspace-fs";
11
+ import { type BrowseDirsResult, type DirListing, type FileContent, type SearchOptions, type SearchResult, type WorkspaceDiff } from "./workspace-fs";
12
12
  import { type GitCheckoutOptions, type GitCommitResult, type GitPushOptions, type GitStatus, type GitWorktreeCreateOptions, type GitWorktreeCreateResult } from "./workspace-git";
13
13
  import type { AgentEndpointView, AgentMessageTraceRecord } from "../orchestration/agent-messaging-types";
14
14
  import type { PromptAttachmentRef } from "@ganglion/xacpx-relay-protocol";
@@ -226,6 +226,7 @@ export declare class ControlService {
226
226
  constructor(deps: ControlServiceDeps);
227
227
  private readonly workspaceFs;
228
228
  listDirectory(workspace: string, path?: string): Promise<DirListing>;
229
+ browseDirectories(path?: string): Promise<BrowseDirsResult>;
229
230
  readWorkspaceFile(workspace: string, path: string): Promise<FileContent>;
230
231
  workspaceGitDiff(workspace: string, path?: string): Promise<WorkspaceDiff>;
231
232
  workspaceGitStatus(workspace: string): Promise<GitStatus>;
@@ -1,3 +1,6 @@
1
+ /** Expand a leading `~` to the home directory (workspace cwds are often configured
2
+ * as `~` or `~/path`). */
3
+ export declare function expandHome(p: string): string;
1
4
  export interface FsEntry {
2
5
  name: string;
3
6
  type: "dir" | "file";
@@ -67,6 +70,18 @@ export interface WorkspaceDiff {
67
70
  linked: boolean;
68
71
  };
69
72
  }
73
+ export interface BrowseDirsResult {
74
+ path: string;
75
+ sep: "/" | "\\";
76
+ parent: string | null;
77
+ home: string;
78
+ dirs: Array<{
79
+ name: string;
80
+ path: string;
81
+ }>;
82
+ truncated: boolean;
83
+ }
84
+ export declare function browseDirectories(input?: string): Promise<BrowseDirsResult>;
70
85
  export interface WorkspaceRef {
71
86
  name: string;
72
87
  cwd: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganglion/xacpx",
3
- "version": "0.23.0-beta.1",
3
+ "version": "0.23.0-beta.2",
4
4
  "description": "随时随地通过聊天频道(微信 / 飞书 / 元宝等)远程控制 `acpx` 上的 Claude Code、Codex 等 Agents。",
5
5
  "keywords": [
6
6
  "acpx",