@ganglion/xacpx 0.19.2 → 0.20.0-beta.0
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/README.md +1 -1
- package/dist/adapters/adapter-catalog.d.ts +49 -2
- package/dist/adapters/adapter-npm.d.ts +6 -0
- package/dist/adapters/adapter-preinstall.d.ts +64 -0
- package/dist/adapters/adapter-registry.d.ts +1 -1
- package/dist/adapters/adapter-verifier.d.ts +10 -0
- package/dist/adapters/hermes-acp-shim.js +172 -0
- package/dist/adapters/hermes-shim.d.ts +41 -0
- package/dist/adapters/resolve-node-exe.d.ts +6 -0
- package/dist/bridge/bridge-main.js +2877 -616
- package/dist/channels/types.d.ts +3 -0
- package/dist/cli.js +4422 -1387
- package/dist/config/agent-catalog.d.ts +4 -2
- package/dist/config/agent-launch.d.ts +28 -0
- package/dist/config/config-path.d.ts +1 -0
- package/dist/config/local-agent-bin.d.ts +7 -0
- package/dist/config/resolve-agent-command.d.ts +23 -1
- package/dist/config/types.d.ts +4 -0
- package/dist/control/control-event-bus.d.ts +2 -0
- package/dist/control/control-service.d.ts +10 -0
- package/dist/control/session-turn-runner.d.ts +1 -0
- package/dist/control/turn-queue.d.ts +30 -0
- package/dist/control/turn-support.d.ts +5 -0
- package/dist/i18n/types.d.ts +5 -0
- package/dist/logging/app-logger.d.ts +1 -0
- package/dist/plugin-api.js +12 -2
- package/dist/process/ipc-guard.d.ts +24 -0
- package/dist/process/terminate-process-tree.d.ts +11 -0
- package/dist/process/windows-process-identity.d.ts +7 -0
- package/dist/process/windows-process-tree.d.ts +57 -0
- package/dist/sessions/session-service.d.ts +33 -3
- package/dist/state/replace-runtime-state.d.ts +3 -0
- package/dist/state/types.d.ts +5 -0
- package/dist/transport/types.d.ts +15 -0
- package/dist/weixin/monitor/consumer-lock.d.ts +6 -0
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Chat isn't the only entry point: xacpx also ships a self-hostable **[relay hub](
|
|
|
31
31
|
|
|
32
32
|
### Prerequisites
|
|
33
33
|
|
|
34
|
-
- Node.js 22.
|
|
34
|
+
- Node.js 22.13+ or Bun
|
|
35
35
|
- A working agent CLI you intend to use, such as Codex / Claude Code / Gemini / OpenCode
|
|
36
36
|
- A phone with WeChat, Feishu, or Yuanbao installed
|
|
37
37
|
|
|
@@ -2,24 +2,71 @@ export declare const MANAGED_ADAPTERS: {
|
|
|
2
2
|
readonly codex: {
|
|
3
3
|
readonly packageName: "@agentclientprotocol/codex-acp";
|
|
4
4
|
readonly binName: "codex-acp";
|
|
5
|
-
readonly defaultVersion: "1.1.
|
|
5
|
+
readonly defaultVersion: "1.1.9";
|
|
6
6
|
};
|
|
7
7
|
readonly claude: {
|
|
8
8
|
readonly packageName: "@agentclientprotocol/claude-agent-acp";
|
|
9
9
|
readonly binName: "claude-agent-acp";
|
|
10
|
-
readonly defaultVersion: "0.
|
|
10
|
+
readonly defaultVersion: "0.64.2";
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export type ManagedAdapterId = keyof typeof MANAGED_ADAPTERS;
|
|
14
14
|
export type AdapterVersionOverrides = Partial<Record<ManagedAdapterId, string>>;
|
|
15
|
+
export interface ManagedNpxCommand {
|
|
16
|
+
kind: "npx";
|
|
17
|
+
id: ManagedAdapterId;
|
|
18
|
+
version: string;
|
|
19
|
+
registry?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ManagedPreinstalledCommand {
|
|
22
|
+
kind: "preinstalled";
|
|
23
|
+
id: ManagedAdapterId;
|
|
24
|
+
releaseId: string;
|
|
25
|
+
nodeExecutable: string;
|
|
26
|
+
entryPath: string;
|
|
27
|
+
}
|
|
28
|
+
export type DecodedManagedAdapterCommand = ManagedNpxCommand | ManagedPreinstalledCommand;
|
|
15
29
|
export declare function isManagedAdapterId(value: string): value is ManagedAdapterId;
|
|
16
30
|
export declare function listManagedAdapterIds(): ManagedAdapterId[];
|
|
17
31
|
export declare function isExactAdapterVersion(value: string): boolean;
|
|
18
32
|
export declare function effectiveAdapterVersion(id: ManagedAdapterId, overrides: AdapterVersionOverrides | undefined): string;
|
|
33
|
+
export declare function buildManagedAdapterArgv(id: ManagedAdapterId, version: string, registry?: string): string[];
|
|
19
34
|
export declare function buildManagedAdapterCommand(id: ManagedAdapterId, version: string, registry?: string): string;
|
|
35
|
+
export declare function resolveManagedAdapterArgv(driver: string, overrides?: AdapterVersionOverrides, registry?: string): string[] | undefined;
|
|
20
36
|
export declare function resolveManagedAdapterCommand(driver: string, overrides?: AdapterVersionOverrides, registry?: string): string | undefined;
|
|
21
37
|
export declare function isManagedAdapterCommand(driver: string, command: string | undefined): boolean;
|
|
22
38
|
export declare function managedAdapterRegistryFromCommand(command: string | undefined): string | undefined;
|
|
39
|
+
export declare function canonicalAdapterRegistry(registry: string): string;
|
|
40
|
+
export declare function adapterRegistryHash8(registry: string): string;
|
|
41
|
+
export declare function createAdapterReleaseId(version: string, registry: string, uuid?: string): string;
|
|
42
|
+
export declare function parseAdapterReleaseId(releaseId: string): {
|
|
43
|
+
version: string;
|
|
44
|
+
registryHash8: string;
|
|
45
|
+
uuid8: string;
|
|
46
|
+
} | null;
|
|
47
|
+
export declare function splitAdapterCommand(command: string): string[] | null;
|
|
48
|
+
/** Structural preinstall classifier used only to decide whether launch fencing is mandatory. */
|
|
49
|
+
export declare function classifyPreinstalledAdapterCommandShape(command: string | undefined): ManagedAdapterId | null;
|
|
50
|
+
export interface ClassifyRecordedPreinstalledAdapterCommandOptions {
|
|
51
|
+
/** Trusted xacpx runtime root containing the managed adapters directory. */
|
|
52
|
+
runtimeRoot: string;
|
|
53
|
+
platform?: NodeJS.Platform;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Strict structural classifier for persisted session identity. Unlike the broad
|
|
57
|
+
* fencing classifier above, this only treats a command as derived managed state
|
|
58
|
+
* when its entry is under the trusted runtime adapter root and has the complete
|
|
59
|
+
* immutable release/package layout.
|
|
60
|
+
*/
|
|
61
|
+
export declare function classifyRecordedPreinstalledAdapterCommand(command: string | undefined, options: ClassifyRecordedPreinstalledAdapterCommandOptions): ManagedAdapterId | null;
|
|
62
|
+
export interface DecodeManagedAdapterCommandOptions {
|
|
63
|
+
adaptersRoot?: string;
|
|
64
|
+
controlledNodeExecutable?: string;
|
|
65
|
+
platform?: NodeJS.Platform;
|
|
66
|
+
realpath?: (path: string) => Promise<string>;
|
|
67
|
+
}
|
|
68
|
+
/** The single trust-boundary decoder used by classification and GC. */
|
|
69
|
+
export declare function decodeManagedAdapterCommand(command: string | undefined, options?: DecodeManagedAdapterCommandOptions): Promise<DecodedManagedAdapterCommand | null>;
|
|
23
70
|
/** A recorded generated command is derived state, so a newer configured/default
|
|
24
71
|
* version replaces it. Truly custom commands remain sticky for session identity. */
|
|
25
72
|
export declare function preferCurrentManagedAdapterCommand(driver: string, recorded: string | undefined, current: string | undefined): string | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ManagedAdapterId } from "./adapter-catalog";
|
|
2
|
+
export declare function getAdapterNpmVersion(id: ManagedAdapterId, version: string | undefined, registry: string): Promise<string | null>;
|
|
3
|
+
export declare function resolveNpmCommand(): {
|
|
4
|
+
command: string;
|
|
5
|
+
prefixArgs: string[];
|
|
6
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type ManagedAdapterId } from "./adapter-catalog";
|
|
2
|
+
export interface InstalledAdapterManifest {
|
|
3
|
+
schemaVersion: 1;
|
|
4
|
+
id: ManagedAdapterId;
|
|
5
|
+
packageName: string;
|
|
6
|
+
version: string;
|
|
7
|
+
releaseId: string;
|
|
8
|
+
registry: string;
|
|
9
|
+
nodeExecutable: string;
|
|
10
|
+
entryRelPath: string;
|
|
11
|
+
installedAt: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ActiveAdapterPointer {
|
|
14
|
+
version: string;
|
|
15
|
+
releaseId: string;
|
|
16
|
+
activatedAt: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ValidateReleaseExpected {
|
|
19
|
+
id: ManagedAdapterId;
|
|
20
|
+
version: string;
|
|
21
|
+
packageName: string;
|
|
22
|
+
registry: string;
|
|
23
|
+
releaseId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ValidateReleaseOptions {
|
|
26
|
+
probe?: boolean;
|
|
27
|
+
verify?: (command: string, args: string[]) => Promise<void>;
|
|
28
|
+
platform?: NodeJS.Platform;
|
|
29
|
+
staging?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface PreinstallAdapterOptions {
|
|
32
|
+
runtimeRoot: string;
|
|
33
|
+
id: ManagedAdapterId;
|
|
34
|
+
version: string;
|
|
35
|
+
registry: string;
|
|
36
|
+
nodeExecutable?: string;
|
|
37
|
+
now?: () => Date;
|
|
38
|
+
uuid?: () => string;
|
|
39
|
+
installPackage?: (stagingDir: string, packageSpec: string, registry: string) => Promise<void>;
|
|
40
|
+
verify?: (command: string, args: string[]) => Promise<void>;
|
|
41
|
+
fault?: (boundary: string) => void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
export declare function validateAdapterRelease(releaseDir: string, expected: ValidateReleaseExpected, options?: ValidateReleaseOptions): Promise<InstalledAdapterManifest>;
|
|
44
|
+
export declare function preinstallAdapter(options: PreinstallAdapterOptions): Promise<{
|
|
45
|
+
releaseDir: string;
|
|
46
|
+
manifest: InstalledAdapterManifest;
|
|
47
|
+
pointer: ActiveAdapterPointer;
|
|
48
|
+
}>;
|
|
49
|
+
export declare function recoverAdapterInstall(runtimeRoot: string, id: ManagedAdapterId): Promise<void>;
|
|
50
|
+
export declare function readActiveAdapterPointer(runtimeRoot: string, id: ManagedAdapterId): Promise<ActiveAdapterPointer | null>;
|
|
51
|
+
export declare function listInstalledAdapterReleases(runtimeRoot: string): Promise<Array<{
|
|
52
|
+
id: ManagedAdapterId;
|
|
53
|
+
releaseId: string;
|
|
54
|
+
active: boolean;
|
|
55
|
+
}>>;
|
|
56
|
+
/** Spawn-time static validation. The initialize probe is intentionally skipped. */
|
|
57
|
+
export declare function resolveActiveAdapterCommandSync(runtimeRoot: string, expected: Omit<ValidateReleaseExpected, "releaseId">): string | null;
|
|
58
|
+
/** Structured-argv variant of the spawn-time resolution for lossless launches. */
|
|
59
|
+
export declare function resolveActiveAdapterArgvSync(runtimeRoot: string, expected: Omit<ValidateReleaseExpected, "releaseId">): string[] | null;
|
|
60
|
+
/** Validate the referenced immutable release, then re-resolve the active pointer. */
|
|
61
|
+
export declare function validateAndReResolveAdapterCommand(runtimeRoot: string, command: string): Promise<{
|
|
62
|
+
id: ManagedAdapterId;
|
|
63
|
+
agentCommand: string;
|
|
64
|
+
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const DEFAULT_ADAPTER_REGISTRY = "https://registry.npmjs.org
|
|
1
|
+
export declare const DEFAULT_ADAPTER_REGISTRY = "https://registry.npmjs.org";
|
|
2
2
|
export declare class AdapterRegistryPackageNotFoundError extends Error {
|
|
3
3
|
readonly registry: string;
|
|
4
4
|
readonly code = "E404";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ManagedAdapterId } from "./adapter-catalog";
|
|
2
|
+
interface VerifyOptions {
|
|
3
|
+
timeoutMs?: number;
|
|
4
|
+
adapterRegistry?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Runs a structured ACP initialize probe and tears down the process tree afterward. */
|
|
7
|
+
export declare function verifyAcpInitialize(command: string, args: string[], options?: VerifyOptions): Promise<void>;
|
|
8
|
+
/** Downloads the exact package version through npm's exec cache, then probes ACP. */
|
|
9
|
+
export declare function verifyAdapterVersion(id: ManagedAdapterId, version: string, registry?: string): Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
20
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
+
for (let key of __getOwnPropNames(mod))
|
|
23
|
+
if (!__hasOwnProp.call(to, key))
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
+
var __returnValue = (v) => v;
|
|
34
|
+
function __exportSetter(name, newValue) {
|
|
35
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
36
|
+
}
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, {
|
|
40
|
+
get: all[name],
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
set: __exportSetter.bind(all, name)
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
47
|
+
var __promiseAll = (args) => Promise.all(args);
|
|
48
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
49
|
+
|
|
50
|
+
// src/adapters/hermes-shim.ts
|
|
51
|
+
import { fileURLToPath } from "node:url";
|
|
52
|
+
function isDefaultHermesCommand(command) {
|
|
53
|
+
return command.trim().replaceAll(/\s+/g, " ") === DEFAULT_HERMES_COMMAND;
|
|
54
|
+
}
|
|
55
|
+
function isHermesShimCommand(command) {
|
|
56
|
+
return command.includes("/hermes-acp-shim.") || command.includes("\\hermes-acp-shim.");
|
|
57
|
+
}
|
|
58
|
+
function resolveHermesAcpShimEntry(moduleUrl = import.meta.url) {
|
|
59
|
+
if (moduleUrl.endsWith(".ts")) {
|
|
60
|
+
return fileURLToPath(new URL("./hermes-acp-shim.ts", moduleUrl));
|
|
61
|
+
}
|
|
62
|
+
const idx = moduleUrl.lastIndexOf(DIST_MARKER);
|
|
63
|
+
if (idx !== -1) {
|
|
64
|
+
return fileURLToPath(new URL(`${moduleUrl.slice(0, idx + DIST_MARKER.length)}adapters/hermes-acp-shim.js`));
|
|
65
|
+
}
|
|
66
|
+
return fileURLToPath(new URL("./hermes-acp-shim.js", moduleUrl));
|
|
67
|
+
}
|
|
68
|
+
function hermesAcpShimArgv(execPath = process.execPath, shimEntry = resolveHermesAcpShimEntry()) {
|
|
69
|
+
return [execPath, shimEntry, "hermes", "acp"];
|
|
70
|
+
}
|
|
71
|
+
function stripResumeCapability(line) {
|
|
72
|
+
let message;
|
|
73
|
+
try {
|
|
74
|
+
message = JSON.parse(line);
|
|
75
|
+
} catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
if (!message || typeof message !== "object")
|
|
79
|
+
return null;
|
|
80
|
+
const result = message.result;
|
|
81
|
+
if (!result || typeof result !== "object")
|
|
82
|
+
return null;
|
|
83
|
+
const capabilities = result.agentCapabilities;
|
|
84
|
+
if (!capabilities || typeof capabilities !== "object")
|
|
85
|
+
return null;
|
|
86
|
+
const sessionCapabilities = capabilities.sessionCapabilities;
|
|
87
|
+
if (!sessionCapabilities || typeof sessionCapabilities !== "object")
|
|
88
|
+
return null;
|
|
89
|
+
if (!Object.hasOwn(sessionCapabilities, "resume"))
|
|
90
|
+
return null;
|
|
91
|
+
delete sessionCapabilities.resume;
|
|
92
|
+
return JSON.stringify(message);
|
|
93
|
+
}
|
|
94
|
+
function isInitializeResponse(line) {
|
|
95
|
+
let message;
|
|
96
|
+
try {
|
|
97
|
+
message = JSON.parse(line);
|
|
98
|
+
} catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (!message || typeof message !== "object")
|
|
102
|
+
return false;
|
|
103
|
+
const result = message.result;
|
|
104
|
+
if (!result || typeof result !== "object")
|
|
105
|
+
return false;
|
|
106
|
+
const capabilities = result.agentCapabilities;
|
|
107
|
+
return Boolean(capabilities) && typeof capabilities === "object";
|
|
108
|
+
}
|
|
109
|
+
var DEFAULT_HERMES_COMMAND = "hermes acp", DIST_MARKER = "/dist/";
|
|
110
|
+
var init_hermes_shim = () => {};
|
|
111
|
+
|
|
112
|
+
// src/adapters/hermes-acp-shim.ts
|
|
113
|
+
init_hermes_shim();
|
|
114
|
+
import { spawn } from "node:child_process";
|
|
115
|
+
import { constants as osConstants } from "node:os";
|
|
116
|
+
var argv = process.argv.slice(2);
|
|
117
|
+
var command = argv.length > 0 ? argv : ["hermes", "acp"];
|
|
118
|
+
var child = spawn(command[0], command.slice(1), {
|
|
119
|
+
stdio: ["pipe", "pipe", "inherit"],
|
|
120
|
+
shell: process.platform === "win32"
|
|
121
|
+
});
|
|
122
|
+
child.on("error", (error) => {
|
|
123
|
+
process.stderr.write(`[hermes-acp-shim] failed to spawn "${command.join(" ")}": ${error.message}
|
|
124
|
+
`);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
});
|
|
127
|
+
child.on("exit", (code, signal) => {
|
|
128
|
+
process.exitCode = signal ? 128 + (osConstants.signals[signal] ?? 0) : code ?? 0;
|
|
129
|
+
});
|
|
130
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
131
|
+
process.on(signal, () => {
|
|
132
|
+
child.kill(signal);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
process.stdin.pipe(child.stdin);
|
|
136
|
+
var patched = false;
|
|
137
|
+
var pending = Buffer.alloc(0);
|
|
138
|
+
var NEWLINE = 10;
|
|
139
|
+
var interceptStdout = (chunk) => {
|
|
140
|
+
pending = pending.length > 0 ? Buffer.concat([pending, chunk]) : chunk;
|
|
141
|
+
let newlineIndex;
|
|
142
|
+
while (!patched && (newlineIndex = pending.indexOf(NEWLINE)) !== -1) {
|
|
143
|
+
const line = pending.subarray(0, newlineIndex + 1);
|
|
144
|
+
pending = pending.subarray(newlineIndex + 1);
|
|
145
|
+
const text = line.toString("utf8");
|
|
146
|
+
const replaced = stripResumeCapability(text);
|
|
147
|
+
if (replaced !== null) {
|
|
148
|
+
patched = true;
|
|
149
|
+
process.stdout.write(`${replaced}
|
|
150
|
+
`);
|
|
151
|
+
} else {
|
|
152
|
+
process.stdout.write(line);
|
|
153
|
+
if (isInitializeResponse(text))
|
|
154
|
+
patched = true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (patched) {
|
|
158
|
+
if (pending.length > 0) {
|
|
159
|
+
process.stdout.write(pending);
|
|
160
|
+
pending = Buffer.alloc(0);
|
|
161
|
+
}
|
|
162
|
+
child.stdout.off("data", interceptStdout);
|
|
163
|
+
child.stdout.pipe(process.stdout, { end: false });
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
child.stdout.on("data", interceptStdout);
|
|
167
|
+
child.stdout.on("end", () => {
|
|
168
|
+
if (pending.length > 0) {
|
|
169
|
+
process.stdout.write(pending);
|
|
170
|
+
pending = Buffer.alloc(0);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** The command the 0.19.2 template baked into configs; treated as "no explicit
|
|
2
|
+
* command" so those configs migrate onto the shim without hand-editing. */
|
|
3
|
+
export declare function isDefaultHermesCommand(command: string): boolean;
|
|
4
|
+
/** A recorded shim command is derived, machine-specific state — the current
|
|
5
|
+
* install's shim (whose dist path may differ after an upgrade) must replace it.
|
|
6
|
+
* The leading separator keeps user wrappers like `my-hermes-acp-shim.sh` custom. */
|
|
7
|
+
export declare function isHermesShimCommand(command: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Path to the shim entry script. Unbundled dev runs (module URL still ends in .ts)
|
|
10
|
+
* resolve the sibling .ts source, which the dev runtime (bun) executes directly —
|
|
11
|
+
* checked FIRST so a checkout path that happens to contain `/dist/` cannot
|
|
12
|
+
* misresolve. Bundled builds (cli.js AND bridge/bridge-main.js both sit under
|
|
13
|
+
* dist/) anchor on the last `/dist/` segment.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveHermesAcpShimEntry(moduleUrl?: string): string;
|
|
16
|
+
/** Quote one token for acpx's `--agent` parser (double quotes; `\` and `"` escaped —
|
|
17
|
+
* its splitCommandLine treats backslash as an escape inside double quotes). */
|
|
18
|
+
export declare function quoteAgentCommandToken(token: string): string;
|
|
19
|
+
/** Runtime-only agent argv for the hermes driver: never persisted to config.
|
|
20
|
+
*
|
|
21
|
+
* Tradeoff: the argv embeds `process.execPath` and this install's dist path,
|
|
22
|
+
* and acpx keys its backend session records by EXACT agentCommand equality — so a
|
|
23
|
+
* node upgrade (nvm paths embed the version) or an install relocation re-keys
|
|
24
|
+
* hermes session identity: acpx starts a fresh backend record and the old queue
|
|
25
|
+
* owner ages out via TTL. Accepted because the alternative (a stable bin shim)
|
|
26
|
+
* isn't worth the packaging surface for a workaround slated for removal. */
|
|
27
|
+
export declare function hermesAcpShimArgv(execPath?: string, shimEntry?: string): string[];
|
|
28
|
+
/** Runtime-only agent command for the hermes driver: the quoted-string form of
|
|
29
|
+
* `hermesAcpShimArgv` for acpx `--agent` (Unix paths only). Only path-bearing
|
|
30
|
+
* tokens are quoted; `hermes acp` stay bare. */
|
|
31
|
+
export declare function hermesAcpShimCommand(execPath?: string, shimEntry?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* If `line` is the initialize response advertising `sessionCapabilities.resume`,
|
|
34
|
+
* return the same frame re-serialized without it; otherwise null (caller forwards
|
|
35
|
+
* the original bytes untouched).
|
|
36
|
+
*/
|
|
37
|
+
export declare function stripResumeCapability(line: string): string | null;
|
|
38
|
+
/** Is `line` an initialize response (the only frame carrying agentCapabilities)?
|
|
39
|
+
* Lets the shim latch to raw passthrough even when hermes stops advertising
|
|
40
|
+
* `resume` after the upstream fix, instead of parsing every line forever. */
|
|
41
|
+
export declare function isInitializeResponse(line: string): boolean;
|