@naturali/sdk 0.66.0 → 0.68.0
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/index.cjs +773 -598
- package/dist/index.d.cts +5536 -4805
- package/dist/index.d.mts +5536 -4805
- package/dist/index.mjs +768 -592
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -606,8 +606,7 @@ var Actors = class {
|
|
|
606
606
|
/**
|
|
607
607
|
* List actors
|
|
608
608
|
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
609
|
+
* Returns all actors the caller has access to. If projectId is provided, returns only actors in that project. project keys are scoped to a single project automatically. JWT users without projectId receive actors across all their accessible projects.
|
|
611
610
|
*/
|
|
612
611
|
static listActors(options) {
|
|
613
612
|
return (options.client ?? client).get({
|
|
@@ -618,9 +617,7 @@ var Actors = class {
|
|
|
618
617
|
/**
|
|
619
618
|
* Create an actor
|
|
620
619
|
*
|
|
621
|
-
* Creates
|
|
622
|
-
* `external_id` may not start with a channel prefix (`whatsapp:`, `discord:`, …) or `address:` — those name actors that belong to an [address](/docs/api/addresses/get-address), which owns its own.
|
|
623
|
-
*
|
|
620
|
+
* Creates a new actor. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
|
|
624
621
|
*/
|
|
625
622
|
static createActor(options) {
|
|
626
623
|
return (options.client ?? client).post({
|
|
@@ -633,11 +630,9 @@ var Actors = class {
|
|
|
633
630
|
});
|
|
634
631
|
}
|
|
635
632
|
/**
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
* Removes the actor and the sessions it holds. Erasure of one identity as this API knows it — narrower than "erase this human everywhere", since naturali does not know that two identities are the same person and does not claim to.
|
|
639
|
-
* An actor that belongs to an [address](/docs/api/addresses/get-address) responds `409`: erase it through `DELETE /v1/projects/{project_id}/addresses/{identifier}`, which also removes the address and its conversations. Deleting it here would leave those behind, pointing at an identity that no longer exists.
|
|
633
|
+
* Delete an actor
|
|
640
634
|
*
|
|
635
|
+
* Deletes an actor by its ID
|
|
641
636
|
*/
|
|
642
637
|
static deleteActor(options) {
|
|
643
638
|
return (options.client ?? client).delete({
|
|
@@ -646,10 +641,9 @@ var Actors = class {
|
|
|
646
641
|
});
|
|
647
642
|
}
|
|
648
643
|
/**
|
|
649
|
-
* Get an actor
|
|
650
|
-
*
|
|
651
|
-
* Returns one actor. An actor belonging to another project responds `404`, not `403` — the API never confirms that an id exists elsewhere.
|
|
644
|
+
* Get an actor by ID
|
|
652
645
|
*
|
|
646
|
+
* Returns an actor by its ID
|
|
653
647
|
*/
|
|
654
648
|
static getActor(options) {
|
|
655
649
|
return (options.client ?? client).get({
|
|
@@ -660,8 +654,7 @@ var Actors = class {
|
|
|
660
654
|
/**
|
|
661
655
|
* Update an actor
|
|
662
656
|
*
|
|
663
|
-
* Updates
|
|
664
|
-
*
|
|
657
|
+
* Updates an actor's properties
|
|
665
658
|
*/
|
|
666
659
|
static updateActor(options) {
|
|
667
660
|
return (options.client ?? client).patch({
|
|
@@ -673,6 +666,47 @@ var Actors = class {
|
|
|
673
666
|
}
|
|
674
667
|
});
|
|
675
668
|
}
|
|
669
|
+
/**
|
|
670
|
+
* Get actor tags
|
|
671
|
+
*
|
|
672
|
+
* Returns all tags attached to the actor
|
|
673
|
+
*/
|
|
674
|
+
static getActorTags(options) {
|
|
675
|
+
return (options.client ?? client).get({
|
|
676
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
677
|
+
...options
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Merge actor tags
|
|
682
|
+
*
|
|
683
|
+
* Merges provided tags with existing tags (existing tags are preserved unless overridden)
|
|
684
|
+
*/
|
|
685
|
+
static mergeActorTags(options) {
|
|
686
|
+
return (options.client ?? client).patch({
|
|
687
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
688
|
+
...options,
|
|
689
|
+
headers: {
|
|
690
|
+
"Content-Type": "application/json",
|
|
691
|
+
...options.headers
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Replace actor tags
|
|
697
|
+
*
|
|
698
|
+
* Replaces all tags on the actor with the provided tags (not merged)
|
|
699
|
+
*/
|
|
700
|
+
static replaceActorTags(options) {
|
|
701
|
+
return (options.client ?? client).put({
|
|
702
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
703
|
+
...options,
|
|
704
|
+
headers: {
|
|
705
|
+
"Content-Type": "application/json",
|
|
706
|
+
...options.headers
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
676
710
|
};
|
|
677
711
|
var Channels = class {
|
|
678
712
|
/**
|
|
@@ -816,22 +850,6 @@ var Channels = class {
|
|
|
816
850
|
});
|
|
817
851
|
}
|
|
818
852
|
/**
|
|
819
|
-
* Open a conversation
|
|
820
|
-
*
|
|
821
|
-
* The outbound-first path (CHANNELS-ROUTING.md §3.11): open a conversation for `{ channel_id, identifier }` ahead of any inbound message, which falls out of making the identifier the unit rather than the message. Resolves the same three-layer action an inbound would (§3.6); a `409` when that does not land on an agent — there is nothing to open for a `message`/`silence` outcome.
|
|
822
|
-
*
|
|
823
|
-
*/
|
|
824
|
-
static createConversation(options) {
|
|
825
|
-
return (options.client ?? client).post({
|
|
826
|
-
url: "/v1/projects/{project_id}/conversations",
|
|
827
|
-
...options,
|
|
828
|
-
headers: {
|
|
829
|
-
"Content-Type": "application/json",
|
|
830
|
-
...options.headers
|
|
831
|
-
}
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
853
|
* List channels
|
|
836
854
|
*
|
|
837
855
|
* Lists the channels connected in the project.
|
|
@@ -919,6 +937,22 @@ var Channels = class {
|
|
|
919
937
|
});
|
|
920
938
|
}
|
|
921
939
|
/**
|
|
940
|
+
* Open a conversation
|
|
941
|
+
*
|
|
942
|
+
* The outbound-first path: open a conversation for an `identifier` ahead of any inbound message, which falls out of making the identifier the unit rather than the message. Resolves the same three-layer action an inbound would; a `409` when that does not land on an agent — there is nothing to open for a `message`/`silence` outcome.
|
|
943
|
+
*
|
|
944
|
+
*/
|
|
945
|
+
static openChannelConversation(options) {
|
|
946
|
+
return (options.client ?? client).post({
|
|
947
|
+
url: "/v1/projects/{project_id}/channels/{channel_id}/conversations",
|
|
948
|
+
...options,
|
|
949
|
+
headers: {
|
|
950
|
+
"Content-Type": "application/json",
|
|
951
|
+
...options.headers
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
922
956
|
* Get a conversation
|
|
923
957
|
*/
|
|
924
958
|
static getChannelConversation(options) {
|
|
@@ -944,7 +978,7 @@ var Agents = class {
|
|
|
944
978
|
/**
|
|
945
979
|
* List agents
|
|
946
980
|
*
|
|
947
|
-
*
|
|
981
|
+
* Returns all agents in the project.
|
|
948
982
|
*/
|
|
949
983
|
static listAgents(options) {
|
|
950
984
|
return (options.client ?? client).get({
|
|
@@ -955,8 +989,7 @@ var Agents = class {
|
|
|
955
989
|
/**
|
|
956
990
|
* Create an agent
|
|
957
991
|
*
|
|
958
|
-
*
|
|
959
|
-
*
|
|
992
|
+
* Creates a new agent bound to an AI provider.
|
|
960
993
|
*/
|
|
961
994
|
static createAgent(options) {
|
|
962
995
|
return (options.client ?? client).post({
|
|
@@ -971,7 +1004,7 @@ var Agents = class {
|
|
|
971
1004
|
/**
|
|
972
1005
|
* Delete an agent
|
|
973
1006
|
*
|
|
974
|
-
* Deletes
|
|
1007
|
+
* Deletes an agent by ID. Fails with `409` if the agent has dependent generations or traces, unless `force=true` is passed, in which case those generations and traces are deleted along with the agent.
|
|
975
1008
|
*
|
|
976
1009
|
*/
|
|
977
1010
|
static deleteAgent(options) {
|
|
@@ -982,6 +1015,8 @@ var Agents = class {
|
|
|
982
1015
|
}
|
|
983
1016
|
/**
|
|
984
1017
|
* Get an agent
|
|
1018
|
+
*
|
|
1019
|
+
* Returns a single agent by ID.
|
|
985
1020
|
*/
|
|
986
1021
|
static getAgent(options) {
|
|
987
1022
|
return (options.client ?? client).get({
|
|
@@ -990,13 +1025,27 @@ var Agents = class {
|
|
|
990
1025
|
});
|
|
991
1026
|
}
|
|
992
1027
|
/**
|
|
993
|
-
*
|
|
1028
|
+
* Partially update an agent
|
|
994
1029
|
*
|
|
995
|
-
*
|
|
1030
|
+
* Partially updates an existing agent. Identical to PUT — both perform partial updates.
|
|
1031
|
+
*/
|
|
1032
|
+
static patchAgent(options) {
|
|
1033
|
+
return (options.client ?? client).patch({
|
|
1034
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
1035
|
+
...options,
|
|
1036
|
+
headers: {
|
|
1037
|
+
"Content-Type": "application/json",
|
|
1038
|
+
...options.headers
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Update an agent
|
|
996
1044
|
*
|
|
1045
|
+
* Updates an existing agent. Identical to PATCH — both perform partial updates.
|
|
997
1046
|
*/
|
|
998
1047
|
static updateAgent(options) {
|
|
999
|
-
return (options.client ?? client).
|
|
1048
|
+
return (options.client ?? client).put({
|
|
1000
1049
|
url: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
1001
1050
|
...options,
|
|
1002
1051
|
headers: {
|
|
@@ -1005,6 +1054,240 @@ var Agents = class {
|
|
|
1005
1054
|
}
|
|
1006
1055
|
});
|
|
1007
1056
|
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Run an agent generation
|
|
1059
|
+
*
|
|
1060
|
+
* Sends messages to the agent, resolves its tools, and runs the AI model loop. Background by default: returns `202 Accepted` with a `generation_id` to poll via `GET /v1/projects/{project_id}/generations/{generation_id}`. Pass `?wait=true` to block and receive the result inline, where client tools pause the generation and return `requires_action`. Streaming (`stream: true`) implies waiting.
|
|
1061
|
+
*
|
|
1062
|
+
*/
|
|
1063
|
+
static createAgentGeneration(options) {
|
|
1064
|
+
return (options.client ?? client).post({
|
|
1065
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/generate",
|
|
1066
|
+
...options,
|
|
1067
|
+
headers: {
|
|
1068
|
+
"Content-Type": "application/json",
|
|
1069
|
+
...options.headers
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Submit tool outputs for a paused generation
|
|
1075
|
+
*
|
|
1076
|
+
* Resumes a generation that was paused due to client tool calls. Provide tool outputs for each pending tool call.
|
|
1077
|
+
*
|
|
1078
|
+
*/
|
|
1079
|
+
static submitAgentToolOutputs(options) {
|
|
1080
|
+
return (options.client ?? client).post({
|
|
1081
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/generate/{generation_id}/tool-outputs",
|
|
1082
|
+
...options,
|
|
1083
|
+
headers: {
|
|
1084
|
+
"Content-Type": "application/json",
|
|
1085
|
+
...options.headers
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
var AgentVersions = class {
|
|
1091
|
+
/**
|
|
1092
|
+
* List an agent's config versions
|
|
1093
|
+
*
|
|
1094
|
+
* Returns the agent's archived configurations, newest first. A version is written on create and on every subsequent write that changes the config — through the REST API or a formation apply alike. See [Versioning and Staged Rollout](/docs/modules/agents#versioning-and-staged-rollout).
|
|
1095
|
+
*
|
|
1096
|
+
*/
|
|
1097
|
+
static listAgentVersions(options) {
|
|
1098
|
+
return (options.client ?? client).get({
|
|
1099
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions",
|
|
1100
|
+
...options
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Get an archived agent config version
|
|
1105
|
+
*
|
|
1106
|
+
* Returns the exact configuration the agent held at a given version, so a generation can be traced back to the config that produced it.
|
|
1107
|
+
*
|
|
1108
|
+
*/
|
|
1109
|
+
static getAgentVersion(options) {
|
|
1110
|
+
return (options.client ?? client).get({
|
|
1111
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions/{version}",
|
|
1112
|
+
...options
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Restore an archived config as a new version
|
|
1117
|
+
*
|
|
1118
|
+
* Copies the named version's configuration onto the agent as a **new** version rather than rewinding the counter, so history stays append-only and the versions in between remain retrievable. Restoring the config the agent already holds is a no-op and creates no version.
|
|
1119
|
+
*
|
|
1120
|
+
* The restored config fully replaces the current one: a field the archived version did not set is cleared, not merged. Restore re-validates the config, so a tool, provider, or guardrail deleted since the snapshot was taken fails the request instead of writing a broken agent.
|
|
1121
|
+
*
|
|
1122
|
+
*/
|
|
1123
|
+
static restoreAgentVersion(options) {
|
|
1124
|
+
return (options.client ?? client).post({
|
|
1125
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions/{version}/restore",
|
|
1126
|
+
...options,
|
|
1127
|
+
headers: {
|
|
1128
|
+
"Content-Type": "application/json",
|
|
1129
|
+
...options.headers
|
|
1130
|
+
}
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Set or replace a staged rollout
|
|
1135
|
+
*
|
|
1136
|
+
* Starts serving two archived versions side by side: `canary_percent` of traffic gets `canary_version`, the rest gets `stable_version`.
|
|
1137
|
+
*
|
|
1138
|
+
* Assignment is deterministic — it hashes the actor behind the request's session (falling back to the session itself), so one end user never flip-flops between configs mid-conversation. Requests with neither are split randomly.
|
|
1139
|
+
*
|
|
1140
|
+
* While a release is active the agent's live columns act as a **draft**: further edits archive new versions but do not disturb either side of the running split. End the rollout with `promote` or `abort`.
|
|
1141
|
+
*
|
|
1142
|
+
*/
|
|
1143
|
+
static setAgentRelease(options) {
|
|
1144
|
+
return (options.client ?? client).put({
|
|
1145
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release",
|
|
1146
|
+
...options,
|
|
1147
|
+
headers: {
|
|
1148
|
+
"Content-Type": "application/json",
|
|
1149
|
+
...options.headers
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Promote the canary and end the rollout
|
|
1155
|
+
*
|
|
1156
|
+
* Makes the canary version's config the agent's live config and clears the release. The canary is pinned by version, so an edit that landed mid-rollout is not promoted in its place — it stays an unreleased draft in the version history.
|
|
1157
|
+
*
|
|
1158
|
+
* When the release carries a `promotion_gate`, the eval it names must have a run that finished `completed` with `passed: true` **and** was pinned to the canary version (`agent_version`); otherwise the call is a `409` and the rollout is left running untouched. The run that cleared the gate is recorded as `eval_run_id` on the version that goes live.
|
|
1159
|
+
*
|
|
1160
|
+
*/
|
|
1161
|
+
static promoteAgentRelease(options) {
|
|
1162
|
+
return (options.client ?? client).post({
|
|
1163
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release/promote",
|
|
1164
|
+
...options
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Abort the rollout and roll back to stable
|
|
1169
|
+
*
|
|
1170
|
+
* Restores the stable version's config as the agent's live config and clears the release, so all traffic returns to the configuration the rollout was measured against — not to whatever draft the live columns happened to hold.
|
|
1171
|
+
*
|
|
1172
|
+
*/
|
|
1173
|
+
static abortAgentRelease(options) {
|
|
1174
|
+
return (options.client ?? client).post({
|
|
1175
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release/abort",
|
|
1176
|
+
...options
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
var AiProviders = class {
|
|
1181
|
+
/**
|
|
1182
|
+
* List AI providers
|
|
1183
|
+
*
|
|
1184
|
+
* Returns a list of AI provider configurations for a project
|
|
1185
|
+
*/
|
|
1186
|
+
static listAiProviders(options) {
|
|
1187
|
+
return (options.client ?? client).get({
|
|
1188
|
+
url: "/v1/projects/{project_id}/ai-providers",
|
|
1189
|
+
...options
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Create an AI provider
|
|
1194
|
+
*
|
|
1195
|
+
* Creates a new LLM provider configuration
|
|
1196
|
+
*/
|
|
1197
|
+
static createAiProvider(options) {
|
|
1198
|
+
return (options.client ?? client).post({
|
|
1199
|
+
url: "/v1/projects/{project_id}/ai-providers",
|
|
1200
|
+
...options,
|
|
1201
|
+
headers: {
|
|
1202
|
+
"Content-Type": "application/json",
|
|
1203
|
+
...options.headers
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Delete an AI provider
|
|
1209
|
+
*
|
|
1210
|
+
* Deletes an AI provider configuration.
|
|
1211
|
+
*
|
|
1212
|
+
* Live references — chats, agents, and model routes whose targets name this provider — always block deletion with `409 AI_PROVIDER_HAS_DEPENDENTS`; `force` does not override them, so delete or repoint those resources first. Soft dependents — price overrides and usage/generation records — also block with `409` unless `force=true`, which deletes the provider's price overrides and unlinks (nulls) its usage history, preserving those rows. The `409` body's `error.meta` reports the counts, a sample of offending IDs, and a `forcible` flag that is `true` when a `force=true` retry would succeed.
|
|
1213
|
+
*
|
|
1214
|
+
*/
|
|
1215
|
+
static deleteAiProvider(options) {
|
|
1216
|
+
return (options.client ?? client).delete({
|
|
1217
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1218
|
+
...options
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Get an AI provider
|
|
1223
|
+
*
|
|
1224
|
+
* Returns a specific AI provider configuration
|
|
1225
|
+
*/
|
|
1226
|
+
static getAiProvider(options) {
|
|
1227
|
+
return (options.client ?? client).get({
|
|
1228
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1229
|
+
...options
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Update an AI provider
|
|
1234
|
+
*
|
|
1235
|
+
* Updates an AI provider configuration
|
|
1236
|
+
*/
|
|
1237
|
+
static updateAiProvider(options) {
|
|
1238
|
+
return (options.client ?? client).patch({
|
|
1239
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1240
|
+
...options,
|
|
1241
|
+
headers: {
|
|
1242
|
+
"Content-Type": "application/json",
|
|
1243
|
+
...options.headers
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* List the models this provider can run
|
|
1249
|
+
*
|
|
1250
|
+
* Asks the provider which models it can run, using this provider record's own credentials and configuration, and returns provider-native model ids — the same strings `default_model` and an agent's `model` carry.
|
|
1251
|
+
* Which models are reachable is a property of the credential, not of the provider type: a Vertex provider sees only the publisher models its Google Cloud project and location serve, and a Bedrock provider only the foundation models enabled in its region. Reading the list is how a caller avoids pinning a model that fails at generation time.
|
|
1252
|
+
* Not every provider type can answer. `azure` lists deployments an operator named rather than models, and `ollama` lists whatever was pulled onto that host, so both return `400 MODEL_LISTING_UNSUPPORTED`.
|
|
1253
|
+
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret when there is one — IAM keys or a Bedrock API key, a Google service-account key — and otherwise fall back to the server environment (the AWS default credential chain, Google Application Default Credentials), so a record with no `secret_id` can still list.
|
|
1254
|
+
* A Vertex record needs no `config.project` when its secret is a service-account key, since the key file names its own project. A Vertex record in express mode (API key) cannot list at all: express mode is a global, project-less endpoint and the publisher-model catalogue is per-project, so it returns `400 MODEL_LISTING_UNSUPPORTED`.
|
|
1255
|
+
*
|
|
1256
|
+
*/
|
|
1257
|
+
static listAiProviderModels(options) {
|
|
1258
|
+
return (options.client ?? client).get({
|
|
1259
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/models",
|
|
1260
|
+
...options
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* List per-provider price overrides
|
|
1265
|
+
*
|
|
1266
|
+
* Returns the per-provider price overrides for this AI provider instance. An override prices this specific provider (e.g. an enterprise-negotiated rate or a gateway with markup) and wins over the global default at cost time. Authorized by the caller's access to the provider's project — so, unlike the global price book, a project's own overrides are visible here.
|
|
1267
|
+
*
|
|
1268
|
+
*/
|
|
1269
|
+
static getAiProviderPrices(options) {
|
|
1270
|
+
return (options.client ?? client).get({
|
|
1271
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/prices",
|
|
1272
|
+
...options
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Upsert per-provider price overrides
|
|
1277
|
+
*
|
|
1278
|
+
* Upserts price overrides for this AI provider instance, keyed on (model, effective_from). The provider slug is taken from the AI provider itself, so only the model, rates, and effective_from are supplied. Authorized by the caller's access to the provider's project. `effective_from` must be in the future — past prices are immutable, so ship corrections as new future-dated rows.
|
|
1279
|
+
*
|
|
1280
|
+
*/
|
|
1281
|
+
static updateAiProviderPrices(options) {
|
|
1282
|
+
return (options.client ?? client).put({
|
|
1283
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/prices",
|
|
1284
|
+
...options,
|
|
1285
|
+
headers: {
|
|
1286
|
+
"Content-Type": "application/json",
|
|
1287
|
+
...options.headers
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1008
1291
|
};
|
|
1009
1292
|
var ApiKeys = class {
|
|
1010
1293
|
/**
|
|
@@ -1023,6 +1306,7 @@ var ApiKeys = class {
|
|
|
1023
1306
|
* Create an API key
|
|
1024
1307
|
*
|
|
1025
1308
|
* Creates an API key. When `project_id` is set the key is scoped to that project (the default and recommended stance); omit it for an account-scoped key. `capabilities` narrows what the key may do; when omitted the key inherits the creator's capabilities. The raw `key` (nat_sk_…) is returned only in this response.
|
|
1309
|
+
* A project-scoped key requires the `admin` role in that project: the key is a standing credential for everything the project can do, so handing one out is an administrative act rather than something a read-only `member` can do for themselves. An account-scoped key requires a credential that is not itself confined to one project.
|
|
1026
1310
|
*
|
|
1027
1311
|
*/
|
|
1028
1312
|
static createApiKey(options) {
|
|
@@ -1206,39 +1490,27 @@ var Auth = class {
|
|
|
1206
1490
|
}
|
|
1207
1491
|
});
|
|
1208
1492
|
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Get the current identity
|
|
1211
|
-
*
|
|
1212
|
-
* Returns the user behind the presented access token.
|
|
1213
|
-
*/
|
|
1214
|
-
static getCurrentUser(options) {
|
|
1215
|
-
return (options?.client ?? client).get({
|
|
1216
|
-
url: "/v1/auth/me",
|
|
1217
|
-
...options
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
1493
|
};
|
|
1221
|
-
var
|
|
1494
|
+
var Conversations = class {
|
|
1222
1495
|
/**
|
|
1223
|
-
* List
|
|
1496
|
+
* List conversations
|
|
1224
1497
|
*
|
|
1225
|
-
*
|
|
1498
|
+
* Returns all conversations the caller has access to. If projectId is provided, returns only conversations in that project. project keys are scoped to a single project automatically.
|
|
1226
1499
|
*/
|
|
1227
|
-
static
|
|
1500
|
+
static listConversations(options) {
|
|
1228
1501
|
return (options.client ?? client).get({
|
|
1229
|
-
url: "/v1/projects/{project_id}/
|
|
1502
|
+
url: "/v1/projects/{project_id}/conversations",
|
|
1230
1503
|
...options
|
|
1231
1504
|
});
|
|
1232
1505
|
}
|
|
1233
1506
|
/**
|
|
1234
|
-
* Create a
|
|
1235
|
-
*
|
|
1236
|
-
* Define a board's columns and moves. Exactly one column must be `initial: true`; any number may be `terminal: true` (a card closes when it enters one). Every agent or tool a column dispatches must belong to this project, and every move a column routes to must be declared in `transitions`.
|
|
1507
|
+
* Create a conversation
|
|
1237
1508
|
*
|
|
1509
|
+
* Creates a new conversation. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
|
|
1238
1510
|
*/
|
|
1239
|
-
static
|
|
1511
|
+
static createConversation(options) {
|
|
1240
1512
|
return (options.client ?? client).post({
|
|
1241
|
-
url: "/v1/projects/{project_id}/
|
|
1513
|
+
url: "/v1/projects/{project_id}/conversations",
|
|
1242
1514
|
...options,
|
|
1243
1515
|
headers: {
|
|
1244
1516
|
"Content-Type": "application/json",
|
|
@@ -1247,39 +1519,35 @@ var Boards = class {
|
|
|
1247
1519
|
});
|
|
1248
1520
|
}
|
|
1249
1521
|
/**
|
|
1250
|
-
* Delete a
|
|
1251
|
-
*
|
|
1252
|
-
* Refused while the board still has open cards (409 `board_has_open_tasks`) — close or delete them first. Deleting a board whose cards are all closed removes those cards and their transition history along with it.
|
|
1522
|
+
* Delete a conversation
|
|
1253
1523
|
*
|
|
1524
|
+
* Deletes a conversation by its ID
|
|
1254
1525
|
*/
|
|
1255
|
-
static
|
|
1526
|
+
static deleteConversation(options) {
|
|
1256
1527
|
return (options.client ?? client).delete({
|
|
1257
|
-
url: "/v1/projects/{project_id}/
|
|
1528
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1258
1529
|
...options
|
|
1259
1530
|
});
|
|
1260
1531
|
}
|
|
1261
1532
|
/**
|
|
1262
|
-
* Get a
|
|
1263
|
-
*
|
|
1264
|
-
* The board's current definition — the source of truth for which columns exist and which moves are legal from each, so a UI renders its columns and its buttons from this response.
|
|
1533
|
+
* Get a conversation by ID
|
|
1265
1534
|
*
|
|
1535
|
+
* Returns a conversation by its ID
|
|
1266
1536
|
*/
|
|
1267
|
-
static
|
|
1537
|
+
static getConversation(options) {
|
|
1268
1538
|
return (options.client ?? client).get({
|
|
1269
|
-
url: "/v1/projects/{project_id}/
|
|
1539
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1270
1540
|
...options
|
|
1271
1541
|
});
|
|
1272
1542
|
}
|
|
1273
1543
|
/**
|
|
1274
|
-
* Update a
|
|
1275
|
-
*
|
|
1276
|
-
* Change the name, description, `payload_schema`, or the definition itself. `states` and `transitions` are edited together or not at all — a column routes to a move and a move names columns, so validating one against a stale copy of the other would accept a definition that cannot route. At least one field is required.
|
|
1277
|
-
* Cards already on the board are not moved. A card sitting in a column the new definition drops stays where it is and can only leave through a move the new definition declares: the definition is the sole authority at the moment a move is fired.
|
|
1544
|
+
* Update a conversation
|
|
1278
1545
|
*
|
|
1546
|
+
* Updates the status of a conversation
|
|
1279
1547
|
*/
|
|
1280
|
-
static
|
|
1548
|
+
static updateConversation(options) {
|
|
1281
1549
|
return (options.client ?? client).patch({
|
|
1282
|
-
url: "/v1/projects/{project_id}/
|
|
1550
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1283
1551
|
...options,
|
|
1284
1552
|
headers: {
|
|
1285
1553
|
"Content-Type": "application/json",
|
|
@@ -1287,35 +1555,25 @@ var Boards = class {
|
|
|
1287
1555
|
}
|
|
1288
1556
|
});
|
|
1289
1557
|
}
|
|
1290
|
-
};
|
|
1291
|
-
var Generations = class {
|
|
1292
1558
|
/**
|
|
1293
|
-
* List
|
|
1294
|
-
*
|
|
1295
|
-
* Lists the generation records the agent has produced, newest first. Filter by lifecycle `status` to find the failures without paging everything the agent has ever run.
|
|
1559
|
+
* List conversation messages
|
|
1296
1560
|
*
|
|
1561
|
+
* Returns all messages (documents) attached to a conversation, ordered by position
|
|
1297
1562
|
*/
|
|
1298
|
-
static
|
|
1563
|
+
static listConversationMessages(options) {
|
|
1299
1564
|
return (options.client ?? client).get({
|
|
1300
|
-
url: "/v1/projects/{project_id}/
|
|
1565
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages",
|
|
1301
1566
|
...options
|
|
1302
1567
|
});
|
|
1303
1568
|
}
|
|
1304
1569
|
/**
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
* Sends messages to the agent, resolves its tools, and runs the model loop.
|
|
1308
|
-
*
|
|
1309
|
-
* Background by default: this returns `202` immediately with a `generation_id`, and the turn runs on. Poll [`GET /v1/projects/{project_id}/generations/{generation_id}`](/docs/api/generations/get-generation) until its `status` leaves `in_progress`.
|
|
1310
|
-
*
|
|
1311
|
-
* Pass `?wait=true` to block instead and receive the turn itself — the final text when `status` is `completed` (plus `object` when the agent has an output schema), or the pending `tool_calls` when `status` is `requires_action`.
|
|
1312
|
-
*
|
|
1313
|
-
* With `stream: true` the response is a Server-Sent Events stream (Content-Type text/event-stream) proxied from the runtime. A stream holds the request open by definition, so it always waits; combining it with an explicit `wait=false` is a `400`.
|
|
1570
|
+
* Add a message to a conversation
|
|
1314
1571
|
*
|
|
1572
|
+
* Creates a document from the message text and attaches it to the conversation at the given position. If position is omitted, it is appended at the end.
|
|
1315
1573
|
*/
|
|
1316
|
-
static
|
|
1574
|
+
static addConversationMessage(options) {
|
|
1317
1575
|
return (options.client ?? client).post({
|
|
1318
|
-
url: "/v1/projects/{project_id}/
|
|
1576
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages",
|
|
1319
1577
|
...options,
|
|
1320
1578
|
headers: {
|
|
1321
1579
|
"Content-Type": "application/json",
|
|
@@ -1324,71 +1582,22 @@ var Generations = class {
|
|
|
1324
1582
|
});
|
|
1325
1583
|
}
|
|
1326
1584
|
/**
|
|
1327
|
-
*
|
|
1585
|
+
* Generate the next message in a conversation
|
|
1328
1586
|
*
|
|
1329
|
-
*
|
|
1330
|
-
*
|
|
1587
|
+
* Generates the next message using the specified actor's linked agent or chat.
|
|
1588
|
+
* Background by default: returns `202 Accepted` immediately and the reply
|
|
1589
|
+
* lands as a new ConversationMessage when it completes — poll
|
|
1590
|
+
* `GET /v1/projects/{project_id}/conversations/{conversation_id}/messages` for it.
|
|
1591
|
+
* Pass `?wait=true` to block and receive the result inline. On
|
|
1592
|
+
* `completed`, the reply is persisted as a new ConversationMessage
|
|
1593
|
+
* authored by that actor. On `requires_action`, nothing is persisted; the
|
|
1594
|
+
* caller must submit tool outputs via the Agents module and re-invoke
|
|
1595
|
+
* generate — so a flow using client tools should pass `?wait=true`.
|
|
1331
1596
|
*
|
|
1332
1597
|
*/
|
|
1333
|
-
static
|
|
1334
|
-
return (options.client ?? client).get({
|
|
1335
|
-
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1336
|
-
...options
|
|
1337
|
-
});
|
|
1338
|
-
}
|
|
1339
|
-
/**
|
|
1340
|
-
* Purge a generation's content
|
|
1341
|
-
*
|
|
1342
|
-
* Clears the generation's content — `metadata`, `error`, `extraction` and the internal recovery state of a paused run — and stamps `content_redacted_at` as verifiable proof the content is gone.
|
|
1343
|
-
* The billing and audit skeleton is preserved: ids, timestamps, status, stop reason and the attribution fields (`action_id`, `trigger_id`) the usage ledger reads. A purged generation still reads back with `GET /v1/projects/{project_id}/generations/{generation_id}` — a `404` there would prove nothing about what was erased.
|
|
1344
|
-
* This is the narrow erasure, scoped to one model turn. It does **not** delete the parent trace's step payload, which holds this generation's content alongside its siblings'. To erase a whole run's content, purge the trace with `DELETE /v1/projects/{project_id}/traces/{trace_id}/content`, which cascades to every descendant trace and all of their generations.
|
|
1345
|
-
* Idempotent: purging an already-purged generation succeeds and leaves the original `content_redacted_at` in place.
|
|
1346
|
-
* A generation belonging to another project responds `404`, not `403`, and nothing is purged.
|
|
1347
|
-
*
|
|
1348
|
-
*/
|
|
1349
|
-
static purgeGenerationContent(options) {
|
|
1350
|
-
return (options.client ?? client).delete({
|
|
1351
|
-
url: "/v1/projects/{project_id}/generations/{generation_id}/content",
|
|
1352
|
-
...options
|
|
1353
|
-
});
|
|
1354
|
-
}
|
|
1355
|
-
/**
|
|
1356
|
-
* Get a generation's cost
|
|
1357
|
-
*
|
|
1358
|
-
* What this one generation cost, and the tokens it was charged on — the billing-grade receipt the runtime froze at write time, per model line item.
|
|
1359
|
-
* This is the per-generation grain that `GET /v1/projects/{project_id}/usage` cannot express: that meter buckets a whole project by model, agent, run, day or meter type, and a run can hold more than one generation. Use this to price a single turn, and the project meter to roll spend up.
|
|
1360
|
-
* `cost_usd` is `null` when nothing was priced — never that the work was free. Only naturali-managed providers are priced; a BYOK generation runs on your own provider account, so it carries no LLM cost here (its tokens are still reported).
|
|
1361
|
-
* A generation belonging to another project responds `404`, not `403`.
|
|
1362
|
-
*
|
|
1363
|
-
*/
|
|
1364
|
-
static getGenerationUsage(options) {
|
|
1365
|
-
return (options.client ?? client).get({
|
|
1366
|
-
url: "/v1/projects/{project_id}/generations/{generation_id}/usage",
|
|
1367
|
-
...options
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
};
|
|
1371
|
-
var Knowledge = class {
|
|
1372
|
-
/**
|
|
1373
|
-
* List collections
|
|
1374
|
-
*
|
|
1375
|
-
* Lists the knowledge collections in the project.
|
|
1376
|
-
*/
|
|
1377
|
-
static listKnowledgeCollections(options) {
|
|
1378
|
-
return (options.client ?? client).get({
|
|
1379
|
-
url: "/v1/projects/{project_id}/knowledge/collections",
|
|
1380
|
-
...options
|
|
1381
|
-
});
|
|
1382
|
-
}
|
|
1383
|
-
/**
|
|
1384
|
-
* Create a collection
|
|
1385
|
-
*
|
|
1386
|
-
* Create a knowledge collection. The name is the key manifests reference (an agent's `knowledge:` block) and must be unique within the project.
|
|
1387
|
-
*
|
|
1388
|
-
*/
|
|
1389
|
-
static createKnowledgeCollection(options) {
|
|
1598
|
+
static generateConversationMessage(options) {
|
|
1390
1599
|
return (options.client ?? client).post({
|
|
1391
|
-
url: "/v1/projects/{project_id}/
|
|
1600
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/generate",
|
|
1392
1601
|
...options,
|
|
1393
1602
|
headers: {
|
|
1394
1603
|
"Content-Type": "application/json",
|
|
@@ -1397,34 +1606,35 @@ var Knowledge = class {
|
|
|
1397
1606
|
});
|
|
1398
1607
|
}
|
|
1399
1608
|
/**
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1402
|
-
* Deletes an empty collection. Returns 409 if the collection still has documents (delete them first).
|
|
1609
|
+
* Remove a message from a conversation
|
|
1403
1610
|
*
|
|
1611
|
+
* Removes a document from a conversation
|
|
1404
1612
|
*/
|
|
1405
|
-
static
|
|
1613
|
+
static removeConversationMessage(options) {
|
|
1406
1614
|
return (options.client ?? client).delete({
|
|
1407
|
-
url: "/v1/projects/{project_id}/
|
|
1615
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages/{document_id}",
|
|
1408
1616
|
...options
|
|
1409
1617
|
});
|
|
1410
1618
|
}
|
|
1411
1619
|
/**
|
|
1412
|
-
* Get
|
|
1620
|
+
* Get conversation tags
|
|
1621
|
+
*
|
|
1622
|
+
* Returns all tags attached to the conversation
|
|
1413
1623
|
*/
|
|
1414
|
-
static
|
|
1624
|
+
static getConversationTags(options) {
|
|
1415
1625
|
return (options.client ?? client).get({
|
|
1416
|
-
url: "/v1/projects/{project_id}/
|
|
1626
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1417
1627
|
...options
|
|
1418
1628
|
});
|
|
1419
1629
|
}
|
|
1420
1630
|
/**
|
|
1421
|
-
*
|
|
1631
|
+
* Merge conversation tags
|
|
1422
1632
|
*
|
|
1423
|
-
*
|
|
1633
|
+
* Merges provided tags with existing tags
|
|
1424
1634
|
*/
|
|
1425
|
-
static
|
|
1635
|
+
static mergeConversationTags(options) {
|
|
1426
1636
|
return (options.client ?? client).patch({
|
|
1427
|
-
url: "/v1/projects/{project_id}/
|
|
1637
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1428
1638
|
...options,
|
|
1429
1639
|
headers: {
|
|
1430
1640
|
"Content-Type": "application/json",
|
|
@@ -1433,14 +1643,13 @@ var Knowledge = class {
|
|
|
1433
1643
|
});
|
|
1434
1644
|
}
|
|
1435
1645
|
/**
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
1438
|
-
* Retrieval preview: returns the chunks the collection would surface for a question — debuggable standalone, before any agent is bound to it. This is the `…:query` action; the path segment is `{collection_id}:query`.
|
|
1646
|
+
* Replace conversation tags
|
|
1439
1647
|
*
|
|
1648
|
+
* Replaces all tags on the conversation with the provided tags
|
|
1440
1649
|
*/
|
|
1441
|
-
static
|
|
1442
|
-
return (options.client ?? client).
|
|
1443
|
-
url: "/v1/projects/{project_id}/
|
|
1650
|
+
static replaceConversationTags(options) {
|
|
1651
|
+
return (options.client ?? client).put({
|
|
1652
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1444
1653
|
...options,
|
|
1445
1654
|
headers: {
|
|
1446
1655
|
"Content-Type": "application/json",
|
|
@@ -1448,30 +1657,29 @@ var Knowledge = class {
|
|
|
1448
1657
|
}
|
|
1449
1658
|
});
|
|
1450
1659
|
}
|
|
1660
|
+
};
|
|
1661
|
+
var Evaluations = class {
|
|
1451
1662
|
/**
|
|
1452
|
-
* List
|
|
1663
|
+
* List datasets
|
|
1453
1664
|
*
|
|
1454
|
-
*
|
|
1665
|
+
* Returns the datasets defined in a project
|
|
1455
1666
|
*/
|
|
1456
|
-
static
|
|
1667
|
+
static listDatasets(options) {
|
|
1457
1668
|
return (options.client ?? client).get({
|
|
1458
|
-
url: "/v1/projects/{project_id}/
|
|
1669
|
+
url: "/v1/projects/{project_id}/datasets",
|
|
1459
1670
|
...options
|
|
1460
1671
|
});
|
|
1461
1672
|
}
|
|
1462
1673
|
/**
|
|
1463
|
-
* Create a
|
|
1464
|
-
*
|
|
1465
|
-
* Add a document to the collection, from **inline text** (`content`) or from an **uploaded file** (`file`, base64, plus `content_type` and `filename`) — exactly one of the two.
|
|
1466
|
-
*
|
|
1467
|
-
* `application/pdf`, `text/plain` and `text/markdown` are extracted natively. Any other media type needs a converter (`POST /v1/projects/{project_id}/knowledge/converters`) registered for it in the project; without one the request is rejected with `unsupported_content_type` and no document is created.
|
|
1674
|
+
* Create a dataset
|
|
1468
1675
|
*
|
|
1469
|
-
*
|
|
1676
|
+
* Creates a project-scoped dataset — a named collection of test cases an eval runs an agent against. Names are unique per project.
|
|
1470
1677
|
*
|
|
1678
|
+
* Datasets are operator-owned **fixtures**. The platform's content purge never deletes or mutates a dataset item, so erasing a generation cannot silently stop a test suite from being runnable.
|
|
1471
1679
|
*/
|
|
1472
|
-
static
|
|
1680
|
+
static createDataset(options) {
|
|
1473
1681
|
return (options.client ?? client).post({
|
|
1474
|
-
url: "/v1/projects/{project_id}/
|
|
1682
|
+
url: "/v1/projects/{project_id}/datasets",
|
|
1475
1683
|
...options,
|
|
1476
1684
|
headers: {
|
|
1477
1685
|
"Content-Type": "application/json",
|
|
@@ -1480,73 +1688,61 @@ var Knowledge = class {
|
|
|
1480
1688
|
});
|
|
1481
1689
|
}
|
|
1482
1690
|
/**
|
|
1483
|
-
* Delete a
|
|
1691
|
+
* Delete a dataset
|
|
1692
|
+
*
|
|
1693
|
+
* Deletes a dataset, its items, and every eval bound to it. Results of runs that already scored those items keep their frozen copies of the input and expected output.
|
|
1484
1694
|
*/
|
|
1485
|
-
static
|
|
1695
|
+
static deleteDataset(options) {
|
|
1486
1696
|
return (options.client ?? client).delete({
|
|
1487
|
-
url: "/v1/projects/{project_id}/
|
|
1697
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}",
|
|
1488
1698
|
...options
|
|
1489
1699
|
});
|
|
1490
1700
|
}
|
|
1491
1701
|
/**
|
|
1492
|
-
* Get a
|
|
1702
|
+
* Get a dataset
|
|
1493
1703
|
*
|
|
1494
|
-
* Returns
|
|
1704
|
+
* Returns a specific dataset
|
|
1495
1705
|
*/
|
|
1496
|
-
static
|
|
1706
|
+
static getDataset(options) {
|
|
1497
1707
|
return (options.client ?? client).get({
|
|
1498
|
-
url: "/v1/projects/{project_id}/
|
|
1708
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}",
|
|
1499
1709
|
...options
|
|
1500
1710
|
});
|
|
1501
1711
|
}
|
|
1502
1712
|
/**
|
|
1503
|
-
*
|
|
1504
|
-
*
|
|
1505
|
-
* Re-run ingestion for a document against its stored source, resetting it to `pending` before re-processing — the recovery path for a `failed` ingest. This is the `…:reingest` action; the path segment is `{document_id}:reingest`.
|
|
1713
|
+
* Update a dataset
|
|
1506
1714
|
*
|
|
1715
|
+
* Updates a dataset's name and/or description
|
|
1507
1716
|
*/
|
|
1508
|
-
static
|
|
1509
|
-
return (options.client ?? client).
|
|
1510
|
-
url: "/v1/projects/{project_id}/
|
|
1511
|
-
...options
|
|
1717
|
+
static updateDataset(options) {
|
|
1718
|
+
return (options.client ?? client).put({
|
|
1719
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}",
|
|
1720
|
+
...options,
|
|
1721
|
+
headers: {
|
|
1722
|
+
"Content-Type": "application/json",
|
|
1723
|
+
...options.headers
|
|
1724
|
+
}
|
|
1512
1725
|
});
|
|
1513
1726
|
}
|
|
1514
1727
|
/**
|
|
1515
|
-
* List
|
|
1728
|
+
* List dataset items
|
|
1516
1729
|
*
|
|
1517
|
-
*
|
|
1730
|
+
* Returns the test cases in a dataset, oldest first
|
|
1518
1731
|
*/
|
|
1519
|
-
static
|
|
1732
|
+
static listDatasetItems(options) {
|
|
1520
1733
|
return (options.client ?? client).get({
|
|
1521
|
-
url: "/v1/projects/{project_id}/
|
|
1734
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items",
|
|
1522
1735
|
...options
|
|
1523
1736
|
});
|
|
1524
1737
|
}
|
|
1525
1738
|
/**
|
|
1526
|
-
*
|
|
1527
|
-
*
|
|
1528
|
-
* Register a converter for a media type the platform cannot extract natively, so files of that type become ingestable documents like any other. A converter maps a `content_type` glob (`image*`, `audio/mpeg`, …) onto one of two workers:
|
|
1529
|
-
*
|
|
1530
|
-
* - an **agent** (`agent_id`) — the file is handed to a
|
|
1531
|
-
* multimodal model with a fixed "extract all the text" instruction and
|
|
1532
|
-
* its answer becomes the document text. The shortest path for images
|
|
1533
|
-
* and scanned PDFs; nothing to map.
|
|
1534
|
-
*
|
|
1535
|
-
* - a **tool** (`tool_id`) — the file is passed to an
|
|
1536
|
-
* `http` tool as `{ content_type, filename, data_base64 }`, and
|
|
1537
|
-
* whatever string the tool returns becomes the document text. The path
|
|
1538
|
-
* for dedicated non-chat APIs (speech-to-text, a specialist OCR
|
|
1539
|
-
* engine); use the tool's `execute.body_mode: multipart` for
|
|
1540
|
-
* form-data endpoints and its `output_mapping` to reduce a JSON
|
|
1541
|
-
* response to the bare string.
|
|
1542
|
-
*
|
|
1543
|
-
*
|
|
1544
|
-
* Exactly one of `agent_id` / `tool_id`, and one converter per `content_type` in a project.
|
|
1739
|
+
* Add a dataset item
|
|
1545
1740
|
*
|
|
1741
|
+
* Adds one test case. `input` is replayed verbatim as the generation's messages, so it must be a non-empty array of `{ role, content }`.
|
|
1546
1742
|
*/
|
|
1547
|
-
static
|
|
1743
|
+
static createDatasetItem(options) {
|
|
1548
1744
|
return (options.client ?? client).post({
|
|
1549
|
-
url: "/v1/projects/{project_id}/
|
|
1745
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items",
|
|
1550
1746
|
...options,
|
|
1551
1747
|
headers: {
|
|
1552
1748
|
"Content-Type": "application/json",
|
|
@@ -1555,35 +1751,45 @@ var Knowledge = class {
|
|
|
1555
1751
|
});
|
|
1556
1752
|
}
|
|
1557
1753
|
/**
|
|
1558
|
-
*
|
|
1754
|
+
* Curate a dataset item from a generation
|
|
1755
|
+
*
|
|
1756
|
+
* Promotes a real, completed generation into a test case: its input messages become the item's `input`, and its own answer becomes `expected_output` unless you supply one. Use it to build an evaluation set out of production traffic rather than hand-authoring fixtures.
|
|
1757
|
+
*
|
|
1758
|
+
* The item is a **copy**, not a view. It keeps working after the source generation's content is purged, and `source_generation_id` goes null if that generation is deleted — a purge can never quietly stop a suite from being runnable.
|
|
1559
1759
|
*
|
|
1560
|
-
*
|
|
1760
|
+
* Requires both `evaluations:CreateDataset` and `generations:GetGeneration`: the call copies content out of a generation, so a principal that may not read that generation may not curate it either.
|
|
1561
1761
|
*
|
|
1762
|
+
* Only a **completed** generation can be promoted (`409 GENERATION_NOT_COMPLETED`), and only while its content is still available: an agent or project running with `trace_content_mode: none` never stored the input, and a purged or expired generation no longer has it (`409 GENERATION_CONTENT_UNAVAILABLE`). Generations that predate input recording answer the same way.
|
|
1562
1763
|
*/
|
|
1563
|
-
static
|
|
1564
|
-
return (options.client ?? client).
|
|
1565
|
-
url: "/v1/projects/{project_id}/
|
|
1566
|
-
...options
|
|
1764
|
+
static createDatasetItemFromGeneration(options) {
|
|
1765
|
+
return (options.client ?? client).post({
|
|
1766
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/from-generation",
|
|
1767
|
+
...options,
|
|
1768
|
+
headers: {
|
|
1769
|
+
"Content-Type": "application/json",
|
|
1770
|
+
...options.headers
|
|
1771
|
+
}
|
|
1567
1772
|
});
|
|
1568
1773
|
}
|
|
1569
1774
|
/**
|
|
1570
|
-
*
|
|
1775
|
+
* Delete a dataset item
|
|
1776
|
+
*
|
|
1777
|
+
* Deletes a test case. Results of runs that already scored it stay readable; their `dataset_item_id` becomes null.
|
|
1571
1778
|
*/
|
|
1572
|
-
static
|
|
1573
|
-
return (options.client ?? client).
|
|
1574
|
-
url: "/v1/projects/{project_id}/
|
|
1779
|
+
static deleteDatasetItem(options) {
|
|
1780
|
+
return (options.client ?? client).delete({
|
|
1781
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/{item_id}",
|
|
1575
1782
|
...options
|
|
1576
1783
|
});
|
|
1577
1784
|
}
|
|
1578
1785
|
/**
|
|
1579
|
-
* Update a
|
|
1580
|
-
*
|
|
1581
|
-
* Change the worker or the chunking defaults. At least one field is required; `agent_id` and `tool_id` stay mutually exclusive, so setting one clears the other.
|
|
1786
|
+
* Update a dataset item
|
|
1582
1787
|
*
|
|
1788
|
+
* Updates a test case. Runs that already scored it are unaffected — each result carries its own frozen copy of the input and expected output.
|
|
1583
1789
|
*/
|
|
1584
|
-
static
|
|
1585
|
-
return (options.client ?? client).
|
|
1586
|
-
url: "/v1/projects/{project_id}/
|
|
1790
|
+
static updateDatasetItem(options) {
|
|
1791
|
+
return (options.client ?? client).put({
|
|
1792
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/{item_id}",
|
|
1587
1793
|
...options,
|
|
1588
1794
|
headers: {
|
|
1589
1795
|
"Content-Type": "application/json",
|
|
@@ -1591,27 +1797,27 @@ var Knowledge = class {
|
|
|
1591
1797
|
}
|
|
1592
1798
|
});
|
|
1593
1799
|
}
|
|
1594
|
-
};
|
|
1595
|
-
var ModelRoutes = class {
|
|
1596
1800
|
/**
|
|
1597
|
-
* List
|
|
1801
|
+
* List evals
|
|
1598
1802
|
*
|
|
1599
|
-
* Returns the
|
|
1803
|
+
* Returns the evals defined in a project
|
|
1600
1804
|
*/
|
|
1601
|
-
static
|
|
1805
|
+
static listEvals(options) {
|
|
1602
1806
|
return (options.client ?? client).get({
|
|
1603
|
-
url: "/v1/projects/{project_id}/
|
|
1807
|
+
url: "/v1/projects/{project_id}/evals",
|
|
1604
1808
|
...options
|
|
1605
1809
|
});
|
|
1606
1810
|
}
|
|
1607
1811
|
/**
|
|
1608
|
-
* Create
|
|
1812
|
+
* Create an eval
|
|
1609
1813
|
*
|
|
1610
|
-
*
|
|
1814
|
+
* Binds an agent under test to a dataset and a list of scorers. The agent and the dataset must belong to the same project as the eval; a cross-project reference is rejected with 400.
|
|
1815
|
+
*
|
|
1816
|
+
* Scorer config is frozen here rather than read from the agent at run time, so two runs of the same eval are always judged by the same criteria and their comparison measures the agent instead of the config drifting underneath it. Each scorer `type` may appear at most once.
|
|
1611
1817
|
*/
|
|
1612
|
-
static
|
|
1818
|
+
static createEval(options) {
|
|
1613
1819
|
return (options.client ?? client).post({
|
|
1614
|
-
url: "/v1/projects/{project_id}/
|
|
1820
|
+
url: "/v1/projects/{project_id}/evals",
|
|
1615
1821
|
...options,
|
|
1616
1822
|
headers: {
|
|
1617
1823
|
"Content-Type": "application/json",
|
|
@@ -1620,35 +1826,69 @@ var ModelRoutes = class {
|
|
|
1620
1826
|
});
|
|
1621
1827
|
}
|
|
1622
1828
|
/**
|
|
1623
|
-
* Delete
|
|
1829
|
+
* Delete an eval
|
|
1624
1830
|
*
|
|
1625
|
-
* Deletes
|
|
1831
|
+
* Deletes an eval, its runs, and their results
|
|
1626
1832
|
*/
|
|
1627
|
-
static
|
|
1833
|
+
static deleteEval(options) {
|
|
1628
1834
|
return (options.client ?? client).delete({
|
|
1629
|
-
url: "/v1/projects/{project_id}/
|
|
1835
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}",
|
|
1630
1836
|
...options
|
|
1631
1837
|
});
|
|
1632
1838
|
}
|
|
1633
1839
|
/**
|
|
1634
|
-
* Get
|
|
1840
|
+
* Get an eval
|
|
1841
|
+
*
|
|
1842
|
+
* Returns a specific eval
|
|
1843
|
+
*/
|
|
1844
|
+
static getEval(options) {
|
|
1845
|
+
return (options.client ?? client).get({
|
|
1846
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}",
|
|
1847
|
+
...options
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Update an eval
|
|
1852
|
+
*
|
|
1853
|
+
* Updates an eval. Changing `agent_id` re-validates the scorers against the new agent, since an `output_schema` scorer that was legal against the old one may not be.
|
|
1854
|
+
*/
|
|
1855
|
+
static updateEval(options) {
|
|
1856
|
+
return (options.client ?? client).put({
|
|
1857
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}",
|
|
1858
|
+
...options,
|
|
1859
|
+
headers: {
|
|
1860
|
+
"Content-Type": "application/json",
|
|
1861
|
+
...options.headers
|
|
1862
|
+
}
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* List eval runs
|
|
1635
1867
|
*
|
|
1636
|
-
* Returns
|
|
1868
|
+
* Returns an eval's runs, newest first
|
|
1637
1869
|
*/
|
|
1638
|
-
static
|
|
1870
|
+
static listEvalRuns(options) {
|
|
1639
1871
|
return (options.client ?? client).get({
|
|
1640
|
-
url: "/v1/projects/{project_id}/
|
|
1872
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs",
|
|
1641
1873
|
...options
|
|
1642
1874
|
});
|
|
1643
1875
|
}
|
|
1644
1876
|
/**
|
|
1645
|
-
*
|
|
1877
|
+
* Start an eval run
|
|
1646
1878
|
*
|
|
1647
|
-
*
|
|
1879
|
+
* Runs the eval against its dataset, creating one real agent generation per item and scoring the outputs.
|
|
1880
|
+
*
|
|
1881
|
+
* `wait: true` executes the run synchronously and returns it terminal, with its scores. The dataset is capped at 25 items for a synchronous run; a larger one is rejected with 400 rather than partially scored.
|
|
1882
|
+
*
|
|
1883
|
+
* `wait: false` (the default) enqueues one task per item and returns immediately with `status: "queued"`. A worker executes the items and the run settles itself; poll `GET /evals/{eval_id}/runs/{eval_run_id}` for the terminal status. There is no item cap on a queued run.
|
|
1884
|
+
*
|
|
1885
|
+
* The whole run is pinned to **one** agent version, stamped on `agent_version`: pass one explicitly to evaluate a canary before promoting it, or omit it to use the active release's stable version (or the live draft when no release is in effect). Without the pin, release assignment would bucket each item independently and blend two configs into a single score.
|
|
1886
|
+
*
|
|
1887
|
+
* With `baseline_run_id`, the finished run's `aggregate_scores.baseline` carries per-scorer deltas against that run, computed over the items present and scorable in **both** runs, with the divergence counted. A delta over a shifted dataset is therefore never presented as a clean comparison.
|
|
1648
1888
|
*/
|
|
1649
|
-
static
|
|
1650
|
-
return (options.client ?? client).
|
|
1651
|
-
url: "/v1/projects/{project_id}/
|
|
1889
|
+
static startEvalRun(options) {
|
|
1890
|
+
return (options.client ?? client).post({
|
|
1891
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs",
|
|
1652
1892
|
...options,
|
|
1653
1893
|
headers: {
|
|
1654
1894
|
"Content-Type": "application/json",
|
|
@@ -1656,66 +1896,78 @@ var ModelRoutes = class {
|
|
|
1656
1896
|
}
|
|
1657
1897
|
});
|
|
1658
1898
|
}
|
|
1659
|
-
};
|
|
1660
|
-
var Models = class {
|
|
1661
1899
|
/**
|
|
1662
|
-
*
|
|
1663
|
-
*
|
|
1664
|
-
* Lists catalog models, newest sources merged and sorted by id. Filter by vendor, provider, output/input modality, status, or `managed` — the last being the axis that decides whether a model is usable without BYOK credentials, so `?managed=true&status=available` is the set an agent can run on today.
|
|
1900
|
+
* Get an eval run
|
|
1665
1901
|
*
|
|
1902
|
+
* Returns a run's status, counts, and aggregate scores
|
|
1666
1903
|
*/
|
|
1667
|
-
static
|
|
1668
|
-
return (options
|
|
1669
|
-
url: "/v1/
|
|
1904
|
+
static getEvalRun(options) {
|
|
1905
|
+
return (options.client ?? client).get({
|
|
1906
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}",
|
|
1670
1907
|
...options
|
|
1671
1908
|
});
|
|
1672
1909
|
}
|
|
1673
1910
|
/**
|
|
1674
|
-
*
|
|
1911
|
+
* List eval run results
|
|
1912
|
+
*
|
|
1913
|
+
* Returns the per-item results of a run, oldest first
|
|
1675
1914
|
*/
|
|
1676
|
-
static
|
|
1915
|
+
static listEvalResults(options) {
|
|
1677
1916
|
return (options.client ?? client).get({
|
|
1678
|
-
url: "/v1/
|
|
1917
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}/results",
|
|
1918
|
+
...options
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Cancel an eval run
|
|
1923
|
+
*
|
|
1924
|
+
* Cancels a queued or running run: its outstanding item tasks are dropped so it stops consuming provider budget, and the run settles as `canceled`.
|
|
1925
|
+
*
|
|
1926
|
+
* Results already written are kept — they are real measurements of generations that were really paid for — and `completed_count` / `errored_count` report what ran. `aggregate_scores` is deliberately left null: a partial roll-up in the same field a completed run uses would read as a whole-dataset verdict.
|
|
1927
|
+
*
|
|
1928
|
+
* A run that has already finished is rejected with 400.
|
|
1929
|
+
*/
|
|
1930
|
+
static cancelEvalRun(options) {
|
|
1931
|
+
return (options.client ?? client).post({
|
|
1932
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}/cancel",
|
|
1679
1933
|
...options
|
|
1680
1934
|
});
|
|
1681
1935
|
}
|
|
1682
1936
|
};
|
|
1683
|
-
var
|
|
1937
|
+
var Generations = class {
|
|
1684
1938
|
/**
|
|
1685
|
-
* List
|
|
1939
|
+
* List generations
|
|
1940
|
+
*
|
|
1941
|
+
* Returns generations the caller can access, optionally filtered by agent, trace, and status. Replaces the former per-trace generations endpoint (use the trace_id query filter).
|
|
1686
1942
|
*
|
|
1687
|
-
* Lists the project's orchestration definitions.
|
|
1688
1943
|
*/
|
|
1689
|
-
static
|
|
1944
|
+
static listGenerations(options) {
|
|
1690
1945
|
return (options.client ?? client).get({
|
|
1691
|
-
url: "/v1/projects/{project_id}/
|
|
1946
|
+
url: "/v1/projects/{project_id}/generations",
|
|
1692
1947
|
...options
|
|
1693
1948
|
});
|
|
1694
1949
|
}
|
|
1695
1950
|
/**
|
|
1696
|
-
*
|
|
1951
|
+
* Get a generation
|
|
1952
|
+
*
|
|
1953
|
+
* Returns a single generation record by ID, including its status and the structured `error` payload when the generation failed (e.g. because the upstream AI provider returned an error).
|
|
1697
1954
|
*
|
|
1698
|
-
* Creates a new orchestration (pipeline) definition in the project.
|
|
1699
1955
|
*/
|
|
1700
|
-
static
|
|
1701
|
-
return (options.client ?? client).
|
|
1702
|
-
url: "/v1/projects/{project_id}/
|
|
1703
|
-
...options
|
|
1704
|
-
headers: {
|
|
1705
|
-
"Content-Type": "application/json",
|
|
1706
|
-
...options.headers
|
|
1707
|
-
}
|
|
1956
|
+
static getGeneration(options) {
|
|
1957
|
+
return (options.client ?? client).get({
|
|
1958
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1959
|
+
...options
|
|
1708
1960
|
});
|
|
1709
1961
|
}
|
|
1710
1962
|
/**
|
|
1711
|
-
*
|
|
1963
|
+
* Update generation metadata
|
|
1712
1964
|
*
|
|
1713
|
-
*
|
|
1965
|
+
* Attaches caller-supplied key/value metadata to a generation record for per-run audit attribution (e.g. recording which knowledge-corpus version produced an AI action). The provided keys are shallow-merged over the existing `metadata`, so repeated patches accumulate. The bag is caller-owned and no key is reserved: server-owned state (usage attribution, the served agent version, the route's record, the extraction summary) lives in its own top-level fields and cannot be written from here.
|
|
1714
1966
|
*
|
|
1715
1967
|
*/
|
|
1716
|
-
static
|
|
1717
|
-
return (options.client ?? client).
|
|
1718
|
-
url: "/v1/projects/{project_id}/
|
|
1968
|
+
static updateGeneration(options) {
|
|
1969
|
+
return (options.client ?? client).patch({
|
|
1970
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1719
1971
|
...options,
|
|
1720
1972
|
headers: {
|
|
1721
1973
|
"Content-Type": "application/json",
|
|
@@ -1724,63 +1976,60 @@ var Orchestrations = class {
|
|
|
1724
1976
|
});
|
|
1725
1977
|
}
|
|
1726
1978
|
/**
|
|
1727
|
-
*
|
|
1979
|
+
* Purge generation content
|
|
1980
|
+
*
|
|
1981
|
+
* Clears the generation's content — `metadata`, `error`, `extraction`, and the internal recovery state of a paused run — and stamps `content_redacted_at`.
|
|
1982
|
+
*
|
|
1983
|
+
* The usage and audit skeleton is preserved: ids, timestamps, status, stop reason, and the attribution fields (`action_id`, `trigger_id`, `orchestration_run_id`, `node_id`, `agent_version`, `routing`) the billing ledger reads. A purged generation reads back as that skeleton, not a 404.
|
|
1984
|
+
*
|
|
1985
|
+
* This does **not** delete the parent trace's steps object, which holds this generation's content alongside its siblings'. To erase the run's content completely, purge the trace (`DELETE /v1/projects/{project_id}/traces/{trace_id}/content`), which cascades here.
|
|
1986
|
+
*
|
|
1987
|
+
* Idempotent — purging an already-purged generation succeeds and leaves the original `content_redacted_at` in place.
|
|
1728
1988
|
*
|
|
1729
|
-
* Deletes the orchestration definition and all of its runs.
|
|
1730
1989
|
*/
|
|
1731
|
-
static
|
|
1990
|
+
static purgeGenerationContent(options) {
|
|
1732
1991
|
return (options.client ?? client).delete({
|
|
1733
|
-
url: "/v1/projects/{project_id}/
|
|
1992
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}/content",
|
|
1734
1993
|
...options
|
|
1735
1994
|
});
|
|
1736
1995
|
}
|
|
1737
1996
|
/**
|
|
1738
|
-
* Get
|
|
1997
|
+
* Get a generation's transcript
|
|
1739
1998
|
*
|
|
1740
|
-
* Returns one
|
|
1999
|
+
* Returns one generation's turn read back as an ordered sequence of steps: what it was asked, each model step with its tool calls and results, and how it ended.
|
|
2000
|
+
*
|
|
2001
|
+
* The transcript is assembled at read time from the generation record and the trace's steps object; nothing is stored, so it cannot outlive the content it projects. Requires `traces:GetTrace` in addition to `generations:GetGeneration`, because the response merges content from both resources.
|
|
2002
|
+
*
|
|
2003
|
+
* A generation whose content is unavailable — never written under zero-retention, or cleared by a purge — returns `200` with the skeleton rather than an error: `input` and `output` are null, `steps` is empty, and the `content_redacted_*` fields say which happened. `content_redacted_by_principal_id` is `zero_retention` when the content was never stored, and the purging principal's ID when it was erased later. A generation that is still running returns the same shape with an empty `steps`; `status` disambiguates the two.
|
|
1741
2004
|
*
|
|
1742
2005
|
*/
|
|
1743
|
-
static
|
|
2006
|
+
static getGenerationTranscript(options) {
|
|
1744
2007
|
return (options.client ?? client).get({
|
|
1745
|
-
url: "/v1/projects/{project_id}/
|
|
2008
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}/transcript",
|
|
1746
2009
|
...options
|
|
1747
2010
|
});
|
|
1748
2011
|
}
|
|
2012
|
+
};
|
|
2013
|
+
var ModelRoutes = class {
|
|
1749
2014
|
/**
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1752
|
-
* Partially updates an orchestration's definition.
|
|
1753
|
-
*/
|
|
1754
|
-
static updateOrchestration(options) {
|
|
1755
|
-
return (options.client ?? client).patch({
|
|
1756
|
-
url: "/v1/projects/{project_id}/orchestrations/{orchestration_id}",
|
|
1757
|
-
...options,
|
|
1758
|
-
headers: {
|
|
1759
|
-
"Content-Type": "application/json",
|
|
1760
|
-
...options.headers
|
|
1761
|
-
}
|
|
1762
|
-
});
|
|
1763
|
-
}
|
|
1764
|
-
/**
|
|
1765
|
-
* List orchestration runs
|
|
1766
|
-
*
|
|
1767
|
-
* Lists runs of one orchestration. `orchestration_id` is required — it is what scopes the list to this project, since a run carries no cheaper project-level filter of its own.
|
|
2015
|
+
* List model routes
|
|
1768
2016
|
*
|
|
2017
|
+
* Returns the model routes defined in a project
|
|
1769
2018
|
*/
|
|
1770
|
-
static
|
|
2019
|
+
static listModelRoutes(options) {
|
|
1771
2020
|
return (options.client ?? client).get({
|
|
1772
|
-
url: "/v1/projects/{project_id}/
|
|
2021
|
+
url: "/v1/projects/{project_id}/model-routes",
|
|
1773
2022
|
...options
|
|
1774
2023
|
});
|
|
1775
2024
|
}
|
|
1776
2025
|
/**
|
|
1777
|
-
*
|
|
2026
|
+
* Create a model route
|
|
1778
2027
|
*
|
|
1779
|
-
*
|
|
2028
|
+
* Creates a project-scoped model route: a named, ordered list of provider+model targets tried in array order. Every target must reference an AI provider in the same project (400 otherwise), and the total attempt budget — the sum of `1 + max_retries` over all targets — may not exceed 10 (400 naming the computed total). A duplicate `name` in the project is rejected with 409.
|
|
1780
2029
|
*/
|
|
1781
|
-
static
|
|
2030
|
+
static createModelRoute(options) {
|
|
1782
2031
|
return (options.client ?? client).post({
|
|
1783
|
-
url: "/v1/projects/{project_id}/
|
|
2032
|
+
url: "/v1/projects/{project_id}/model-routes",
|
|
1784
2033
|
...options,
|
|
1785
2034
|
headers: {
|
|
1786
2035
|
"Content-Type": "application/json",
|
|
@@ -1789,46 +2038,35 @@ var Orchestrations = class {
|
|
|
1789
2038
|
});
|
|
1790
2039
|
}
|
|
1791
2040
|
/**
|
|
1792
|
-
*
|
|
1793
|
-
*
|
|
1794
|
-
* Returns the status, state, and artifacts of one run.
|
|
1795
|
-
*/
|
|
1796
|
-
static getOrchestrationRun(options) {
|
|
1797
|
-
return (options.client ?? client).get({
|
|
1798
|
-
url: "/v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}",
|
|
1799
|
-
...options
|
|
1800
|
-
});
|
|
1801
|
-
}
|
|
1802
|
-
/**
|
|
1803
|
-
* Cancel an orchestration run
|
|
2041
|
+
* Delete a model route
|
|
1804
2042
|
*
|
|
1805
|
-
*
|
|
2043
|
+
* Deletes a model route. Returns 409 when an agent still references it — a routed agent has no pinned provider to fall back on, so the reference must be repointed or the agent deleted first.
|
|
1806
2044
|
*/
|
|
1807
|
-
static
|
|
1808
|
-
return (options.client ?? client).
|
|
1809
|
-
url: "/v1/projects/{project_id}/
|
|
2045
|
+
static deleteModelRoute(options) {
|
|
2046
|
+
return (options.client ?? client).delete({
|
|
2047
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1810
2048
|
...options
|
|
1811
2049
|
});
|
|
1812
2050
|
}
|
|
1813
2051
|
/**
|
|
1814
|
-
*
|
|
2052
|
+
* Get a model route
|
|
1815
2053
|
*
|
|
1816
|
-
*
|
|
2054
|
+
* Returns a specific model route
|
|
1817
2055
|
*/
|
|
1818
|
-
static
|
|
1819
|
-
return (options.client ?? client).
|
|
1820
|
-
url: "/v1/projects/{project_id}/
|
|
2056
|
+
static getModelRoute(options) {
|
|
2057
|
+
return (options.client ?? client).get({
|
|
2058
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1821
2059
|
...options
|
|
1822
2060
|
});
|
|
1823
2061
|
}
|
|
1824
2062
|
/**
|
|
1825
|
-
*
|
|
2063
|
+
* Update a model route
|
|
1826
2064
|
*
|
|
1827
|
-
*
|
|
2065
|
+
* Updates a model route's name, targets, retry classes, or breaker configuration. Omitted fields are left unchanged.
|
|
1828
2066
|
*/
|
|
1829
|
-
static
|
|
1830
|
-
return (options.client ?? client).
|
|
1831
|
-
url: "/v1/projects/{project_id}/
|
|
2067
|
+
static updateModelRoute(options) {
|
|
2068
|
+
return (options.client ?? client).put({
|
|
2069
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1832
2070
|
...options,
|
|
1833
2071
|
headers: {
|
|
1834
2072
|
"Content-Type": "application/json",
|
|
@@ -1841,7 +2079,8 @@ var Projects = class {
|
|
|
1841
2079
|
/**
|
|
1842
2080
|
* List projects
|
|
1843
2081
|
*
|
|
1844
|
-
* Lists projects
|
|
2082
|
+
* Lists the projects the caller is a member of. A project-scoped API key lists only its own project.
|
|
2083
|
+
*
|
|
1845
2084
|
*/
|
|
1846
2085
|
static listProjects(options) {
|
|
1847
2086
|
return (options?.client ?? client).get({
|
|
@@ -1868,6 +2107,7 @@ var Projects = class {
|
|
|
1868
2107
|
* Delete a project
|
|
1869
2108
|
*
|
|
1870
2109
|
* Permanently deletes the project and its backing runtime project. Fails with 409 if the runtime project still has dependent resources — remove them first, or pass `force=true` to delete the project and all its dependents (agents, providers, tools, sessions, generations, traces). Forcing is destructive and irreversible.
|
|
2110
|
+
* Requires the `owner` role — an `admin` runs the project day to day, but destroying it is the billing owner's call.
|
|
1871
2111
|
*
|
|
1872
2112
|
*/
|
|
1873
2113
|
static deleteProject(options) {
|
|
@@ -1879,8 +2119,8 @@ var Projects = class {
|
|
|
1879
2119
|
/**
|
|
1880
2120
|
* Get a project
|
|
1881
2121
|
*
|
|
1882
|
-
* Returns one project. An id you
|
|
1883
|
-
* `403` is reserved for the
|
|
2122
|
+
* Returns one project you are a member of, and your `role` in it. An id you are not a member of — including one that does not exist — responds `404`, not `403`: the API never confirms that an id exists elsewhere.
|
|
2123
|
+
* `403` is reserved for the cases where there is nothing to hide: a project you *are* in, addressed with a credential scoped to a different one, or an action your role does not carry. There the message is what makes the failure fixable.
|
|
1884
2124
|
*
|
|
1885
2125
|
*/
|
|
1886
2126
|
static getProject(options) {
|
|
@@ -1893,6 +2133,7 @@ var Projects = class {
|
|
|
1893
2133
|
* Update a project
|
|
1894
2134
|
*
|
|
1895
2135
|
* Rename or archive a project, and/or change its content-retention settings (`trace_content_retention_days`, `trace_content_mode`). Archiving is reversible; resources are retained.
|
|
2136
|
+
* Requires the `admin` role in the project (an `owner` has it too).
|
|
1896
2137
|
* The two retention controls answer different questions. The window bounds how long content *stays* — a daily sweep purges anything past it, leaving auditable skeletons behind. `trace_content_mode: none` means content is never *written*, which is the stronger guarantee: it cannot be missed by a sweep or survive in a backup.
|
|
1897
2138
|
*
|
|
1898
2139
|
*/
|
|
@@ -1907,6 +2148,19 @@ var Projects = class {
|
|
|
1907
2148
|
});
|
|
1908
2149
|
}
|
|
1909
2150
|
/**
|
|
2151
|
+
* List project members
|
|
2152
|
+
*
|
|
2153
|
+
* Lists who may act in the project, and with what role. Readable by every member, including a read-only `member`: who else is in the project is not a privileged fact, and hiding it makes "why can that person see my agents?" unanswerable.
|
|
2154
|
+
* Read-only for now — adding and removing members arrives with the invitation flow, since an invitee may not have an account yet.
|
|
2155
|
+
*
|
|
2156
|
+
*/
|
|
2157
|
+
static listProjectMembers(options) {
|
|
2158
|
+
return (options.client ?? client).get({
|
|
2159
|
+
url: "/v1/projects/{project_id}/members",
|
|
2160
|
+
...options
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
1910
2164
|
* Get per-project usage
|
|
1911
2165
|
*
|
|
1912
2166
|
* The per-project meter — the re-billing view (A11/C12/P3). Aggregates the project's usage over an optional [from, to] window, bucketed by a single dimension. Costs are the billing-grade cost_usd the runtime freezes at write time; null means nothing in the bucket was priced (never that it was free). Only managed providers are priced (on the runtime), so cost reflects managed usage; BYOK usage carries no LLM cost.
|
|
@@ -1921,27 +2175,26 @@ var Projects = class {
|
|
|
1921
2175
|
});
|
|
1922
2176
|
}
|
|
1923
2177
|
};
|
|
1924
|
-
var
|
|
2178
|
+
var Secrets = class {
|
|
1925
2179
|
/**
|
|
1926
|
-
* List
|
|
2180
|
+
* List secrets
|
|
1927
2181
|
*
|
|
1928
|
-
*
|
|
2182
|
+
* Returns a list of secrets for a project
|
|
1929
2183
|
*/
|
|
1930
|
-
static
|
|
2184
|
+
static listSecrets(options) {
|
|
1931
2185
|
return (options.client ?? client).get({
|
|
1932
|
-
url: "/v1/projects/{project_id}/
|
|
2186
|
+
url: "/v1/projects/{project_id}/secrets",
|
|
1933
2187
|
...options
|
|
1934
2188
|
});
|
|
1935
2189
|
}
|
|
1936
2190
|
/**
|
|
1937
|
-
*
|
|
1938
|
-
*
|
|
1939
|
-
* Register a managed provider (naturali-keyed, priced on the runtime) or a BYOK provider (your credentials, stored write-only and never priced). See ProviderCreate for the fields each mode takes.
|
|
2191
|
+
* Create a secret
|
|
1940
2192
|
*
|
|
2193
|
+
* Creates a new encrypted secret in a project
|
|
1941
2194
|
*/
|
|
1942
|
-
static
|
|
2195
|
+
static createSecret(options) {
|
|
1943
2196
|
return (options.client ?? client).post({
|
|
1944
|
-
url: "/v1/projects/{project_id}/
|
|
2197
|
+
url: "/v1/projects/{project_id}/secrets",
|
|
1945
2198
|
...options,
|
|
1946
2199
|
headers: {
|
|
1947
2200
|
"Content-Type": "application/json",
|
|
@@ -1950,35 +2203,35 @@ var Providers = class {
|
|
|
1950
2203
|
});
|
|
1951
2204
|
}
|
|
1952
2205
|
/**
|
|
1953
|
-
* Delete a
|
|
1954
|
-
*
|
|
1955
|
-
* Deletes the backing provider record on the runtime and its secret. Returns 409 if the provider is still referenced by live resources (agents) — detach those first. `force=true` clears only soft dependents (price overrides, usage history); live references always block deletion.
|
|
2206
|
+
* Delete a secret
|
|
1956
2207
|
*
|
|
2208
|
+
* Deletes a secret
|
|
1957
2209
|
*/
|
|
1958
|
-
static
|
|
2210
|
+
static deleteSecret(options) {
|
|
1959
2211
|
return (options.client ?? client).delete({
|
|
1960
|
-
url: "/v1/projects/{project_id}/
|
|
2212
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1961
2213
|
...options
|
|
1962
2214
|
});
|
|
1963
2215
|
}
|
|
1964
2216
|
/**
|
|
1965
|
-
* Get a
|
|
2217
|
+
* Get a secret
|
|
2218
|
+
*
|
|
2219
|
+
* Returns a specific secret
|
|
1966
2220
|
*/
|
|
1967
|
-
static
|
|
2221
|
+
static getSecret(options) {
|
|
1968
2222
|
return (options.client ?? client).get({
|
|
1969
|
-
url: "/v1/projects/{project_id}/
|
|
2223
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1970
2224
|
...options
|
|
1971
2225
|
});
|
|
1972
2226
|
}
|
|
1973
2227
|
/**
|
|
1974
|
-
* Update a
|
|
1975
|
-
*
|
|
1976
|
-
* Change the model, name or base URL, or rotate the credentials (api_key). At least one field is required.
|
|
2228
|
+
* Update a secret
|
|
1977
2229
|
*
|
|
2230
|
+
* Updates a secret's name and/or value
|
|
1978
2231
|
*/
|
|
1979
|
-
static
|
|
2232
|
+
static updateSecret(options) {
|
|
1980
2233
|
return (options.client ?? client).patch({
|
|
1981
|
-
url: "/v1/projects/{project_id}/
|
|
2234
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1982
2235
|
...options,
|
|
1983
2236
|
headers: {
|
|
1984
2237
|
"Content-Type": "application/json",
|
|
@@ -1989,14 +2242,25 @@ var Providers = class {
|
|
|
1989
2242
|
};
|
|
1990
2243
|
var Sessions = class {
|
|
1991
2244
|
/**
|
|
1992
|
-
*
|
|
2245
|
+
* List sessions
|
|
2246
|
+
*
|
|
2247
|
+
* Returns sessions the caller can access, optionally filtered by agent, actor and status.
|
|
2248
|
+
*/
|
|
2249
|
+
static listSessions(options) {
|
|
2250
|
+
return (options.client ?? client).get({
|
|
2251
|
+
url: "/v1/projects/{project_id}/sessions",
|
|
2252
|
+
...options
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Create a session
|
|
1993
2257
|
*
|
|
1994
|
-
*
|
|
2258
|
+
* Creates a new session for the specified agent, along with the underlying conversation, so the caller only needs this single call to start interacting with the agent. No actor is created: pass `actor_id` to attach an existing actor as the session's end user. When it is omitted the session has no actor, and generations in it carry no end-user attribution — they are not billed to an actor in the usage meter and they match no `actor`-scoped quota.
|
|
1995
2259
|
*
|
|
1996
2260
|
*/
|
|
1997
2261
|
static createSession(options) {
|
|
1998
2262
|
return (options.client ?? client).post({
|
|
1999
|
-
url: "/v1/projects/{project_id}/
|
|
2263
|
+
url: "/v1/projects/{project_id}/sessions",
|
|
2000
2264
|
...options,
|
|
2001
2265
|
headers: {
|
|
2002
2266
|
"Content-Type": "application/json",
|
|
@@ -2005,38 +2269,52 @@ var Sessions = class {
|
|
|
2005
2269
|
});
|
|
2006
2270
|
}
|
|
2007
2271
|
/**
|
|
2008
|
-
*
|
|
2272
|
+
* Delete a session
|
|
2009
2273
|
*
|
|
2010
|
-
*
|
|
2274
|
+
* Deletes the session and its underlying conversation and messages. The session's actor is not deleted. Generations and traces produced by the session are not deleted either, since they are not linked to the session or conversation.
|
|
2011
2275
|
*
|
|
2012
2276
|
*/
|
|
2013
|
-
static
|
|
2014
|
-
return (options.client ?? client).
|
|
2015
|
-
url: "/v1/projects/{project_id}/
|
|
2277
|
+
static deleteSession(options) {
|
|
2278
|
+
return (options.client ?? client).delete({
|
|
2279
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
2016
2280
|
...options
|
|
2017
2281
|
});
|
|
2018
2282
|
}
|
|
2019
2283
|
/**
|
|
2020
|
-
*
|
|
2021
|
-
*
|
|
2022
|
-
* The session's messages, oldest first. naturali stores no message bodies — the dialogue lives in the backing runtime conversation the session maps to, so this reads through to the runtime. Pagination is `limit`/`offset` rather than an opaque cursor because the upstream is offset-based over a stable `position` ordering. This is the one way to read back a session opened directly through this API (no [Channels](/docs/modules/channels) conversation involved) — see `GET .../channels/{channel_id}/conversations/{conversation_id}/messages` for the channel-backed equivalent.
|
|
2284
|
+
* Get a session
|
|
2023
2285
|
*
|
|
2286
|
+
* Returns details of a single session.
|
|
2024
2287
|
*/
|
|
2025
|
-
static
|
|
2288
|
+
static getSession(options) {
|
|
2026
2289
|
return (options.client ?? client).get({
|
|
2027
|
-
url: "/v1/projects/{project_id}/
|
|
2290
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
2028
2291
|
...options
|
|
2029
2292
|
});
|
|
2030
2293
|
}
|
|
2031
2294
|
/**
|
|
2032
|
-
*
|
|
2295
|
+
* Update a session
|
|
2033
2296
|
*
|
|
2034
|
-
*
|
|
2297
|
+
* Updates the session name and/or status.
|
|
2298
|
+
*/
|
|
2299
|
+
static updateSession(options) {
|
|
2300
|
+
return (options.client ?? client).patch({
|
|
2301
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
2302
|
+
...options,
|
|
2303
|
+
headers: {
|
|
2304
|
+
"Content-Type": "application/json",
|
|
2305
|
+
...options.headers
|
|
2306
|
+
}
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Add a user message
|
|
2311
|
+
*
|
|
2312
|
+
* Saves a user message to the session. When autoGenerate is enabled on the session and no generation is currently in progress, generation is triggered automatically and the response mirrors GenerateSessionResponse. Otherwise returns the saved user message.
|
|
2035
2313
|
*
|
|
2036
2314
|
*/
|
|
2037
2315
|
static addSessionMessage(options) {
|
|
2038
2316
|
return (options.client ?? client).post({
|
|
2039
|
-
url: "/v1/projects/{project_id}/
|
|
2317
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/messages",
|
|
2040
2318
|
...options,
|
|
2041
2319
|
headers: {
|
|
2042
2320
|
"Content-Type": "application/json",
|
|
@@ -2045,20 +2323,14 @@ var Sessions = class {
|
|
|
2045
2323
|
});
|
|
2046
2324
|
}
|
|
2047
2325
|
/**
|
|
2048
|
-
*
|
|
2049
|
-
*
|
|
2050
|
-
* Runs the agent over the session's accumulated messages.
|
|
2326
|
+
* Trigger agent generation
|
|
2051
2327
|
*
|
|
2052
|
-
* Background by default:
|
|
2053
|
-
*
|
|
2054
|
-
* Pass `?wait=true` to block instead and receive the turn itself: `status` is `completed` with the assistant `message`, or `requires_action` with the pending `required_action` tool calls.
|
|
2055
|
-
*
|
|
2056
|
-
* `model` overrides the agent's default model for this turn only.
|
|
2328
|
+
* Triggers the agent to generate a response based on the current conversation. Background by default: returns `202 Accepted` immediately while the generation runs. Pass ?wait=true to block and receive the assistant reply (or a requires_action status if the agent needs client tool outputs) in the response.
|
|
2057
2329
|
*
|
|
2058
2330
|
*/
|
|
2059
2331
|
static generateSessionResponse(options) {
|
|
2060
2332
|
return (options.client ?? client).post({
|
|
2061
|
-
url: "/v1/projects/{project_id}/
|
|
2333
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/generate",
|
|
2062
2334
|
...options,
|
|
2063
2335
|
headers: {
|
|
2064
2336
|
"Content-Type": "application/json",
|
|
@@ -2066,29 +2338,35 @@ var Sessions = class {
|
|
|
2066
2338
|
}
|
|
2067
2339
|
});
|
|
2068
2340
|
}
|
|
2069
|
-
};
|
|
2070
|
-
var Tasks = class {
|
|
2071
2341
|
/**
|
|
2072
|
-
*
|
|
2342
|
+
* Submit tool outputs
|
|
2073
2343
|
*
|
|
2074
|
-
*
|
|
2344
|
+
* Submits client tool outputs for a generation that returned requires_action. The agent continues its loop and returns the final or next requires_action result.
|
|
2075
2345
|
*
|
|
2076
2346
|
*/
|
|
2077
|
-
static
|
|
2078
|
-
return (options.client ?? client).
|
|
2079
|
-
url: "/v1/projects/{project_id}/
|
|
2080
|
-
...options
|
|
2347
|
+
static submitSessionToolOutputs(options) {
|
|
2348
|
+
return (options.client ?? client).post({
|
|
2349
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tool-outputs",
|
|
2350
|
+
...options,
|
|
2351
|
+
headers: {
|
|
2352
|
+
"Content-Type": "application/json",
|
|
2353
|
+
...options.headers
|
|
2354
|
+
}
|
|
2081
2355
|
});
|
|
2082
2356
|
}
|
|
2083
2357
|
/**
|
|
2084
|
-
*
|
|
2358
|
+
* Fork a session
|
|
2359
|
+
*
|
|
2360
|
+
* Branches a new session from a point in this session's history: same context, different continuation.
|
|
2085
2361
|
*
|
|
2086
|
-
*
|
|
2362
|
+
* The fork gets its own conversation whose messages **reference the same documents** as the parent rather than copying them, so there is one stored copy of the content and a retention purge erases it from both. Recorded tool results ride along on those messages and are **replayed** as model input on the fork's next turn — forking never re-invokes a tool, so exploring a "what if" cannot send an email or charge a card a second time. The consequence to accept is that a forked turn sees the tool data as it was, not as it is now.
|
|
2363
|
+
*
|
|
2364
|
+
* The fork is created **inert**: `auto_generate` is false and no generation is triggered. Drive it with the normal message and generate endpoints. The fork has no actor — attach one only if the branch is meant to be driven by the same end user, since `single_session_per_actor` agents allow one open session per actor.
|
|
2087
2365
|
*
|
|
2088
2366
|
*/
|
|
2089
|
-
static
|
|
2367
|
+
static forkSession(options) {
|
|
2090
2368
|
return (options.client ?? client).post({
|
|
2091
|
-
url: "/v1/projects/{project_id}/
|
|
2369
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/fork",
|
|
2092
2370
|
...options,
|
|
2093
2371
|
headers: {
|
|
2094
2372
|
"Content-Type": "application/json",
|
|
@@ -2097,39 +2375,36 @@ var Tasks = class {
|
|
|
2097
2375
|
});
|
|
2098
2376
|
}
|
|
2099
2377
|
/**
|
|
2100
|
-
*
|
|
2378
|
+
* List a session's forks
|
|
2101
2379
|
*
|
|
2102
|
-
*
|
|
2380
|
+
* Returns the sessions forked directly from this one. One level of lineage: a fork of a fork is listed under its own parent.
|
|
2103
2381
|
*
|
|
2104
2382
|
*/
|
|
2105
|
-
static
|
|
2106
|
-
return (options.client ?? client).
|
|
2107
|
-
url: "/v1/projects/{project_id}/
|
|
2383
|
+
static listSessionForks(options) {
|
|
2384
|
+
return (options.client ?? client).get({
|
|
2385
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/forks",
|
|
2108
2386
|
...options
|
|
2109
2387
|
});
|
|
2110
2388
|
}
|
|
2111
2389
|
/**
|
|
2112
|
-
* Get
|
|
2390
|
+
* Get session tags
|
|
2113
2391
|
*
|
|
2114
|
-
*
|
|
2392
|
+
* Returns the session's tags object.
|
|
2115
2393
|
*/
|
|
2116
|
-
static
|
|
2394
|
+
static getSessionTags(options) {
|
|
2117
2395
|
return (options.client ?? client).get({
|
|
2118
|
-
url: "/v1/projects/{project_id}/
|
|
2396
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2119
2397
|
...options
|
|
2120
2398
|
});
|
|
2121
2399
|
}
|
|
2122
2400
|
/**
|
|
2123
|
-
*
|
|
2124
|
-
*
|
|
2125
|
-
* Edit the card's `title`, `assignee` or `payload`. At least one is required.
|
|
2126
|
-
* `payload` is **shallow-merged** over what is there: keys the request omits are preserved. The merged result is validated against the board's `payload_schema`. `last_result` is read-only and lives in its own field — a payload write can never discard or forge it.
|
|
2127
|
-
* `state` and `board_id` are rejected — a card moves only through `:transition`, and it never changes boards.
|
|
2401
|
+
* Merge session tags
|
|
2128
2402
|
*
|
|
2403
|
+
* Merges the provided tags into the session's existing tags.
|
|
2129
2404
|
*/
|
|
2130
|
-
static
|
|
2405
|
+
static mergeSessionTags(options) {
|
|
2131
2406
|
return (options.client ?? client).patch({
|
|
2132
|
-
url: "/v1/projects/{project_id}/
|
|
2407
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2133
2408
|
...options,
|
|
2134
2409
|
headers: {
|
|
2135
2410
|
"Content-Type": "application/json",
|
|
@@ -2138,15 +2413,13 @@ var Tasks = class {
|
|
|
2138
2413
|
});
|
|
2139
2414
|
}
|
|
2140
2415
|
/**
|
|
2141
|
-
*
|
|
2142
|
-
*
|
|
2143
|
-
* Fire a named move on the card — the single path every state change takes. The move must be declared on the board and valid from the card's current column; the board's definition is what a UI renders its buttons from.
|
|
2144
|
-
* Naming a move that does not exist, one that is not legal from this column, or any move at all on a closed card all answer 409 `task_transition_conflict`: it is a conflict with the card's state rather than a malformed request — the same body succeeds one column earlier.
|
|
2416
|
+
* Replace session tags
|
|
2145
2417
|
*
|
|
2418
|
+
* Replaces all tags on the session.
|
|
2146
2419
|
*/
|
|
2147
|
-
static
|
|
2148
|
-
return (options.client ?? client).
|
|
2149
|
-
url: "/v1/projects/{project_id}/
|
|
2420
|
+
static replaceSessionTags(options) {
|
|
2421
|
+
return (options.client ?? client).put({
|
|
2422
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2150
2423
|
...options,
|
|
2151
2424
|
headers: {
|
|
2152
2425
|
"Content-Type": "application/json",
|
|
@@ -2154,24 +2427,12 @@ var Tasks = class {
|
|
|
2154
2427
|
}
|
|
2155
2428
|
});
|
|
2156
2429
|
}
|
|
2157
|
-
/**
|
|
2158
|
-
* List the task's moves
|
|
2159
|
-
*
|
|
2160
|
-
* The card's append-only history, oldest first: every move it made, what kind of principal made it, and what caused it. Returned whole — `next_cursor` is always null.
|
|
2161
|
-
*
|
|
2162
|
-
*/
|
|
2163
|
-
static listTaskTransitions(options) {
|
|
2164
|
-
return (options.client ?? client).get({
|
|
2165
|
-
url: "/v1/projects/{project_id}/tasks/{task_id}/transitions",
|
|
2166
|
-
...options
|
|
2167
|
-
});
|
|
2168
|
-
}
|
|
2169
2430
|
};
|
|
2170
2431
|
var Tools = class {
|
|
2171
2432
|
/**
|
|
2172
2433
|
* List tools
|
|
2173
2434
|
*
|
|
2174
|
-
*
|
|
2435
|
+
* Returns all tools in the project.
|
|
2175
2436
|
*/
|
|
2176
2437
|
static listTools(options) {
|
|
2177
2438
|
return (options.client ?? client).get({
|
|
@@ -2182,8 +2443,7 @@ var Tools = class {
|
|
|
2182
2443
|
/**
|
|
2183
2444
|
* Create a tool
|
|
2184
2445
|
*
|
|
2185
|
-
*
|
|
2186
|
-
*
|
|
2446
|
+
* Creates a new tool in the project.
|
|
2187
2447
|
*/
|
|
2188
2448
|
static createTool(options) {
|
|
2189
2449
|
return (options.client ?? client).post({
|
|
@@ -2198,8 +2458,7 @@ var Tools = class {
|
|
|
2198
2458
|
/**
|
|
2199
2459
|
* Delete a tool
|
|
2200
2460
|
*
|
|
2201
|
-
* Deletes
|
|
2202
|
-
*
|
|
2461
|
+
* Deletes a tool by ID.
|
|
2203
2462
|
*/
|
|
2204
2463
|
static deleteTool(options) {
|
|
2205
2464
|
return (options.client ?? client).delete({
|
|
@@ -2209,6 +2468,8 @@ var Tools = class {
|
|
|
2209
2468
|
}
|
|
2210
2469
|
/**
|
|
2211
2470
|
* Get a tool
|
|
2471
|
+
*
|
|
2472
|
+
* Returns a single tool by ID.
|
|
2212
2473
|
*/
|
|
2213
2474
|
static getTool(options) {
|
|
2214
2475
|
return (options.client ?? client).get({
|
|
@@ -2219,8 +2480,7 @@ var Tools = class {
|
|
|
2219
2480
|
/**
|
|
2220
2481
|
* Update a tool
|
|
2221
2482
|
*
|
|
2222
|
-
*
|
|
2223
|
-
*
|
|
2483
|
+
* Updates an existing tool.
|
|
2224
2484
|
*/
|
|
2225
2485
|
static updateTool(options) {
|
|
2226
2486
|
return (options.client ?? client).patch({
|
|
@@ -2232,12 +2492,30 @@ var Tools = class {
|
|
|
2232
2492
|
}
|
|
2233
2493
|
});
|
|
2234
2494
|
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Call a tool
|
|
2497
|
+
*
|
|
2498
|
+
* Directly invokes a tool and returns its output. Supported for `http`, `mcp` and `pipeline` tools. `client` tools cannot be invoked server-side and will return 422. A `pipeline` tool runs its declared steps in order and returns the mapped `output` (or the last step's output); `action` is ignored and `input` is the pipeline input.
|
|
2499
|
+
* For `mcp` tools the `action` field is required and identifies which tool name to invoke. For `http` tools `action` is ignored. When an `mcp` tool declares an `actions` allowlist, an action outside it is rejected with `400 VALIDATION_FAILED` ("not available on this tool") before any outbound request is made.
|
|
2500
|
+
* `preset_parameters` stored on the tool are merged with the caller-supplied `input` before execution; preset keys take lower precedence.
|
|
2501
|
+
*
|
|
2502
|
+
*/
|
|
2503
|
+
static callTool(options) {
|
|
2504
|
+
return (options.client ?? client).post({
|
|
2505
|
+
url: "/v1/projects/{project_id}/tools/{tool_id}/call",
|
|
2506
|
+
...options,
|
|
2507
|
+
headers: {
|
|
2508
|
+
"Content-Type": "application/json",
|
|
2509
|
+
...options.headers
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2235
2513
|
};
|
|
2236
2514
|
var Traces = class {
|
|
2237
2515
|
/**
|
|
2238
2516
|
* List traces
|
|
2239
2517
|
*
|
|
2240
|
-
*
|
|
2518
|
+
* Returns a paginated list of execution traces for the project.
|
|
2241
2519
|
*/
|
|
2242
2520
|
static listTraces(options) {
|
|
2243
2521
|
return (options.client ?? client).get({
|
|
@@ -2248,8 +2526,7 @@ var Traces = class {
|
|
|
2248
2526
|
/**
|
|
2249
2527
|
* Get a trace
|
|
2250
2528
|
*
|
|
2251
|
-
* Returns
|
|
2252
|
-
*
|
|
2529
|
+
* Returns a single trace by ID.
|
|
2253
2530
|
*/
|
|
2254
2531
|
static getTrace(options) {
|
|
2255
2532
|
return (options.client ?? client).get({
|
|
@@ -2258,10 +2535,9 @@ var Traces = class {
|
|
|
2258
2535
|
});
|
|
2259
2536
|
}
|
|
2260
2537
|
/**
|
|
2261
|
-
* Get
|
|
2538
|
+
* Get trace tree
|
|
2262
2539
|
*
|
|
2263
|
-
* Returns the
|
|
2264
|
-
* Asking for a child returns the tree from its root, so the response is the full execution either way — pass `include=generations` and one call is enough to render a finished run.
|
|
2540
|
+
* Returns the full execution tree rooted at the given trace (or its root if the given trace is a child). Each node represents one agent's execution session. The `children` array contains traces triggered by sub-agent tool calls from that trace.
|
|
2265
2541
|
*
|
|
2266
2542
|
*/
|
|
2267
2543
|
static getTraceTree(options) {
|
|
@@ -2271,36 +2547,13 @@ var Traces = class {
|
|
|
2271
2547
|
});
|
|
2272
2548
|
}
|
|
2273
2549
|
/**
|
|
2274
|
-
*
|
|
2275
|
-
*
|
|
2276
|
-
* Lists the generations recorded under this trace — the model loops the execution ran, including sub-agent generations linked by `initiator_generation_id`.
|
|
2277
|
-
*
|
|
2278
|
-
*/
|
|
2279
|
-
static listTraceGenerations(options) {
|
|
2280
|
-
return (options.client ?? client).get({
|
|
2281
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/generations",
|
|
2282
|
-
...options
|
|
2283
|
-
});
|
|
2284
|
-
}
|
|
2285
|
-
/**
|
|
2286
|
-
* Get a trace's steps
|
|
2550
|
+
* Purge trace content
|
|
2287
2551
|
*
|
|
2288
|
-
*
|
|
2289
|
-
* Saving the payload is fire-and-forget on the runtime, so a trace can report `has_steps: false` for a short window after it finishes; this route 404s with `steps_not_available` during that window rather than returning an empty list, so a caller does not mistake "not saved yet" for "no steps ran".
|
|
2290
|
-
* A trace with no payload at all answers `steps_redacted` instead — its content was purged, or its agent runs in zero-retention and nothing was ever written. The distinction is the whole point of two codes: retrying `steps_not_available` succeeds once the write lands, while retrying `steps_redacted` can never succeed. The response carries `content_redacted_at` in `details`.
|
|
2552
|
+
* Deletes the trace's steps object from storage and clears its content columns (`file_id`, `error`), cascading to every descendant trace and to all of their generations. A descendant holds its own steps object covering the same run, so the cascade is what makes the erasure complete rather than merely partial.
|
|
2291
2553
|
*
|
|
2292
|
-
|
|
2293
|
-
static getTraceSteps(options) {
|
|
2294
|
-
return (options.client ?? client).get({
|
|
2295
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/steps",
|
|
2296
|
-
...options
|
|
2297
|
-
});
|
|
2298
|
-
}
|
|
2299
|
-
/**
|
|
2300
|
-
* Purge a trace's content
|
|
2554
|
+
* The rows survive as auditable skeletons with `content_redacted_at` set — ids, timestamps, step counts, and the generations' usage-attribution fields are preserved, because the billing and audit ledger must outlive a tenant's erasure of the content. A purged trace therefore reads back as a skeleton, not a 404: a 404 would prove nothing.
|
|
2301
2555
|
*
|
|
2302
|
-
*
|
|
2303
|
-
* Idempotent: purging an already-purged trace succeeds and leaves the original `content_redacted_at` in place.
|
|
2556
|
+
* Idempotent — purging an already-purged trace succeeds and leaves the original `content_redacted_at` in place.
|
|
2304
2557
|
*
|
|
2305
2558
|
*/
|
|
2306
2559
|
static purgeTraceContent(options) {
|
|
@@ -2310,82 +2563,27 @@ var Traces = class {
|
|
|
2310
2563
|
});
|
|
2311
2564
|
}
|
|
2312
2565
|
};
|
|
2313
|
-
var
|
|
2314
|
-
/**
|
|
2315
|
-
* List triggers
|
|
2316
|
-
*
|
|
2317
|
-
* The project's schedule triggers, of either fronted target kind.
|
|
2318
|
-
* `total` is the runtime's count of the project's schedule triggers, so it can exceed the rows returned when a trigger was authored directly against the runtime with a target this surface doesn't front (the same bypass `getTrigger` answers `404` for). Pass `target_type` — which is filtered and counted upstream — when an exact count matters.
|
|
2319
|
-
*
|
|
2320
|
-
*/
|
|
2321
|
-
static listTriggers(options) {
|
|
2322
|
-
return (options.client ?? client).get({
|
|
2323
|
-
url: "/v1/projects/{project_id}/triggers",
|
|
2324
|
-
...options
|
|
2325
|
-
});
|
|
2326
|
-
}
|
|
2327
|
-
/**
|
|
2328
|
-
* Create a trigger
|
|
2329
|
-
*
|
|
2330
|
-
* Schedules `target_id` — an agent or an orchestration in this project, per `target_type` — to run on `cron`, a 5-field cron expression evaluated in UTC.
|
|
2331
|
-
*
|
|
2332
|
-
*/
|
|
2333
|
-
static createTrigger(options) {
|
|
2334
|
-
return (options.client ?? client).post({
|
|
2335
|
-
url: "/v1/projects/{project_id}/triggers",
|
|
2336
|
-
...options,
|
|
2337
|
-
headers: {
|
|
2338
|
-
"Content-Type": "application/json",
|
|
2339
|
-
...options.headers
|
|
2340
|
-
}
|
|
2341
|
-
});
|
|
2342
|
-
}
|
|
2566
|
+
var Users = class {
|
|
2343
2567
|
/**
|
|
2344
|
-
*
|
|
2568
|
+
* Get the current user
|
|
2345
2569
|
*
|
|
2346
|
-
*
|
|
2347
|
-
*/
|
|
2348
|
-
static deleteTrigger(options) {
|
|
2349
|
-
return (options.client ?? client).delete({
|
|
2350
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}",
|
|
2351
|
-
...options
|
|
2352
|
-
});
|
|
2353
|
-
}
|
|
2354
|
-
/**
|
|
2355
|
-
* Get a trigger
|
|
2570
|
+
* Returns the account the presented credential resolves to.
|
|
2356
2571
|
*/
|
|
2357
|
-
static
|
|
2358
|
-
return (options
|
|
2359
|
-
url: "/v1/
|
|
2572
|
+
static getCurrentUser(options) {
|
|
2573
|
+
return (options?.client ?? client).get({
|
|
2574
|
+
url: "/v1/users/me",
|
|
2360
2575
|
...options
|
|
2361
2576
|
});
|
|
2362
2577
|
}
|
|
2363
2578
|
/**
|
|
2364
|
-
* Update
|
|
2579
|
+
* Update the current user
|
|
2365
2580
|
*
|
|
2366
|
-
*
|
|
2581
|
+
* Edits the account's display name. `name` is required in the body — send null to clear it — so a request that misspelled the field is rejected rather than answered with a silent 200.
|
|
2367
2582
|
*
|
|
2368
2583
|
*/
|
|
2369
|
-
static
|
|
2584
|
+
static updateCurrentUser(options) {
|
|
2370
2585
|
return (options.client ?? client).patch({
|
|
2371
|
-
url: "/v1/
|
|
2372
|
-
...options,
|
|
2373
|
-
headers: {
|
|
2374
|
-
"Content-Type": "application/json",
|
|
2375
|
-
...options.headers
|
|
2376
|
-
}
|
|
2377
|
-
});
|
|
2378
|
-
}
|
|
2379
|
-
/**
|
|
2380
|
-
* Fire a trigger manually
|
|
2381
|
-
*
|
|
2382
|
-
* Runs the trigger's target right now, outside its schedule, and waits for the run to finish. This is the `…:fire` action; the path segment is `{trigger_id}:fire`.
|
|
2383
|
-
* `input` is shallow-merged over the trigger's own stored `input` for this run only — the trigger's configuration is unchanged.
|
|
2384
|
-
*
|
|
2385
|
-
*/
|
|
2386
|
-
static fireTrigger(options) {
|
|
2387
|
-
return (options.client ?? client).post({
|
|
2388
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}:fire",
|
|
2586
|
+
url: "/v1/users/me",
|
|
2389
2587
|
...options,
|
|
2390
2588
|
headers: {
|
|
2391
2589
|
"Content-Type": "application/json",
|
|
@@ -2393,26 +2591,6 @@ var Triggers = class {
|
|
|
2393
2591
|
}
|
|
2394
2592
|
});
|
|
2395
2593
|
}
|
|
2396
|
-
/**
|
|
2397
|
-
* List a trigger's firings
|
|
2398
|
-
*
|
|
2399
|
-
* Every time this trigger ran, newest first — scheduled and manual alike.
|
|
2400
|
-
*/
|
|
2401
|
-
static listTriggerFirings(options) {
|
|
2402
|
-
return (options.client ?? client).get({
|
|
2403
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings",
|
|
2404
|
-
...options
|
|
2405
|
-
});
|
|
2406
|
-
}
|
|
2407
|
-
/**
|
|
2408
|
-
* Get a trigger firing
|
|
2409
|
-
*/
|
|
2410
|
-
static getTriggerFiring(options) {
|
|
2411
|
-
return (options.client ?? client).get({
|
|
2412
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings/{firing_id}",
|
|
2413
|
-
...options
|
|
2414
|
-
});
|
|
2415
|
-
}
|
|
2416
2594
|
};
|
|
2417
2595
|
var Webhooks = class {
|
|
2418
2596
|
/**
|
|
@@ -2571,8 +2749,8 @@ const API_BASE_URL = "https://api.naturali.ai";
|
|
|
2571
2749
|
* });
|
|
2572
2750
|
*
|
|
2573
2751
|
* const { data, error } = await naturali.sessions.addSessionMessage({
|
|
2574
|
-
* path: { project_id: PROJECT_ID,
|
|
2575
|
-
* body: {
|
|
2752
|
+
* path: { project_id: PROJECT_ID, session_id: SESSION_ID },
|
|
2753
|
+
* body: { message: 'What is the capital of France?' },
|
|
2576
2754
|
* });
|
|
2577
2755
|
* ```
|
|
2578
2756
|
*
|
|
@@ -2583,23 +2761,22 @@ const API_BASE_URL = "https://api.naturali.ai";
|
|
|
2583
2761
|
var NaturaliClient = class {
|
|
2584
2762
|
actors;
|
|
2585
2763
|
agents;
|
|
2764
|
+
agentVersions;
|
|
2765
|
+
aiProviders;
|
|
2586
2766
|
apiKeys;
|
|
2587
2767
|
assistant;
|
|
2588
|
-
auth;
|
|
2589
|
-
boards;
|
|
2590
2768
|
channels;
|
|
2769
|
+
auth;
|
|
2770
|
+
conversations;
|
|
2771
|
+
evaluations;
|
|
2591
2772
|
generations;
|
|
2592
|
-
knowledge;
|
|
2593
2773
|
modelRoutes;
|
|
2594
|
-
models;
|
|
2595
|
-
orchestrations;
|
|
2596
2774
|
projects;
|
|
2597
|
-
|
|
2775
|
+
secrets;
|
|
2598
2776
|
sessions;
|
|
2599
|
-
tasks;
|
|
2600
2777
|
tools;
|
|
2601
2778
|
traces;
|
|
2602
|
-
|
|
2779
|
+
users;
|
|
2603
2780
|
webhooks;
|
|
2604
2781
|
/** The underlying HTTP client, for interceptors or one-off requests. */
|
|
2605
2782
|
http;
|
|
@@ -2613,25 +2790,24 @@ var NaturaliClient = class {
|
|
|
2613
2790
|
}));
|
|
2614
2791
|
this.actors = bindResource(Actors, this.http);
|
|
2615
2792
|
this.agents = bindResource(Agents, this.http);
|
|
2793
|
+
this.agentVersions = bindResource(AgentVersions, this.http);
|
|
2794
|
+
this.aiProviders = bindResource(AiProviders, this.http);
|
|
2616
2795
|
this.apiKeys = bindResource(ApiKeys, this.http);
|
|
2617
2796
|
this.assistant = bindResource(Assistant, this.http);
|
|
2618
|
-
this.auth = bindResource(Auth, this.http);
|
|
2619
|
-
this.boards = bindResource(Boards, this.http);
|
|
2620
2797
|
this.channels = bindResource(Channels, this.http);
|
|
2798
|
+
this.auth = bindResource(Auth, this.http);
|
|
2799
|
+
this.conversations = bindResource(Conversations, this.http);
|
|
2800
|
+
this.evaluations = bindResource(Evaluations, this.http);
|
|
2621
2801
|
this.generations = bindResource(Generations, this.http);
|
|
2622
|
-
this.knowledge = bindResource(Knowledge, this.http);
|
|
2623
2802
|
this.modelRoutes = bindResource(ModelRoutes, this.http);
|
|
2624
|
-
this.models = bindResource(Models, this.http);
|
|
2625
|
-
this.orchestrations = bindResource(Orchestrations, this.http);
|
|
2626
2803
|
this.projects = bindResource(Projects, this.http);
|
|
2627
|
-
this.
|
|
2804
|
+
this.secrets = bindResource(Secrets, this.http);
|
|
2628
2805
|
this.sessions = bindResource(Sessions, this.http);
|
|
2629
|
-
this.tasks = bindResource(Tasks, this.http);
|
|
2630
2806
|
this.tools = bindResource(Tools, this.http);
|
|
2631
2807
|
this.traces = bindResource(Traces, this.http);
|
|
2632
|
-
this.
|
|
2808
|
+
this.users = bindResource(Users, this.http);
|
|
2633
2809
|
this.webhooks = bindResource(Webhooks, this.http);
|
|
2634
2810
|
}
|
|
2635
2811
|
};
|
|
2636
2812
|
//#endregion
|
|
2637
|
-
export { Actors, Agents, ApiKeys, Assistant, Auth,
|
|
2813
|
+
export { Actors, AgentVersions, Agents, AiProviders, ApiKeys, Assistant, Auth, Channels, Conversations, Evaluations, Generations, ModelRoutes, NaturaliClient, Projects, Secrets, Sessions, Tools, Traces, Users, Webhooks, createClient, createConfig };
|