create-open-autonomy 2.3.7 → 2.3.9

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.7",
3
+ "version": "2.3.9",
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.7' } as const;
12
+ export const KIT = { name: 'hermes', version: '2.3.9' } as const;
13
13
  export const KIT_FILE = '.open-autonomy/kit.json';
14
14
  const TEMPLATE = resolve(import.meta.dir, '..', 'template');
15
15
 
@@ -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[] = [];
@@ -0,0 +1,25 @@
1
+ """Open Autonomy's Hermes model wire."""
2
+
3
+ from agent.portal_tags import get_conversation_context
4
+ from providers import register_provider
5
+ from providers.base import ProviderProfile
6
+
7
+
8
+ class OpenAutonomyProfile(ProviderProfile):
9
+ """Name the active Hermes session on every request to the platform."""
10
+
11
+ def build_extra_body(
12
+ self, *, session_id: str | None = None, **context
13
+ ) -> dict[str, str]:
14
+ active = session_id or get_conversation_context()
15
+ return {"session_id": active} if active else {}
16
+
17
+
18
+ register_provider(
19
+ OpenAutonomyProfile(
20
+ name="custom",
21
+ display_name="Open Autonomy",
22
+ description="The project's metered Open Autonomy model rail",
23
+ env_vars=("OPEN_AUTONOMY_BASE_URL", "OPEN_AUTONOMY_KEY"),
24
+ )
25
+ )
@@ -0,0 +1,5 @@
1
+ name: open-autonomy
2
+ kind: model-provider
3
+ version: 1.0.0
4
+ description: Names the active Hermes session on Open Autonomy model calls.
5
+ author: Open Autonomy