@hanzo/rooms 0.1.52 → 0.1.54

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/dist/lib/ai.d.ts CHANGED
@@ -18,7 +18,10 @@ export declare const FREE = "enso-free";
18
18
  /** Enso routes a signed-in turn: enso-auto when logged in. */
19
19
  export declare const ENSO = "enso-auto";
20
20
  /**
21
- * The model that will actually ANSWER, given what the gateway serves.
21
+ * The model that will actually ANSWER, given what the gateway serves: the one
22
+ * asked for when the gateway serves it, else the free pool for a free turn,
23
+ * else a house router (Enso or Zen), else the first model served. An id is read
24
+ * by its own name; one the gateway does not serve is never relabelled.
22
25
  */
23
26
  export declare function served(models: {
24
27
  id: string;
package/dist/lib/ai.js CHANGED
@@ -46,31 +46,22 @@ export const FREE = 'enso-free';
46
46
  /** Enso routes a signed-in turn: enso-auto when logged in. */
47
47
  export const ENSO = 'enso-auto';
48
48
  /**
49
- * The model that will actually ANSWER, given what the gateway serves.
49
+ * The model that will actually ANSWER, given what the gateway serves: the one
50
+ * asked for when the gateway serves it, else the free pool for a free turn,
51
+ * else a house router (Enso or Zen), else the first model served. An id is read
52
+ * by its own name; one the gateway does not serve is never relabelled.
50
53
  */
51
54
  export function served(models, prefer) {
52
- const cleanPrefer = prefer === 'openrouter/auto' || prefer?.includes('openrouter') ? 'enso-auto' : prefer;
53
55
  if (models.length === 0)
54
- return cleanPrefer || 'enso-auto';
55
- if (cleanPrefer && models.some((m) => m.id === cleanPrefer))
56
- return cleanPrefer;
57
- if (cleanPrefer === 'enso-free' || cleanPrefer === 'free' || cleanPrefer.includes('free')) {
58
- const free = models.find((m) => m.id === 'enso-free' || m.id === 'zen-free' || (m.id.includes('free') && !m.id.includes('openrouter')));
59
- if (free)
60
- return free.id;
61
- return 'enso-free';
56
+ return prefer || ENSO;
57
+ if (prefer && models.some((m) => m.id === prefer))
58
+ return prefer;
59
+ if (prefer === FREE || prefer === 'free' || prefer?.includes('free')) {
60
+ return models.find((m) => m.id === FREE || m.id === 'zen-free')?.id ?? FREE;
62
61
  }
63
- // House routers: Enso or Zen
64
- const houseAuto = models.find((m) => m.id === 'enso-auto' || m.id === 'zen-auto' || m.id === 'enso' || m.id === 'zen');
65
- if (houseAuto)
66
- return houseAuto.id;
67
- const houseModel = models.find((m) => (m.id.startsWith('enso') || m.id.startsWith('zen')) && !m.id.includes('openrouter'));
68
- if (houseModel)
69
- return houseModel.id;
70
- const clean = models.find((m) => !m.id.includes('openrouter'));
71
- if (clean)
72
- return clean.id;
73
- return 'enso-auto';
62
+ const house = models.find((m) => m.id === ENSO || m.id === 'zen-auto' || m.id === 'enso' || m.id === 'zen') ??
63
+ models.find((m) => m.id.startsWith('enso') || m.id.startsWith('zen'));
64
+ return house?.id ?? models[0].id;
74
65
  }
75
66
  /**
76
67
  * The gateway's address in the shape `createAiClient` takes it.
@@ -130,8 +130,9 @@ export declare const WEB = "https://hanzo.ai/chat";
130
130
  export declare const guest: (hostname: string) => boolean;
131
131
  /**
132
132
  * Whether a host is the devnet's: its production twin with `-dev` on the one
133
- * label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai).
134
- * A deeper name (a.b-dev.hanzo.ai) is not one, and neither is a name that only
135
- * contains the suffix (app-dev.hanzo.ai.example.com).
133
+ * label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai),
134
+ * and dev.hanzo.ai, the devnet's sandbox checkout. A deeper name
135
+ * (a.b-dev.hanzo.ai) is not one, and neither is a name that only contains the
136
+ * suffix (app-dev.hanzo.ai.example.com).
136
137
  */
137
138
  export declare function devnet(hostname: string): boolean;
package/dist/lib/host.js CHANGED
@@ -201,11 +201,14 @@ export const guest = (hostname) => hostname === 'hanzo.app' || hostname.endsWith
201
201
  const DEVNET = '-dev.hanzo.ai';
202
202
  /**
203
203
  * Whether a host is the devnet's: its production twin with `-dev` on the one
204
- * label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai).
205
- * A deeper name (a.b-dev.hanzo.ai) is not one, and neither is a name that only
206
- * contains the suffix (app-dev.hanzo.ai.example.com).
204
+ * label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai),
205
+ * and dev.hanzo.ai, the devnet's sandbox checkout. A deeper name
206
+ * (a.b-dev.hanzo.ai) is not one, and neither is a name that only contains the
207
+ * suffix (app-dev.hanzo.ai.example.com).
207
208
  */
208
209
  export function devnet(hostname) {
210
+ if (hostname === 'dev.hanzo.ai')
211
+ return true;
209
212
  if (!hostname.endsWith(DEVNET))
210
213
  return false;
211
214
  const label = hostname.slice(0, -'.hanzo.ai'.length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/rooms",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "description": "The workspace rooms — Home, Chat, Inbox, Contacts, Meet, Cal, Drive, Board, Work, Bots — and the frame that holds them, once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",