@ganglion/xacpx 0.20.3-beta.1 → 0.20.3

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.
@@ -7227,8 +7227,28 @@ function deriveAgentAlias(driver, argv) {
7227
7227
  const hash = createHash5("sha256").update(identity).digest("hex").slice(0, 12);
7228
7228
  return `xacpx-managed-${driver}-${hash}`;
7229
7229
  }
7230
+ function isDerivedAgentArgv(driver, argv, runtimeRoot, platform) {
7231
+ if (!argv || argv.length === 0) {
7232
+ return false;
7233
+ }
7234
+ if (isManagedAdapterId(driver)) {
7235
+ const spec = MANAGED_ADAPTERS[driver];
7236
+ return argv[0] === "npx" && argv[1] === "-y" && argv.some((entry) => entry.startsWith(`${spec.packageName}@`)) || classifyRecordedPreinstalledAdapterCommand(renderAgentArgvIdentity(argv), {
7237
+ runtimeRoot,
7238
+ platform
7239
+ }) === driver;
7240
+ }
7241
+ if (driver === "hermes") {
7242
+ return argv[1]?.includes("hermes-acp-shim.") === true;
7243
+ }
7244
+ if (driver === "opencode" || driver === "kilocode") {
7245
+ return argv.length === 2 && argv[0] === driver && argv[1] === "acp";
7246
+ }
7247
+ return false;
7248
+ }
7230
7249
  var IDENTITY_SAFE_ARG_RE;
7231
7250
  var init_agent_launch = __esm(() => {
7251
+ init_adapter_catalog();
7232
7252
  IDENTITY_SAFE_ARG_RE = /^[A-Za-z0-9_@%+=:,./^~-]+$/u;
7233
7253
  });
7234
7254
 
package/dist/cli.js CHANGED
@@ -4622,8 +4622,28 @@ function deriveAgentAlias(driver, argv) {
4622
4622
  const hash = createHash3("sha256").update(identity).digest("hex").slice(0, 12);
4623
4623
  return `xacpx-managed-${driver}-${hash}`;
4624
4624
  }
4625
+ function isDerivedAgentArgv(driver, argv, runtimeRoot, platform) {
4626
+ if (!argv || argv.length === 0) {
4627
+ return false;
4628
+ }
4629
+ if (isManagedAdapterId(driver)) {
4630
+ const spec = MANAGED_ADAPTERS[driver];
4631
+ return argv[0] === "npx" && argv[1] === "-y" && argv.some((entry) => entry.startsWith(`${spec.packageName}@`)) || classifyRecordedPreinstalledAdapterCommand(renderAgentArgvIdentity(argv), {
4632
+ runtimeRoot,
4633
+ platform
4634
+ }) === driver;
4635
+ }
4636
+ if (driver === "hermes") {
4637
+ return argv[1]?.includes("hermes-acp-shim.") === true;
4638
+ }
4639
+ if (driver === "opencode" || driver === "kilocode") {
4640
+ return argv.length === 2 && argv[0] === driver && argv[1] === "acp";
4641
+ }
4642
+ return false;
4643
+ }
4625
4644
  var IDENTITY_SAFE_ARG_RE;
4626
4645
  var init_agent_launch = __esm(() => {
4646
+ init_adapter_catalog();
4627
4647
  IDENTITY_SAFE_ARG_RE = /^[A-Za-z0-9_@%+=:,./^~-]+$/u;
4628
4648
  });
4629
4649
 
@@ -6304,6 +6324,7 @@ class ConfigStore {
6304
6324
  agents[name] = {
6305
6325
  driver: agent3.driver,
6306
6326
  ...agent3.command ? { command: agent3.command } : {},
6327
+ ...agent3.argv ? { argv: [...agent3.argv] } : {},
6307
6328
  ...agent3.model ? { model: agent3.model } : {},
6308
6329
  ...agent3.settingsPolicy ? { settingsPolicy: agent3.settingsPolicy } : {}
6309
6330
  };
@@ -50131,7 +50152,7 @@ class SessionService {
50131
50152
  platform,
50132
50153
  runtimeRoot: this.runtimeRoot
50133
50154
  });
50134
- if (current.rawCommand) {
50155
+ if (current.rawCommand || resolveAgentCommand(agentConfig.driver, agentConfig.command)) {
50135
50156
  return current;
50136
50157
  }
50137
50158
  const recordedArgv = isDerivedAgentArgv(agentConfig.driver, session3.transport_agent_argv, this.runtimeRoot, platform) ? undefined : session3.transport_agent_argv;
@@ -50151,9 +50172,6 @@ class SessionService {
50151
50172
  }) === agentConfig.driver);
50152
50173
  const recordedCommand = recordedIsDerived ? undefined : session3.transport_agent_command;
50153
50174
  if (recordedCommand) {
50154
- if (platform === "win32") {
50155
- throw new Error(`session "${session3.alias}" was created with a raw command that cannot be launched ` + "on Windows. Migrate the agent to an argv array in config: " + 'agents.<name>.argv = ["agent.exe", "--acp", ...]');
50156
- }
50157
50175
  return { acpxAgent: agentConfig.driver, rawCommand: recordedCommand, agentCommand: recordedCommand };
50158
50176
  }
50159
50177
  return current;
@@ -50330,25 +50348,6 @@ class SessionService {
50330
50348
  }
50331
50349
  }
50332
50350
  }
50333
- function isDerivedAgentArgv(driver, argv, runtimeRoot, platform) {
50334
- if (!argv || argv.length === 0) {
50335
- return false;
50336
- }
50337
- if (isManagedAdapterId(driver)) {
50338
- const spec = MANAGED_ADAPTERS[driver];
50339
- return argv[0] === "npx" && argv[1] === "-y" && argv.some((entry) => entry.startsWith(`${spec.packageName}@`)) || classifyRecordedPreinstalledAdapterCommand(renderAgentArgvIdentity(argv), {
50340
- runtimeRoot,
50341
- platform
50342
- }) === driver;
50343
- }
50344
- if (driver === "hermes") {
50345
- return argv[1]?.includes("hermes-acp-shim.") === true;
50346
- }
50347
- if (driver === "opencode" || driver === "kilocode") {
50348
- return argv.length === 2 && argv[0] === driver && argv[1] === "acp";
50349
- }
50350
- return false;
50351
- }
50352
50351
  var init_session_service = __esm(() => {
50353
50352
  init_resolve_agent_command();
50354
50353
  init_adapter_catalog();
@@ -8,16 +8,16 @@
8
8
  * - Structured launches carry `agentArgv` (exact boundaries, Windows-safe) and
9
9
  * `agentCommand` (the stable canonical identity acpx persists and keys its
10
10
  * session records by).
11
- * - `rawCommand` is the Unix-only legacy escape hatch passed as acpx `--agent`.
11
+ * - `rawCommand` is the legacy escape hatch / historical selector for acpx `--agent`.
12
12
  */
13
13
  export interface AgentLaunchSpec {
14
14
  /** acpx positional agent: bare driver or xacpx-managed alias. */
15
15
  acpxAgent: string;
16
16
  /** Stable acpx session identity for explicit launches. */
17
17
  agentCommand?: string;
18
- /** Exact executable and argument boundaries for overlay/migration. */
18
+ /** Exact executable and argument boundaries for structured / overlay launches. */
19
19
  agentArgv?: string[];
20
- /** Unix-only legacy raw override. */
20
+ /** Legacy raw override / historical session selector. */
21
21
  rawCommand?: string;
22
22
  }
23
23
  export declare function renderAgentArgvIdentity(argv: readonly string[]): string;
@@ -26,3 +26,9 @@ export declare function isValidAgentArgv(value: unknown): value is string[];
26
26
  /** Content-addressed overlay alias: stable per canonical argv across processes
27
27
  * and platforms; only acpx-safe name characters. */
28
28
  export declare function deriveAgentAlias(driver: string, argv: readonly string[]): string;
29
+ /** Detects an argv shape that `resolveLaunchSpec` treats as derived state
30
+ * (managed adapter pin, hermes shim, or local fallback for opencode /
31
+ * kilocode). A session with such argv has `recordedArgv` reset to undefined
32
+ * before step 2 in `resolveLaunchSpec`, so the sticky bypass does NOT
33
+ * apply — the session follows the current config / derived launch instead. */
34
+ export declare function isDerivedAgentArgv(driver: string, argv: string[] | undefined, runtimeRoot: string, platform: NodeJS.Platform): boolean;
@@ -64,7 +64,7 @@ export interface ResolvedSession {
64
64
  * alias provisioned in ~/.acpx/config.json; bare drivers pass through.
65
65
  */
66
66
  acpxAgent?: string;
67
- /** Unix-only legacy raw override passed as acpx `--agent`. */
67
+ /** Legacy raw override / historical session selector passed as acpx `--agent`. */
68
68
  rawCommand?: string;
69
69
  /** Exact executable + argument boundaries for overlay/migration. */
70
70
  agentArgv?: string[];
@@ -124,7 +124,7 @@ export interface AgentSessionListQuery {
124
124
  agentCommand?: string;
125
125
  /** Positional acpx agent for list/show queries (overlay alias or bare driver). */
126
126
  acpxAgent?: string;
127
- /** Unix-only legacy raw override; the shared builder prefers it over acpxAgent. */
127
+ /** Legacy raw override / historical selector; the shared builder prefers it over acpxAgent. */
128
128
  rawCommand?: string;
129
129
  /** Resolved acpx driver for `agent` (e.g. a custom `my-codex` agent has driver `codex`). Used to gate driver-specific list filtering. */
130
130
  driver?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganglion/xacpx",
3
- "version": "0.20.3-beta.1",
3
+ "version": "0.20.3",
4
4
  "description": "随时随地通过聊天频道(微信 / 飞书 / 元宝等)远程控制 `acpx` 上的 Claude Code、Codex 等 Agents。",
5
5
  "keywords": [
6
6
  "acpx",