@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.cjs
CHANGED
|
@@ -607,8 +607,7 @@ var Actors = class {
|
|
|
607
607
|
/**
|
|
608
608
|
* List actors
|
|
609
609
|
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
610
|
+
* 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.
|
|
612
611
|
*/
|
|
613
612
|
static listActors(options) {
|
|
614
613
|
return (options.client ?? client).get({
|
|
@@ -619,9 +618,7 @@ var Actors = class {
|
|
|
619
618
|
/**
|
|
620
619
|
* Create an actor
|
|
621
620
|
*
|
|
622
|
-
* Creates
|
|
623
|
-
* `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.
|
|
624
|
-
*
|
|
621
|
+
* Creates a new actor. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
|
|
625
622
|
*/
|
|
626
623
|
static createActor(options) {
|
|
627
624
|
return (options.client ?? client).post({
|
|
@@ -634,11 +631,9 @@ var Actors = class {
|
|
|
634
631
|
});
|
|
635
632
|
}
|
|
636
633
|
/**
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
* 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.
|
|
640
|
-
* 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.
|
|
634
|
+
* Delete an actor
|
|
641
635
|
*
|
|
636
|
+
* Deletes an actor by its ID
|
|
642
637
|
*/
|
|
643
638
|
static deleteActor(options) {
|
|
644
639
|
return (options.client ?? client).delete({
|
|
@@ -647,10 +642,9 @@ var Actors = class {
|
|
|
647
642
|
});
|
|
648
643
|
}
|
|
649
644
|
/**
|
|
650
|
-
* Get an actor
|
|
651
|
-
*
|
|
652
|
-
* Returns one actor. An actor belonging to another project responds `404`, not `403` — the API never confirms that an id exists elsewhere.
|
|
645
|
+
* Get an actor by ID
|
|
653
646
|
*
|
|
647
|
+
* Returns an actor by its ID
|
|
654
648
|
*/
|
|
655
649
|
static getActor(options) {
|
|
656
650
|
return (options.client ?? client).get({
|
|
@@ -661,8 +655,7 @@ var Actors = class {
|
|
|
661
655
|
/**
|
|
662
656
|
* Update an actor
|
|
663
657
|
*
|
|
664
|
-
* Updates
|
|
665
|
-
*
|
|
658
|
+
* Updates an actor's properties
|
|
666
659
|
*/
|
|
667
660
|
static updateActor(options) {
|
|
668
661
|
return (options.client ?? client).patch({
|
|
@@ -674,6 +667,47 @@ var Actors = class {
|
|
|
674
667
|
}
|
|
675
668
|
});
|
|
676
669
|
}
|
|
670
|
+
/**
|
|
671
|
+
* Get actor tags
|
|
672
|
+
*
|
|
673
|
+
* Returns all tags attached to the actor
|
|
674
|
+
*/
|
|
675
|
+
static getActorTags(options) {
|
|
676
|
+
return (options.client ?? client).get({
|
|
677
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
678
|
+
...options
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Merge actor tags
|
|
683
|
+
*
|
|
684
|
+
* Merges provided tags with existing tags (existing tags are preserved unless overridden)
|
|
685
|
+
*/
|
|
686
|
+
static mergeActorTags(options) {
|
|
687
|
+
return (options.client ?? client).patch({
|
|
688
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
689
|
+
...options,
|
|
690
|
+
headers: {
|
|
691
|
+
"Content-Type": "application/json",
|
|
692
|
+
...options.headers
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Replace actor tags
|
|
698
|
+
*
|
|
699
|
+
* Replaces all tags on the actor with the provided tags (not merged)
|
|
700
|
+
*/
|
|
701
|
+
static replaceActorTags(options) {
|
|
702
|
+
return (options.client ?? client).put({
|
|
703
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
704
|
+
...options,
|
|
705
|
+
headers: {
|
|
706
|
+
"Content-Type": "application/json",
|
|
707
|
+
...options.headers
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
}
|
|
677
711
|
};
|
|
678
712
|
var Channels = class {
|
|
679
713
|
/**
|
|
@@ -817,22 +851,6 @@ var Channels = class {
|
|
|
817
851
|
});
|
|
818
852
|
}
|
|
819
853
|
/**
|
|
820
|
-
* Open a conversation
|
|
821
|
-
*
|
|
822
|
-
* 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.
|
|
823
|
-
*
|
|
824
|
-
*/
|
|
825
|
-
static createConversation(options) {
|
|
826
|
-
return (options.client ?? client).post({
|
|
827
|
-
url: "/v1/projects/{project_id}/conversations",
|
|
828
|
-
...options,
|
|
829
|
-
headers: {
|
|
830
|
-
"Content-Type": "application/json",
|
|
831
|
-
...options.headers
|
|
832
|
-
}
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
/**
|
|
836
854
|
* List channels
|
|
837
855
|
*
|
|
838
856
|
* Lists the channels connected in the project.
|
|
@@ -920,6 +938,22 @@ var Channels = class {
|
|
|
920
938
|
});
|
|
921
939
|
}
|
|
922
940
|
/**
|
|
941
|
+
* Open a conversation
|
|
942
|
+
*
|
|
943
|
+
* 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.
|
|
944
|
+
*
|
|
945
|
+
*/
|
|
946
|
+
static openChannelConversation(options) {
|
|
947
|
+
return (options.client ?? client).post({
|
|
948
|
+
url: "/v1/projects/{project_id}/channels/{channel_id}/conversations",
|
|
949
|
+
...options,
|
|
950
|
+
headers: {
|
|
951
|
+
"Content-Type": "application/json",
|
|
952
|
+
...options.headers
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
923
957
|
* Get a conversation
|
|
924
958
|
*/
|
|
925
959
|
static getChannelConversation(options) {
|
|
@@ -945,7 +979,7 @@ var Agents = class {
|
|
|
945
979
|
/**
|
|
946
980
|
* List agents
|
|
947
981
|
*
|
|
948
|
-
*
|
|
982
|
+
* Returns all agents in the project.
|
|
949
983
|
*/
|
|
950
984
|
static listAgents(options) {
|
|
951
985
|
return (options.client ?? client).get({
|
|
@@ -956,8 +990,7 @@ var Agents = class {
|
|
|
956
990
|
/**
|
|
957
991
|
* Create an agent
|
|
958
992
|
*
|
|
959
|
-
*
|
|
960
|
-
*
|
|
993
|
+
* Creates a new agent bound to an AI provider.
|
|
961
994
|
*/
|
|
962
995
|
static createAgent(options) {
|
|
963
996
|
return (options.client ?? client).post({
|
|
@@ -972,7 +1005,7 @@ var Agents = class {
|
|
|
972
1005
|
/**
|
|
973
1006
|
* Delete an agent
|
|
974
1007
|
*
|
|
975
|
-
* Deletes
|
|
1008
|
+
* 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.
|
|
976
1009
|
*
|
|
977
1010
|
*/
|
|
978
1011
|
static deleteAgent(options) {
|
|
@@ -983,6 +1016,8 @@ var Agents = class {
|
|
|
983
1016
|
}
|
|
984
1017
|
/**
|
|
985
1018
|
* Get an agent
|
|
1019
|
+
*
|
|
1020
|
+
* Returns a single agent by ID.
|
|
986
1021
|
*/
|
|
987
1022
|
static getAgent(options) {
|
|
988
1023
|
return (options.client ?? client).get({
|
|
@@ -991,13 +1026,27 @@ var Agents = class {
|
|
|
991
1026
|
});
|
|
992
1027
|
}
|
|
993
1028
|
/**
|
|
994
|
-
*
|
|
1029
|
+
* Partially update an agent
|
|
995
1030
|
*
|
|
996
|
-
*
|
|
1031
|
+
* Partially updates an existing agent. Identical to PUT — both perform partial updates.
|
|
1032
|
+
*/
|
|
1033
|
+
static patchAgent(options) {
|
|
1034
|
+
return (options.client ?? client).patch({
|
|
1035
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
1036
|
+
...options,
|
|
1037
|
+
headers: {
|
|
1038
|
+
"Content-Type": "application/json",
|
|
1039
|
+
...options.headers
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Update an agent
|
|
997
1045
|
*
|
|
1046
|
+
* Updates an existing agent. Identical to PATCH — both perform partial updates.
|
|
998
1047
|
*/
|
|
999
1048
|
static updateAgent(options) {
|
|
1000
|
-
return (options.client ?? client).
|
|
1049
|
+
return (options.client ?? client).put({
|
|
1001
1050
|
url: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
1002
1051
|
...options,
|
|
1003
1052
|
headers: {
|
|
@@ -1006,6 +1055,240 @@ var Agents = class {
|
|
|
1006
1055
|
}
|
|
1007
1056
|
});
|
|
1008
1057
|
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Run an agent generation
|
|
1060
|
+
*
|
|
1061
|
+
* 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.
|
|
1062
|
+
*
|
|
1063
|
+
*/
|
|
1064
|
+
static createAgentGeneration(options) {
|
|
1065
|
+
return (options.client ?? client).post({
|
|
1066
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/generate",
|
|
1067
|
+
...options,
|
|
1068
|
+
headers: {
|
|
1069
|
+
"Content-Type": "application/json",
|
|
1070
|
+
...options.headers
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Submit tool outputs for a paused generation
|
|
1076
|
+
*
|
|
1077
|
+
* Resumes a generation that was paused due to client tool calls. Provide tool outputs for each pending tool call.
|
|
1078
|
+
*
|
|
1079
|
+
*/
|
|
1080
|
+
static submitAgentToolOutputs(options) {
|
|
1081
|
+
return (options.client ?? client).post({
|
|
1082
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/generate/{generation_id}/tool-outputs",
|
|
1083
|
+
...options,
|
|
1084
|
+
headers: {
|
|
1085
|
+
"Content-Type": "application/json",
|
|
1086
|
+
...options.headers
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
var AgentVersions = class {
|
|
1092
|
+
/**
|
|
1093
|
+
* List an agent's config versions
|
|
1094
|
+
*
|
|
1095
|
+
* 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).
|
|
1096
|
+
*
|
|
1097
|
+
*/
|
|
1098
|
+
static listAgentVersions(options) {
|
|
1099
|
+
return (options.client ?? client).get({
|
|
1100
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions",
|
|
1101
|
+
...options
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Get an archived agent config version
|
|
1106
|
+
*
|
|
1107
|
+
* Returns the exact configuration the agent held at a given version, so a generation can be traced back to the config that produced it.
|
|
1108
|
+
*
|
|
1109
|
+
*/
|
|
1110
|
+
static getAgentVersion(options) {
|
|
1111
|
+
return (options.client ?? client).get({
|
|
1112
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions/{version}",
|
|
1113
|
+
...options
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Restore an archived config as a new version
|
|
1118
|
+
*
|
|
1119
|
+
* 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.
|
|
1120
|
+
*
|
|
1121
|
+
* 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.
|
|
1122
|
+
*
|
|
1123
|
+
*/
|
|
1124
|
+
static restoreAgentVersion(options) {
|
|
1125
|
+
return (options.client ?? client).post({
|
|
1126
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions/{version}/restore",
|
|
1127
|
+
...options,
|
|
1128
|
+
headers: {
|
|
1129
|
+
"Content-Type": "application/json",
|
|
1130
|
+
...options.headers
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Set or replace a staged rollout
|
|
1136
|
+
*
|
|
1137
|
+
* Starts serving two archived versions side by side: `canary_percent` of traffic gets `canary_version`, the rest gets `stable_version`.
|
|
1138
|
+
*
|
|
1139
|
+
* 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.
|
|
1140
|
+
*
|
|
1141
|
+
* 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`.
|
|
1142
|
+
*
|
|
1143
|
+
*/
|
|
1144
|
+
static setAgentRelease(options) {
|
|
1145
|
+
return (options.client ?? client).put({
|
|
1146
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release",
|
|
1147
|
+
...options,
|
|
1148
|
+
headers: {
|
|
1149
|
+
"Content-Type": "application/json",
|
|
1150
|
+
...options.headers
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Promote the canary and end the rollout
|
|
1156
|
+
*
|
|
1157
|
+
* 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.
|
|
1158
|
+
*
|
|
1159
|
+
* 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.
|
|
1160
|
+
*
|
|
1161
|
+
*/
|
|
1162
|
+
static promoteAgentRelease(options) {
|
|
1163
|
+
return (options.client ?? client).post({
|
|
1164
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release/promote",
|
|
1165
|
+
...options
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Abort the rollout and roll back to stable
|
|
1170
|
+
*
|
|
1171
|
+
* 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.
|
|
1172
|
+
*
|
|
1173
|
+
*/
|
|
1174
|
+
static abortAgentRelease(options) {
|
|
1175
|
+
return (options.client ?? client).post({
|
|
1176
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release/abort",
|
|
1177
|
+
...options
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
var AiProviders = class {
|
|
1182
|
+
/**
|
|
1183
|
+
* List AI providers
|
|
1184
|
+
*
|
|
1185
|
+
* Returns a list of AI provider configurations for a project
|
|
1186
|
+
*/
|
|
1187
|
+
static listAiProviders(options) {
|
|
1188
|
+
return (options.client ?? client).get({
|
|
1189
|
+
url: "/v1/projects/{project_id}/ai-providers",
|
|
1190
|
+
...options
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Create an AI provider
|
|
1195
|
+
*
|
|
1196
|
+
* Creates a new LLM provider configuration
|
|
1197
|
+
*/
|
|
1198
|
+
static createAiProvider(options) {
|
|
1199
|
+
return (options.client ?? client).post({
|
|
1200
|
+
url: "/v1/projects/{project_id}/ai-providers",
|
|
1201
|
+
...options,
|
|
1202
|
+
headers: {
|
|
1203
|
+
"Content-Type": "application/json",
|
|
1204
|
+
...options.headers
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Delete an AI provider
|
|
1210
|
+
*
|
|
1211
|
+
* Deletes an AI provider configuration.
|
|
1212
|
+
*
|
|
1213
|
+
* 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.
|
|
1214
|
+
*
|
|
1215
|
+
*/
|
|
1216
|
+
static deleteAiProvider(options) {
|
|
1217
|
+
return (options.client ?? client).delete({
|
|
1218
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1219
|
+
...options
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Get an AI provider
|
|
1224
|
+
*
|
|
1225
|
+
* Returns a specific AI provider configuration
|
|
1226
|
+
*/
|
|
1227
|
+
static getAiProvider(options) {
|
|
1228
|
+
return (options.client ?? client).get({
|
|
1229
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1230
|
+
...options
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Update an AI provider
|
|
1235
|
+
*
|
|
1236
|
+
* Updates an AI provider configuration
|
|
1237
|
+
*/
|
|
1238
|
+
static updateAiProvider(options) {
|
|
1239
|
+
return (options.client ?? client).patch({
|
|
1240
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1241
|
+
...options,
|
|
1242
|
+
headers: {
|
|
1243
|
+
"Content-Type": "application/json",
|
|
1244
|
+
...options.headers
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* List the models this provider can run
|
|
1250
|
+
*
|
|
1251
|
+
* 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.
|
|
1252
|
+
* 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.
|
|
1253
|
+
* 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`.
|
|
1254
|
+
* 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.
|
|
1255
|
+
* 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`.
|
|
1256
|
+
*
|
|
1257
|
+
*/
|
|
1258
|
+
static listAiProviderModels(options) {
|
|
1259
|
+
return (options.client ?? client).get({
|
|
1260
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/models",
|
|
1261
|
+
...options
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* List per-provider price overrides
|
|
1266
|
+
*
|
|
1267
|
+
* 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.
|
|
1268
|
+
*
|
|
1269
|
+
*/
|
|
1270
|
+
static getAiProviderPrices(options) {
|
|
1271
|
+
return (options.client ?? client).get({
|
|
1272
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/prices",
|
|
1273
|
+
...options
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Upsert per-provider price overrides
|
|
1278
|
+
*
|
|
1279
|
+
* 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.
|
|
1280
|
+
*
|
|
1281
|
+
*/
|
|
1282
|
+
static updateAiProviderPrices(options) {
|
|
1283
|
+
return (options.client ?? client).put({
|
|
1284
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/prices",
|
|
1285
|
+
...options,
|
|
1286
|
+
headers: {
|
|
1287
|
+
"Content-Type": "application/json",
|
|
1288
|
+
...options.headers
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1009
1292
|
};
|
|
1010
1293
|
var ApiKeys = class {
|
|
1011
1294
|
/**
|
|
@@ -1024,6 +1307,7 @@ var ApiKeys = class {
|
|
|
1024
1307
|
* Create an API key
|
|
1025
1308
|
*
|
|
1026
1309
|
* 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.
|
|
1310
|
+
* 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.
|
|
1027
1311
|
*
|
|
1028
1312
|
*/
|
|
1029
1313
|
static createApiKey(options) {
|
|
@@ -1207,39 +1491,27 @@ var Auth = class {
|
|
|
1207
1491
|
}
|
|
1208
1492
|
});
|
|
1209
1493
|
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Get the current identity
|
|
1212
|
-
*
|
|
1213
|
-
* Returns the user behind the presented access token.
|
|
1214
|
-
*/
|
|
1215
|
-
static getCurrentUser(options) {
|
|
1216
|
-
return (options?.client ?? client).get({
|
|
1217
|
-
url: "/v1/auth/me",
|
|
1218
|
-
...options
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
1494
|
};
|
|
1222
|
-
var
|
|
1495
|
+
var Conversations = class {
|
|
1223
1496
|
/**
|
|
1224
|
-
* List
|
|
1497
|
+
* List conversations
|
|
1225
1498
|
*
|
|
1226
|
-
*
|
|
1499
|
+
* 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.
|
|
1227
1500
|
*/
|
|
1228
|
-
static
|
|
1501
|
+
static listConversations(options) {
|
|
1229
1502
|
return (options.client ?? client).get({
|
|
1230
|
-
url: "/v1/projects/{project_id}/
|
|
1503
|
+
url: "/v1/projects/{project_id}/conversations",
|
|
1231
1504
|
...options
|
|
1232
1505
|
});
|
|
1233
1506
|
}
|
|
1234
1507
|
/**
|
|
1235
|
-
* Create a
|
|
1236
|
-
*
|
|
1237
|
-
* 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`.
|
|
1508
|
+
* Create a conversation
|
|
1238
1509
|
*
|
|
1510
|
+
* Creates a new conversation. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
|
|
1239
1511
|
*/
|
|
1240
|
-
static
|
|
1512
|
+
static createConversation(options) {
|
|
1241
1513
|
return (options.client ?? client).post({
|
|
1242
|
-
url: "/v1/projects/{project_id}/
|
|
1514
|
+
url: "/v1/projects/{project_id}/conversations",
|
|
1243
1515
|
...options,
|
|
1244
1516
|
headers: {
|
|
1245
1517
|
"Content-Type": "application/json",
|
|
@@ -1248,39 +1520,35 @@ var Boards = class {
|
|
|
1248
1520
|
});
|
|
1249
1521
|
}
|
|
1250
1522
|
/**
|
|
1251
|
-
* Delete a
|
|
1252
|
-
*
|
|
1253
|
-
* 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.
|
|
1523
|
+
* Delete a conversation
|
|
1254
1524
|
*
|
|
1525
|
+
* Deletes a conversation by its ID
|
|
1255
1526
|
*/
|
|
1256
|
-
static
|
|
1527
|
+
static deleteConversation(options) {
|
|
1257
1528
|
return (options.client ?? client).delete({
|
|
1258
|
-
url: "/v1/projects/{project_id}/
|
|
1529
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1259
1530
|
...options
|
|
1260
1531
|
});
|
|
1261
1532
|
}
|
|
1262
1533
|
/**
|
|
1263
|
-
* Get a
|
|
1264
|
-
*
|
|
1265
|
-
* 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.
|
|
1534
|
+
* Get a conversation by ID
|
|
1266
1535
|
*
|
|
1536
|
+
* Returns a conversation by its ID
|
|
1267
1537
|
*/
|
|
1268
|
-
static
|
|
1538
|
+
static getConversation(options) {
|
|
1269
1539
|
return (options.client ?? client).get({
|
|
1270
|
-
url: "/v1/projects/{project_id}/
|
|
1540
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1271
1541
|
...options
|
|
1272
1542
|
});
|
|
1273
1543
|
}
|
|
1274
1544
|
/**
|
|
1275
|
-
* Update a
|
|
1276
|
-
*
|
|
1277
|
-
* 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.
|
|
1278
|
-
* 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.
|
|
1545
|
+
* Update a conversation
|
|
1279
1546
|
*
|
|
1547
|
+
* Updates the status of a conversation
|
|
1280
1548
|
*/
|
|
1281
|
-
static
|
|
1549
|
+
static updateConversation(options) {
|
|
1282
1550
|
return (options.client ?? client).patch({
|
|
1283
|
-
url: "/v1/projects/{project_id}/
|
|
1551
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1284
1552
|
...options,
|
|
1285
1553
|
headers: {
|
|
1286
1554
|
"Content-Type": "application/json",
|
|
@@ -1288,35 +1556,25 @@ var Boards = class {
|
|
|
1288
1556
|
}
|
|
1289
1557
|
});
|
|
1290
1558
|
}
|
|
1291
|
-
};
|
|
1292
|
-
var Generations = class {
|
|
1293
1559
|
/**
|
|
1294
|
-
* List
|
|
1295
|
-
*
|
|
1296
|
-
* 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.
|
|
1560
|
+
* List conversation messages
|
|
1297
1561
|
*
|
|
1562
|
+
* Returns all messages (documents) attached to a conversation, ordered by position
|
|
1298
1563
|
*/
|
|
1299
|
-
static
|
|
1564
|
+
static listConversationMessages(options) {
|
|
1300
1565
|
return (options.client ?? client).get({
|
|
1301
|
-
url: "/v1/projects/{project_id}/
|
|
1566
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages",
|
|
1302
1567
|
...options
|
|
1303
1568
|
});
|
|
1304
1569
|
}
|
|
1305
1570
|
/**
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1308
|
-
* Sends messages to the agent, resolves its tools, and runs the model loop.
|
|
1309
|
-
*
|
|
1310
|
-
* 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`.
|
|
1311
|
-
*
|
|
1312
|
-
* 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`.
|
|
1313
|
-
*
|
|
1314
|
-
* 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`.
|
|
1571
|
+
* Add a message to a conversation
|
|
1315
1572
|
*
|
|
1573
|
+
* 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.
|
|
1316
1574
|
*/
|
|
1317
|
-
static
|
|
1575
|
+
static addConversationMessage(options) {
|
|
1318
1576
|
return (options.client ?? client).post({
|
|
1319
|
-
url: "/v1/projects/{project_id}/
|
|
1577
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages",
|
|
1320
1578
|
...options,
|
|
1321
1579
|
headers: {
|
|
1322
1580
|
"Content-Type": "application/json",
|
|
@@ -1325,71 +1583,22 @@ var Generations = class {
|
|
|
1325
1583
|
});
|
|
1326
1584
|
}
|
|
1327
1585
|
/**
|
|
1328
|
-
*
|
|
1586
|
+
* Generate the next message in a conversation
|
|
1329
1587
|
*
|
|
1330
|
-
*
|
|
1331
|
-
*
|
|
1588
|
+
* Generates the next message using the specified actor's linked agent or chat.
|
|
1589
|
+
* Background by default: returns `202 Accepted` immediately and the reply
|
|
1590
|
+
* lands as a new ConversationMessage when it completes — poll
|
|
1591
|
+
* `GET /v1/projects/{project_id}/conversations/{conversation_id}/messages` for it.
|
|
1592
|
+
* Pass `?wait=true` to block and receive the result inline. On
|
|
1593
|
+
* `completed`, the reply is persisted as a new ConversationMessage
|
|
1594
|
+
* authored by that actor. On `requires_action`, nothing is persisted; the
|
|
1595
|
+
* caller must submit tool outputs via the Agents module and re-invoke
|
|
1596
|
+
* generate — so a flow using client tools should pass `?wait=true`.
|
|
1332
1597
|
*
|
|
1333
1598
|
*/
|
|
1334
|
-
static
|
|
1335
|
-
return (options.client ?? client).get({
|
|
1336
|
-
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1337
|
-
...options
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
/**
|
|
1341
|
-
* Purge a generation's content
|
|
1342
|
-
*
|
|
1343
|
-
* 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.
|
|
1344
|
-
* 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.
|
|
1345
|
-
* 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.
|
|
1346
|
-
* Idempotent: purging an already-purged generation succeeds and leaves the original `content_redacted_at` in place.
|
|
1347
|
-
* A generation belonging to another project responds `404`, not `403`, and nothing is purged.
|
|
1348
|
-
*
|
|
1349
|
-
*/
|
|
1350
|
-
static purgeGenerationContent(options) {
|
|
1351
|
-
return (options.client ?? client).delete({
|
|
1352
|
-
url: "/v1/projects/{project_id}/generations/{generation_id}/content",
|
|
1353
|
-
...options
|
|
1354
|
-
});
|
|
1355
|
-
}
|
|
1356
|
-
/**
|
|
1357
|
-
* Get a generation's cost
|
|
1358
|
-
*
|
|
1359
|
-
* 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.
|
|
1360
|
-
* 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.
|
|
1361
|
-
* `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).
|
|
1362
|
-
* A generation belonging to another project responds `404`, not `403`.
|
|
1363
|
-
*
|
|
1364
|
-
*/
|
|
1365
|
-
static getGenerationUsage(options) {
|
|
1366
|
-
return (options.client ?? client).get({
|
|
1367
|
-
url: "/v1/projects/{project_id}/generations/{generation_id}/usage",
|
|
1368
|
-
...options
|
|
1369
|
-
});
|
|
1370
|
-
}
|
|
1371
|
-
};
|
|
1372
|
-
var Knowledge = class {
|
|
1373
|
-
/**
|
|
1374
|
-
* List collections
|
|
1375
|
-
*
|
|
1376
|
-
* Lists the knowledge collections in the project.
|
|
1377
|
-
*/
|
|
1378
|
-
static listKnowledgeCollections(options) {
|
|
1379
|
-
return (options.client ?? client).get({
|
|
1380
|
-
url: "/v1/projects/{project_id}/knowledge/collections",
|
|
1381
|
-
...options
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1384
|
-
/**
|
|
1385
|
-
* Create a collection
|
|
1386
|
-
*
|
|
1387
|
-
* Create a knowledge collection. The name is the key manifests reference (an agent's `knowledge:` block) and must be unique within the project.
|
|
1388
|
-
*
|
|
1389
|
-
*/
|
|
1390
|
-
static createKnowledgeCollection(options) {
|
|
1599
|
+
static generateConversationMessage(options) {
|
|
1391
1600
|
return (options.client ?? client).post({
|
|
1392
|
-
url: "/v1/projects/{project_id}/
|
|
1601
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/generate",
|
|
1393
1602
|
...options,
|
|
1394
1603
|
headers: {
|
|
1395
1604
|
"Content-Type": "application/json",
|
|
@@ -1398,34 +1607,35 @@ var Knowledge = class {
|
|
|
1398
1607
|
});
|
|
1399
1608
|
}
|
|
1400
1609
|
/**
|
|
1401
|
-
*
|
|
1402
|
-
*
|
|
1403
|
-
* Deletes an empty collection. Returns 409 if the collection still has documents (delete them first).
|
|
1610
|
+
* Remove a message from a conversation
|
|
1404
1611
|
*
|
|
1612
|
+
* Removes a document from a conversation
|
|
1405
1613
|
*/
|
|
1406
|
-
static
|
|
1614
|
+
static removeConversationMessage(options) {
|
|
1407
1615
|
return (options.client ?? client).delete({
|
|
1408
|
-
url: "/v1/projects/{project_id}/
|
|
1616
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages/{document_id}",
|
|
1409
1617
|
...options
|
|
1410
1618
|
});
|
|
1411
1619
|
}
|
|
1412
1620
|
/**
|
|
1413
|
-
* Get
|
|
1621
|
+
* Get conversation tags
|
|
1622
|
+
*
|
|
1623
|
+
* Returns all tags attached to the conversation
|
|
1414
1624
|
*/
|
|
1415
|
-
static
|
|
1625
|
+
static getConversationTags(options) {
|
|
1416
1626
|
return (options.client ?? client).get({
|
|
1417
|
-
url: "/v1/projects/{project_id}/
|
|
1627
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1418
1628
|
...options
|
|
1419
1629
|
});
|
|
1420
1630
|
}
|
|
1421
1631
|
/**
|
|
1422
|
-
*
|
|
1632
|
+
* Merge conversation tags
|
|
1423
1633
|
*
|
|
1424
|
-
*
|
|
1634
|
+
* Merges provided tags with existing tags
|
|
1425
1635
|
*/
|
|
1426
|
-
static
|
|
1636
|
+
static mergeConversationTags(options) {
|
|
1427
1637
|
return (options.client ?? client).patch({
|
|
1428
|
-
url: "/v1/projects/{project_id}/
|
|
1638
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1429
1639
|
...options,
|
|
1430
1640
|
headers: {
|
|
1431
1641
|
"Content-Type": "application/json",
|
|
@@ -1434,14 +1644,13 @@ var Knowledge = class {
|
|
|
1434
1644
|
});
|
|
1435
1645
|
}
|
|
1436
1646
|
/**
|
|
1437
|
-
*
|
|
1438
|
-
*
|
|
1439
|
-
* 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`.
|
|
1647
|
+
* Replace conversation tags
|
|
1440
1648
|
*
|
|
1649
|
+
* Replaces all tags on the conversation with the provided tags
|
|
1441
1650
|
*/
|
|
1442
|
-
static
|
|
1443
|
-
return (options.client ?? client).
|
|
1444
|
-
url: "/v1/projects/{project_id}/
|
|
1651
|
+
static replaceConversationTags(options) {
|
|
1652
|
+
return (options.client ?? client).put({
|
|
1653
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1445
1654
|
...options,
|
|
1446
1655
|
headers: {
|
|
1447
1656
|
"Content-Type": "application/json",
|
|
@@ -1449,30 +1658,29 @@ var Knowledge = class {
|
|
|
1449
1658
|
}
|
|
1450
1659
|
});
|
|
1451
1660
|
}
|
|
1661
|
+
};
|
|
1662
|
+
var Evaluations = class {
|
|
1452
1663
|
/**
|
|
1453
|
-
* List
|
|
1664
|
+
* List datasets
|
|
1454
1665
|
*
|
|
1455
|
-
*
|
|
1666
|
+
* Returns the datasets defined in a project
|
|
1456
1667
|
*/
|
|
1457
|
-
static
|
|
1668
|
+
static listDatasets(options) {
|
|
1458
1669
|
return (options.client ?? client).get({
|
|
1459
|
-
url: "/v1/projects/{project_id}/
|
|
1670
|
+
url: "/v1/projects/{project_id}/datasets",
|
|
1460
1671
|
...options
|
|
1461
1672
|
});
|
|
1462
1673
|
}
|
|
1463
1674
|
/**
|
|
1464
|
-
* Create a
|
|
1465
|
-
*
|
|
1466
|
-
* 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.
|
|
1467
|
-
*
|
|
1468
|
-
* `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.
|
|
1675
|
+
* Create a dataset
|
|
1469
1676
|
*
|
|
1470
|
-
*
|
|
1677
|
+
* Creates a project-scoped dataset — a named collection of test cases an eval runs an agent against. Names are unique per project.
|
|
1471
1678
|
*
|
|
1679
|
+
* 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.
|
|
1472
1680
|
*/
|
|
1473
|
-
static
|
|
1681
|
+
static createDataset(options) {
|
|
1474
1682
|
return (options.client ?? client).post({
|
|
1475
|
-
url: "/v1/projects/{project_id}/
|
|
1683
|
+
url: "/v1/projects/{project_id}/datasets",
|
|
1476
1684
|
...options,
|
|
1477
1685
|
headers: {
|
|
1478
1686
|
"Content-Type": "application/json",
|
|
@@ -1481,73 +1689,61 @@ var Knowledge = class {
|
|
|
1481
1689
|
});
|
|
1482
1690
|
}
|
|
1483
1691
|
/**
|
|
1484
|
-
* Delete a
|
|
1692
|
+
* Delete a dataset
|
|
1693
|
+
*
|
|
1694
|
+
* 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.
|
|
1485
1695
|
*/
|
|
1486
|
-
static
|
|
1696
|
+
static deleteDataset(options) {
|
|
1487
1697
|
return (options.client ?? client).delete({
|
|
1488
|
-
url: "/v1/projects/{project_id}/
|
|
1698
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}",
|
|
1489
1699
|
...options
|
|
1490
1700
|
});
|
|
1491
1701
|
}
|
|
1492
1702
|
/**
|
|
1493
|
-
* Get a
|
|
1703
|
+
* Get a dataset
|
|
1494
1704
|
*
|
|
1495
|
-
* Returns
|
|
1705
|
+
* Returns a specific dataset
|
|
1496
1706
|
*/
|
|
1497
|
-
static
|
|
1707
|
+
static getDataset(options) {
|
|
1498
1708
|
return (options.client ?? client).get({
|
|
1499
|
-
url: "/v1/projects/{project_id}/
|
|
1709
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}",
|
|
1500
1710
|
...options
|
|
1501
1711
|
});
|
|
1502
1712
|
}
|
|
1503
1713
|
/**
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
* 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`.
|
|
1714
|
+
* Update a dataset
|
|
1507
1715
|
*
|
|
1716
|
+
* Updates a dataset's name and/or description
|
|
1508
1717
|
*/
|
|
1509
|
-
static
|
|
1510
|
-
return (options.client ?? client).
|
|
1511
|
-
url: "/v1/projects/{project_id}/
|
|
1512
|
-
...options
|
|
1718
|
+
static updateDataset(options) {
|
|
1719
|
+
return (options.client ?? client).put({
|
|
1720
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}",
|
|
1721
|
+
...options,
|
|
1722
|
+
headers: {
|
|
1723
|
+
"Content-Type": "application/json",
|
|
1724
|
+
...options.headers
|
|
1725
|
+
}
|
|
1513
1726
|
});
|
|
1514
1727
|
}
|
|
1515
1728
|
/**
|
|
1516
|
-
* List
|
|
1729
|
+
* List dataset items
|
|
1517
1730
|
*
|
|
1518
|
-
*
|
|
1731
|
+
* Returns the test cases in a dataset, oldest first
|
|
1519
1732
|
*/
|
|
1520
|
-
static
|
|
1733
|
+
static listDatasetItems(options) {
|
|
1521
1734
|
return (options.client ?? client).get({
|
|
1522
|
-
url: "/v1/projects/{project_id}/
|
|
1735
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items",
|
|
1523
1736
|
...options
|
|
1524
1737
|
});
|
|
1525
1738
|
}
|
|
1526
1739
|
/**
|
|
1527
|
-
*
|
|
1528
|
-
*
|
|
1529
|
-
* 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:
|
|
1530
|
-
*
|
|
1531
|
-
* - an **agent** (`agent_id`) — the file is handed to a
|
|
1532
|
-
* multimodal model with a fixed "extract all the text" instruction and
|
|
1533
|
-
* its answer becomes the document text. The shortest path for images
|
|
1534
|
-
* and scanned PDFs; nothing to map.
|
|
1535
|
-
*
|
|
1536
|
-
* - a **tool** (`tool_id`) — the file is passed to an
|
|
1537
|
-
* `http` tool as `{ content_type, filename, data_base64 }`, and
|
|
1538
|
-
* whatever string the tool returns becomes the document text. The path
|
|
1539
|
-
* for dedicated non-chat APIs (speech-to-text, a specialist OCR
|
|
1540
|
-
* engine); use the tool's `execute.body_mode: multipart` for
|
|
1541
|
-
* form-data endpoints and its `output_mapping` to reduce a JSON
|
|
1542
|
-
* response to the bare string.
|
|
1543
|
-
*
|
|
1544
|
-
*
|
|
1545
|
-
* Exactly one of `agent_id` / `tool_id`, and one converter per `content_type` in a project.
|
|
1740
|
+
* Add a dataset item
|
|
1546
1741
|
*
|
|
1742
|
+
* Adds one test case. `input` is replayed verbatim as the generation's messages, so it must be a non-empty array of `{ role, content }`.
|
|
1547
1743
|
*/
|
|
1548
|
-
static
|
|
1744
|
+
static createDatasetItem(options) {
|
|
1549
1745
|
return (options.client ?? client).post({
|
|
1550
|
-
url: "/v1/projects/{project_id}/
|
|
1746
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items",
|
|
1551
1747
|
...options,
|
|
1552
1748
|
headers: {
|
|
1553
1749
|
"Content-Type": "application/json",
|
|
@@ -1556,35 +1752,45 @@ var Knowledge = class {
|
|
|
1556
1752
|
});
|
|
1557
1753
|
}
|
|
1558
1754
|
/**
|
|
1559
|
-
*
|
|
1755
|
+
* Curate a dataset item from a generation
|
|
1756
|
+
*
|
|
1757
|
+
* 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.
|
|
1758
|
+
*
|
|
1759
|
+
* 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.
|
|
1560
1760
|
*
|
|
1561
|
-
*
|
|
1761
|
+
* 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.
|
|
1562
1762
|
*
|
|
1763
|
+
* 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.
|
|
1563
1764
|
*/
|
|
1564
|
-
static
|
|
1565
|
-
return (options.client ?? client).
|
|
1566
|
-
url: "/v1/projects/{project_id}/
|
|
1567
|
-
...options
|
|
1765
|
+
static createDatasetItemFromGeneration(options) {
|
|
1766
|
+
return (options.client ?? client).post({
|
|
1767
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/from-generation",
|
|
1768
|
+
...options,
|
|
1769
|
+
headers: {
|
|
1770
|
+
"Content-Type": "application/json",
|
|
1771
|
+
...options.headers
|
|
1772
|
+
}
|
|
1568
1773
|
});
|
|
1569
1774
|
}
|
|
1570
1775
|
/**
|
|
1571
|
-
*
|
|
1776
|
+
* Delete a dataset item
|
|
1777
|
+
*
|
|
1778
|
+
* Deletes a test case. Results of runs that already scored it stay readable; their `dataset_item_id` becomes null.
|
|
1572
1779
|
*/
|
|
1573
|
-
static
|
|
1574
|
-
return (options.client ?? client).
|
|
1575
|
-
url: "/v1/projects/{project_id}/
|
|
1780
|
+
static deleteDatasetItem(options) {
|
|
1781
|
+
return (options.client ?? client).delete({
|
|
1782
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/{item_id}",
|
|
1576
1783
|
...options
|
|
1577
1784
|
});
|
|
1578
1785
|
}
|
|
1579
1786
|
/**
|
|
1580
|
-
* Update a
|
|
1581
|
-
*
|
|
1582
|
-
* 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.
|
|
1787
|
+
* Update a dataset item
|
|
1583
1788
|
*
|
|
1789
|
+
* Updates a test case. Runs that already scored it are unaffected — each result carries its own frozen copy of the input and expected output.
|
|
1584
1790
|
*/
|
|
1585
|
-
static
|
|
1586
|
-
return (options.client ?? client).
|
|
1587
|
-
url: "/v1/projects/{project_id}/
|
|
1791
|
+
static updateDatasetItem(options) {
|
|
1792
|
+
return (options.client ?? client).put({
|
|
1793
|
+
url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/{item_id}",
|
|
1588
1794
|
...options,
|
|
1589
1795
|
headers: {
|
|
1590
1796
|
"Content-Type": "application/json",
|
|
@@ -1592,27 +1798,27 @@ var Knowledge = class {
|
|
|
1592
1798
|
}
|
|
1593
1799
|
});
|
|
1594
1800
|
}
|
|
1595
|
-
};
|
|
1596
|
-
var ModelRoutes = class {
|
|
1597
1801
|
/**
|
|
1598
|
-
* List
|
|
1802
|
+
* List evals
|
|
1599
1803
|
*
|
|
1600
|
-
* Returns the
|
|
1804
|
+
* Returns the evals defined in a project
|
|
1601
1805
|
*/
|
|
1602
|
-
static
|
|
1806
|
+
static listEvals(options) {
|
|
1603
1807
|
return (options.client ?? client).get({
|
|
1604
|
-
url: "/v1/projects/{project_id}/
|
|
1808
|
+
url: "/v1/projects/{project_id}/evals",
|
|
1605
1809
|
...options
|
|
1606
1810
|
});
|
|
1607
1811
|
}
|
|
1608
1812
|
/**
|
|
1609
|
-
* Create
|
|
1813
|
+
* Create an eval
|
|
1610
1814
|
*
|
|
1611
|
-
*
|
|
1815
|
+
* 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.
|
|
1816
|
+
*
|
|
1817
|
+
* 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.
|
|
1612
1818
|
*/
|
|
1613
|
-
static
|
|
1819
|
+
static createEval(options) {
|
|
1614
1820
|
return (options.client ?? client).post({
|
|
1615
|
-
url: "/v1/projects/{project_id}/
|
|
1821
|
+
url: "/v1/projects/{project_id}/evals",
|
|
1616
1822
|
...options,
|
|
1617
1823
|
headers: {
|
|
1618
1824
|
"Content-Type": "application/json",
|
|
@@ -1621,35 +1827,69 @@ var ModelRoutes = class {
|
|
|
1621
1827
|
});
|
|
1622
1828
|
}
|
|
1623
1829
|
/**
|
|
1624
|
-
* Delete
|
|
1830
|
+
* Delete an eval
|
|
1625
1831
|
*
|
|
1626
|
-
* Deletes
|
|
1832
|
+
* Deletes an eval, its runs, and their results
|
|
1627
1833
|
*/
|
|
1628
|
-
static
|
|
1834
|
+
static deleteEval(options) {
|
|
1629
1835
|
return (options.client ?? client).delete({
|
|
1630
|
-
url: "/v1/projects/{project_id}/
|
|
1836
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}",
|
|
1631
1837
|
...options
|
|
1632
1838
|
});
|
|
1633
1839
|
}
|
|
1634
1840
|
/**
|
|
1635
|
-
* Get
|
|
1841
|
+
* Get an eval
|
|
1842
|
+
*
|
|
1843
|
+
* Returns a specific eval
|
|
1844
|
+
*/
|
|
1845
|
+
static getEval(options) {
|
|
1846
|
+
return (options.client ?? client).get({
|
|
1847
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}",
|
|
1848
|
+
...options
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Update an eval
|
|
1853
|
+
*
|
|
1854
|
+
* 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.
|
|
1855
|
+
*/
|
|
1856
|
+
static updateEval(options) {
|
|
1857
|
+
return (options.client ?? client).put({
|
|
1858
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}",
|
|
1859
|
+
...options,
|
|
1860
|
+
headers: {
|
|
1861
|
+
"Content-Type": "application/json",
|
|
1862
|
+
...options.headers
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* List eval runs
|
|
1636
1868
|
*
|
|
1637
|
-
* Returns
|
|
1869
|
+
* Returns an eval's runs, newest first
|
|
1638
1870
|
*/
|
|
1639
|
-
static
|
|
1871
|
+
static listEvalRuns(options) {
|
|
1640
1872
|
return (options.client ?? client).get({
|
|
1641
|
-
url: "/v1/projects/{project_id}/
|
|
1873
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs",
|
|
1642
1874
|
...options
|
|
1643
1875
|
});
|
|
1644
1876
|
}
|
|
1645
1877
|
/**
|
|
1646
|
-
*
|
|
1878
|
+
* Start an eval run
|
|
1647
1879
|
*
|
|
1648
|
-
*
|
|
1880
|
+
* Runs the eval against its dataset, creating one real agent generation per item and scoring the outputs.
|
|
1881
|
+
*
|
|
1882
|
+
* `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.
|
|
1883
|
+
*
|
|
1884
|
+
* `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.
|
|
1885
|
+
*
|
|
1886
|
+
* 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.
|
|
1887
|
+
*
|
|
1888
|
+
* 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.
|
|
1649
1889
|
*/
|
|
1650
|
-
static
|
|
1651
|
-
return (options.client ?? client).
|
|
1652
|
-
url: "/v1/projects/{project_id}/
|
|
1890
|
+
static startEvalRun(options) {
|
|
1891
|
+
return (options.client ?? client).post({
|
|
1892
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs",
|
|
1653
1893
|
...options,
|
|
1654
1894
|
headers: {
|
|
1655
1895
|
"Content-Type": "application/json",
|
|
@@ -1657,66 +1897,78 @@ var ModelRoutes = class {
|
|
|
1657
1897
|
}
|
|
1658
1898
|
});
|
|
1659
1899
|
}
|
|
1660
|
-
};
|
|
1661
|
-
var Models = class {
|
|
1662
1900
|
/**
|
|
1663
|
-
*
|
|
1664
|
-
*
|
|
1665
|
-
* 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.
|
|
1901
|
+
* Get an eval run
|
|
1666
1902
|
*
|
|
1903
|
+
* Returns a run's status, counts, and aggregate scores
|
|
1667
1904
|
*/
|
|
1668
|
-
static
|
|
1669
|
-
return (options
|
|
1670
|
-
url: "/v1/
|
|
1905
|
+
static getEvalRun(options) {
|
|
1906
|
+
return (options.client ?? client).get({
|
|
1907
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}",
|
|
1671
1908
|
...options
|
|
1672
1909
|
});
|
|
1673
1910
|
}
|
|
1674
1911
|
/**
|
|
1675
|
-
*
|
|
1912
|
+
* List eval run results
|
|
1913
|
+
*
|
|
1914
|
+
* Returns the per-item results of a run, oldest first
|
|
1676
1915
|
*/
|
|
1677
|
-
static
|
|
1916
|
+
static listEvalResults(options) {
|
|
1678
1917
|
return (options.client ?? client).get({
|
|
1679
|
-
url: "/v1/
|
|
1918
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}/results",
|
|
1919
|
+
...options
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Cancel an eval run
|
|
1924
|
+
*
|
|
1925
|
+
* Cancels a queued or running run: its outstanding item tasks are dropped so it stops consuming provider budget, and the run settles as `canceled`.
|
|
1926
|
+
*
|
|
1927
|
+
* 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.
|
|
1928
|
+
*
|
|
1929
|
+
* A run that has already finished is rejected with 400.
|
|
1930
|
+
*/
|
|
1931
|
+
static cancelEvalRun(options) {
|
|
1932
|
+
return (options.client ?? client).post({
|
|
1933
|
+
url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}/cancel",
|
|
1680
1934
|
...options
|
|
1681
1935
|
});
|
|
1682
1936
|
}
|
|
1683
1937
|
};
|
|
1684
|
-
var
|
|
1938
|
+
var Generations = class {
|
|
1685
1939
|
/**
|
|
1686
|
-
* List
|
|
1940
|
+
* List generations
|
|
1941
|
+
*
|
|
1942
|
+
* 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).
|
|
1687
1943
|
*
|
|
1688
|
-
* Lists the project's orchestration definitions.
|
|
1689
1944
|
*/
|
|
1690
|
-
static
|
|
1945
|
+
static listGenerations(options) {
|
|
1691
1946
|
return (options.client ?? client).get({
|
|
1692
|
-
url: "/v1/projects/{project_id}/
|
|
1947
|
+
url: "/v1/projects/{project_id}/generations",
|
|
1693
1948
|
...options
|
|
1694
1949
|
});
|
|
1695
1950
|
}
|
|
1696
1951
|
/**
|
|
1697
|
-
*
|
|
1952
|
+
* Get a generation
|
|
1953
|
+
*
|
|
1954
|
+
* 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).
|
|
1698
1955
|
*
|
|
1699
|
-
* Creates a new orchestration (pipeline) definition in the project.
|
|
1700
1956
|
*/
|
|
1701
|
-
static
|
|
1702
|
-
return (options.client ?? client).
|
|
1703
|
-
url: "/v1/projects/{project_id}/
|
|
1704
|
-
...options
|
|
1705
|
-
headers: {
|
|
1706
|
-
"Content-Type": "application/json",
|
|
1707
|
-
...options.headers
|
|
1708
|
-
}
|
|
1957
|
+
static getGeneration(options) {
|
|
1958
|
+
return (options.client ?? client).get({
|
|
1959
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1960
|
+
...options
|
|
1709
1961
|
});
|
|
1710
1962
|
}
|
|
1711
1963
|
/**
|
|
1712
|
-
*
|
|
1964
|
+
* Update generation metadata
|
|
1713
1965
|
*
|
|
1714
|
-
*
|
|
1966
|
+
* 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.
|
|
1715
1967
|
*
|
|
1716
1968
|
*/
|
|
1717
|
-
static
|
|
1718
|
-
return (options.client ?? client).
|
|
1719
|
-
url: "/v1/projects/{project_id}/
|
|
1969
|
+
static updateGeneration(options) {
|
|
1970
|
+
return (options.client ?? client).patch({
|
|
1971
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1720
1972
|
...options,
|
|
1721
1973
|
headers: {
|
|
1722
1974
|
"Content-Type": "application/json",
|
|
@@ -1725,63 +1977,60 @@ var Orchestrations = class {
|
|
|
1725
1977
|
});
|
|
1726
1978
|
}
|
|
1727
1979
|
/**
|
|
1728
|
-
*
|
|
1980
|
+
* Purge generation content
|
|
1981
|
+
*
|
|
1982
|
+
* Clears the generation's content — `metadata`, `error`, `extraction`, and the internal recovery state of a paused run — and stamps `content_redacted_at`.
|
|
1983
|
+
*
|
|
1984
|
+
* 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.
|
|
1985
|
+
*
|
|
1986
|
+
* 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.
|
|
1987
|
+
*
|
|
1988
|
+
* Idempotent — purging an already-purged generation succeeds and leaves the original `content_redacted_at` in place.
|
|
1729
1989
|
*
|
|
1730
|
-
* Deletes the orchestration definition and all of its runs.
|
|
1731
1990
|
*/
|
|
1732
|
-
static
|
|
1991
|
+
static purgeGenerationContent(options) {
|
|
1733
1992
|
return (options.client ?? client).delete({
|
|
1734
|
-
url: "/v1/projects/{project_id}/
|
|
1993
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}/content",
|
|
1735
1994
|
...options
|
|
1736
1995
|
});
|
|
1737
1996
|
}
|
|
1738
1997
|
/**
|
|
1739
|
-
* Get
|
|
1998
|
+
* Get a generation's transcript
|
|
1740
1999
|
*
|
|
1741
|
-
* Returns one
|
|
2000
|
+
* 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.
|
|
2001
|
+
*
|
|
2002
|
+
* 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.
|
|
2003
|
+
*
|
|
2004
|
+
* 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.
|
|
1742
2005
|
*
|
|
1743
2006
|
*/
|
|
1744
|
-
static
|
|
2007
|
+
static getGenerationTranscript(options) {
|
|
1745
2008
|
return (options.client ?? client).get({
|
|
1746
|
-
url: "/v1/projects/{project_id}/
|
|
2009
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}/transcript",
|
|
1747
2010
|
...options
|
|
1748
2011
|
});
|
|
1749
2012
|
}
|
|
2013
|
+
};
|
|
2014
|
+
var ModelRoutes = class {
|
|
1750
2015
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
* Partially updates an orchestration's definition.
|
|
1754
|
-
*/
|
|
1755
|
-
static updateOrchestration(options) {
|
|
1756
|
-
return (options.client ?? client).patch({
|
|
1757
|
-
url: "/v1/projects/{project_id}/orchestrations/{orchestration_id}",
|
|
1758
|
-
...options,
|
|
1759
|
-
headers: {
|
|
1760
|
-
"Content-Type": "application/json",
|
|
1761
|
-
...options.headers
|
|
1762
|
-
}
|
|
1763
|
-
});
|
|
1764
|
-
}
|
|
1765
|
-
/**
|
|
1766
|
-
* List orchestration runs
|
|
1767
|
-
*
|
|
1768
|
-
* 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.
|
|
2016
|
+
* List model routes
|
|
1769
2017
|
*
|
|
2018
|
+
* Returns the model routes defined in a project
|
|
1770
2019
|
*/
|
|
1771
|
-
static
|
|
2020
|
+
static listModelRoutes(options) {
|
|
1772
2021
|
return (options.client ?? client).get({
|
|
1773
|
-
url: "/v1/projects/{project_id}/
|
|
2022
|
+
url: "/v1/projects/{project_id}/model-routes",
|
|
1774
2023
|
...options
|
|
1775
2024
|
});
|
|
1776
2025
|
}
|
|
1777
2026
|
/**
|
|
1778
|
-
*
|
|
2027
|
+
* Create a model route
|
|
1779
2028
|
*
|
|
1780
|
-
*
|
|
2029
|
+
* 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.
|
|
1781
2030
|
*/
|
|
1782
|
-
static
|
|
2031
|
+
static createModelRoute(options) {
|
|
1783
2032
|
return (options.client ?? client).post({
|
|
1784
|
-
url: "/v1/projects/{project_id}/
|
|
2033
|
+
url: "/v1/projects/{project_id}/model-routes",
|
|
1785
2034
|
...options,
|
|
1786
2035
|
headers: {
|
|
1787
2036
|
"Content-Type": "application/json",
|
|
@@ -1790,46 +2039,35 @@ var Orchestrations = class {
|
|
|
1790
2039
|
});
|
|
1791
2040
|
}
|
|
1792
2041
|
/**
|
|
1793
|
-
*
|
|
1794
|
-
*
|
|
1795
|
-
* Returns the status, state, and artifacts of one run.
|
|
1796
|
-
*/
|
|
1797
|
-
static getOrchestrationRun(options) {
|
|
1798
|
-
return (options.client ?? client).get({
|
|
1799
|
-
url: "/v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}",
|
|
1800
|
-
...options
|
|
1801
|
-
});
|
|
1802
|
-
}
|
|
1803
|
-
/**
|
|
1804
|
-
* Cancel an orchestration run
|
|
2042
|
+
* Delete a model route
|
|
1805
2043
|
*
|
|
1806
|
-
*
|
|
2044
|
+
* 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.
|
|
1807
2045
|
*/
|
|
1808
|
-
static
|
|
1809
|
-
return (options.client ?? client).
|
|
1810
|
-
url: "/v1/projects/{project_id}/
|
|
2046
|
+
static deleteModelRoute(options) {
|
|
2047
|
+
return (options.client ?? client).delete({
|
|
2048
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1811
2049
|
...options
|
|
1812
2050
|
});
|
|
1813
2051
|
}
|
|
1814
2052
|
/**
|
|
1815
|
-
*
|
|
2053
|
+
* Get a model route
|
|
1816
2054
|
*
|
|
1817
|
-
*
|
|
2055
|
+
* Returns a specific model route
|
|
1818
2056
|
*/
|
|
1819
|
-
static
|
|
1820
|
-
return (options.client ?? client).
|
|
1821
|
-
url: "/v1/projects/{project_id}/
|
|
2057
|
+
static getModelRoute(options) {
|
|
2058
|
+
return (options.client ?? client).get({
|
|
2059
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1822
2060
|
...options
|
|
1823
2061
|
});
|
|
1824
2062
|
}
|
|
1825
2063
|
/**
|
|
1826
|
-
*
|
|
2064
|
+
* Update a model route
|
|
1827
2065
|
*
|
|
1828
|
-
*
|
|
2066
|
+
* Updates a model route's name, targets, retry classes, or breaker configuration. Omitted fields are left unchanged.
|
|
1829
2067
|
*/
|
|
1830
|
-
static
|
|
1831
|
-
return (options.client ?? client).
|
|
1832
|
-
url: "/v1/projects/{project_id}/
|
|
2068
|
+
static updateModelRoute(options) {
|
|
2069
|
+
return (options.client ?? client).put({
|
|
2070
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1833
2071
|
...options,
|
|
1834
2072
|
headers: {
|
|
1835
2073
|
"Content-Type": "application/json",
|
|
@@ -1842,7 +2080,8 @@ var Projects = class {
|
|
|
1842
2080
|
/**
|
|
1843
2081
|
* List projects
|
|
1844
2082
|
*
|
|
1845
|
-
* Lists projects
|
|
2083
|
+
* Lists the projects the caller is a member of. A project-scoped API key lists only its own project.
|
|
2084
|
+
*
|
|
1846
2085
|
*/
|
|
1847
2086
|
static listProjects(options) {
|
|
1848
2087
|
return (options?.client ?? client).get({
|
|
@@ -1869,6 +2108,7 @@ var Projects = class {
|
|
|
1869
2108
|
* Delete a project
|
|
1870
2109
|
*
|
|
1871
2110
|
* 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.
|
|
2111
|
+
* Requires the `owner` role — an `admin` runs the project day to day, but destroying it is the billing owner's call.
|
|
1872
2112
|
*
|
|
1873
2113
|
*/
|
|
1874
2114
|
static deleteProject(options) {
|
|
@@ -1880,8 +2120,8 @@ var Projects = class {
|
|
|
1880
2120
|
/**
|
|
1881
2121
|
* Get a project
|
|
1882
2122
|
*
|
|
1883
|
-
* Returns one project. An id you
|
|
1884
|
-
* `403` is reserved for the
|
|
2123
|
+
* 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.
|
|
2124
|
+
* `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.
|
|
1885
2125
|
*
|
|
1886
2126
|
*/
|
|
1887
2127
|
static getProject(options) {
|
|
@@ -1894,6 +2134,7 @@ var Projects = class {
|
|
|
1894
2134
|
* Update a project
|
|
1895
2135
|
*
|
|
1896
2136
|
* 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.
|
|
2137
|
+
* Requires the `admin` role in the project (an `owner` has it too).
|
|
1897
2138
|
* 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.
|
|
1898
2139
|
*
|
|
1899
2140
|
*/
|
|
@@ -1908,6 +2149,19 @@ var Projects = class {
|
|
|
1908
2149
|
});
|
|
1909
2150
|
}
|
|
1910
2151
|
/**
|
|
2152
|
+
* List project members
|
|
2153
|
+
*
|
|
2154
|
+
* 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.
|
|
2155
|
+
* Read-only for now — adding and removing members arrives with the invitation flow, since an invitee may not have an account yet.
|
|
2156
|
+
*
|
|
2157
|
+
*/
|
|
2158
|
+
static listProjectMembers(options) {
|
|
2159
|
+
return (options.client ?? client).get({
|
|
2160
|
+
url: "/v1/projects/{project_id}/members",
|
|
2161
|
+
...options
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
/**
|
|
1911
2165
|
* Get per-project usage
|
|
1912
2166
|
*
|
|
1913
2167
|
* 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.
|
|
@@ -1922,27 +2176,26 @@ var Projects = class {
|
|
|
1922
2176
|
});
|
|
1923
2177
|
}
|
|
1924
2178
|
};
|
|
1925
|
-
var
|
|
2179
|
+
var Secrets = class {
|
|
1926
2180
|
/**
|
|
1927
|
-
* List
|
|
2181
|
+
* List secrets
|
|
1928
2182
|
*
|
|
1929
|
-
*
|
|
2183
|
+
* Returns a list of secrets for a project
|
|
1930
2184
|
*/
|
|
1931
|
-
static
|
|
2185
|
+
static listSecrets(options) {
|
|
1932
2186
|
return (options.client ?? client).get({
|
|
1933
|
-
url: "/v1/projects/{project_id}/
|
|
2187
|
+
url: "/v1/projects/{project_id}/secrets",
|
|
1934
2188
|
...options
|
|
1935
2189
|
});
|
|
1936
2190
|
}
|
|
1937
2191
|
/**
|
|
1938
|
-
*
|
|
1939
|
-
*
|
|
1940
|
-
* 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.
|
|
2192
|
+
* Create a secret
|
|
1941
2193
|
*
|
|
2194
|
+
* Creates a new encrypted secret in a project
|
|
1942
2195
|
*/
|
|
1943
|
-
static
|
|
2196
|
+
static createSecret(options) {
|
|
1944
2197
|
return (options.client ?? client).post({
|
|
1945
|
-
url: "/v1/projects/{project_id}/
|
|
2198
|
+
url: "/v1/projects/{project_id}/secrets",
|
|
1946
2199
|
...options,
|
|
1947
2200
|
headers: {
|
|
1948
2201
|
"Content-Type": "application/json",
|
|
@@ -1951,35 +2204,35 @@ var Providers = class {
|
|
|
1951
2204
|
});
|
|
1952
2205
|
}
|
|
1953
2206
|
/**
|
|
1954
|
-
* Delete a
|
|
1955
|
-
*
|
|
1956
|
-
* 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.
|
|
2207
|
+
* Delete a secret
|
|
1957
2208
|
*
|
|
2209
|
+
* Deletes a secret
|
|
1958
2210
|
*/
|
|
1959
|
-
static
|
|
2211
|
+
static deleteSecret(options) {
|
|
1960
2212
|
return (options.client ?? client).delete({
|
|
1961
|
-
url: "/v1/projects/{project_id}/
|
|
2213
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1962
2214
|
...options
|
|
1963
2215
|
});
|
|
1964
2216
|
}
|
|
1965
2217
|
/**
|
|
1966
|
-
* Get a
|
|
2218
|
+
* Get a secret
|
|
2219
|
+
*
|
|
2220
|
+
* Returns a specific secret
|
|
1967
2221
|
*/
|
|
1968
|
-
static
|
|
2222
|
+
static getSecret(options) {
|
|
1969
2223
|
return (options.client ?? client).get({
|
|
1970
|
-
url: "/v1/projects/{project_id}/
|
|
2224
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1971
2225
|
...options
|
|
1972
2226
|
});
|
|
1973
2227
|
}
|
|
1974
2228
|
/**
|
|
1975
|
-
* Update a
|
|
1976
|
-
*
|
|
1977
|
-
* Change the model, name or base URL, or rotate the credentials (api_key). At least one field is required.
|
|
2229
|
+
* Update a secret
|
|
1978
2230
|
*
|
|
2231
|
+
* Updates a secret's name and/or value
|
|
1979
2232
|
*/
|
|
1980
|
-
static
|
|
2233
|
+
static updateSecret(options) {
|
|
1981
2234
|
return (options.client ?? client).patch({
|
|
1982
|
-
url: "/v1/projects/{project_id}/
|
|
2235
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1983
2236
|
...options,
|
|
1984
2237
|
headers: {
|
|
1985
2238
|
"Content-Type": "application/json",
|
|
@@ -1990,14 +2243,25 @@ var Providers = class {
|
|
|
1990
2243
|
};
|
|
1991
2244
|
var Sessions = class {
|
|
1992
2245
|
/**
|
|
1993
|
-
*
|
|
2246
|
+
* List sessions
|
|
2247
|
+
*
|
|
2248
|
+
* Returns sessions the caller can access, optionally filtered by agent, actor and status.
|
|
2249
|
+
*/
|
|
2250
|
+
static listSessions(options) {
|
|
2251
|
+
return (options.client ?? client).get({
|
|
2252
|
+
url: "/v1/projects/{project_id}/sessions",
|
|
2253
|
+
...options
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* Create a session
|
|
1994
2258
|
*
|
|
1995
|
-
*
|
|
2259
|
+
* 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.
|
|
1996
2260
|
*
|
|
1997
2261
|
*/
|
|
1998
2262
|
static createSession(options) {
|
|
1999
2263
|
return (options.client ?? client).post({
|
|
2000
|
-
url: "/v1/projects/{project_id}/
|
|
2264
|
+
url: "/v1/projects/{project_id}/sessions",
|
|
2001
2265
|
...options,
|
|
2002
2266
|
headers: {
|
|
2003
2267
|
"Content-Type": "application/json",
|
|
@@ -2006,38 +2270,52 @@ var Sessions = class {
|
|
|
2006
2270
|
});
|
|
2007
2271
|
}
|
|
2008
2272
|
/**
|
|
2009
|
-
*
|
|
2273
|
+
* Delete a session
|
|
2010
2274
|
*
|
|
2011
|
-
*
|
|
2275
|
+
* 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.
|
|
2012
2276
|
*
|
|
2013
2277
|
*/
|
|
2014
|
-
static
|
|
2015
|
-
return (options.client ?? client).
|
|
2016
|
-
url: "/v1/projects/{project_id}/
|
|
2278
|
+
static deleteSession(options) {
|
|
2279
|
+
return (options.client ?? client).delete({
|
|
2280
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
2017
2281
|
...options
|
|
2018
2282
|
});
|
|
2019
2283
|
}
|
|
2020
2284
|
/**
|
|
2021
|
-
*
|
|
2022
|
-
*
|
|
2023
|
-
* 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.
|
|
2285
|
+
* Get a session
|
|
2024
2286
|
*
|
|
2287
|
+
* Returns details of a single session.
|
|
2025
2288
|
*/
|
|
2026
|
-
static
|
|
2289
|
+
static getSession(options) {
|
|
2027
2290
|
return (options.client ?? client).get({
|
|
2028
|
-
url: "/v1/projects/{project_id}/
|
|
2291
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
2029
2292
|
...options
|
|
2030
2293
|
});
|
|
2031
2294
|
}
|
|
2032
2295
|
/**
|
|
2033
|
-
*
|
|
2296
|
+
* Update a session
|
|
2034
2297
|
*
|
|
2035
|
-
*
|
|
2298
|
+
* Updates the session name and/or status.
|
|
2299
|
+
*/
|
|
2300
|
+
static updateSession(options) {
|
|
2301
|
+
return (options.client ?? client).patch({
|
|
2302
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
2303
|
+
...options,
|
|
2304
|
+
headers: {
|
|
2305
|
+
"Content-Type": "application/json",
|
|
2306
|
+
...options.headers
|
|
2307
|
+
}
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
/**
|
|
2311
|
+
* Add a user message
|
|
2312
|
+
*
|
|
2313
|
+
* 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.
|
|
2036
2314
|
*
|
|
2037
2315
|
*/
|
|
2038
2316
|
static addSessionMessage(options) {
|
|
2039
2317
|
return (options.client ?? client).post({
|
|
2040
|
-
url: "/v1/projects/{project_id}/
|
|
2318
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/messages",
|
|
2041
2319
|
...options,
|
|
2042
2320
|
headers: {
|
|
2043
2321
|
"Content-Type": "application/json",
|
|
@@ -2046,20 +2324,14 @@ var Sessions = class {
|
|
|
2046
2324
|
});
|
|
2047
2325
|
}
|
|
2048
2326
|
/**
|
|
2049
|
-
*
|
|
2050
|
-
*
|
|
2051
|
-
* Runs the agent over the session's accumulated messages.
|
|
2327
|
+
* Trigger agent generation
|
|
2052
2328
|
*
|
|
2053
|
-
* Background by default:
|
|
2054
|
-
*
|
|
2055
|
-
* 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.
|
|
2056
|
-
*
|
|
2057
|
-
* `model` overrides the agent's default model for this turn only.
|
|
2329
|
+
* 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.
|
|
2058
2330
|
*
|
|
2059
2331
|
*/
|
|
2060
2332
|
static generateSessionResponse(options) {
|
|
2061
2333
|
return (options.client ?? client).post({
|
|
2062
|
-
url: "/v1/projects/{project_id}/
|
|
2334
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/generate",
|
|
2063
2335
|
...options,
|
|
2064
2336
|
headers: {
|
|
2065
2337
|
"Content-Type": "application/json",
|
|
@@ -2067,29 +2339,35 @@ var Sessions = class {
|
|
|
2067
2339
|
}
|
|
2068
2340
|
});
|
|
2069
2341
|
}
|
|
2070
|
-
};
|
|
2071
|
-
var Tasks = class {
|
|
2072
2342
|
/**
|
|
2073
|
-
*
|
|
2343
|
+
* Submit tool outputs
|
|
2074
2344
|
*
|
|
2075
|
-
*
|
|
2345
|
+
* 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.
|
|
2076
2346
|
*
|
|
2077
2347
|
*/
|
|
2078
|
-
static
|
|
2079
|
-
return (options.client ?? client).
|
|
2080
|
-
url: "/v1/projects/{project_id}/
|
|
2081
|
-
...options
|
|
2348
|
+
static submitSessionToolOutputs(options) {
|
|
2349
|
+
return (options.client ?? client).post({
|
|
2350
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tool-outputs",
|
|
2351
|
+
...options,
|
|
2352
|
+
headers: {
|
|
2353
|
+
"Content-Type": "application/json",
|
|
2354
|
+
...options.headers
|
|
2355
|
+
}
|
|
2082
2356
|
});
|
|
2083
2357
|
}
|
|
2084
2358
|
/**
|
|
2085
|
-
*
|
|
2359
|
+
* Fork a session
|
|
2360
|
+
*
|
|
2361
|
+
* Branches a new session from a point in this session's history: same context, different continuation.
|
|
2086
2362
|
*
|
|
2087
|
-
*
|
|
2363
|
+
* 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.
|
|
2364
|
+
*
|
|
2365
|
+
* 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.
|
|
2088
2366
|
*
|
|
2089
2367
|
*/
|
|
2090
|
-
static
|
|
2368
|
+
static forkSession(options) {
|
|
2091
2369
|
return (options.client ?? client).post({
|
|
2092
|
-
url: "/v1/projects/{project_id}/
|
|
2370
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/fork",
|
|
2093
2371
|
...options,
|
|
2094
2372
|
headers: {
|
|
2095
2373
|
"Content-Type": "application/json",
|
|
@@ -2098,39 +2376,36 @@ var Tasks = class {
|
|
|
2098
2376
|
});
|
|
2099
2377
|
}
|
|
2100
2378
|
/**
|
|
2101
|
-
*
|
|
2379
|
+
* List a session's forks
|
|
2102
2380
|
*
|
|
2103
|
-
*
|
|
2381
|
+
* Returns the sessions forked directly from this one. One level of lineage: a fork of a fork is listed under its own parent.
|
|
2104
2382
|
*
|
|
2105
2383
|
*/
|
|
2106
|
-
static
|
|
2107
|
-
return (options.client ?? client).
|
|
2108
|
-
url: "/v1/projects/{project_id}/
|
|
2384
|
+
static listSessionForks(options) {
|
|
2385
|
+
return (options.client ?? client).get({
|
|
2386
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/forks",
|
|
2109
2387
|
...options
|
|
2110
2388
|
});
|
|
2111
2389
|
}
|
|
2112
2390
|
/**
|
|
2113
|
-
* Get
|
|
2391
|
+
* Get session tags
|
|
2114
2392
|
*
|
|
2115
|
-
*
|
|
2393
|
+
* Returns the session's tags object.
|
|
2116
2394
|
*/
|
|
2117
|
-
static
|
|
2395
|
+
static getSessionTags(options) {
|
|
2118
2396
|
return (options.client ?? client).get({
|
|
2119
|
-
url: "/v1/projects/{project_id}/
|
|
2397
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2120
2398
|
...options
|
|
2121
2399
|
});
|
|
2122
2400
|
}
|
|
2123
2401
|
/**
|
|
2124
|
-
*
|
|
2125
|
-
*
|
|
2126
|
-
* Edit the card's `title`, `assignee` or `payload`. At least one is required.
|
|
2127
|
-
* `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.
|
|
2128
|
-
* `state` and `board_id` are rejected — a card moves only through `:transition`, and it never changes boards.
|
|
2402
|
+
* Merge session tags
|
|
2129
2403
|
*
|
|
2404
|
+
* Merges the provided tags into the session's existing tags.
|
|
2130
2405
|
*/
|
|
2131
|
-
static
|
|
2406
|
+
static mergeSessionTags(options) {
|
|
2132
2407
|
return (options.client ?? client).patch({
|
|
2133
|
-
url: "/v1/projects/{project_id}/
|
|
2408
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2134
2409
|
...options,
|
|
2135
2410
|
headers: {
|
|
2136
2411
|
"Content-Type": "application/json",
|
|
@@ -2139,15 +2414,13 @@ var Tasks = class {
|
|
|
2139
2414
|
});
|
|
2140
2415
|
}
|
|
2141
2416
|
/**
|
|
2142
|
-
*
|
|
2143
|
-
*
|
|
2144
|
-
* 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.
|
|
2145
|
-
* 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.
|
|
2417
|
+
* Replace session tags
|
|
2146
2418
|
*
|
|
2419
|
+
* Replaces all tags on the session.
|
|
2147
2420
|
*/
|
|
2148
|
-
static
|
|
2149
|
-
return (options.client ?? client).
|
|
2150
|
-
url: "/v1/projects/{project_id}/
|
|
2421
|
+
static replaceSessionTags(options) {
|
|
2422
|
+
return (options.client ?? client).put({
|
|
2423
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2151
2424
|
...options,
|
|
2152
2425
|
headers: {
|
|
2153
2426
|
"Content-Type": "application/json",
|
|
@@ -2155,24 +2428,12 @@ var Tasks = class {
|
|
|
2155
2428
|
}
|
|
2156
2429
|
});
|
|
2157
2430
|
}
|
|
2158
|
-
/**
|
|
2159
|
-
* List the task's moves
|
|
2160
|
-
*
|
|
2161
|
-
* 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.
|
|
2162
|
-
*
|
|
2163
|
-
*/
|
|
2164
|
-
static listTaskTransitions(options) {
|
|
2165
|
-
return (options.client ?? client).get({
|
|
2166
|
-
url: "/v1/projects/{project_id}/tasks/{task_id}/transitions",
|
|
2167
|
-
...options
|
|
2168
|
-
});
|
|
2169
|
-
}
|
|
2170
2431
|
};
|
|
2171
2432
|
var Tools = class {
|
|
2172
2433
|
/**
|
|
2173
2434
|
* List tools
|
|
2174
2435
|
*
|
|
2175
|
-
*
|
|
2436
|
+
* Returns all tools in the project.
|
|
2176
2437
|
*/
|
|
2177
2438
|
static listTools(options) {
|
|
2178
2439
|
return (options.client ?? client).get({
|
|
@@ -2183,8 +2444,7 @@ var Tools = class {
|
|
|
2183
2444
|
/**
|
|
2184
2445
|
* Create a tool
|
|
2185
2446
|
*
|
|
2186
|
-
*
|
|
2187
|
-
*
|
|
2447
|
+
* Creates a new tool in the project.
|
|
2188
2448
|
*/
|
|
2189
2449
|
static createTool(options) {
|
|
2190
2450
|
return (options.client ?? client).post({
|
|
@@ -2199,8 +2459,7 @@ var Tools = class {
|
|
|
2199
2459
|
/**
|
|
2200
2460
|
* Delete a tool
|
|
2201
2461
|
*
|
|
2202
|
-
* Deletes
|
|
2203
|
-
*
|
|
2462
|
+
* Deletes a tool by ID.
|
|
2204
2463
|
*/
|
|
2205
2464
|
static deleteTool(options) {
|
|
2206
2465
|
return (options.client ?? client).delete({
|
|
@@ -2210,6 +2469,8 @@ var Tools = class {
|
|
|
2210
2469
|
}
|
|
2211
2470
|
/**
|
|
2212
2471
|
* Get a tool
|
|
2472
|
+
*
|
|
2473
|
+
* Returns a single tool by ID.
|
|
2213
2474
|
*/
|
|
2214
2475
|
static getTool(options) {
|
|
2215
2476
|
return (options.client ?? client).get({
|
|
@@ -2220,8 +2481,7 @@ var Tools = class {
|
|
|
2220
2481
|
/**
|
|
2221
2482
|
* Update a tool
|
|
2222
2483
|
*
|
|
2223
|
-
*
|
|
2224
|
-
*
|
|
2484
|
+
* Updates an existing tool.
|
|
2225
2485
|
*/
|
|
2226
2486
|
static updateTool(options) {
|
|
2227
2487
|
return (options.client ?? client).patch({
|
|
@@ -2233,12 +2493,30 @@ var Tools = class {
|
|
|
2233
2493
|
}
|
|
2234
2494
|
});
|
|
2235
2495
|
}
|
|
2496
|
+
/**
|
|
2497
|
+
* Call a tool
|
|
2498
|
+
*
|
|
2499
|
+
* 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.
|
|
2500
|
+
* 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.
|
|
2501
|
+
* `preset_parameters` stored on the tool are merged with the caller-supplied `input` before execution; preset keys take lower precedence.
|
|
2502
|
+
*
|
|
2503
|
+
*/
|
|
2504
|
+
static callTool(options) {
|
|
2505
|
+
return (options.client ?? client).post({
|
|
2506
|
+
url: "/v1/projects/{project_id}/tools/{tool_id}/call",
|
|
2507
|
+
...options,
|
|
2508
|
+
headers: {
|
|
2509
|
+
"Content-Type": "application/json",
|
|
2510
|
+
...options.headers
|
|
2511
|
+
}
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2236
2514
|
};
|
|
2237
2515
|
var Traces = class {
|
|
2238
2516
|
/**
|
|
2239
2517
|
* List traces
|
|
2240
2518
|
*
|
|
2241
|
-
*
|
|
2519
|
+
* Returns a paginated list of execution traces for the project.
|
|
2242
2520
|
*/
|
|
2243
2521
|
static listTraces(options) {
|
|
2244
2522
|
return (options.client ?? client).get({
|
|
@@ -2249,8 +2527,7 @@ var Traces = class {
|
|
|
2249
2527
|
/**
|
|
2250
2528
|
* Get a trace
|
|
2251
2529
|
*
|
|
2252
|
-
* Returns
|
|
2253
|
-
*
|
|
2530
|
+
* Returns a single trace by ID.
|
|
2254
2531
|
*/
|
|
2255
2532
|
static getTrace(options) {
|
|
2256
2533
|
return (options.client ?? client).get({
|
|
@@ -2259,10 +2536,9 @@ var Traces = class {
|
|
|
2259
2536
|
});
|
|
2260
2537
|
}
|
|
2261
2538
|
/**
|
|
2262
|
-
* Get
|
|
2539
|
+
* Get trace tree
|
|
2263
2540
|
*
|
|
2264
|
-
* Returns the
|
|
2265
|
-
* 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.
|
|
2541
|
+
* 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.
|
|
2266
2542
|
*
|
|
2267
2543
|
*/
|
|
2268
2544
|
static getTraceTree(options) {
|
|
@@ -2272,36 +2548,13 @@ var Traces = class {
|
|
|
2272
2548
|
});
|
|
2273
2549
|
}
|
|
2274
2550
|
/**
|
|
2275
|
-
*
|
|
2276
|
-
*
|
|
2277
|
-
* Lists the generations recorded under this trace — the model loops the execution ran, including sub-agent generations linked by `initiator_generation_id`.
|
|
2278
|
-
*
|
|
2279
|
-
*/
|
|
2280
|
-
static listTraceGenerations(options) {
|
|
2281
|
-
return (options.client ?? client).get({
|
|
2282
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/generations",
|
|
2283
|
-
...options
|
|
2284
|
-
});
|
|
2285
|
-
}
|
|
2286
|
-
/**
|
|
2287
|
-
* Get a trace's steps
|
|
2551
|
+
* Purge trace content
|
|
2288
2552
|
*
|
|
2289
|
-
*
|
|
2290
|
-
* 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".
|
|
2291
|
-
* 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`.
|
|
2553
|
+
* 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.
|
|
2292
2554
|
*
|
|
2293
|
-
|
|
2294
|
-
static getTraceSteps(options) {
|
|
2295
|
-
return (options.client ?? client).get({
|
|
2296
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/steps",
|
|
2297
|
-
...options
|
|
2298
|
-
});
|
|
2299
|
-
}
|
|
2300
|
-
/**
|
|
2301
|
-
* Purge a trace's content
|
|
2555
|
+
* 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.
|
|
2302
2556
|
*
|
|
2303
|
-
*
|
|
2304
|
-
* Idempotent: purging an already-purged trace succeeds and leaves the original `content_redacted_at` in place.
|
|
2557
|
+
* Idempotent — purging an already-purged trace succeeds and leaves the original `content_redacted_at` in place.
|
|
2305
2558
|
*
|
|
2306
2559
|
*/
|
|
2307
2560
|
static purgeTraceContent(options) {
|
|
@@ -2311,82 +2564,27 @@ var Traces = class {
|
|
|
2311
2564
|
});
|
|
2312
2565
|
}
|
|
2313
2566
|
};
|
|
2314
|
-
var
|
|
2315
|
-
/**
|
|
2316
|
-
* List triggers
|
|
2317
|
-
*
|
|
2318
|
-
* The project's schedule triggers, of either fronted target kind.
|
|
2319
|
-
* `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.
|
|
2320
|
-
*
|
|
2321
|
-
*/
|
|
2322
|
-
static listTriggers(options) {
|
|
2323
|
-
return (options.client ?? client).get({
|
|
2324
|
-
url: "/v1/projects/{project_id}/triggers",
|
|
2325
|
-
...options
|
|
2326
|
-
});
|
|
2327
|
-
}
|
|
2328
|
-
/**
|
|
2329
|
-
* Create a trigger
|
|
2330
|
-
*
|
|
2331
|
-
* 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.
|
|
2332
|
-
*
|
|
2333
|
-
*/
|
|
2334
|
-
static createTrigger(options) {
|
|
2335
|
-
return (options.client ?? client).post({
|
|
2336
|
-
url: "/v1/projects/{project_id}/triggers",
|
|
2337
|
-
...options,
|
|
2338
|
-
headers: {
|
|
2339
|
-
"Content-Type": "application/json",
|
|
2340
|
-
...options.headers
|
|
2341
|
-
}
|
|
2342
|
-
});
|
|
2343
|
-
}
|
|
2567
|
+
var Users = class {
|
|
2344
2568
|
/**
|
|
2345
|
-
*
|
|
2569
|
+
* Get the current user
|
|
2346
2570
|
*
|
|
2347
|
-
*
|
|
2348
|
-
*/
|
|
2349
|
-
static deleteTrigger(options) {
|
|
2350
|
-
return (options.client ?? client).delete({
|
|
2351
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}",
|
|
2352
|
-
...options
|
|
2353
|
-
});
|
|
2354
|
-
}
|
|
2355
|
-
/**
|
|
2356
|
-
* Get a trigger
|
|
2571
|
+
* Returns the account the presented credential resolves to.
|
|
2357
2572
|
*/
|
|
2358
|
-
static
|
|
2359
|
-
return (options
|
|
2360
|
-
url: "/v1/
|
|
2573
|
+
static getCurrentUser(options) {
|
|
2574
|
+
return (options?.client ?? client).get({
|
|
2575
|
+
url: "/v1/users/me",
|
|
2361
2576
|
...options
|
|
2362
2577
|
});
|
|
2363
2578
|
}
|
|
2364
2579
|
/**
|
|
2365
|
-
* Update
|
|
2580
|
+
* Update the current user
|
|
2366
2581
|
*
|
|
2367
|
-
*
|
|
2582
|
+
* 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.
|
|
2368
2583
|
*
|
|
2369
2584
|
*/
|
|
2370
|
-
static
|
|
2585
|
+
static updateCurrentUser(options) {
|
|
2371
2586
|
return (options.client ?? client).patch({
|
|
2372
|
-
url: "/v1/
|
|
2373
|
-
...options,
|
|
2374
|
-
headers: {
|
|
2375
|
-
"Content-Type": "application/json",
|
|
2376
|
-
...options.headers
|
|
2377
|
-
}
|
|
2378
|
-
});
|
|
2379
|
-
}
|
|
2380
|
-
/**
|
|
2381
|
-
* Fire a trigger manually
|
|
2382
|
-
*
|
|
2383
|
-
* 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`.
|
|
2384
|
-
* `input` is shallow-merged over the trigger's own stored `input` for this run only — the trigger's configuration is unchanged.
|
|
2385
|
-
*
|
|
2386
|
-
*/
|
|
2387
|
-
static fireTrigger(options) {
|
|
2388
|
-
return (options.client ?? client).post({
|
|
2389
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}:fire",
|
|
2587
|
+
url: "/v1/users/me",
|
|
2390
2588
|
...options,
|
|
2391
2589
|
headers: {
|
|
2392
2590
|
"Content-Type": "application/json",
|
|
@@ -2394,26 +2592,6 @@ var Triggers = class {
|
|
|
2394
2592
|
}
|
|
2395
2593
|
});
|
|
2396
2594
|
}
|
|
2397
|
-
/**
|
|
2398
|
-
* List a trigger's firings
|
|
2399
|
-
*
|
|
2400
|
-
* Every time this trigger ran, newest first — scheduled and manual alike.
|
|
2401
|
-
*/
|
|
2402
|
-
static listTriggerFirings(options) {
|
|
2403
|
-
return (options.client ?? client).get({
|
|
2404
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings",
|
|
2405
|
-
...options
|
|
2406
|
-
});
|
|
2407
|
-
}
|
|
2408
|
-
/**
|
|
2409
|
-
* Get a trigger firing
|
|
2410
|
-
*/
|
|
2411
|
-
static getTriggerFiring(options) {
|
|
2412
|
-
return (options.client ?? client).get({
|
|
2413
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings/{firing_id}",
|
|
2414
|
-
...options
|
|
2415
|
-
});
|
|
2416
|
-
}
|
|
2417
2595
|
};
|
|
2418
2596
|
var Webhooks = class {
|
|
2419
2597
|
/**
|
|
@@ -2572,8 +2750,8 @@ const API_BASE_URL = "https://api.naturali.ai";
|
|
|
2572
2750
|
* });
|
|
2573
2751
|
*
|
|
2574
2752
|
* const { data, error } = await naturali.sessions.addSessionMessage({
|
|
2575
|
-
* path: { project_id: PROJECT_ID,
|
|
2576
|
-
* body: {
|
|
2753
|
+
* path: { project_id: PROJECT_ID, session_id: SESSION_ID },
|
|
2754
|
+
* body: { message: 'What is the capital of France?' },
|
|
2577
2755
|
* });
|
|
2578
2756
|
* ```
|
|
2579
2757
|
*
|
|
@@ -2584,23 +2762,22 @@ const API_BASE_URL = "https://api.naturali.ai";
|
|
|
2584
2762
|
var NaturaliClient = class {
|
|
2585
2763
|
actors;
|
|
2586
2764
|
agents;
|
|
2765
|
+
agentVersions;
|
|
2766
|
+
aiProviders;
|
|
2587
2767
|
apiKeys;
|
|
2588
2768
|
assistant;
|
|
2589
|
-
auth;
|
|
2590
|
-
boards;
|
|
2591
2769
|
channels;
|
|
2770
|
+
auth;
|
|
2771
|
+
conversations;
|
|
2772
|
+
evaluations;
|
|
2592
2773
|
generations;
|
|
2593
|
-
knowledge;
|
|
2594
2774
|
modelRoutes;
|
|
2595
|
-
models;
|
|
2596
|
-
orchestrations;
|
|
2597
2775
|
projects;
|
|
2598
|
-
|
|
2776
|
+
secrets;
|
|
2599
2777
|
sessions;
|
|
2600
|
-
tasks;
|
|
2601
2778
|
tools;
|
|
2602
2779
|
traces;
|
|
2603
|
-
|
|
2780
|
+
users;
|
|
2604
2781
|
webhooks;
|
|
2605
2782
|
/** The underlying HTTP client, for interceptors or one-off requests. */
|
|
2606
2783
|
http;
|
|
@@ -2614,47 +2791,45 @@ var NaturaliClient = class {
|
|
|
2614
2791
|
}));
|
|
2615
2792
|
this.actors = bindResource(Actors, this.http);
|
|
2616
2793
|
this.agents = bindResource(Agents, this.http);
|
|
2794
|
+
this.agentVersions = bindResource(AgentVersions, this.http);
|
|
2795
|
+
this.aiProviders = bindResource(AiProviders, this.http);
|
|
2617
2796
|
this.apiKeys = bindResource(ApiKeys, this.http);
|
|
2618
2797
|
this.assistant = bindResource(Assistant, this.http);
|
|
2619
|
-
this.auth = bindResource(Auth, this.http);
|
|
2620
|
-
this.boards = bindResource(Boards, this.http);
|
|
2621
2798
|
this.channels = bindResource(Channels, this.http);
|
|
2799
|
+
this.auth = bindResource(Auth, this.http);
|
|
2800
|
+
this.conversations = bindResource(Conversations, this.http);
|
|
2801
|
+
this.evaluations = bindResource(Evaluations, this.http);
|
|
2622
2802
|
this.generations = bindResource(Generations, this.http);
|
|
2623
|
-
this.knowledge = bindResource(Knowledge, this.http);
|
|
2624
2803
|
this.modelRoutes = bindResource(ModelRoutes, this.http);
|
|
2625
|
-
this.models = bindResource(Models, this.http);
|
|
2626
|
-
this.orchestrations = bindResource(Orchestrations, this.http);
|
|
2627
2804
|
this.projects = bindResource(Projects, this.http);
|
|
2628
|
-
this.
|
|
2805
|
+
this.secrets = bindResource(Secrets, this.http);
|
|
2629
2806
|
this.sessions = bindResource(Sessions, this.http);
|
|
2630
|
-
this.tasks = bindResource(Tasks, this.http);
|
|
2631
2807
|
this.tools = bindResource(Tools, this.http);
|
|
2632
2808
|
this.traces = bindResource(Traces, this.http);
|
|
2633
|
-
this.
|
|
2809
|
+
this.users = bindResource(Users, this.http);
|
|
2634
2810
|
this.webhooks = bindResource(Webhooks, this.http);
|
|
2635
2811
|
}
|
|
2636
2812
|
};
|
|
2637
2813
|
//#endregion
|
|
2638
2814
|
exports.Actors = Actors;
|
|
2815
|
+
exports.AgentVersions = AgentVersions;
|
|
2639
2816
|
exports.Agents = Agents;
|
|
2817
|
+
exports.AiProviders = AiProviders;
|
|
2640
2818
|
exports.ApiKeys = ApiKeys;
|
|
2641
2819
|
exports.Assistant = Assistant;
|
|
2642
2820
|
exports.Auth = Auth;
|
|
2643
|
-
exports.Boards = Boards;
|
|
2644
2821
|
exports.Channels = Channels;
|
|
2822
|
+
exports.Conversations = Conversations;
|
|
2823
|
+
exports.Evaluations = Evaluations;
|
|
2645
2824
|
exports.Generations = Generations;
|
|
2646
|
-
exports.Knowledge = Knowledge;
|
|
2647
2825
|
exports.ModelRoutes = ModelRoutes;
|
|
2648
|
-
exports.Models = Models;
|
|
2649
2826
|
exports.NaturaliClient = NaturaliClient;
|
|
2650
|
-
exports.Orchestrations = Orchestrations;
|
|
2651
2827
|
exports.Projects = Projects;
|
|
2652
|
-
exports.
|
|
2828
|
+
exports.Secrets = Secrets;
|
|
2653
2829
|
exports.Sessions = Sessions;
|
|
2654
|
-
exports.Tasks = Tasks;
|
|
2655
2830
|
exports.Tools = Tools;
|
|
2656
2831
|
exports.Traces = Traces;
|
|
2657
|
-
exports.
|
|
2832
|
+
exports.Users = Users;
|
|
2658
2833
|
exports.Webhooks = Webhooks;
|
|
2659
2834
|
exports.createClient = createClient;
|
|
2660
2835
|
exports.createConfig = createConfig;
|