@cubos/agent-sdk 0.0.1166554 → 0.0.1166559
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/admin/index.d.ts +2 -0
- package/dist/admin/routing-policies.d.ts +130 -0
- package/dist/generated/schema.d.ts +404 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +5 -4
- package/package.json +1 -1
package/dist/admin/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { apiKeysApi, pluginsApi, sharedProvidersApi, tenantsApi } from "./global
|
|
|
11
11
|
import { knowledgeBasesApi } from "./knowledge-bases.js";
|
|
12
12
|
import { mcpsApi } from "./mcps.js";
|
|
13
13
|
import { instanceMetricsApi, metricsApi } from "./metrics.js";
|
|
14
|
+
import { routingPoliciesApi } from "./routing-policies.js";
|
|
14
15
|
import { skillsApi } from "./skills.js";
|
|
15
16
|
import { backgroundTasksApi, scheduledRunsApi, taskTemplatesApi } from "./task-templates.js";
|
|
16
17
|
import { tenantSettingsApi } from "./tenant-settings.js";
|
|
@@ -37,6 +38,7 @@ export interface TenantScope {
|
|
|
37
38
|
settings: ReturnType<typeof tenantSettingsApi>;
|
|
38
39
|
agents: ReturnType<typeof agentsApi>;
|
|
39
40
|
aiProviders: ReturnType<typeof aiProvidersApi>;
|
|
41
|
+
routingPolicies: ReturnType<typeof routingPoliciesApi>;
|
|
40
42
|
mcps: ReturnType<typeof mcpsApi>;
|
|
41
43
|
skills: ReturnType<typeof skillsApi>;
|
|
42
44
|
componentLibraries: ReturnType<typeof componentLibrariesApi>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Transport } from "../http.js";
|
|
2
|
+
import type { Schemas } from "../schemas.js";
|
|
3
|
+
/**
|
|
4
|
+
* The rule tree of a routing policy. Hand-written rather than generated: the
|
|
5
|
+
* server types `spec` as free-form JSON so a recursive schema stays out of the
|
|
6
|
+
* OpenAPI document, and these are the shapes it validates against on write.
|
|
7
|
+
*/
|
|
8
|
+
export type RoutingNode = RoutingModelNode | RoutingFallbackNode | RoutingWeightedNode | RoutingWhenNode | RoutingClassifyNode;
|
|
9
|
+
export interface RoutingModelNode {
|
|
10
|
+
type: "model";
|
|
11
|
+
/** `provider_models.id` of a real catalog model — never another policy. */
|
|
12
|
+
provider_model_id: string;
|
|
13
|
+
/** Reasoning effort in *this model's* own vocabulary. Effort belongs to the
|
|
14
|
+
* leaf, so a composite model exposes no reasoning options of its own. */
|
|
15
|
+
thinking_level?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface RoutingFallbackNode {
|
|
18
|
+
type: "fallback";
|
|
19
|
+
/** Defaults to `["timeout", "retryable_error", "context_exceeded"]`. A
|
|
20
|
+
* failure outside this set is terminal — notably a 4xx, which repeats
|
|
21
|
+
* identically on every leaf. */
|
|
22
|
+
on?: RoutingTrigger[];
|
|
23
|
+
/** Per-attempt ceiling. Hitting it cancels the call and moves on; the
|
|
24
|
+
* cancelled request may still be billed upstream and that spend is not
|
|
25
|
+
* recorded. */
|
|
26
|
+
timeout_ms?: number;
|
|
27
|
+
children: RoutingNode[];
|
|
28
|
+
}
|
|
29
|
+
export type RoutingTrigger = "timeout" | "retryable_error" | "context_exceeded" | "rate_limited" | "any_error";
|
|
30
|
+
export interface RoutingWeightedNode {
|
|
31
|
+
type: "weighted";
|
|
32
|
+
children: {
|
|
33
|
+
weight: number;
|
|
34
|
+
node: RoutingNode;
|
|
35
|
+
}[];
|
|
36
|
+
}
|
|
37
|
+
export interface RoutingWhenNode {
|
|
38
|
+
type: "when";
|
|
39
|
+
condition: RoutingCondition;
|
|
40
|
+
/** Named `if_true`/`if_false` rather than `then`/`otherwise`: an object with
|
|
41
|
+
* a `then` key reads as a thenable to JavaScript, which linters flag and
|
|
42
|
+
* `await` inspects. */
|
|
43
|
+
if_true: RoutingNode;
|
|
44
|
+
/** When absent and the condition is false, this branch contributes nothing.
|
|
45
|
+
* A `when` whose taken branch is unusable is pruned rather than falling
|
|
46
|
+
* through to the other one. */
|
|
47
|
+
if_false?: RoutingNode;
|
|
48
|
+
}
|
|
49
|
+
/** A model that decides which way to go. It is asked about the request and
|
|
50
|
+
* a description of each option, and answers with one of them. */
|
|
51
|
+
export interface RoutingClassifyNode {
|
|
52
|
+
type: "classify";
|
|
53
|
+
/** `provider_models.id` of the model that decides. It must support
|
|
54
|
+
* `classify` — a decision model (TypeSafe's Jev) or a chat model. */
|
|
55
|
+
classifier_model_id: string;
|
|
56
|
+
/** What the classifier is shown. Defaults to the last 6 messages, rendered
|
|
57
|
+
* as the envelopes that say what was said, the agent's replies and tool
|
|
58
|
+
* call/result names only — never tool output, memories or the system
|
|
59
|
+
* prompt unless `system` is chosen. */
|
|
60
|
+
input?: RoutingClassifierInput;
|
|
61
|
+
/** The branches it chooses between. Each option's `description` is required:
|
|
62
|
+
* it is what the decider reads to choose. */
|
|
63
|
+
options: {
|
|
64
|
+
key: string;
|
|
65
|
+
description: string;
|
|
66
|
+
node: RoutingNode;
|
|
67
|
+
}[];
|
|
68
|
+
/** Taken when the classifier's answer is unusable — it named no known
|
|
69
|
+
* option, or it was less confident than `min_confidence`. */
|
|
70
|
+
fallback?: RoutingNode;
|
|
71
|
+
/** The probability the chosen option must reach for its branch to be
|
|
72
|
+
* taken. Below it, the fallback is. */
|
|
73
|
+
min_confidence?: number;
|
|
74
|
+
/** Ceiling for the classifier's own call, in ms. */
|
|
75
|
+
timeout_ms?: number;
|
|
76
|
+
}
|
|
77
|
+
/** The slice of the request a classifier is shown. */
|
|
78
|
+
export type RoutingClassifierInput = "last_user_message" | "system" | "tools" | {
|
|
79
|
+
last_messages: {
|
|
80
|
+
count: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export type RoutingCondition = {
|
|
84
|
+
type: "has_image";
|
|
85
|
+
} | {
|
|
86
|
+
type: "has_tools";
|
|
87
|
+
} | {
|
|
88
|
+
type: "has_response_schema";
|
|
89
|
+
} | {
|
|
90
|
+
type: "all";
|
|
91
|
+
of: RoutingCondition[];
|
|
92
|
+
} | {
|
|
93
|
+
type: "any";
|
|
94
|
+
of: RoutingCondition[];
|
|
95
|
+
} | {
|
|
96
|
+
type: "not";
|
|
97
|
+
of: RoutingCondition;
|
|
98
|
+
};
|
|
99
|
+
export type RoutingSticky = "turn" | "conversation" | "none";
|
|
100
|
+
export interface RoutingSpec {
|
|
101
|
+
version: 1;
|
|
102
|
+
/** What every weighted draw in this policy stays stable across. `turn` (the
|
|
103
|
+
* default) keeps every iteration of one turn on the same leaf, which is what
|
|
104
|
+
* preserves reasoning continuity and the prompt cache; `conversation` keeps
|
|
105
|
+
* the same leaf for the whole conversation; `none` draws on every call. One
|
|
106
|
+
* key hashes the whole plan, so this is the policy's setting, not a node's. */
|
|
107
|
+
sticky?: RoutingSticky;
|
|
108
|
+
root: RoutingNode;
|
|
109
|
+
}
|
|
110
|
+
/** `RoutingPolicy` with `spec` narrowed from free-form JSON to the tree. */
|
|
111
|
+
export type RoutingPolicy = Omit<Schemas["RoutingPolicy"], "spec"> & {
|
|
112
|
+
spec: RoutingSpec;
|
|
113
|
+
};
|
|
114
|
+
export declare function routingPoliciesApi(t: Transport, tenantSlug: string): {
|
|
115
|
+
/** Each item carries `derived`: what the tree resolves to against the live
|
|
116
|
+
* catalog right now — capabilities, context window, leaves and deciders. */
|
|
117
|
+
list: (signal?: AbortSignal) => Promise<RoutingPolicy[]>;
|
|
118
|
+
get: (slug: string, signal?: AbortSignal) => Promise<RoutingPolicy>;
|
|
119
|
+
/** Publishes the policy as a selectable model under the tenant's composite
|
|
120
|
+
* provider, which is created on first use. */
|
|
121
|
+
create: (input: Omit<Schemas["CreateRoutingPolicyInput"], "spec"> & {
|
|
122
|
+
spec: RoutingSpec;
|
|
123
|
+
}) => Promise<RoutingPolicy>;
|
|
124
|
+
update: (currentSlug: string, input: Omit<Schemas["UpdateRoutingPolicyInput"], "spec"> & {
|
|
125
|
+
spec?: RoutingSpec;
|
|
126
|
+
}) => Promise<RoutingPolicy>;
|
|
127
|
+
/** The policy and its mirrored catalog entry are both removed. Refused
|
|
128
|
+
* with a `409` naming an agent still pointing at it. */
|
|
129
|
+
delete: (slug: string) => Promise<void>;
|
|
130
|
+
};
|
|
@@ -87,7 +87,7 @@ export interface paths {
|
|
|
87
87
|
post?: never;
|
|
88
88
|
/**
|
|
89
89
|
* Delete shared provider
|
|
90
|
-
* @description Same as the per-tenant delete, but for a provider owned by the reserved `_root` system tenant. Refused with 409 while an agent of any tenant uses one of its models
|
|
90
|
+
* @description Same as the per-tenant delete, but for a provider owned by the reserved `_root` system tenant. Refused with 409 while an agent (in any model field) or a routing policy of any tenant uses one of its models — the body names each as `tenant/slug`. Root-only.
|
|
91
91
|
*/
|
|
92
92
|
delete: {
|
|
93
93
|
parameters: {
|
|
@@ -126,7 +126,7 @@ export interface paths {
|
|
|
126
126
|
};
|
|
127
127
|
content?: never;
|
|
128
128
|
};
|
|
129
|
-
/** @description An agent still uses one of its models; the body names it. */
|
|
129
|
+
/** @description An agent or a routing policy still uses one of its models; the body names it. */
|
|
130
130
|
409: {
|
|
131
131
|
headers: {
|
|
132
132
|
[name: string]: unknown;
|
|
@@ -3163,7 +3163,7 @@ export interface paths {
|
|
|
3163
3163
|
post?: never;
|
|
3164
3164
|
/**
|
|
3165
3165
|
* Delete provider
|
|
3166
|
-
* @description Deletes the provider and cascades to its cached `provider_models` rows. Refused with 409 while an agent
|
|
3166
|
+
* @description Deletes the provider and cascades to its cached `provider_models` rows. Refused with 409 while an agent (in any model field) or a routing policy uses any of its models — the body names them; point them at another model first. Only ever touches a provider owned by `tenant_slug` itself — a shared provider is deleted through `DELETE /ai-providers/shared/{slug}` instead.
|
|
3167
3167
|
*/
|
|
3168
3168
|
delete: {
|
|
3169
3169
|
parameters: {
|
|
@@ -3203,7 +3203,7 @@ export interface paths {
|
|
|
3203
3203
|
};
|
|
3204
3204
|
content?: never;
|
|
3205
3205
|
};
|
|
3206
|
-
/** @description An agent still uses one of its models; the body names it. */
|
|
3206
|
+
/** @description An agent or a routing policy still uses one of its models; the body names it. */
|
|
3207
3207
|
409: {
|
|
3208
3208
|
headers: {
|
|
3209
3209
|
[name: string]: unknown;
|
|
@@ -9892,6 +9892,295 @@ export interface paths {
|
|
|
9892
9892
|
patch?: never;
|
|
9893
9893
|
trace?: never;
|
|
9894
9894
|
};
|
|
9895
|
+
"/api/v1/tenants/{tenantSlug}/routing-policies": {
|
|
9896
|
+
parameters: {
|
|
9897
|
+
query?: never;
|
|
9898
|
+
header?: never;
|
|
9899
|
+
path?: never;
|
|
9900
|
+
cookie?: never;
|
|
9901
|
+
};
|
|
9902
|
+
/**
|
|
9903
|
+
* List routing policies
|
|
9904
|
+
* @description Lists the tenant's routing policies ordered by slug. Each carries its rule tree plus `derived` — the capabilities and context window the policy resolves to against the live model catalog.
|
|
9905
|
+
*/
|
|
9906
|
+
get: {
|
|
9907
|
+
parameters: {
|
|
9908
|
+
query?: never;
|
|
9909
|
+
header?: never;
|
|
9910
|
+
path: {
|
|
9911
|
+
/** @description Tenant slug identifying the tenant. */
|
|
9912
|
+
tenantSlug: string;
|
|
9913
|
+
};
|
|
9914
|
+
cookie?: never;
|
|
9915
|
+
};
|
|
9916
|
+
requestBody?: never;
|
|
9917
|
+
responses: {
|
|
9918
|
+
200: {
|
|
9919
|
+
headers: {
|
|
9920
|
+
[name: string]: unknown;
|
|
9921
|
+
};
|
|
9922
|
+
content: {
|
|
9923
|
+
"application/json": components["schemas"]["RoutingPolicy"][];
|
|
9924
|
+
};
|
|
9925
|
+
};
|
|
9926
|
+
401: {
|
|
9927
|
+
headers: {
|
|
9928
|
+
[name: string]: unknown;
|
|
9929
|
+
};
|
|
9930
|
+
content?: never;
|
|
9931
|
+
};
|
|
9932
|
+
403: {
|
|
9933
|
+
headers: {
|
|
9934
|
+
[name: string]: unknown;
|
|
9935
|
+
};
|
|
9936
|
+
content?: never;
|
|
9937
|
+
};
|
|
9938
|
+
404: {
|
|
9939
|
+
headers: {
|
|
9940
|
+
[name: string]: unknown;
|
|
9941
|
+
};
|
|
9942
|
+
content?: never;
|
|
9943
|
+
};
|
|
9944
|
+
};
|
|
9945
|
+
};
|
|
9946
|
+
put?: never;
|
|
9947
|
+
/**
|
|
9948
|
+
* Create routing policy
|
|
9949
|
+
* @description Creates a routing policy and publishes it to the model catalog under the tenant's composite provider (created on first use, slug `routing`). The rule tree is validated against the live catalog: unknown or disappeared leaves, policies nesting other policies, empty branches, all-zero weights, no path for an ordinary request, classify options without a description, and a node-level `sticky` (stickiness belongs to the policy's spec) are all refused. A tree whose leaves refuse tools is valid — it publishes `tools: false`.
|
|
9950
|
+
*/
|
|
9951
|
+
post: {
|
|
9952
|
+
parameters: {
|
|
9953
|
+
query?: never;
|
|
9954
|
+
header?: never;
|
|
9955
|
+
path: {
|
|
9956
|
+
/** @description Tenant slug identifying the tenant. */
|
|
9957
|
+
tenantSlug: string;
|
|
9958
|
+
};
|
|
9959
|
+
cookie?: never;
|
|
9960
|
+
};
|
|
9961
|
+
requestBody: {
|
|
9962
|
+
content: {
|
|
9963
|
+
"application/json": components["schemas"]["CreateRoutingPolicyInput"];
|
|
9964
|
+
};
|
|
9965
|
+
};
|
|
9966
|
+
responses: {
|
|
9967
|
+
201: {
|
|
9968
|
+
headers: {
|
|
9969
|
+
[name: string]: unknown;
|
|
9970
|
+
};
|
|
9971
|
+
content: {
|
|
9972
|
+
"application/json": components["schemas"]["RoutingPolicy"];
|
|
9973
|
+
};
|
|
9974
|
+
};
|
|
9975
|
+
/** @description Invalid slug or rule tree; the body carries the reason. */
|
|
9976
|
+
400: {
|
|
9977
|
+
headers: {
|
|
9978
|
+
[name: string]: unknown;
|
|
9979
|
+
};
|
|
9980
|
+
content?: never;
|
|
9981
|
+
};
|
|
9982
|
+
401: {
|
|
9983
|
+
headers: {
|
|
9984
|
+
[name: string]: unknown;
|
|
9985
|
+
};
|
|
9986
|
+
content?: never;
|
|
9987
|
+
};
|
|
9988
|
+
403: {
|
|
9989
|
+
headers: {
|
|
9990
|
+
[name: string]: unknown;
|
|
9991
|
+
};
|
|
9992
|
+
content?: never;
|
|
9993
|
+
};
|
|
9994
|
+
404: {
|
|
9995
|
+
headers: {
|
|
9996
|
+
[name: string]: unknown;
|
|
9997
|
+
};
|
|
9998
|
+
content?: never;
|
|
9999
|
+
};
|
|
10000
|
+
/** @description Slug already used in this tenant. */
|
|
10001
|
+
409: {
|
|
10002
|
+
headers: {
|
|
10003
|
+
[name: string]: unknown;
|
|
10004
|
+
};
|
|
10005
|
+
content?: never;
|
|
10006
|
+
};
|
|
10007
|
+
};
|
|
10008
|
+
};
|
|
10009
|
+
delete?: never;
|
|
10010
|
+
options?: never;
|
|
10011
|
+
head?: never;
|
|
10012
|
+
patch?: never;
|
|
10013
|
+
trace?: never;
|
|
10014
|
+
};
|
|
10015
|
+
"/api/v1/tenants/{tenantSlug}/routing-policies/{slug}": {
|
|
10016
|
+
parameters: {
|
|
10017
|
+
query?: never;
|
|
10018
|
+
header?: never;
|
|
10019
|
+
path?: never;
|
|
10020
|
+
cookie?: never;
|
|
10021
|
+
};
|
|
10022
|
+
/** Get routing policy */
|
|
10023
|
+
get: {
|
|
10024
|
+
parameters: {
|
|
10025
|
+
query?: never;
|
|
10026
|
+
header?: never;
|
|
10027
|
+
path: {
|
|
10028
|
+
/** @description Policy slug. */
|
|
10029
|
+
slug: string;
|
|
10030
|
+
/** @description Tenant slug identifying the tenant. */
|
|
10031
|
+
tenantSlug: string;
|
|
10032
|
+
};
|
|
10033
|
+
cookie?: never;
|
|
10034
|
+
};
|
|
10035
|
+
requestBody?: never;
|
|
10036
|
+
responses: {
|
|
10037
|
+
200: {
|
|
10038
|
+
headers: {
|
|
10039
|
+
[name: string]: unknown;
|
|
10040
|
+
};
|
|
10041
|
+
content: {
|
|
10042
|
+
"application/json": components["schemas"]["RoutingPolicy"];
|
|
10043
|
+
};
|
|
10044
|
+
};
|
|
10045
|
+
401: {
|
|
10046
|
+
headers: {
|
|
10047
|
+
[name: string]: unknown;
|
|
10048
|
+
};
|
|
10049
|
+
content?: never;
|
|
10050
|
+
};
|
|
10051
|
+
403: {
|
|
10052
|
+
headers: {
|
|
10053
|
+
[name: string]: unknown;
|
|
10054
|
+
};
|
|
10055
|
+
content?: never;
|
|
10056
|
+
};
|
|
10057
|
+
404: {
|
|
10058
|
+
headers: {
|
|
10059
|
+
[name: string]: unknown;
|
|
10060
|
+
};
|
|
10061
|
+
content?: never;
|
|
10062
|
+
};
|
|
10063
|
+
};
|
|
10064
|
+
};
|
|
10065
|
+
put?: never;
|
|
10066
|
+
post?: never;
|
|
10067
|
+
/**
|
|
10068
|
+
* Delete routing policy
|
|
10069
|
+
* @description Deletes the policy and its mirrored catalog entry in one transaction. If an agent still points at the policy — as its chat model or in any other model field — the database refuses the delete and the answer is `409`, naming the agents: point them at another model first.
|
|
10070
|
+
*/
|
|
10071
|
+
delete: {
|
|
10072
|
+
parameters: {
|
|
10073
|
+
query?: never;
|
|
10074
|
+
header?: never;
|
|
10075
|
+
path: {
|
|
10076
|
+
/** @description Policy slug. */
|
|
10077
|
+
slug: string;
|
|
10078
|
+
/** @description Tenant slug identifying the tenant. */
|
|
10079
|
+
tenantSlug: string;
|
|
10080
|
+
};
|
|
10081
|
+
cookie?: never;
|
|
10082
|
+
};
|
|
10083
|
+
requestBody?: never;
|
|
10084
|
+
responses: {
|
|
10085
|
+
204: {
|
|
10086
|
+
headers: {
|
|
10087
|
+
[name: string]: unknown;
|
|
10088
|
+
};
|
|
10089
|
+
content?: never;
|
|
10090
|
+
};
|
|
10091
|
+
401: {
|
|
10092
|
+
headers: {
|
|
10093
|
+
[name: string]: unknown;
|
|
10094
|
+
};
|
|
10095
|
+
content?: never;
|
|
10096
|
+
};
|
|
10097
|
+
403: {
|
|
10098
|
+
headers: {
|
|
10099
|
+
[name: string]: unknown;
|
|
10100
|
+
};
|
|
10101
|
+
content?: never;
|
|
10102
|
+
};
|
|
10103
|
+
404: {
|
|
10104
|
+
headers: {
|
|
10105
|
+
[name: string]: unknown;
|
|
10106
|
+
};
|
|
10107
|
+
content?: never;
|
|
10108
|
+
};
|
|
10109
|
+
/** @description An agent still points at the policy; the body names it. */
|
|
10110
|
+
409: {
|
|
10111
|
+
headers: {
|
|
10112
|
+
[name: string]: unknown;
|
|
10113
|
+
};
|
|
10114
|
+
content?: never;
|
|
10115
|
+
};
|
|
10116
|
+
};
|
|
10117
|
+
};
|
|
10118
|
+
options?: never;
|
|
10119
|
+
head?: never;
|
|
10120
|
+
/**
|
|
10121
|
+
* Update routing policy
|
|
10122
|
+
* @description Partial update; omitted fields are left untouched. A model that has left the catalog stays usable when the policy already referenced it; a newly introduced disappeared model is refused, as on create, and so is a classify option without a description. Renaming a policy retires its old catalog entry and publishes a new one, so agents bound to the old model id keep pointing at a soft-deleted row — rebind them before renaming.
|
|
10123
|
+
*/
|
|
10124
|
+
patch: {
|
|
10125
|
+
parameters: {
|
|
10126
|
+
query?: never;
|
|
10127
|
+
header?: never;
|
|
10128
|
+
path: {
|
|
10129
|
+
/** @description Policy slug. */
|
|
10130
|
+
slug: string;
|
|
10131
|
+
/** @description Tenant slug identifying the tenant. */
|
|
10132
|
+
tenantSlug: string;
|
|
10133
|
+
};
|
|
10134
|
+
cookie?: never;
|
|
10135
|
+
};
|
|
10136
|
+
requestBody: {
|
|
10137
|
+
content: {
|
|
10138
|
+
"application/json": components["schemas"]["UpdateRoutingPolicyInput"];
|
|
10139
|
+
};
|
|
10140
|
+
};
|
|
10141
|
+
responses: {
|
|
10142
|
+
200: {
|
|
10143
|
+
headers: {
|
|
10144
|
+
[name: string]: unknown;
|
|
10145
|
+
};
|
|
10146
|
+
content: {
|
|
10147
|
+
"application/json": components["schemas"]["RoutingPolicy"];
|
|
10148
|
+
};
|
|
10149
|
+
};
|
|
10150
|
+
400: {
|
|
10151
|
+
headers: {
|
|
10152
|
+
[name: string]: unknown;
|
|
10153
|
+
};
|
|
10154
|
+
content?: never;
|
|
10155
|
+
};
|
|
10156
|
+
401: {
|
|
10157
|
+
headers: {
|
|
10158
|
+
[name: string]: unknown;
|
|
10159
|
+
};
|
|
10160
|
+
content?: never;
|
|
10161
|
+
};
|
|
10162
|
+
403: {
|
|
10163
|
+
headers: {
|
|
10164
|
+
[name: string]: unknown;
|
|
10165
|
+
};
|
|
10166
|
+
content?: never;
|
|
10167
|
+
};
|
|
10168
|
+
404: {
|
|
10169
|
+
headers: {
|
|
10170
|
+
[name: string]: unknown;
|
|
10171
|
+
};
|
|
10172
|
+
content?: never;
|
|
10173
|
+
};
|
|
10174
|
+
409: {
|
|
10175
|
+
headers: {
|
|
10176
|
+
[name: string]: unknown;
|
|
10177
|
+
};
|
|
10178
|
+
content?: never;
|
|
10179
|
+
};
|
|
10180
|
+
};
|
|
10181
|
+
};
|
|
10182
|
+
trace?: never;
|
|
10183
|
+
};
|
|
9895
10184
|
"/api/v1/tenants/{tenantSlug}/scheduled-runs": {
|
|
9896
10185
|
parameters: {
|
|
9897
10186
|
query?: never;
|
|
@@ -14429,6 +14718,13 @@ export interface components {
|
|
|
14429
14718
|
CreateMemoryObservationInput: {
|
|
14430
14719
|
content: string;
|
|
14431
14720
|
};
|
|
14721
|
+
CreateRoutingPolicyInput: {
|
|
14722
|
+
/** @description Defaults to `keep`. */
|
|
14723
|
+
cross_model_reasoning_text?: string | null;
|
|
14724
|
+
display_name?: string | null;
|
|
14725
|
+
slug: string;
|
|
14726
|
+
spec: unknown;
|
|
14727
|
+
};
|
|
14432
14728
|
CreateSkillInput: {
|
|
14433
14729
|
description?: string;
|
|
14434
14730
|
display_name: string;
|
|
@@ -14590,6 +14886,67 @@ export interface components {
|
|
|
14590
14886
|
/** @description `conversation` (tied to a thread) or `outbound` (proactive send). */
|
|
14591
14887
|
source: string;
|
|
14592
14888
|
};
|
|
14889
|
+
/** @description A model the policy asks which way to go. */
|
|
14890
|
+
DerivedClassifier: {
|
|
14891
|
+
/**
|
|
14892
|
+
* @description True for a model that answers natively through a decision endpoint
|
|
14893
|
+
* (TypeSafe's Jev, OpenAI's Decisions API, an Ollama decision model) and
|
|
14894
|
+
* false for a chat model answering the same question through a
|
|
14895
|
+
* structured-output completion — the catalog's `native_classify`.
|
|
14896
|
+
*/
|
|
14897
|
+
decision_model: boolean;
|
|
14898
|
+
model_id: string;
|
|
14899
|
+
/** Format: uuid */
|
|
14900
|
+
provider_model_id: string;
|
|
14901
|
+
provider_slug: string;
|
|
14902
|
+
/**
|
|
14903
|
+
* @description Whether the model can answer a typed decision at all. `null` = never
|
|
14904
|
+
* probed, which for a chat model means "yes, through one
|
|
14905
|
+
* JSON-constrained completion".
|
|
14906
|
+
*/
|
|
14907
|
+
supports_classify: boolean | null;
|
|
14908
|
+
};
|
|
14909
|
+
DerivedLeaf: {
|
|
14910
|
+
/** Format: int32 */
|
|
14911
|
+
context_window_tokens: number | null;
|
|
14912
|
+
/**
|
|
14913
|
+
* @description True when the catalog row is soft-deleted. The leaf is still called —
|
|
14914
|
+
* the flag exists so the editor can name a model that left the catalog.
|
|
14915
|
+
*/
|
|
14916
|
+
disappeared: boolean;
|
|
14917
|
+
model_id: string;
|
|
14918
|
+
/** Format: uuid */
|
|
14919
|
+
provider_model_id: string;
|
|
14920
|
+
provider_slug: string;
|
|
14921
|
+
supports_tools: boolean | null;
|
|
14922
|
+
supports_vision: boolean | null;
|
|
14923
|
+
};
|
|
14924
|
+
DerivedPolicy: {
|
|
14925
|
+
/**
|
|
14926
|
+
* @description The models the policy asks to decide. A policy with none routes on
|
|
14927
|
+
* rules alone.
|
|
14928
|
+
*/
|
|
14929
|
+
classifiers: components["schemas"]["DerivedClassifier"][];
|
|
14930
|
+
/**
|
|
14931
|
+
* Format: int32
|
|
14932
|
+
* @description Minimum context window across the leaves — what compaction will budget
|
|
14933
|
+
* against. `null` when no leaf advertises one.
|
|
14934
|
+
*/
|
|
14935
|
+
context_window_tokens: number | null;
|
|
14936
|
+
/** @description One entry per leaf the tree names, in tree order. */
|
|
14937
|
+
leaves: components["schemas"]["DerivedLeaf"][];
|
|
14938
|
+
serves_images: boolean;
|
|
14939
|
+
/**
|
|
14940
|
+
* @description Which request shapes still have a path through the tree. A `false` here
|
|
14941
|
+
* is the thing that turns into a runtime `Misconfigured`.
|
|
14942
|
+
*/
|
|
14943
|
+
serves_plain: boolean;
|
|
14944
|
+
serves_tools: boolean;
|
|
14945
|
+
supports_thinking: boolean;
|
|
14946
|
+
supports_tools: boolean;
|
|
14947
|
+
/** @description Capabilities published to the catalog: the union over reachable leaves. */
|
|
14948
|
+
supports_vision: boolean;
|
|
14949
|
+
};
|
|
14593
14950
|
/**
|
|
14594
14951
|
* @description What a metric can be grouped and filtered by. One vocabulary for every
|
|
14595
14952
|
* metric, so a dimension always means the same id wherever it appears.
|
|
@@ -15900,6 +16257,37 @@ export interface components {
|
|
|
15900
16257
|
RotatedSecret: {
|
|
15901
16258
|
connection_secret: string;
|
|
15902
16259
|
};
|
|
16260
|
+
RoutingPolicy: {
|
|
16261
|
+
/** Format: date-time */
|
|
16262
|
+
created_at: string;
|
|
16263
|
+
/** @description `keep` | `drop`. Whether plaintext reasoning may cross between leaves. */
|
|
16264
|
+
cross_model_reasoning_text: string;
|
|
16265
|
+
/**
|
|
16266
|
+
* @description What this policy resolves to right now, recomputed on every read from
|
|
16267
|
+
* the live catalog. This is the part an operator actually needs: a tree
|
|
16268
|
+
* referencing a model that lost its vision probe silently stops accepting
|
|
16269
|
+
* images, and nothing in the tree itself would show it.
|
|
16270
|
+
*/
|
|
16271
|
+
derived: components["schemas"]["DerivedPolicy"];
|
|
16272
|
+
display_name: string | null;
|
|
16273
|
+
/** Format: uuid */
|
|
16274
|
+
id: string;
|
|
16275
|
+
/**
|
|
16276
|
+
* @description Slug of the composite provider publishing this policy — the provider an
|
|
16277
|
+
* agent's model selector shows it under.
|
|
16278
|
+
*/
|
|
16279
|
+
provider_slug: string;
|
|
16280
|
+
slug: string;
|
|
16281
|
+
/**
|
|
16282
|
+
* @description The rule tree. Free-form JSON on the wire — the shape lives in
|
|
16283
|
+
* `ai_providers::composite::spec` and is validated on every write, which
|
|
16284
|
+
* keeps a recursive schema out of the OpenAPI document (and out of every
|
|
16285
|
+
* generated client) without weakening the guarantee.
|
|
16286
|
+
*/
|
|
16287
|
+
spec: unknown;
|
|
16288
|
+
/** Format: date-time */
|
|
16289
|
+
updated_at: string;
|
|
16290
|
+
};
|
|
15903
16291
|
/** @description One background-task conversation a scheduled run produced. */
|
|
15904
16292
|
RunTask: {
|
|
15905
16293
|
/** Format: date-time */
|
|
@@ -16654,6 +17042,18 @@ export interface components {
|
|
|
16654
17042
|
[key: string]: number;
|
|
16655
17043
|
} | null;
|
|
16656
17044
|
};
|
|
17045
|
+
UpdateRoutingPolicyInput: {
|
|
17046
|
+
cross_model_reasoning_text?: string | null;
|
|
17047
|
+
/**
|
|
17048
|
+
* @description Omit to leave untouched; send `""` to clear it back to the slug. Unlike
|
|
17049
|
+
* every other resource's `display_name`, this one is nullable, so "no
|
|
17050
|
+
* name" is a state the operator can legitimately want back — and an
|
|
17051
|
+
* omitted field can't express it.
|
|
17052
|
+
*/
|
|
17053
|
+
display_name?: string | null;
|
|
17054
|
+
slug?: string | null;
|
|
17055
|
+
spec?: unknown;
|
|
17056
|
+
};
|
|
16657
17057
|
/**
|
|
16658
17058
|
* @description Operator edits to a live schedule. Every field is optional (PATCH): absent
|
|
16659
17059
|
* leaves it untouched. The handler re-derives `next_fire_at` and re-validates
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { AdminClient, AdminClientOptions, TenantScope } from "./admin/index.js";
|
|
2
2
|
export { createAdminClient } from "./admin/index.js";
|
|
3
3
|
export type { Dimension, DimensionValues, DimensionValuesQuery, EntityLabel, Granularity, MetricId, MetricIdOf, MetricInfo, MetricSpec, MetricsCatalog, MetricsCompleteness, MetricsFilter, MetricsFilters, MetricsInclude, MetricsOrderBy, MetricsQuery, MetricsResult, MetricsRow, } from "./admin/metrics.js";
|
|
4
|
+
export type { RoutingClassifierInput, RoutingClassifyNode, RoutingCondition, RoutingFallbackNode, RoutingModelNode, RoutingNode, RoutingPolicy, RoutingSpec, RoutingSticky, RoutingTrigger, RoutingWeightedNode, RoutingWhenNode, } from "./admin/routing-policies.js";
|
|
4
5
|
export type { CostPeriod } from "./admin/users.js";
|
|
5
6
|
export type { CachedConversation, ConversationCache, MemoryConversationCacheOptions, } from "./cache.js";
|
|
6
7
|
export { MemoryConversationCache } from "./cache.js";
|
package/dist/index.js
CHANGED
|
@@ -1068,6 +1068,21 @@ function metricsApi(t, tenantSlug) {
|
|
|
1068
1068
|
return metricsApiAt(t, `${tenantPath(tenantSlug)}/metrics`);
|
|
1069
1069
|
}
|
|
1070
1070
|
|
|
1071
|
+
// src/admin/routing-policies.ts
|
|
1072
|
+
function routingPoliciesApi(t, tenantSlug) {
|
|
1073
|
+
const base = `${tenantPath(tenantSlug)}/routing-policies`;
|
|
1074
|
+
const policy = (slug) => `${base}/${enc(slug)}`;
|
|
1075
|
+
return {
|
|
1076
|
+
list: (signal) => t.request("GET", base, { signal }),
|
|
1077
|
+
get: (slug, signal) => t.request("GET", policy(slug), { signal }),
|
|
1078
|
+
create: (input) => t.request("POST", base, { body: input }),
|
|
1079
|
+
update: (currentSlug, input) => t.request("PATCH", policy(currentSlug), {
|
|
1080
|
+
body: withoutNoopRename(input, currentSlug)
|
|
1081
|
+
}),
|
|
1082
|
+
delete: (slug) => t.request("DELETE", policy(slug), { raw: true })
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1071
1086
|
// src/admin/skills.ts
|
|
1072
1087
|
function skillsApi(t, tenantSlug) {
|
|
1073
1088
|
const base = `${tenantPath(tenantSlug)}/skills`;
|
|
@@ -1204,6 +1219,7 @@ function tenantScope(t, slug) {
|
|
|
1204
1219
|
settings: tenantSettingsApi(t, slug),
|
|
1205
1220
|
agents: agentsApi(t, slug),
|
|
1206
1221
|
aiProviders: aiProvidersApi(t, slug),
|
|
1222
|
+
routingPolicies: routingPoliciesApi(t, slug),
|
|
1207
1223
|
mcps: mcpsApi(t, slug),
|
|
1208
1224
|
skills: skillsApi(t, slug),
|
|
1209
1225
|
componentLibraries: componentLibrariesApi(t, slug),
|
|
@@ -2122,5 +2138,5 @@ export {
|
|
|
2122
2138
|
serveClientTools
|
|
2123
2139
|
};
|
|
2124
2140
|
|
|
2125
|
-
//# debugId=
|
|
2141
|
+
//# debugId=D55AB084EDC2C3F864756E2164756E21
|
|
2126
2142
|
//# sourceMappingURL=index.js.map
|