@agentshouse/kit 0.2.1-c7252abc8a583 → 0.2.1-c8179f06883b6
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 +2 -2
- package/dist/bootstrap.json +4 -4
- package/dist/clis.js +8 -2
- package/dist/codex.js +61 -0
- package/dist/kit-main.js +4 -1
- package/dist/login.js +4 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,14 +35,14 @@ them out; running it again without the flag brings them back.
|
|
|
35
35
|
or another, continues on its own and keeps the Environment's credential in
|
|
36
36
|
`~/.house-kit`, or in `$HOUSE_KIT_HOME` when it is set. `--environment <id>`
|
|
37
37
|
reconnects an Environment you already have; `--rooms <ref>[,<ref>...]` gives it
|
|
38
|
-
only those Rooms and `--no-private` every Room but your Private Room;
|
|
39
|
-
`--code <code>` connects immediately without a link.
|
|
38
|
+
only those Rooms and `--no-private` every Room but your Private Room; `--code <code>` connects immediately without a link.
|
|
40
39
|
A login also connects your own agent: outside an Agent conversation, `house <tool>` calls
|
|
41
40
|
House as you and `git` clones and pushes your Apps at `<house>/app/` as you, until you revoke
|
|
42
41
|
that connection on Connections. `house help` lists the Tools. Codex sessions started after a
|
|
43
42
|
login run a lone `house` command outside their sandbox. `kit logout` disconnects this
|
|
44
43
|
computer, stops House Kit and ends your own agent's connection, so `house` and `git` no
|
|
45
44
|
longer act as you here; a later `kit login` reconnects the same Environment.
|
|
45
|
+
`kit codex --key <key>` starts Codex with `house` acting as you through a key made on Connections; next time, just `kit codex`.
|
|
46
46
|
|
|
47
47
|
`kit resident` keeps the Environment connected and, as it connects, copies each
|
|
48
48
|
Room you chose for it as a Git repository in the workspace's `local-copies`.
|
package/dist/bootstrap.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
|
-
"version": "0.2.1-
|
|
3
|
+
"version": "0.2.1-c8179f06883b6",
|
|
4
4
|
"hosts": {
|
|
5
5
|
"macos": {
|
|
6
6
|
"asset": {
|
|
7
7
|
"name": "connect-linux.sh",
|
|
8
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
8
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c8179f06883b6/connect-linux.sh"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"linux": {
|
|
12
12
|
"asset": {
|
|
13
13
|
"name": "connect-linux.sh",
|
|
14
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
14
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c8179f06883b6/connect-linux.sh"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"windows": {
|
|
18
18
|
"asset": {
|
|
19
19
|
"name": "connect-windows.ps1",
|
|
20
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
20
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c8179f06883b6/connect-windows.ps1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
package/dist/clis.js
CHANGED
|
@@ -2,7 +2,7 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { constants, readFileSync } from 'node:fs';
|
|
3
3
|
import { access, mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { homedir, userInfo } from 'node:os';
|
|
5
|
-
import { delimiter, isAbsolute, join } from 'node:path';
|
|
5
|
+
import { delimiter, dirname, isAbsolute, join } from 'node:path';
|
|
6
6
|
import { kitHome } from './home.js';
|
|
7
7
|
const HOUSE_EXECUTABLES = /^host_executable\(name = "house", paths = (\[.*\])\)$/m;
|
|
8
8
|
function houseRule(houses) {
|
|
@@ -17,7 +17,7 @@ const RAW_SUBTYPES = [
|
|
|
17
17
|
'hook_started',
|
|
18
18
|
'hook_response',
|
|
19
19
|
];
|
|
20
|
-
async function executable(path) {
|
|
20
|
+
export async function executable(path) {
|
|
21
21
|
try {
|
|
22
22
|
await access(path, constants.X_OK);
|
|
23
23
|
return true;
|
|
@@ -224,6 +224,12 @@ export async function loginPath() {
|
|
|
224
224
|
const ran = await inLoginShell(`printf "${marker}%s\\n" "$PATH"`);
|
|
225
225
|
return ran.stdout.split('\n').findLast((line) => line.startsWith(marker)).slice(marker.length);
|
|
226
226
|
}
|
|
227
|
+
export async function writeCodexRule() {
|
|
228
|
+
const shell = await loginPath().catch(() => '');
|
|
229
|
+
await allowHouseInCodex([dirname(process.execPath), process.env.PATH ?? '', shell].join(delimiter)).catch((error) => {
|
|
230
|
+
throw new Error(`Codex's rule for house could not be written: ${error.message}`);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
227
233
|
export async function versionOf(path, signal) {
|
|
228
234
|
return VERSION.exec((await run(path, ['--version'], READ_MS, false, signal)).stdout)?.[0] ?? null;
|
|
229
235
|
}
|
package/dist/codex.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { delimiter, join, resolve } from 'node:path';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { CLIS, executable, writeCodexRule } from './clis.js';
|
|
5
|
+
import { kitHome, readOwnAgent, writeOwnAgent } from './home.js';
|
|
6
|
+
import { accepted, DEFAULT_HOUSE } from './login.js';
|
|
7
|
+
const USAGE = `usage: kit codex [--key <key>] [--house <origin>] [<codex argument>...]
|
|
8
|
+
--key <key> a key from New key for a script on Connections, kept for later runs
|
|
9
|
+
--house <origin> the House of the key, ${DEFAULT_HOUSE} unless one is stored
|
|
10
|
+
`;
|
|
11
|
+
const VALUED = ['--key', '--house'];
|
|
12
|
+
const KEY_SOURCE = 'New key for a script on Connections';
|
|
13
|
+
function codexArgumentsStart(argv) {
|
|
14
|
+
let index = 0;
|
|
15
|
+
while (index < argv.length) {
|
|
16
|
+
const arg = argv[index];
|
|
17
|
+
if (VALUED.includes(arg))
|
|
18
|
+
index += 2;
|
|
19
|
+
else if (arg === '--help' || VALUED.some((option) => arg.startsWith(`${option}=`)))
|
|
20
|
+
index += 1;
|
|
21
|
+
else
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
return index;
|
|
25
|
+
}
|
|
26
|
+
async function onPath(name) {
|
|
27
|
+
for (const directory of (process.env.PATH ?? '').split(delimiter)) {
|
|
28
|
+
const path = resolve(directory, name);
|
|
29
|
+
if (await executable(path))
|
|
30
|
+
return path;
|
|
31
|
+
}
|
|
32
|
+
throw new Error(`${name} is not on your PATH; install it with ${CLIS['codex-acp'].install}`);
|
|
33
|
+
}
|
|
34
|
+
export async function codex(argv) {
|
|
35
|
+
const start = codexArgumentsStart(argv);
|
|
36
|
+
const { values } = parseArgs({
|
|
37
|
+
args: argv.slice(0, start),
|
|
38
|
+
options: { key: { type: 'string' }, house: { type: 'string' }, help: { type: 'boolean', default: false } },
|
|
39
|
+
});
|
|
40
|
+
if (values.help) {
|
|
41
|
+
process.stdout.write(USAGE);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
process.env.HOUSE_KIT_HOME = resolve(process.env.HOUSE_KIT_HOME || join(homedir(), '.house-kit-outside'));
|
|
45
|
+
const stored = await readOwnAgent();
|
|
46
|
+
if (values.key !== undefined) {
|
|
47
|
+
const house = values.house ?? stored?.house ?? DEFAULT_HOUSE;
|
|
48
|
+
if (!(await accepted(house, values.key)))
|
|
49
|
+
throw new Error(`${house} does not accept this key; pass one from ${KEY_SOURCE}`);
|
|
50
|
+
await writeOwnAgent({ house, credential: values.key });
|
|
51
|
+
}
|
|
52
|
+
else if (values.house !== undefined) {
|
|
53
|
+
throw new Error('--house names the House of a --key; pass the key with it');
|
|
54
|
+
}
|
|
55
|
+
else if (stored === null) {
|
|
56
|
+
throw new Error(`${kitHome()} holds no House key; pass --key with one from ${KEY_SOURCE}`);
|
|
57
|
+
}
|
|
58
|
+
await writeCodexRule();
|
|
59
|
+
const path = await onPath('codex');
|
|
60
|
+
process.execve(path, [path, ...argv.slice(start)], process.env);
|
|
61
|
+
}
|
package/dist/kit-main.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { setGlobalProxyFromEnv } from 'node:http';
|
|
3
3
|
import { parseArgs } from 'node:util';
|
|
4
4
|
import { answerGitCredential } from './app-git.js';
|
|
5
|
+
import { codex } from './codex.js';
|
|
5
6
|
import { login } from './login.js';
|
|
6
7
|
import { logout } from './logout.js';
|
|
7
8
|
import { resident } from './resident.js';
|
|
8
|
-
const USAGE = 'usage: kit <login|logout|resident>\n';
|
|
9
|
+
const USAGE = 'usage: kit <login|logout|resident|codex>\n';
|
|
9
10
|
const COMMANDS = new Map([
|
|
10
11
|
[
|
|
11
12
|
'logout',
|
|
@@ -40,6 +41,8 @@ setGlobalProxyFromEnv();
|
|
|
40
41
|
async function run() {
|
|
41
42
|
if (command === 'login')
|
|
42
43
|
return login(argv);
|
|
44
|
+
if (command === 'codex')
|
|
45
|
+
return codex(argv);
|
|
43
46
|
if (command === '--help') {
|
|
44
47
|
parseArgs({ args: argv });
|
|
45
48
|
process.stdout.write(USAGE);
|
package/dist/login.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { createHash, randomBytes } from 'node:crypto';
|
|
3
3
|
import { hostname } from 'node:os';
|
|
4
|
-
import { delimiter, dirname } from 'node:path';
|
|
5
4
|
import { parseArgs } from 'node:util';
|
|
6
5
|
import { post, retrying } from './api.js';
|
|
7
6
|
import { placeAppGit } from './app-git.js';
|
|
8
|
-
import {
|
|
7
|
+
import { writeCodexRule } from './clis.js';
|
|
9
8
|
import { forgetOwnAgent, readDisconnected, readEnrolment, readOwnAgent, writeEnrolment, writeOwnAgent } from './home.js';
|
|
10
9
|
import { callHouse, rpc } from './mcp.js';
|
|
11
10
|
import { selectRelay } from './relay.js';
|
|
12
11
|
import { startService } from './service.js';
|
|
13
12
|
import { placeSkillSet } from './skills.js';
|
|
14
|
-
const DEFAULT_HOUSE = 'https://agents.house';
|
|
13
|
+
export const DEFAULT_HOUSE = 'https://agents.house';
|
|
15
14
|
const OPENER = process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
16
15
|
// Polling every two seconds brings the User's confirmation to the waiting Kit moments after they give it.
|
|
17
16
|
const POLL_INTERVAL_MS = 2000;
|
|
@@ -20,7 +19,7 @@ function open(link) {
|
|
|
20
19
|
.on('error', () => undefined)
|
|
21
20
|
.unref();
|
|
22
21
|
}
|
|
23
|
-
async function accepted(house, credential) {
|
|
22
|
+
export async function accepted(house, credential) {
|
|
24
23
|
const checked = await callHouse(house, credential, rpc('tools/list', {}));
|
|
25
24
|
if (checked.status === 200)
|
|
26
25
|
return true;
|
|
@@ -103,13 +102,7 @@ export async function login(argv) {
|
|
|
103
102
|
catch (error) {
|
|
104
103
|
process.stderr.write(`kit: the skills could not be placed: ${error.message}\n`);
|
|
105
104
|
}
|
|
106
|
-
|
|
107
|
-
const shell = await loginPath().catch(() => '');
|
|
108
|
-
await allowHouseInCodex([dirname(process.execPath), process.env.PATH ?? '', shell].join(delimiter));
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
process.stderr.write(`kit: Codex's rule for house could not be written: ${error.message}\n`);
|
|
112
|
-
}
|
|
105
|
+
await writeCodexRule().catch((error) => process.stderr.write(`kit: ${error.message}\n`));
|
|
113
106
|
await writeEnrolment({
|
|
114
107
|
house,
|
|
115
108
|
...(relay === undefined ? {} : { relay }),
|