create-open-autonomy 2.3.2 → 2.3.4
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 +1 -1
- package/src/kit.ts +2 -2
- package/template/.open-autonomy/start.ts +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-open-autonomy",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
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
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// platform account — into a complete repository. Two kinds of files come out of it:
|
|
3
3
|
// kit-owned the agent's home, the reporter, the container stack, the landing workflows: what the kit
|
|
4
4
|
// keeps current. `check` diffs them against a fresh render; `upgrade` rewrites them.
|
|
5
|
-
// seeded README, the board's seed,
|
|
5
|
+
// seeded README, the board's seed, CONTRIBUTING.md, the constitution, changelog, AGENTS.md, license, the model config, the publish
|
|
6
6
|
// policy: the project's own files, written once as a courtesy and never touched again.
|
|
7
7
|
// `.open-autonomy/kit.json` records which kit, which version and which parameters made the repo: the anchor
|
|
8
8
|
// `check` and `upgrade` read, so neither needs to be told anything twice.
|
|
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.3.
|
|
12
|
+
export const KIT = { name: 'hermes', version: '2.3.4' } as const;
|
|
13
13
|
export const KIT_FILE = '.open-autonomy/kit.json';
|
|
14
14
|
const TEMPLATE = resolve(import.meta.dir, '..', 'template');
|
|
15
15
|
|
|
@@ -39,12 +39,16 @@ const sock = resolve(home, 'ssh-agent.sock');
|
|
|
39
39
|
const user = as ? (() => { const r = Bun.spawnSync({ cmd: ['id', '-u', as], stdout: 'pipe', stderr: 'pipe' }); const g = Bun.spawnSync({ cmd: ['id', '-g', as], stdout: 'pipe' }); if (r.exitCode !== 0) throw new Error(`start: no such user ${as}`); return { name: as, uid: Number(r.stdout.toString().trim()), gid: Number(g.stdout.toString().trim()) }; })() : null;
|
|
40
40
|
const drop = (cmd: string[]): string[] => (user ? ['setpriv', `--reuid=${user.uid}`, `--regid=${user.gid}`, '--clear-groups', ...cmd] : cmd);
|
|
41
41
|
const own = (path: string) => { if (user) Bun.spawnSync({ cmd: ['chown', '-R', `${user.uid}:${user.gid}`, path] }); };
|
|
42
|
-
|
|
42
|
+
// The agent's environment is what this script says. Nothing Hermes set on the process that started this one comes
|
|
43
|
+
// through: a start from inside another agent's worker (a project's world, brought up by a task) would otherwise inherit
|
|
44
|
+
// that worker's HERMES_KANBAN_DB, HERMES_KANBAN_HOME, its task and run, and file its work on the outer board.
|
|
45
|
+
const inherited = (): Record<string, string> => { const env: Record<string, string> = {}; for (const [k, v] of Object.entries(process.env)) if (v !== undefined && !k.startsWith('HERMES_')) env[k] = v; return env; };
|
|
46
|
+
const agentEnv = (): Record<string, string> => ({ ...inherited(), HERMES_HOME: home, ...(user ? { HOME: home, USER: user.name, LOGNAME: user.name } : {}), ...(existsSync(sock) ? { SSH_AUTH_SOCK: sock } : {}), GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND ?? 'ssh -o StrictHostKeyChecking=accept-new' });
|
|
43
47
|
|
|
44
48
|
const children: Array<{ name: string; proc: ReturnType<typeof Bun.spawn> }> = [];
|
|
45
49
|
let ending = false;
|
|
46
50
|
function spawn(name: string, cmd: string[], opts: { cwd?: string; env?: Record<string, string>; asAgent?: boolean }) {
|
|
47
|
-
const proc = Bun.spawn({ cmd: opts.asAgent ? drop(cmd) : cmd, cwd: opts.cwd ?? project, env: opts.env ?? (
|
|
51
|
+
const proc = Bun.spawn({ cmd: opts.asAgent ? drop(cmd) : cmd, cwd: opts.cwd ?? project, env: opts.env ?? inherited(), stdout: 'inherit', stderr: 'inherit', stdin: 'ignore' });
|
|
48
52
|
children.push({ name, proc });
|
|
49
53
|
proc.exited.then((code) => { if (ending) return; ending = true; say(`${name} ended (${code}); stopping the rest`); for (const c of children) if (c.proc !== proc) c.proc.kill(); setTimeout(() => process.exit(1), 500); });
|
|
50
54
|
return proc;
|
|
@@ -77,8 +81,12 @@ if (!existsSync(resolve(project, '.git'))) {
|
|
|
77
81
|
|
|
78
82
|
// 3. The home, from the checkout: everything under hermes/ except its .env, which is the home's own.
|
|
79
83
|
const committed = resolve(project, 'hermes');
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
if (existsSync(committed)) {
|
|
85
|
+
// The kit's own families are mirrored, not merged: a skill or hook the checkout no longer has leaves the home too.
|
|
86
|
+
for (const family of ['skills/open-autonomy', 'hooks']) rmSync(resolve(home, family), { recursive: true, force: true });
|
|
87
|
+
// force: with a filter, Bun's cpSync leaves an existing file alone unless told to overwrite.
|
|
88
|
+
cpSync(committed, home, { recursive: true, force: true, filter: (src) => basename(src) !== '.env' });
|
|
89
|
+
}
|
|
82
90
|
// The home's .env is the home's own, except the valve's three lines, which are this start's truth on every start.
|
|
83
91
|
const envFile = resolve(home, '.env');
|
|
84
92
|
const kept = existsSync(envFile) ? readFileSync(envFile, 'utf8').split('\n').filter((l) => l.trim() && !/^OPEN_AUTONOMY_(BASE_URL|PAY_URL|KEY)=/.test(l)) : [];
|