an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
'use strict';
const test = require('node:test');
const assert = require('node:assert/strict');
const loadTs = require('./load-ts.cjs');
const {
codexRemoteAliasPath,
codexRemoteEndpoint,
codexRemoteSocketFits,
withCodexRemoteArgs,
CODEX_REMOTE_SOCKET_MAX,
CODEX_REMOTE_SOCKET_RELATIVE
} = loadTs('src/shared/codexRemote.ts');
test('Codex remote uses a short stable per-agent home alias', {
skip: process.platform === 'win32' ? 'Codex remote uses Unix sockets and is disabled on Windows' : false
}, () => {
const first = codexRemoteAliasPath('/very/long/hive/agent/.codex', 'dev-1', '/tmp');
const again = codexRemoteAliasPath('/very/long/hive/agent/.codex', 'dev-1', '/tmp');
const other = codexRemoteAliasPath('/very/long/hive/agent/.codex', 'dev-2', '/tmp');
assert.equal(first, again);
assert.notEqual(first, other);
assert.ok(first.length < 80);
assert.match(codexRemoteEndpoint(first), /^unix:\/\/\/tmp\//);
});
test('the default alias root yields a socket within sun_path', () => {
// The real hive home that failed with "path must be shorter than SUN_LEN".
const realHome =
'/Users/vyapakgoyal/Documents/HarnessAgents/hive/agents/dev2-mrxb3l43/.codex';
const socket =
codexRemoteAliasPath(realHome, 'dev2-mrxb3l43') + '/' + CODEX_REMOTE_SOCKET_RELATIVE;
assert.ok(
socket.length < CODEX_REMOTE_SOCKET_MAX,
`socket path is ${socket.length} bytes: ${socket}`
);
// …and shorter than the home it replaces, which the $TMPDIR version was not.
assert.ok(socket.length < (realHome + '/' + CODEX_REMOTE_SOCKET_RELATIVE).length);
});
test('an over-long alias root is rejected instead of failing at bind time', () => {
const tmpdirStyle = '/var/folders/v6/9f10q5d148z7bxdzhr22xl7r0000gn/T/munder-codex';
assert.equal(codexRemoteSocketFits(codexRemoteAliasPath('/h/.codex', 'a', tmpdirStyle)), false);
assert.equal(codexRemoteSocketFits(codexRemoteAliasPath('/h/.codex', 'a')), true);
});
test('remote endpoint precedes both fresh and resumed Codex invocations', () => {
const endpoint = 'unix:///tmp/munder-codex/a/app-server-control/app-server-control.sock';
assert.deepEqual(
withCodexRemoteArgs(['--model', 'gpt-5.6-sol', 'hello'], endpoint),
['--remote', endpoint, '--model', 'gpt-5.6-sol', 'hello']
);
assert.deepEqual(
withCodexRemoteArgs(['resume', 'session-id', '--model', 'gpt-5.6-sol'], endpoint),
['--remote', endpoint, 'resume', 'session-id', '--model', 'gpt-5.6-sol']
);
assert.deepEqual(
withCodexRemoteArgs(['--remote', endpoint, 'resume'], endpoint),
['--remote', endpoint, 'resume']
);
});