@agentshouse/kit 0.2.1-c7252abc8a583 → 0.2.1-c87bb54c0a0ce

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 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
+ In a container you do not control, such as ChatGPT's, `npm i -g @agentshouse/kit` and `kit chatgpt --key <key>` with a key made on Connections let `house <tool>` act as you, starting and configuring nothing else.
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`.
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
- "version": "0.2.1-c7252abc8a583",
3
+ "version": "0.2.1-c87bb54c0a0ce",
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-c7252abc8a583/connect-linux.sh"
8
+ "url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c87bb54c0a0ce/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-c7252abc8a583/connect-linux.sh"
14
+ "url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c87bb54c0a0ce/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-c7252abc8a583/connect-windows.ps1"
20
+ "url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c87bb54c0a0ce/connect-windows.ps1"
21
21
  }
22
22
  }
23
23
  }
@@ -0,0 +1,25 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { kitHome, readOwnAgent, writeOwnAgent } from './home.js';
3
+ import { accepted, DEFAULT_HOUSE } from './login.js';
4
+ const KEY_SOURCE = 'New key for a script on Connections';
5
+ const USAGE = `usage: kit chatgpt --key <key> [--house <origin>]
6
+ --key <key> a key from ${KEY_SOURCE}
7
+ --house <origin> the House of the key, ${DEFAULT_HOUSE} unless one is stored
8
+ `;
9
+ export async function chatgpt(argv) {
10
+ const { values } = parseArgs({
11
+ args: argv,
12
+ options: { key: { type: 'string' }, house: { type: 'string' }, help: { type: 'boolean', default: false } },
13
+ });
14
+ if (values.help) {
15
+ process.stdout.write(USAGE);
16
+ return;
17
+ }
18
+ if (values.key === undefined)
19
+ throw new Error(`pass --key with a key from ${KEY_SOURCE}`);
20
+ const house = values.house ?? (await readOwnAgent())?.house ?? DEFAULT_HOUSE;
21
+ if (!(await accepted(house, values.key)))
22
+ throw new Error(`${house} does not accept this key; pass one from ${KEY_SOURCE}`);
23
+ await writeOwnAgent({ house, credential: values.key });
24
+ process.stdout.write(`house now calls ${house} as you, with the key kept in ${kitHome()}.\n`);
25
+ }
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) {
@@ -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/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 { chatgpt } from './chatgpt.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|chatgpt>\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 === 'chatgpt')
45
+ return chatgpt(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 { allowHouseInCodex, loginPath } from './clis.js';
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
- try {
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 }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/kit",
3
- "version": "0.2.1-c7252abc8a583",
3
+ "version": "0.2.1-c87bb54c0a0ce",
4
4
  "description": "House Kit connects an Environment to agents.house.",
5
5
  "license": "MIT",
6
6
  "repository": {