create-open-autonomy 2.4.2 → 2.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-open-autonomy",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "The default Open Autonomy starter kit: a complete repository that runs its own Hermes agent against the platform, with the SDK wired in. `bun create open-autonomy <dir>` scaffolds one.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/kit.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
10
10
  import { dirname, join, relative, resolve } from 'node:path';
11
11
 
12
- export const KIT = { name: 'hermes', version: '2.4.2' } as const;
12
+ export const KIT = { name: 'hermes', version: '2.4.3' } as const;
13
13
  export const KIT_FILE = '.open-autonomy/kit.json';
14
14
  const TEMPLATE = resolve(import.meta.dir, '..', 'template');
15
15
 
@@ -36,7 +36,10 @@ import { basename, resolve } from 'node:path';
36
36
  const argv = process.argv.slice(2);
37
37
  const arg = (name: string): string | undefined => { const i = argv.indexOf(name); return i >= 0 ? argv[i + 1] : undefined; };
38
38
  const project = resolve(arg('--project') ?? resolve(import.meta.dir, '..'));
39
- const home = resolve(arg('--home') ?? process.env.AGENT_HOME ?? resolve(homedir(), '.local', 'state', 'open-autonomy', basename(project), 'home'));
39
+ // The home's default is named by the project's account (owner/repo from .open-autonomy/config.yaml), never by the
40
+ // checkout's directory name: two projects checked out as `project` must not share one home.
41
+ const account = /^account:\s*(\S+)/m.exec(existsSync(resolve(project, '.open-autonomy', 'config.yaml')) ? readFileSync(resolve(project, '.open-autonomy', 'config.yaml'), 'utf8') : '')?.[1];
42
+ const home = resolve(arg('--home') ?? process.env.AGENT_HOME ?? resolve(homedir(), '.local', 'state', 'open-autonomy', ...(account ?? basename(project)).split('/'), 'home'));
40
43
  const secrets = resolve(arg('--secrets') ?? process.env.AGENT_SECRETS ?? resolve(homedir(), '.config', 'open-autonomy'));
41
44
  const origin = arg('--origin') ?? process.env.ORIGIN;
42
45
  const as = arg('--as');
@@ -140,8 +143,14 @@ const githubFile = resolve(secrets, 'github-app.json');
140
143
  if (githubApp) keys.push('--github-app', `${githubFile}:${valvePort + 3}`);
141
144
  spawn('valve', ['bun', resolve(import.meta.dir, 'sdk', 'valve.ts'), ...keys], {});
142
145
 
143
- // 5. The reporter and the gateway, as the agent.
146
+ // 5. The reporter and the gateway, as the agent. The reporter's own dependencies (supercode, beside it in
147
+ // .open-autonomy/package.json) are installed on the first start of a bare checkout.
144
148
  const env = agentEnv();
149
+ if (!existsSync(resolve(import.meta.dir, 'node_modules'))) {
150
+ const install = Bun.spawnSync({ cmd: drop(['bun', 'install']), cwd: import.meta.dir, env, stdout: 'inherit', stderr: 'inherit' });
151
+ if (install.exitCode !== 0) { console.error(`start: cannot install the reporter's dependencies in ${import.meta.dir}`); process.exit(1); }
152
+ say(`reporter dependencies installed in ${import.meta.dir}`);
153
+ }
145
154
  spawn('reporter', ['bun', resolve(import.meta.dir, 'reporter.ts'), '--config', resolve(project, '.open-autonomy', 'config.yaml')], { asAgent: true, env: { ...env, OPEN_AUTONOMY_BASE_URL: baseUrl } });
146
155
  spawn('gateway', ['hermes', 'gateway', 'run'], { asAgent: true, env });
147
156
  say(`gateway up in ${project} as ${user?.name ?? userInfo().username}, home ${home}; the valve on :${valvePort}${existsSync(resolve(secrets, 'treasurer.env')) ? ` and :${valvePort + 1}` : ''}${existsSync(codexFile) ? `; the Codex subscription on :${codexPort}` : ''}${githubApp ? `; the GitHub App on :${valvePort + 3}` : ''}`);