create-open-autonomy 2.3.8 → 2.3.10

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.3.8",
3
+ "version": "2.3.10",
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": {
@@ -28,7 +28,7 @@
28
28
  "check": "bunx tsc --noEmit"
29
29
  },
30
30
  "dependencies": {
31
- "@open-autonomy/sdk": "2.3.2"
31
+ "@open-autonomy/sdk": "2.3.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/bun": "^1.3.10",
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.3.8' } as const;
12
+ export const KIT = { name: 'hermes', version: '2.3.10' } as const;
13
13
  export const KIT_FILE = '.open-autonomy/kit.json';
14
14
  const TEMPLATE = resolve(import.meta.dir, '..', 'template');
15
15
 
@@ -25,5 +25,10 @@ jobs:
25
25
  --body "Opened by the landing workflow for \`$BRANCH\`. It merges on its own when the required checks pass."
26
26
  existing=$(gh pr list -R "$REPO" --head "$BRANCH" --state open --json number -q '.[0].number')
27
27
  fi
28
- gh pr merge -R "$REPO" "$existing" --merge
29
- echo "pull request #$existing: merged"
28
+ # The merge races other landings ("base branch was modified") and GitHub's own mergeability check; try again a
29
+ # few times before giving up, so two branches landing in the same minute both land.
30
+ for attempt in 1 2 3 4 5 6; do
31
+ if gh pr merge -R "$REPO" "$existing" --merge; then echo "pull request #$existing: merged"; exit 0; fi
32
+ echo "merge attempt $attempt did not go through; retrying in 20s"; sleep 20
33
+ done
34
+ echo "pull request #$existing: could not be merged after six attempts"; exit 1
@@ -80,6 +80,22 @@ function jobName(id: string): string {
80
80
  return jobNames.get(id) ?? id;
81
81
  }
82
82
  const sourceOf = (d: SessionDescriptor): string => (d.recurrence?.job_id ? jobName(d.recurrence.job_id) : d.trigger === 'task' ? 'board' : d.surface?.platform ?? kindOf(d));
83
+ // A provider id is safe to publish; an endpoint and credential are not. The kit's `custom` provider is the
84
+ // platform only when its configured base URL names the valve. For any other configured provider, the owner's
85
+ // provider account funds the session. An incomplete custom configuration stays unknown.
86
+ function configuredProvider(home: string): string | undefined {
87
+ const config = readText(resolve(home, 'config.yaml')) ?? readText(resolve(cfg.hermes_home, 'config.yaml')) ?? '';
88
+ const provider = /^\s+provider:\s*["']?([^\s"']+)/m.exec(config)?.[1];
89
+ const endpoint = /^\s+base_url:\s*["']?([^\s"']+)/m.exec(config)?.[1];
90
+ if (!provider) return undefined;
91
+ if (endpoint === '${OPEN_AUTONOMY_BASE_URL}' || (endpoint && endpoint.replace(/\/$/, '') === baseUrl.replace(/\/$/, ''))) return 'open-autonomy';
92
+ if (provider === 'custom' && !endpoint) return undefined;
93
+ return provider;
94
+ }
95
+ function modelProviderOf(d: SessionDescriptor): string | undefined {
96
+ const home = d.profile && d.profile !== 'default' ? resolve(cfg.hermes_home, 'profiles', d.profile) : cfg.hermes_home;
97
+ return configuredProvider(home);
98
+ }
83
99
  function publishes(d: SessionDescriptor): boolean {
84
100
  const id = d.locator.session_id;
85
101
  if (cfg.publish.private.includes(id) || (d.recurrence?.job_id && cfg.publish.private.includes(d.recurrence.job_id))) return false;
@@ -127,7 +143,7 @@ class Followed {
127
143
  constructor(readonly d: SessionDescriptor) {}
128
144
  get key(): string { return this.d.locator.session_id; }
129
145
  async open(): Promise<void> {
130
- const start = { key: this.key, kind: kindOf(this.d), source: sourceOf(this.d), title: this.d.title ?? undefined, startedAt: this.d.updated_at_ms ? new Date(this.d.updated_at_ms).toISOString() : undefined };
146
+ const start = { key: this.key, kind: kindOf(this.d), source: sourceOf(this.d), title: this.d.title ?? undefined, modelProvider: modelProviderOf(this.d), startedAt: this.d.updated_at_ms ? new Date(this.d.updated_at_ms).toISOString() : undefined };
131
147
  this.session = await oa.resume(this.key, cfg.account, start);
132
148
  this.seq = this.session.seq;
133
149
  // Resuming at the platform's turn offset: the message index it corresponds to.
@@ -302,7 +318,7 @@ async function setup(): Promise<void> {
302
318
  const home = cfg.hermes_home;
303
319
  const config = readText(resolve(home, 'config.yaml')) ?? '';
304
320
  const model = /^\s+default:\s*(\S+)/m.exec(config)?.[1];
305
- const provider = /^\s+provider:\s*(\S+)/m.exec(config)?.[1];
321
+ const provider = configuredProvider(home);
306
322
  let schedule: Array<{ name: string; schedule: string; description?: string }> = [];
307
323
  try { const seed = JSON.parse(readText(resolve(home, 'cron', 'jobs.seed.json')) ?? '{}') as { jobs?: Array<{ name?: string; schedule?: string; prompt?: string; script?: string }> }; schedule = (seed.jobs ?? []).filter((j) => j.name && j.schedule).map((j) => ({ name: j.name!, schedule: j.schedule!, description: j.prompt ?? (j.script ? `runs ${j.script}` : undefined) })); } catch { /* no seed */ }
308
324
  const skills: string[] = [];