@urun-sh/openai 0.6.36 → 0.6.38

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.
@@ -443,62 +443,6 @@ interface SharedCatalogBlock {
443
443
  } | null;
444
444
  }
445
445
 
446
- /**
447
- * Per-model → per-app routing for the compat proxy (owner directive
448
- * 2026-08-07): swapping the model in a coding harness routes the request to
449
- * the org's DEPLOYED app for that model. v1 is deployed-only — a uRun model
450
- * that is not deployed gets a loud 404 naming `urun serve <id>`; a later
451
- * phase (explicitly out of scope here; urun-infra#1490 shared-endpoints)
452
- * auto-creates from the model catalog on first request.
453
- *
454
- * MODEL-ID SURFACE (the documented mapping): a model may be named by
455
- * - the app slug itself ("qwen3-6-27b-bf16"), or
456
- * - the catalog id ("qwen3.6-27b"), or
457
- * - the catalog id:variant ("qwen3.6-27b:bf16"),
458
- * where slugification mirrors urun-cli `serve.py _default_app_name` exactly:
459
- * lowercase, every non-alphanumeric-non-dash character becomes "-", leading/
460
- * trailing dashes stripped (catalog id "qwen3.6-27b" + variant "bf16" → app
461
- * "qwen3-6-27b-bf16"). COLLISION RULE (within one namespace): an exact slug
462
- * match always wins over the catalog-id (prefix) interpretation. ACROSS
463
- * namespaces the SHARED catalog wins: a raw id that names a catalog `shared`
464
- * model resolves to the shared lane even when the caller's own org deploys an
465
- * app with a colliding slug (see rule 2).
466
- *
467
- * RESOLUTION ORDER (one canonical path, documented end to end):
468
- * 1. model absent / "urun" / an alias of the startup app → DEFAULT app.
469
- * 2. the raw id names a catalog `shared` model — exact id, `id:variant`, or
470
- * the slugified-equal id form → the SHARED org's app (`sharedApp: true`,
471
- * the cross-org dial). THIS OUTRANKS the caller-org slug match below:
472
- * the shared block is the platform namespace every surface advertises, so
473
- * a caller-org app whose slug collides with a shared model must not
474
- * shadow it (the pre-2026-10-06 rule let it). ELSEWISE, an exact slug
475
- * match on a deployed app that declares serves="openai" → that app.
476
- * 3. catalog-id form matching exactly one deployed app → that app
477
- * (two or more candidates → loud ambiguity error naming them).
478
- * 4. the name maps to an org app that has NO function declaring the
479
- * serve protocol (`serves="openai"`) → loud 404
480
- * naming `urun serve <model>` and the available models.
481
- * 5. the name matches a catalog row but no deployed app → loud 404
482
- * naming `urun serve <id>` (deployed-only v1).
483
- * 6. anything else — a model name outside the uRun namespace entirely
484
- * (e.g. the harness's own upstream default, "claude-*"/"gpt-*") →
485
- * DEFAULT app. This IS today's single-app contract, kept deliberately
486
- * so `urun compat <agent>` with the agent's stock model keeps working
487
- * with zero new env; the per-model /stats table records every such
488
- * mapping so it is visible, never silent. Models the proxy ADVERTISES
489
- * on /v1/models can never land here — they resolve (2/3) or fail loud
490
- * (4/5) above.
491
- *
492
- * NO-DEFAULT MODE (`defaultApp: null`) — the HOSTED multi-tenant lane
493
- * (`src/hosted/`): a shared endpoint serving every org has no "the app this
494
- * proxy was started for", so rules 1 and 6 have nothing to fall back TO.
495
- * Rather than inventing one (picking "some" app for a caller would be the
496
- * worst kind of silent divergence), both rules become the SAME loud
497
- * {@link UnknownModelError} that rules 4/5 already raise: name a deployed
498
- * model, here is the list. Rules 2–5 are byte-for-byte the local behavior —
499
- * one router, one resolution order, two configurations.
500
- */
501
-
502
446
  /** One org app row from `GET {orgApi}/apps` (urun-cli `ApiClient.list_apps`). */
503
447
  interface DeployedApp {
504
448
  app_slug: string;
@@ -1075,6 +1019,32 @@ declare class ModelRouter<S> {
1075
1019
  entry: S;
1076
1020
  identity: TurnCatalogIdentity;
1077
1021
  }>;
1022
+ /**
1023
+ * A DEDICATED pooled session for one caller's exclusive use (owner ruling
1024
+ * 2026-10-27: "realtime ticks should be getting an isolated session, chats
1025
+ * only share with each other") — the realtime binding's session seam. The
1026
+ * SAME acquisition path every other pool slot rides ({@link openSession}
1027
+ * — shared targets mint the shared-app-constrained token and start the
1028
+ * session with `shared_app: true`), under a UNIQUE `realtime:<uuid>` pool
1029
+ * key minted per call: two calls NEVER share an entry, and no other lane
1030
+ * (chat included) can resolve the slot. Lifecycle is the pool's own — the
1031
+ * `openSession` wiring's gone-watch evicts a dead entry, and the realtime
1032
+ * binding's connection release rides {@link evictHandle} (native detach
1033
+ * underneath, the named session stays live per session semantics).
1034
+ */
1035
+ dedicatedSessionFor(model: string | undefined): Promise<{
1036
+ app: string;
1037
+ entry: S;
1038
+ identity: TurnCatalogIdentity;
1039
+ }>;
1040
+ /**
1041
+ * Release the pooled session a handle names WITHOUT touching anything
1042
+ * shared: the dedicated slot's pool entry is dropped and the native
1043
+ * session is detached (never `end()`). Malformed/unknown/gone handles are
1044
+ * a NO-OP — the release's goal is already true — never a throw on the
1045
+ * connection's teardown path.
1046
+ */
1047
+ evictHandle(handle: string): Promise<void>;
1078
1048
  /**
1079
1049
  * The ONE acquisition path both lanes ride — opened lazily under exactly
1080
1050
  * `key`, reused afterwards. A failed open never poisons the slot.
@@ -2517,6 +2487,19 @@ interface ProxyClients {
2517
2487
  sessionHandle(model: string | undefined): Promise<string>;
2518
2488
  /** Release the lease {@link sessionHandle} took on a lane; a no-op for a pooled handle. */
2519
2489
  releaseSessionHandle?(handle: string): void;
2490
+ /**
2491
+ * THE REALTIME ISOLATION SEAM (owner ruling 2026-10-27): the session handle
2492
+ * a REALTIME connection rides — its OWN dedicated session, never the shared
2493
+ * lane chat serves from. On a SHARED target this mints a per-connection
2494
+ * native uRun session (its own dispatch demand ⇒ its own seat while
2495
+ * attached; released on connection close through the native detach — the
2496
+ * platform's pause/park, never an end). On a NON-SHARED target the pooled
2497
+ * handle is already the caller's own slot and is answered unchanged.
2498
+ * Optional at the seam: a composition that wires none keeps
2499
+ * {@link sessionHandle} (the realtime binding falls back), so the local
2500
+ * compat proxy and existing test doubles are untouched.
2501
+ */
2502
+ dedicatedSessionHandle?(model: string | undefined): Promise<string>;
2520
2503
  /**
2521
2504
  * THE SPEECH LANE'S OWN HANDLE (greptile urun-ts#500): the opaque handle
2522
2505
  * for the SPEECH-SCOPED pooled session (`speech:<pool key>` — routing.ts