refactor(routing): call the RESTful /v1/router/defaults cloud endpoint
hanzoai/ai renamed the routing-defaults read from the compound-verb /v1/get-routing-defaults to the resource-oriented /v1/router/defaults, with no backwards-compat alias (the old path 404s). Point the RoutingDefaults proxy at the new noun; same GET + Bearer contract, same fail-soft ABSENT fallback. Type/mobile doc comments updated to match.
This commit is contained in:
@@ -3,7 +3,7 @@ const { resolveTenantBearer } = require('@hanzochat/api');
|
||||
|
||||
/**
|
||||
* Server-driven auto-routing defaults for the caller's org. Proxies cloud's
|
||||
* `GET /v1/get-routing-defaults` (authenticated, org-scoped) so ops can enable
|
||||
* `GET /v1/router/defaults` (authenticated, org-scoped) so ops can enable
|
||||
* routing per-default in production from admin.hanzo.ai. The user's hanzo.id
|
||||
* bearer is resolved server-side and forwarded on-behalf-of — cloud validates it
|
||||
* and scopes to the caller's own org (same trust model as CloudAgentsClient); the
|
||||
@@ -44,7 +44,7 @@ async function routingDefaultsController(req, res) {
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), TIMEOUT);
|
||||
try {
|
||||
const resp = await fetch(`${endpoint}/v1/get-routing-defaults`, {
|
||||
const resp = await fetch(`${endpoint}/v1/router/defaults`, {
|
||||
method: 'GET',
|
||||
headers: { Authorization: `Bearer ${bearer}` },
|
||||
signal: controller.signal,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// the jest coverage; keep the semantics in lock-step.
|
||||
|
||||
/**
|
||||
* Org-scoped auto-routing defaults from cloud (`GET /v1/get-routing-defaults`),
|
||||
* Org-scoped auto-routing defaults from cloud (`GET /v1/router/defaults`),
|
||||
* proxied by the chat backend at `/v1/chat/routing-defaults`. `available` is
|
||||
* false when the endpoint is absent (older cloud-api) or the fetch failed soft —
|
||||
* the client then behaves exactly as today (local preference only).
|
||||
|
||||
@@ -732,7 +732,7 @@ export type TUsageResponse = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Org-scoped auto-routing defaults from cloud (`GET /v1/get-routing-defaults`),
|
||||
* Org-scoped auto-routing defaults from cloud (`GET /v1/router/defaults`),
|
||||
* proxied by the chat backend. `available` is false when the endpoint is absent
|
||||
* (older cloud-api) or the fetch failed soft — the client then behaves exactly as
|
||||
* today (local preference only).
|
||||
|
||||
Reference in New Issue
Block a user