* refactor: add acpx runtime embedding API * fix: preserve session state on replay failure * fix: honor startup controls in runtime manager * Runtime: deduplicate shared session engine * Runtime: honor oneshot and steer inputs * Runtime: keep persistent sessions stable * Runtime: initialize embedded event logs * Runtime: drop unsupported ensure env * Refactor: reorganize ACPX source layout * refactor: finish ACPX source layout cleanup * docs: note runtime embedding API
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import {
|
|
queueBaseDir,
|
|
queueKeyForSession,
|
|
queueLockFilePath,
|
|
queueSocketBaseDir,
|
|
queueSocketPath,
|
|
} from "../src/cli/queue/paths.js";
|
|
|
|
test("queue path helpers derive stable lock and socket paths", () => {
|
|
const homeDir = "/tmp/example-home";
|
|
const key = queueKeyForSession("session-id");
|
|
|
|
assert.equal(key.length, 24);
|
|
assert.equal(queueBaseDir(homeDir), "/tmp/example-home/.acpx/queues");
|
|
assert.equal(queueLockFilePath("session-id", homeDir), `${queueBaseDir(homeDir)}/${key}.lock`);
|
|
|
|
if (process.platform === "win32") {
|
|
assert.equal(queueSocketBaseDir(homeDir), undefined);
|
|
assert.equal(queueSocketPath("session-id", homeDir), `\\\\.\\pipe\\acpx-${key}`);
|
|
return;
|
|
}
|
|
|
|
assert.equal(queueSocketBaseDir(homeDir)?.startsWith("/tmp/acpx-"), true);
|
|
assert.equal(queueSocketPath("session-id", homeDir).endsWith(`${key}.sock`), true);
|
|
});
|
|
|
|
test("queueSocketPath stays short on unix even for long home paths", () => {
|
|
if (process.platform === "win32") {
|
|
return;
|
|
}
|
|
|
|
const longHome =
|
|
"/Users/example/Library/Containers/com.example.ReallyLongTemporaryHomePath/Somewhere/Deep";
|
|
const socketPath = queueSocketPath("session-id-for-length-check", longHome);
|
|
|
|
assert(socketPath.startsWith("/tmp/acpx-"));
|
|
assert(socketPath.length < 104, socketPath);
|
|
});
|