@naturali/sdk 0.65.0 → 0.67.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 +599 -690
- package/dist/index.d.cts +4691 -5283
- package/dist/index.d.mts +4691 -5283
- package/dist/index.mjs +594 -683
- 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,12 +1026,11 @@ var Agents = class {
|
|
|
991
1026
|
});
|
|
992
1027
|
}
|
|
993
1028
|
/**
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
* Change the bound provider, name, model, instructions, sampling/step config, attached tools (tool_bindings/tool_choice/step_rules), or the structured-output schema (output_schema). At least one field is required.
|
|
1029
|
+
* Partially update an agent
|
|
997
1030
|
*
|
|
1031
|
+
* Partially updates an existing agent. Identical to PUT — both perform partial updates.
|
|
998
1032
|
*/
|
|
999
|
-
static
|
|
1033
|
+
static patchAgent(options) {
|
|
1000
1034
|
return (options.client ?? client).patch({
|
|
1001
1035
|
url: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
1002
1036
|
...options,
|
|
@@ -1006,29 +1040,14 @@ var Agents = class {
|
|
|
1006
1040
|
}
|
|
1007
1041
|
});
|
|
1008
1042
|
}
|
|
1009
|
-
};
|
|
1010
|
-
var ApiKeys = class {
|
|
1011
|
-
/**
|
|
1012
|
-
* List API keys
|
|
1013
|
-
*
|
|
1014
|
-
* Lists API keys accessible to the caller. A project-scoped credential sees only keys in its project; an account-scoped credential sees all keys in the account. Raw secrets are never returned.
|
|
1015
|
-
*
|
|
1016
|
-
*/
|
|
1017
|
-
static listApiKeys(options) {
|
|
1018
|
-
return (options?.client ?? client).get({
|
|
1019
|
-
url: "/v1/api-keys",
|
|
1020
|
-
...options
|
|
1021
|
-
});
|
|
1022
|
-
}
|
|
1023
1043
|
/**
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
* 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.
|
|
1044
|
+
* Update an agent
|
|
1027
1045
|
*
|
|
1046
|
+
* Updates an existing agent. Identical to PATCH — both perform partial updates.
|
|
1028
1047
|
*/
|
|
1029
|
-
static
|
|
1030
|
-
return (options.client ?? client).
|
|
1031
|
-
url: "/v1/
|
|
1048
|
+
static updateAgent(options) {
|
|
1049
|
+
return (options.client ?? client).put({
|
|
1050
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
1032
1051
|
...options,
|
|
1033
1052
|
headers: {
|
|
1034
1053
|
"Content-Type": "application/json",
|
|
@@ -1037,35 +1056,14 @@ var ApiKeys = class {
|
|
|
1037
1056
|
});
|
|
1038
1057
|
}
|
|
1039
1058
|
/**
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
* Revokes an API key immediately. Subsequent use returns 401.
|
|
1043
|
-
*/
|
|
1044
|
-
static deleteApiKey(options) {
|
|
1045
|
-
return (options.client ?? client).delete({
|
|
1046
|
-
url: "/v1/api-keys/{api_key_id}",
|
|
1047
|
-
...options
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
/**
|
|
1051
|
-
* Get an API key
|
|
1059
|
+
* Run an agent generation
|
|
1052
1060
|
*
|
|
1053
|
-
*
|
|
1054
|
-
*/
|
|
1055
|
-
static getApiKey(options) {
|
|
1056
|
-
return (options.client ?? client).get({
|
|
1057
|
-
url: "/v1/api-keys/{api_key_id}",
|
|
1058
|
-
...options
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* Update an API key
|
|
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.
|
|
1063
1062
|
*
|
|
1064
|
-
* Rename an API key or replace its capability set. The scope (project vs account) is immutable.
|
|
1065
1063
|
*/
|
|
1066
|
-
static
|
|
1067
|
-
return (options.client ?? client).
|
|
1068
|
-
url: "/v1/
|
|
1064
|
+
static createAgentGeneration(options) {
|
|
1065
|
+
return (options.client ?? client).post({
|
|
1066
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/generate",
|
|
1069
1067
|
...options,
|
|
1070
1068
|
headers: {
|
|
1071
1069
|
"Content-Type": "application/json",
|
|
@@ -1074,66 +1072,58 @@ var ApiKeys = class {
|
|
|
1074
1072
|
});
|
|
1075
1073
|
}
|
|
1076
1074
|
/**
|
|
1077
|
-
*
|
|
1075
|
+
* Submit tool outputs for a paused generation
|
|
1078
1076
|
*
|
|
1079
|
-
*
|
|
1077
|
+
* Resumes a generation that was paused due to client tool calls. Provide tool outputs for each pending tool call.
|
|
1080
1078
|
*
|
|
1081
1079
|
*/
|
|
1082
|
-
static
|
|
1080
|
+
static submitAgentToolOutputs(options) {
|
|
1083
1081
|
return (options.client ?? client).post({
|
|
1084
|
-
url: "/v1/
|
|
1085
|
-
...options
|
|
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
|
+
}
|
|
1086
1088
|
});
|
|
1087
1089
|
}
|
|
1088
1090
|
};
|
|
1089
|
-
var
|
|
1090
|
-
/**
|
|
1091
|
-
* List linked identities
|
|
1092
|
-
*
|
|
1093
|
-
* Lists the caller's assistant grants — one per channel identity that may operate their account. Grants belong to the account, so this is the caller's own set regardless of which projects they own.
|
|
1094
|
-
*
|
|
1095
|
-
*/
|
|
1096
|
-
static listAssistantGrants(options) {
|
|
1097
|
-
return (options?.client ?? client).get({
|
|
1098
|
-
url: "/v1/assistant/grants",
|
|
1099
|
-
...options
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1091
|
+
var AgentVersions = class {
|
|
1102
1092
|
/**
|
|
1103
|
-
*
|
|
1093
|
+
* List an agent's config versions
|
|
1104
1094
|
*
|
|
1105
|
-
*
|
|
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).
|
|
1106
1096
|
*
|
|
1107
1097
|
*/
|
|
1108
|
-
static
|
|
1109
|
-
return (options.client ?? client).
|
|
1110
|
-
url: "/v1/
|
|
1098
|
+
static listAgentVersions(options) {
|
|
1099
|
+
return (options.client ?? client).get({
|
|
1100
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions",
|
|
1111
1101
|
...options
|
|
1112
1102
|
});
|
|
1113
1103
|
}
|
|
1114
1104
|
/**
|
|
1115
|
-
*
|
|
1105
|
+
* Get an archived agent config version
|
|
1116
1106
|
*
|
|
1117
|
-
*
|
|
1118
|
-
* Reading is deliberately separate from redeeming: a single-use nonce must not be burned by a link preview, a URL scanner or a browser prefetch.
|
|
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.
|
|
1119
1108
|
*
|
|
1120
1109
|
*/
|
|
1121
|
-
static
|
|
1110
|
+
static getAgentVersion(options) {
|
|
1122
1111
|
return (options.client ?? client).get({
|
|
1123
|
-
url: "/v1/
|
|
1112
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions/{version}",
|
|
1124
1113
|
...options
|
|
1125
1114
|
});
|
|
1126
1115
|
}
|
|
1127
1116
|
/**
|
|
1128
|
-
*
|
|
1117
|
+
* Restore an archived config as a new version
|
|
1129
1118
|
*
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
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.
|
|
1132
1122
|
*
|
|
1133
1123
|
*/
|
|
1134
|
-
static
|
|
1124
|
+
static restoreAgentVersion(options) {
|
|
1135
1125
|
return (options.client ?? client).post({
|
|
1136
|
-
url: "/v1/
|
|
1126
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions/{version}/restore",
|
|
1137
1127
|
...options,
|
|
1138
1128
|
headers: {
|
|
1139
1129
|
"Content-Type": "application/json",
|
|
@@ -1141,17 +1131,19 @@ var Assistant = class {
|
|
|
1141
1131
|
}
|
|
1142
1132
|
});
|
|
1143
1133
|
}
|
|
1144
|
-
};
|
|
1145
|
-
var Auth = class {
|
|
1146
1134
|
/**
|
|
1147
|
-
*
|
|
1135
|
+
* Set or replace a staged rollout
|
|
1148
1136
|
*
|
|
1149
|
-
*
|
|
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`.
|
|
1150
1142
|
*
|
|
1151
1143
|
*/
|
|
1152
|
-
static
|
|
1153
|
-
return (options.client ?? client).
|
|
1154
|
-
url: "/v1/
|
|
1144
|
+
static setAgentRelease(options) {
|
|
1145
|
+
return (options.client ?? client).put({
|
|
1146
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release",
|
|
1155
1147
|
...options,
|
|
1156
1148
|
headers: {
|
|
1157
1149
|
"Content-Type": "application/json",
|
|
@@ -1160,86 +1152,92 @@ var Auth = class {
|
|
|
1160
1152
|
});
|
|
1161
1153
|
}
|
|
1162
1154
|
/**
|
|
1163
|
-
*
|
|
1155
|
+
* Promote the canary and end the rollout
|
|
1164
1156
|
*
|
|
1165
|
-
*
|
|
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.
|
|
1166
1160
|
*
|
|
1167
1161
|
*/
|
|
1168
|
-
static
|
|
1162
|
+
static promoteAgentRelease(options) {
|
|
1169
1163
|
return (options.client ?? client).post({
|
|
1170
|
-
url: "/v1/
|
|
1171
|
-
...options
|
|
1172
|
-
headers: {
|
|
1173
|
-
"Content-Type": "application/json",
|
|
1174
|
-
...options.headers
|
|
1175
|
-
}
|
|
1164
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release/promote",
|
|
1165
|
+
...options
|
|
1176
1166
|
});
|
|
1177
1167
|
}
|
|
1178
1168
|
/**
|
|
1179
|
-
*
|
|
1169
|
+
* Abort the rollout and roll back to stable
|
|
1180
1170
|
*
|
|
1181
|
-
*
|
|
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.
|
|
1182
1172
|
*
|
|
1183
1173
|
*/
|
|
1184
|
-
static
|
|
1174
|
+
static abortAgentRelease(options) {
|
|
1185
1175
|
return (options.client ?? client).post({
|
|
1186
|
-
url: "/v1/
|
|
1187
|
-
...options
|
|
1188
|
-
headers: {
|
|
1189
|
-
"Content-Type": "application/json",
|
|
1190
|
-
...options.headers
|
|
1191
|
-
}
|
|
1176
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release/abort",
|
|
1177
|
+
...options
|
|
1192
1178
|
});
|
|
1193
1179
|
}
|
|
1180
|
+
};
|
|
1181
|
+
var AiProviders = class {
|
|
1194
1182
|
/**
|
|
1195
|
-
*
|
|
1183
|
+
* List AI providers
|
|
1196
1184
|
*
|
|
1197
|
-
*
|
|
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
|
|
1198
1195
|
*
|
|
1196
|
+
* Creates a new LLM provider configuration
|
|
1199
1197
|
*/
|
|
1200
|
-
static
|
|
1201
|
-
return (options
|
|
1202
|
-
url: "/v1/
|
|
1198
|
+
static createAiProvider(options) {
|
|
1199
|
+
return (options.client ?? client).post({
|
|
1200
|
+
url: "/v1/projects/{project_id}/ai-providers",
|
|
1203
1201
|
...options,
|
|
1204
1202
|
headers: {
|
|
1205
1203
|
"Content-Type": "application/json",
|
|
1206
|
-
...options
|
|
1204
|
+
...options.headers
|
|
1207
1205
|
}
|
|
1208
1206
|
});
|
|
1209
1207
|
}
|
|
1210
1208
|
/**
|
|
1211
|
-
*
|
|
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.
|
|
1212
1214
|
*
|
|
1213
|
-
* Returns the user behind the presented access token.
|
|
1214
1215
|
*/
|
|
1215
|
-
static
|
|
1216
|
-
return (options
|
|
1217
|
-
url: "/v1/
|
|
1216
|
+
static deleteAiProvider(options) {
|
|
1217
|
+
return (options.client ?? client).delete({
|
|
1218
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1218
1219
|
...options
|
|
1219
1220
|
});
|
|
1220
1221
|
}
|
|
1221
|
-
};
|
|
1222
|
-
var Boards = class {
|
|
1223
1222
|
/**
|
|
1224
|
-
*
|
|
1223
|
+
* Get an AI provider
|
|
1225
1224
|
*
|
|
1226
|
-
*
|
|
1225
|
+
* Returns a specific AI provider configuration
|
|
1227
1226
|
*/
|
|
1228
|
-
static
|
|
1227
|
+
static getAiProvider(options) {
|
|
1229
1228
|
return (options.client ?? client).get({
|
|
1230
|
-
url: "/v1/projects/{project_id}/
|
|
1229
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1231
1230
|
...options
|
|
1232
1231
|
});
|
|
1233
1232
|
}
|
|
1234
1233
|
/**
|
|
1235
|
-
*
|
|
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`.
|
|
1234
|
+
* Update an AI provider
|
|
1238
1235
|
*
|
|
1236
|
+
* Updates an AI provider configuration
|
|
1239
1237
|
*/
|
|
1240
|
-
static
|
|
1241
|
-
return (options.client ?? client).
|
|
1242
|
-
url: "/v1/projects/{project_id}/
|
|
1238
|
+
static updateAiProvider(options) {
|
|
1239
|
+
return (options.client ?? client).patch({
|
|
1240
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1243
1241
|
...options,
|
|
1244
1242
|
headers: {
|
|
1245
1243
|
"Content-Type": "application/json",
|
|
@@ -1248,39 +1246,42 @@ var Boards = class {
|
|
|
1248
1246
|
});
|
|
1249
1247
|
}
|
|
1250
1248
|
/**
|
|
1251
|
-
*
|
|
1249
|
+
* List the models this provider can run
|
|
1252
1250
|
*
|
|
1253
|
-
*
|
|
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`.
|
|
1254
1256
|
*
|
|
1255
1257
|
*/
|
|
1256
|
-
static
|
|
1257
|
-
return (options.client ?? client).
|
|
1258
|
-
url: "/v1/projects/{project_id}/
|
|
1258
|
+
static listAiProviderModels(options) {
|
|
1259
|
+
return (options.client ?? client).get({
|
|
1260
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/models",
|
|
1259
1261
|
...options
|
|
1260
1262
|
});
|
|
1261
1263
|
}
|
|
1262
1264
|
/**
|
|
1263
|
-
*
|
|
1265
|
+
* List per-provider price overrides
|
|
1264
1266
|
*
|
|
1265
|
-
*
|
|
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.
|
|
1266
1268
|
*
|
|
1267
1269
|
*/
|
|
1268
|
-
static
|
|
1270
|
+
static getAiProviderPrices(options) {
|
|
1269
1271
|
return (options.client ?? client).get({
|
|
1270
|
-
url: "/v1/projects/{project_id}/
|
|
1272
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/prices",
|
|
1271
1273
|
...options
|
|
1272
1274
|
});
|
|
1273
1275
|
}
|
|
1274
1276
|
/**
|
|
1275
|
-
*
|
|
1277
|
+
* Upsert per-provider price overrides
|
|
1276
1278
|
*
|
|
1277
|
-
*
|
|
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.
|
|
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.
|
|
1279
1280
|
*
|
|
1280
1281
|
*/
|
|
1281
|
-
static
|
|
1282
|
-
return (options.client ?? client).
|
|
1283
|
-
url: "/v1/projects/{project_id}/
|
|
1282
|
+
static updateAiProviderPrices(options) {
|
|
1283
|
+
return (options.client ?? client).put({
|
|
1284
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/prices",
|
|
1284
1285
|
...options,
|
|
1285
1286
|
headers: {
|
|
1286
1287
|
"Content-Type": "application/json",
|
|
@@ -1289,34 +1290,29 @@ var Boards = class {
|
|
|
1289
1290
|
});
|
|
1290
1291
|
}
|
|
1291
1292
|
};
|
|
1292
|
-
var
|
|
1293
|
+
var ApiKeys = class {
|
|
1293
1294
|
/**
|
|
1294
|
-
* List
|
|
1295
|
+
* List API keys
|
|
1295
1296
|
*
|
|
1296
|
-
* Lists
|
|
1297
|
+
* Lists API keys accessible to the caller. A project-scoped credential sees only keys in its project; an account-scoped credential sees all keys in the account. Raw secrets are never returned.
|
|
1297
1298
|
*
|
|
1298
1299
|
*/
|
|
1299
|
-
static
|
|
1300
|
-
return (options
|
|
1301
|
-
url: "/v1/
|
|
1300
|
+
static listApiKeys(options) {
|
|
1301
|
+
return (options?.client ?? client).get({
|
|
1302
|
+
url: "/v1/api-keys",
|
|
1302
1303
|
...options
|
|
1303
1304
|
});
|
|
1304
1305
|
}
|
|
1305
1306
|
/**
|
|
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`.
|
|
1307
|
+
* Create an API key
|
|
1313
1308
|
*
|
|
1314
|
-
*
|
|
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.
|
|
1315
1311
|
*
|
|
1316
1312
|
*/
|
|
1317
|
-
static
|
|
1313
|
+
static createApiKey(options) {
|
|
1318
1314
|
return (options.client ?? client).post({
|
|
1319
|
-
url: "/v1/
|
|
1315
|
+
url: "/v1/api-keys",
|
|
1320
1316
|
...options,
|
|
1321
1317
|
headers: {
|
|
1322
1318
|
"Content-Type": "application/json",
|
|
@@ -1325,107 +1321,103 @@ var Generations = class {
|
|
|
1325
1321
|
});
|
|
1326
1322
|
}
|
|
1327
1323
|
/**
|
|
1328
|
-
*
|
|
1329
|
-
*
|
|
1330
|
-
* Returns one generation record. Flat rather than nested under the agent, because the ids that need resolving arrive on their own — a session reply carries a `generation_id` with no agent in hand.
|
|
1331
|
-
* A generation belonging to another project responds `404`, not `403` — the API never confirms that an id exists elsewhere.
|
|
1324
|
+
* Revoke an API key
|
|
1332
1325
|
*
|
|
1326
|
+
* Revokes an API key immediately. Subsequent use returns 401.
|
|
1333
1327
|
*/
|
|
1334
|
-
static
|
|
1335
|
-
return (options.client ?? client).
|
|
1336
|
-
url: "/v1/
|
|
1328
|
+
static deleteApiKey(options) {
|
|
1329
|
+
return (options.client ?? client).delete({
|
|
1330
|
+
url: "/v1/api-keys/{api_key_id}",
|
|
1337
1331
|
...options
|
|
1338
1332
|
});
|
|
1339
1333
|
}
|
|
1340
1334
|
/**
|
|
1341
|
-
*
|
|
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.
|
|
1335
|
+
* Get an API key
|
|
1348
1336
|
*
|
|
1337
|
+
* Returns metadata for an API key. The raw secret is never returned after creation.
|
|
1349
1338
|
*/
|
|
1350
|
-
static
|
|
1351
|
-
return (options.client ?? client).
|
|
1352
|
-
url: "/v1/
|
|
1339
|
+
static getApiKey(options) {
|
|
1340
|
+
return (options.client ?? client).get({
|
|
1341
|
+
url: "/v1/api-keys/{api_key_id}",
|
|
1353
1342
|
...options
|
|
1354
1343
|
});
|
|
1355
1344
|
}
|
|
1356
1345
|
/**
|
|
1357
|
-
*
|
|
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`.
|
|
1346
|
+
* Update an API key
|
|
1363
1347
|
*
|
|
1348
|
+
* Rename an API key or replace its capability set. The scope (project vs account) is immutable.
|
|
1364
1349
|
*/
|
|
1365
|
-
static
|
|
1366
|
-
return (options.client ?? client).
|
|
1367
|
-
url: "/v1/
|
|
1368
|
-
...options
|
|
1350
|
+
static updateApiKey(options) {
|
|
1351
|
+
return (options.client ?? client).patch({
|
|
1352
|
+
url: "/v1/api-keys/{api_key_id}",
|
|
1353
|
+
...options,
|
|
1354
|
+
headers: {
|
|
1355
|
+
"Content-Type": "application/json",
|
|
1356
|
+
...options.headers
|
|
1357
|
+
}
|
|
1369
1358
|
});
|
|
1370
1359
|
}
|
|
1371
|
-
};
|
|
1372
|
-
var Knowledge = class {
|
|
1373
1360
|
/**
|
|
1374
|
-
*
|
|
1361
|
+
* Rotate an API key
|
|
1362
|
+
*
|
|
1363
|
+
* Issues a new secret for the same key record (same id, scope and capabilities) and invalidates the previous secret. The new raw `key` is returned only in this response.
|
|
1375
1364
|
*
|
|
1376
|
-
* Lists the knowledge collections in the project.
|
|
1377
1365
|
*/
|
|
1378
|
-
static
|
|
1379
|
-
return (options.client ?? client).
|
|
1380
|
-
url: "/v1/
|
|
1366
|
+
static rotateApiKey(options) {
|
|
1367
|
+
return (options.client ?? client).post({
|
|
1368
|
+
url: "/v1/api-keys/{api_key_id}:rotate",
|
|
1381
1369
|
...options
|
|
1382
1370
|
});
|
|
1383
1371
|
}
|
|
1372
|
+
};
|
|
1373
|
+
var Assistant = class {
|
|
1384
1374
|
/**
|
|
1385
|
-
*
|
|
1375
|
+
* List linked identities
|
|
1386
1376
|
*
|
|
1387
|
-
*
|
|
1377
|
+
* Lists the caller's assistant grants — one per channel identity that may operate their account. Grants belong to the account, so this is the caller's own set regardless of which projects they own.
|
|
1388
1378
|
*
|
|
1389
1379
|
*/
|
|
1390
|
-
static
|
|
1391
|
-
return (options
|
|
1392
|
-
url: "/v1/
|
|
1393
|
-
...options
|
|
1394
|
-
headers: {
|
|
1395
|
-
"Content-Type": "application/json",
|
|
1396
|
-
...options.headers
|
|
1397
|
-
}
|
|
1380
|
+
static listAssistantGrants(options) {
|
|
1381
|
+
return (options?.client ?? client).get({
|
|
1382
|
+
url: "/v1/assistant/grants",
|
|
1383
|
+
...options
|
|
1398
1384
|
});
|
|
1399
1385
|
}
|
|
1400
1386
|
/**
|
|
1401
|
-
*
|
|
1387
|
+
* Revoke a linked identity
|
|
1402
1388
|
*
|
|
1403
|
-
*
|
|
1389
|
+
* Revokes the grant, disabling the Assistant for that identity. The grant is resolved on every inbound message, so the next one from that identity is refused before the agent is invoked — revocation is immediate, not eventual. The identity is free to link again afterwards.
|
|
1404
1390
|
*
|
|
1405
1391
|
*/
|
|
1406
|
-
static
|
|
1392
|
+
static revokeAssistantGrant(options) {
|
|
1407
1393
|
return (options.client ?? client).delete({
|
|
1408
|
-
url: "/v1/
|
|
1394
|
+
url: "/v1/assistant/grants/{grant_id}",
|
|
1409
1395
|
...options
|
|
1410
1396
|
});
|
|
1411
1397
|
}
|
|
1412
1398
|
/**
|
|
1413
|
-
*
|
|
1399
|
+
* Resolve a pending link
|
|
1400
|
+
*
|
|
1401
|
+
* Resolves a link token **without consuming it**, so the confirmation screen can name the identity being linked ("@user on Discord") before anyone commits to it. Naming it is what makes a link pasted into the wrong hands fail the human check as well as the server-side binding.
|
|
1402
|
+
* Reading is deliberately separate from redeeming: a single-use nonce must not be burned by a link preview, a URL scanner or a browser prefetch.
|
|
1403
|
+
*
|
|
1414
1404
|
*/
|
|
1415
|
-
static
|
|
1405
|
+
static previewAssistantLink(options) {
|
|
1416
1406
|
return (options.client ?? client).get({
|
|
1417
|
-
url: "/v1/
|
|
1407
|
+
url: "/v1/assistant/link",
|
|
1418
1408
|
...options
|
|
1419
1409
|
});
|
|
1420
1410
|
}
|
|
1421
1411
|
/**
|
|
1422
|
-
*
|
|
1412
|
+
* Redeem a link token
|
|
1413
|
+
*
|
|
1414
|
+
* Redeems a link token and creates the grant, binding the channel identity the token carries to the authenticated account. The identity is read from the token server-side — nothing in this request can point the link at a different one.
|
|
1415
|
+
* The token is the idempotency key: it is single-use, so a replay of this request fails rather than creating a second grant.
|
|
1423
1416
|
*
|
|
1424
|
-
* Rename the collection or edit its description. At least one field is required.
|
|
1425
1417
|
*/
|
|
1426
|
-
static
|
|
1427
|
-
return (options.client ?? client).
|
|
1428
|
-
url: "/v1/
|
|
1418
|
+
static redeemAssistantLink(options) {
|
|
1419
|
+
return (options.client ?? client).post({
|
|
1420
|
+
url: "/v1/assistant/link",
|
|
1429
1421
|
...options,
|
|
1430
1422
|
headers: {
|
|
1431
1423
|
"Content-Type": "application/json",
|
|
@@ -1433,15 +1425,17 @@ var Knowledge = class {
|
|
|
1433
1425
|
}
|
|
1434
1426
|
});
|
|
1435
1427
|
}
|
|
1428
|
+
};
|
|
1429
|
+
var Auth = class {
|
|
1436
1430
|
/**
|
|
1437
|
-
*
|
|
1431
|
+
* Email a sign-in code
|
|
1438
1432
|
*
|
|
1439
|
-
*
|
|
1433
|
+
* Emails a short numeric code to the address. Always responds 200 with the same body whether or not the address has an account, so it never leaks existence. A first-time address gets an account on its first successful verification, so this is both sign-up and log-in. Issuing a code invalidates any previous one for the same address.
|
|
1440
1434
|
*
|
|
1441
1435
|
*/
|
|
1442
|
-
static
|
|
1436
|
+
static requestSignInCode(options) {
|
|
1443
1437
|
return (options.client ?? client).post({
|
|
1444
|
-
url: "/v1/
|
|
1438
|
+
url: "/v1/auth/code",
|
|
1445
1439
|
...options,
|
|
1446
1440
|
headers: {
|
|
1447
1441
|
"Content-Type": "application/json",
|
|
@@ -1450,29 +1444,30 @@ var Knowledge = class {
|
|
|
1450
1444
|
});
|
|
1451
1445
|
}
|
|
1452
1446
|
/**
|
|
1453
|
-
*
|
|
1447
|
+
* Redeem a sign-in code
|
|
1448
|
+
*
|
|
1449
|
+
* Exchanges an emailed code for a session, creating the account if the address is new. The code is single-use and short-lived. A code is destroyed after too many wrong guesses, since six digits is small enough to guess given unlimited attempts — the client must then request a new one rather than retry.
|
|
1454
1450
|
*
|
|
1455
|
-
* Lists the documents in the collection, with their ingestion status.
|
|
1456
1451
|
*/
|
|
1457
|
-
static
|
|
1458
|
-
return (options.client ?? client).
|
|
1459
|
-
url: "/v1/
|
|
1460
|
-
...options
|
|
1452
|
+
static verifySignInCode(options) {
|
|
1453
|
+
return (options.client ?? client).post({
|
|
1454
|
+
url: "/v1/auth/code/verify",
|
|
1455
|
+
...options,
|
|
1456
|
+
headers: {
|
|
1457
|
+
"Content-Type": "application/json",
|
|
1458
|
+
...options.headers
|
|
1459
|
+
}
|
|
1461
1460
|
});
|
|
1462
1461
|
}
|
|
1463
1462
|
/**
|
|
1464
|
-
*
|
|
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.
|
|
1463
|
+
* Refresh a session
|
|
1469
1464
|
*
|
|
1470
|
-
*
|
|
1465
|
+
* Exchanges a valid refresh token for a new access JWT and a rotated refresh token, taken from the body or from the `refresh_token` cookie set at sign-in — a browser sends an empty body and the cookie carries the credential. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection), except within a few seconds of the rotation, where it is treated as two tabs racing on one cookie and rotated again.
|
|
1471
1466
|
*
|
|
1472
1467
|
*/
|
|
1473
|
-
static
|
|
1468
|
+
static refreshSession(options) {
|
|
1474
1469
|
return (options.client ?? client).post({
|
|
1475
|
-
url: "/v1/
|
|
1470
|
+
url: "/v1/auth/refresh",
|
|
1476
1471
|
...options,
|
|
1477
1472
|
headers: {
|
|
1478
1473
|
"Content-Type": "application/json",
|
|
@@ -1481,73 +1476,79 @@ var Knowledge = class {
|
|
|
1481
1476
|
});
|
|
1482
1477
|
}
|
|
1483
1478
|
/**
|
|
1484
|
-
*
|
|
1479
|
+
* Log out
|
|
1480
|
+
*
|
|
1481
|
+
* Revokes the current refresh token (and its rotation family) and clears the `refresh_token` cookie. Pass `all: true` to revoke every active session for the user.
|
|
1482
|
+
*
|
|
1485
1483
|
*/
|
|
1486
|
-
static
|
|
1487
|
-
return (options
|
|
1488
|
-
url: "/v1/
|
|
1489
|
-
...options
|
|
1484
|
+
static logout(options) {
|
|
1485
|
+
return (options?.client ?? client).post({
|
|
1486
|
+
url: "/v1/auth/logout",
|
|
1487
|
+
...options,
|
|
1488
|
+
headers: {
|
|
1489
|
+
"Content-Type": "application/json",
|
|
1490
|
+
...options?.headers
|
|
1491
|
+
}
|
|
1490
1492
|
});
|
|
1491
1493
|
}
|
|
1494
|
+
};
|
|
1495
|
+
var Conversations = class {
|
|
1492
1496
|
/**
|
|
1493
|
-
*
|
|
1497
|
+
* List conversations
|
|
1494
1498
|
*
|
|
1495
|
-
* Returns the
|
|
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.
|
|
1496
1500
|
*/
|
|
1497
|
-
static
|
|
1501
|
+
static listConversations(options) {
|
|
1498
1502
|
return (options.client ?? client).get({
|
|
1499
|
-
url: "/v1/projects/{project_id}/
|
|
1503
|
+
url: "/v1/projects/{project_id}/conversations",
|
|
1500
1504
|
...options
|
|
1501
1505
|
});
|
|
1502
1506
|
}
|
|
1503
1507
|
/**
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
*
|
|
1508
|
+
* Create a conversation
|
|
1509
|
+
*
|
|
1510
|
+
* Creates a new conversation. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
|
|
1511
|
+
*/
|
|
1512
|
+
static createConversation(options) {
|
|
1513
|
+
return (options.client ?? client).post({
|
|
1514
|
+
url: "/v1/projects/{project_id}/conversations",
|
|
1515
|
+
...options,
|
|
1516
|
+
headers: {
|
|
1517
|
+
"Content-Type": "application/json",
|
|
1518
|
+
...options.headers
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Delete a conversation
|
|
1507
1524
|
*
|
|
1525
|
+
* Deletes a conversation by its ID
|
|
1508
1526
|
*/
|
|
1509
|
-
static
|
|
1510
|
-
return (options.client ?? client).
|
|
1511
|
-
url: "/v1/projects/{project_id}/
|
|
1527
|
+
static deleteConversation(options) {
|
|
1528
|
+
return (options.client ?? client).delete({
|
|
1529
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1512
1530
|
...options
|
|
1513
1531
|
});
|
|
1514
1532
|
}
|
|
1515
1533
|
/**
|
|
1516
|
-
*
|
|
1534
|
+
* Get a conversation by ID
|
|
1517
1535
|
*
|
|
1518
|
-
*
|
|
1536
|
+
* Returns a conversation by its ID
|
|
1519
1537
|
*/
|
|
1520
|
-
static
|
|
1538
|
+
static getConversation(options) {
|
|
1521
1539
|
return (options.client ?? client).get({
|
|
1522
|
-
url: "/v1/projects/{project_id}/
|
|
1540
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1523
1541
|
...options
|
|
1524
1542
|
});
|
|
1525
1543
|
}
|
|
1526
1544
|
/**
|
|
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.
|
|
1545
|
+
* Update a conversation
|
|
1546
1546
|
*
|
|
1547
|
+
* Updates the status of a conversation
|
|
1547
1548
|
*/
|
|
1548
|
-
static
|
|
1549
|
-
return (options.client ?? client).
|
|
1550
|
-
url: "/v1/projects/{project_id}/
|
|
1549
|
+
static updateConversation(options) {
|
|
1550
|
+
return (options.client ?? client).patch({
|
|
1551
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1551
1552
|
...options,
|
|
1552
1553
|
headers: {
|
|
1553
1554
|
"Content-Type": "application/json",
|
|
@@ -1556,35 +1557,24 @@ var Knowledge = class {
|
|
|
1556
1557
|
});
|
|
1557
1558
|
}
|
|
1558
1559
|
/**
|
|
1559
|
-
*
|
|
1560
|
+
* List conversation messages
|
|
1560
1561
|
*
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1563
|
-
*/
|
|
1564
|
-
static deleteKnowledgeConverter(options) {
|
|
1565
|
-
return (options.client ?? client).delete({
|
|
1566
|
-
url: "/v1/projects/{project_id}/knowledge/converters/{converter_id}",
|
|
1567
|
-
...options
|
|
1568
|
-
});
|
|
1569
|
-
}
|
|
1570
|
-
/**
|
|
1571
|
-
* Get a converter
|
|
1562
|
+
* Returns all messages (documents) attached to a conversation, ordered by position
|
|
1572
1563
|
*/
|
|
1573
|
-
static
|
|
1564
|
+
static listConversationMessages(options) {
|
|
1574
1565
|
return (options.client ?? client).get({
|
|
1575
|
-
url: "/v1/projects/{project_id}/
|
|
1566
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages",
|
|
1576
1567
|
...options
|
|
1577
1568
|
});
|
|
1578
1569
|
}
|
|
1579
1570
|
/**
|
|
1580
|
-
*
|
|
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.
|
|
1571
|
+
* Add a message to a conversation
|
|
1583
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.
|
|
1584
1574
|
*/
|
|
1585
|
-
static
|
|
1586
|
-
return (options.client ?? client).
|
|
1587
|
-
url: "/v1/projects/{project_id}/
|
|
1575
|
+
static addConversationMessage(options) {
|
|
1576
|
+
return (options.client ?? client).post({
|
|
1577
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages",
|
|
1588
1578
|
...options,
|
|
1589
1579
|
headers: {
|
|
1590
1580
|
"Content-Type": "application/json",
|
|
@@ -1592,50 +1582,60 @@ var Knowledge = class {
|
|
|
1592
1582
|
}
|
|
1593
1583
|
});
|
|
1594
1584
|
}
|
|
1595
|
-
};
|
|
1596
|
-
var Models = class {
|
|
1597
1585
|
/**
|
|
1598
|
-
*
|
|
1586
|
+
* Generate the next message in a conversation
|
|
1599
1587
|
*
|
|
1600
|
-
*
|
|
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`.
|
|
1601
1597
|
*
|
|
1602
1598
|
*/
|
|
1603
|
-
static
|
|
1604
|
-
return (options
|
|
1605
|
-
url: "/v1/
|
|
1606
|
-
...options
|
|
1599
|
+
static generateConversationMessage(options) {
|
|
1600
|
+
return (options.client ?? client).post({
|
|
1601
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/generate",
|
|
1602
|
+
...options,
|
|
1603
|
+
headers: {
|
|
1604
|
+
"Content-Type": "application/json",
|
|
1605
|
+
...options.headers
|
|
1606
|
+
}
|
|
1607
1607
|
});
|
|
1608
1608
|
}
|
|
1609
1609
|
/**
|
|
1610
|
-
*
|
|
1610
|
+
* Remove a message from a conversation
|
|
1611
|
+
*
|
|
1612
|
+
* Removes a document from a conversation
|
|
1611
1613
|
*/
|
|
1612
|
-
static
|
|
1613
|
-
return (options.client ?? client).
|
|
1614
|
-
url: "/v1/
|
|
1614
|
+
static removeConversationMessage(options) {
|
|
1615
|
+
return (options.client ?? client).delete({
|
|
1616
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages/{document_id}",
|
|
1615
1617
|
...options
|
|
1616
1618
|
});
|
|
1617
1619
|
}
|
|
1618
|
-
};
|
|
1619
|
-
var Orchestrations = class {
|
|
1620
1620
|
/**
|
|
1621
|
-
*
|
|
1621
|
+
* Get conversation tags
|
|
1622
1622
|
*
|
|
1623
|
-
*
|
|
1623
|
+
* Returns all tags attached to the conversation
|
|
1624
1624
|
*/
|
|
1625
|
-
static
|
|
1625
|
+
static getConversationTags(options) {
|
|
1626
1626
|
return (options.client ?? client).get({
|
|
1627
|
-
url: "/v1/projects/{project_id}/
|
|
1627
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1628
1628
|
...options
|
|
1629
1629
|
});
|
|
1630
1630
|
}
|
|
1631
1631
|
/**
|
|
1632
|
-
*
|
|
1632
|
+
* Merge conversation tags
|
|
1633
1633
|
*
|
|
1634
|
-
*
|
|
1634
|
+
* Merges provided tags with existing tags
|
|
1635
1635
|
*/
|
|
1636
|
-
static
|
|
1637
|
-
return (options.client ?? client).
|
|
1638
|
-
url: "/v1/projects/{project_id}/
|
|
1636
|
+
static mergeConversationTags(options) {
|
|
1637
|
+
return (options.client ?? client).patch({
|
|
1638
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1639
1639
|
...options,
|
|
1640
1640
|
headers: {
|
|
1641
1641
|
"Content-Type": "application/json",
|
|
@@ -1644,14 +1644,13 @@ var Orchestrations = class {
|
|
|
1644
1644
|
});
|
|
1645
1645
|
}
|
|
1646
1646
|
/**
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
* Statically validates a graph without persisting anything — the same checks `create`/`update` enforce (unique node ids, edges reference existing nodes, the graph is acyclic unless it contains a loop node, every `input_mapping` reference resolves). Returns blocking `errors` and non-blocking `warnings`.
|
|
1647
|
+
* Replace conversation tags
|
|
1650
1648
|
*
|
|
1649
|
+
* Replaces all tags on the conversation with the provided tags
|
|
1651
1650
|
*/
|
|
1652
|
-
static
|
|
1653
|
-
return (options.client ?? client).
|
|
1654
|
-
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",
|
|
1655
1654
|
...options,
|
|
1656
1655
|
headers: {
|
|
1657
1656
|
"Content-Type": "application/json",
|
|
@@ -1659,37 +1658,41 @@ var Orchestrations = class {
|
|
|
1659
1658
|
}
|
|
1660
1659
|
});
|
|
1661
1660
|
}
|
|
1661
|
+
};
|
|
1662
|
+
var Generations = class {
|
|
1662
1663
|
/**
|
|
1663
|
-
*
|
|
1664
|
+
* List generations
|
|
1665
|
+
*
|
|
1666
|
+
* 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).
|
|
1664
1667
|
*
|
|
1665
|
-
* Deletes the orchestration definition and all of its runs.
|
|
1666
1668
|
*/
|
|
1667
|
-
static
|
|
1668
|
-
return (options.client ?? client).
|
|
1669
|
-
url: "/v1/projects/{project_id}/
|
|
1669
|
+
static listGenerations(options) {
|
|
1670
|
+
return (options.client ?? client).get({
|
|
1671
|
+
url: "/v1/projects/{project_id}/generations",
|
|
1670
1672
|
...options
|
|
1671
1673
|
});
|
|
1672
1674
|
}
|
|
1673
1675
|
/**
|
|
1674
|
-
* Get
|
|
1676
|
+
* Get a generation
|
|
1675
1677
|
*
|
|
1676
|
-
* Returns
|
|
1678
|
+
* 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).
|
|
1677
1679
|
*
|
|
1678
1680
|
*/
|
|
1679
|
-
static
|
|
1681
|
+
static getGeneration(options) {
|
|
1680
1682
|
return (options.client ?? client).get({
|
|
1681
|
-
url: "/v1/projects/{project_id}/
|
|
1683
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1682
1684
|
...options
|
|
1683
1685
|
});
|
|
1684
1686
|
}
|
|
1685
1687
|
/**
|
|
1686
|
-
* Update
|
|
1688
|
+
* Update generation metadata
|
|
1689
|
+
*
|
|
1690
|
+
* 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.
|
|
1687
1691
|
*
|
|
1688
|
-
* Partially updates an orchestration's definition.
|
|
1689
1692
|
*/
|
|
1690
|
-
static
|
|
1693
|
+
static updateGeneration(options) {
|
|
1691
1694
|
return (options.client ?? client).patch({
|
|
1692
|
-
url: "/v1/projects/{project_id}/
|
|
1695
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1693
1696
|
...options,
|
|
1694
1697
|
headers: {
|
|
1695
1698
|
"Content-Type": "application/json",
|
|
@@ -1698,73 +1701,97 @@ var Orchestrations = class {
|
|
|
1698
1701
|
});
|
|
1699
1702
|
}
|
|
1700
1703
|
/**
|
|
1701
|
-
*
|
|
1704
|
+
* Purge generation content
|
|
1702
1705
|
*
|
|
1703
|
-
*
|
|
1706
|
+
* Clears the generation's content — `metadata`, `error`, `extraction`, and the internal recovery state of a paused run — and stamps `content_redacted_at`.
|
|
1707
|
+
*
|
|
1708
|
+
* 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.
|
|
1709
|
+
*
|
|
1710
|
+
* 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.
|
|
1711
|
+
*
|
|
1712
|
+
* Idempotent — purging an already-purged generation succeeds and leaves the original `content_redacted_at` in place.
|
|
1704
1713
|
*
|
|
1705
1714
|
*/
|
|
1706
|
-
static
|
|
1707
|
-
return (options.client ?? client).
|
|
1708
|
-
url: "/v1/projects/{project_id}/
|
|
1715
|
+
static purgeGenerationContent(options) {
|
|
1716
|
+
return (options.client ?? client).delete({
|
|
1717
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}/content",
|
|
1709
1718
|
...options
|
|
1710
1719
|
});
|
|
1711
1720
|
}
|
|
1712
1721
|
/**
|
|
1713
|
-
*
|
|
1722
|
+
* Get a generation's transcript
|
|
1723
|
+
*
|
|
1724
|
+
* 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.
|
|
1725
|
+
*
|
|
1726
|
+
* 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.
|
|
1727
|
+
*
|
|
1728
|
+
* 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.
|
|
1714
1729
|
*
|
|
1715
|
-
* Starts a new run of the orchestration named by `orchestration_id`, which must belong to this project. By default the run executes durably in the background and this returns immediately with `status: "queued"`; pass `wait: true` to block until the run reaches a terminal or `awaiting_input` state instead.
|
|
1716
1730
|
*/
|
|
1717
|
-
static
|
|
1718
|
-
return (options.client ?? client).
|
|
1719
|
-
url: "/v1/projects/{project_id}/
|
|
1720
|
-
...options
|
|
1721
|
-
headers: {
|
|
1722
|
-
"Content-Type": "application/json",
|
|
1723
|
-
...options.headers
|
|
1724
|
-
}
|
|
1731
|
+
static getGenerationTranscript(options) {
|
|
1732
|
+
return (options.client ?? client).get({
|
|
1733
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}/transcript",
|
|
1734
|
+
...options
|
|
1725
1735
|
});
|
|
1726
1736
|
}
|
|
1737
|
+
};
|
|
1738
|
+
var ModelRoutes = class {
|
|
1727
1739
|
/**
|
|
1728
|
-
*
|
|
1740
|
+
* List model routes
|
|
1729
1741
|
*
|
|
1730
|
-
* Returns the
|
|
1742
|
+
* Returns the model routes defined in a project
|
|
1731
1743
|
*/
|
|
1732
|
-
static
|
|
1744
|
+
static listModelRoutes(options) {
|
|
1733
1745
|
return (options.client ?? client).get({
|
|
1734
|
-
url: "/v1/projects/{project_id}/
|
|
1746
|
+
url: "/v1/projects/{project_id}/model-routes",
|
|
1735
1747
|
...options
|
|
1736
1748
|
});
|
|
1737
1749
|
}
|
|
1738
1750
|
/**
|
|
1739
|
-
*
|
|
1751
|
+
* Create a model route
|
|
1740
1752
|
*
|
|
1741
|
-
*
|
|
1753
|
+
* 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.
|
|
1742
1754
|
*/
|
|
1743
|
-
static
|
|
1755
|
+
static createModelRoute(options) {
|
|
1744
1756
|
return (options.client ?? client).post({
|
|
1745
|
-
url: "/v1/projects/{project_id}/
|
|
1757
|
+
url: "/v1/projects/{project_id}/model-routes",
|
|
1758
|
+
...options,
|
|
1759
|
+
headers: {
|
|
1760
|
+
"Content-Type": "application/json",
|
|
1761
|
+
...options.headers
|
|
1762
|
+
}
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Delete a model route
|
|
1767
|
+
*
|
|
1768
|
+
* 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.
|
|
1769
|
+
*/
|
|
1770
|
+
static deleteModelRoute(options) {
|
|
1771
|
+
return (options.client ?? client).delete({
|
|
1772
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1746
1773
|
...options
|
|
1747
1774
|
});
|
|
1748
1775
|
}
|
|
1749
1776
|
/**
|
|
1750
|
-
*
|
|
1777
|
+
* Get a model route
|
|
1751
1778
|
*
|
|
1752
|
-
*
|
|
1779
|
+
* Returns a specific model route
|
|
1753
1780
|
*/
|
|
1754
|
-
static
|
|
1755
|
-
return (options.client ?? client).
|
|
1756
|
-
url: "/v1/projects/{project_id}/
|
|
1781
|
+
static getModelRoute(options) {
|
|
1782
|
+
return (options.client ?? client).get({
|
|
1783
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1757
1784
|
...options
|
|
1758
1785
|
});
|
|
1759
1786
|
}
|
|
1760
1787
|
/**
|
|
1761
|
-
*
|
|
1788
|
+
* Update a model route
|
|
1762
1789
|
*
|
|
1763
|
-
*
|
|
1790
|
+
* Updates a model route's name, targets, retry classes, or breaker configuration. Omitted fields are left unchanged.
|
|
1764
1791
|
*/
|
|
1765
|
-
static
|
|
1766
|
-
return (options.client ?? client).
|
|
1767
|
-
url: "/v1/projects/{project_id}/
|
|
1792
|
+
static updateModelRoute(options) {
|
|
1793
|
+
return (options.client ?? client).put({
|
|
1794
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1768
1795
|
...options,
|
|
1769
1796
|
headers: {
|
|
1770
1797
|
"Content-Type": "application/json",
|
|
@@ -1777,7 +1804,8 @@ var Projects = class {
|
|
|
1777
1804
|
/**
|
|
1778
1805
|
* List projects
|
|
1779
1806
|
*
|
|
1780
|
-
* Lists projects
|
|
1807
|
+
* Lists the projects the caller is a member of. A project-scoped API key lists only its own project.
|
|
1808
|
+
*
|
|
1781
1809
|
*/
|
|
1782
1810
|
static listProjects(options) {
|
|
1783
1811
|
return (options?.client ?? client).get({
|
|
@@ -1804,6 +1832,7 @@ var Projects = class {
|
|
|
1804
1832
|
* Delete a project
|
|
1805
1833
|
*
|
|
1806
1834
|
* 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.
|
|
1835
|
+
* Requires the `owner` role — an `admin` runs the project day to day, but destroying it is the billing owner's call.
|
|
1807
1836
|
*
|
|
1808
1837
|
*/
|
|
1809
1838
|
static deleteProject(options) {
|
|
@@ -1815,8 +1844,8 @@ var Projects = class {
|
|
|
1815
1844
|
/**
|
|
1816
1845
|
* Get a project
|
|
1817
1846
|
*
|
|
1818
|
-
* Returns one project. An id you
|
|
1819
|
-
* `403` is reserved for the
|
|
1847
|
+
* 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.
|
|
1848
|
+
* `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.
|
|
1820
1849
|
*
|
|
1821
1850
|
*/
|
|
1822
1851
|
static getProject(options) {
|
|
@@ -1829,6 +1858,7 @@ var Projects = class {
|
|
|
1829
1858
|
* Update a project
|
|
1830
1859
|
*
|
|
1831
1860
|
* 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.
|
|
1861
|
+
* Requires the `admin` role in the project (an `owner` has it too).
|
|
1832
1862
|
* 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.
|
|
1833
1863
|
*
|
|
1834
1864
|
*/
|
|
@@ -1843,6 +1873,19 @@ var Projects = class {
|
|
|
1843
1873
|
});
|
|
1844
1874
|
}
|
|
1845
1875
|
/**
|
|
1876
|
+
* List project members
|
|
1877
|
+
*
|
|
1878
|
+
* 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.
|
|
1879
|
+
* Read-only for now — adding and removing members arrives with the invitation flow, since an invitee may not have an account yet.
|
|
1880
|
+
*
|
|
1881
|
+
*/
|
|
1882
|
+
static listProjectMembers(options) {
|
|
1883
|
+
return (options.client ?? client).get({
|
|
1884
|
+
url: "/v1/projects/{project_id}/members",
|
|
1885
|
+
...options
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1846
1889
|
* Get per-project usage
|
|
1847
1890
|
*
|
|
1848
1891
|
* 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.
|
|
@@ -1857,27 +1900,26 @@ var Projects = class {
|
|
|
1857
1900
|
});
|
|
1858
1901
|
}
|
|
1859
1902
|
};
|
|
1860
|
-
var
|
|
1903
|
+
var Secrets = class {
|
|
1861
1904
|
/**
|
|
1862
|
-
* List
|
|
1905
|
+
* List secrets
|
|
1863
1906
|
*
|
|
1864
|
-
*
|
|
1907
|
+
* Returns a list of secrets for a project
|
|
1865
1908
|
*/
|
|
1866
|
-
static
|
|
1909
|
+
static listSecrets(options) {
|
|
1867
1910
|
return (options.client ?? client).get({
|
|
1868
|
-
url: "/v1/projects/{project_id}/
|
|
1911
|
+
url: "/v1/projects/{project_id}/secrets",
|
|
1869
1912
|
...options
|
|
1870
1913
|
});
|
|
1871
1914
|
}
|
|
1872
1915
|
/**
|
|
1873
|
-
*
|
|
1874
|
-
*
|
|
1875
|
-
* 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.
|
|
1916
|
+
* Create a secret
|
|
1876
1917
|
*
|
|
1918
|
+
* Creates a new encrypted secret in a project
|
|
1877
1919
|
*/
|
|
1878
|
-
static
|
|
1920
|
+
static createSecret(options) {
|
|
1879
1921
|
return (options.client ?? client).post({
|
|
1880
|
-
url: "/v1/projects/{project_id}/
|
|
1922
|
+
url: "/v1/projects/{project_id}/secrets",
|
|
1881
1923
|
...options,
|
|
1882
1924
|
headers: {
|
|
1883
1925
|
"Content-Type": "application/json",
|
|
@@ -1886,35 +1928,35 @@ var Providers = class {
|
|
|
1886
1928
|
});
|
|
1887
1929
|
}
|
|
1888
1930
|
/**
|
|
1889
|
-
* Delete a
|
|
1890
|
-
*
|
|
1891
|
-
* 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.
|
|
1931
|
+
* Delete a secret
|
|
1892
1932
|
*
|
|
1933
|
+
* Deletes a secret
|
|
1893
1934
|
*/
|
|
1894
|
-
static
|
|
1935
|
+
static deleteSecret(options) {
|
|
1895
1936
|
return (options.client ?? client).delete({
|
|
1896
|
-
url: "/v1/projects/{project_id}/
|
|
1937
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1897
1938
|
...options
|
|
1898
1939
|
});
|
|
1899
1940
|
}
|
|
1900
1941
|
/**
|
|
1901
|
-
* Get a
|
|
1942
|
+
* Get a secret
|
|
1943
|
+
*
|
|
1944
|
+
* Returns a specific secret
|
|
1902
1945
|
*/
|
|
1903
|
-
static
|
|
1946
|
+
static getSecret(options) {
|
|
1904
1947
|
return (options.client ?? client).get({
|
|
1905
|
-
url: "/v1/projects/{project_id}/
|
|
1948
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1906
1949
|
...options
|
|
1907
1950
|
});
|
|
1908
1951
|
}
|
|
1909
1952
|
/**
|
|
1910
|
-
* Update a
|
|
1911
|
-
*
|
|
1912
|
-
* Change the model, name or base URL, or rotate the credentials (api_key). At least one field is required.
|
|
1953
|
+
* Update a secret
|
|
1913
1954
|
*
|
|
1955
|
+
* Updates a secret's name and/or value
|
|
1914
1956
|
*/
|
|
1915
|
-
static
|
|
1957
|
+
static updateSecret(options) {
|
|
1916
1958
|
return (options.client ?? client).patch({
|
|
1917
|
-
url: "/v1/projects/{project_id}/
|
|
1959
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1918
1960
|
...options,
|
|
1919
1961
|
headers: {
|
|
1920
1962
|
"Content-Type": "application/json",
|
|
@@ -1925,14 +1967,25 @@ var Providers = class {
|
|
|
1925
1967
|
};
|
|
1926
1968
|
var Sessions = class {
|
|
1927
1969
|
/**
|
|
1928
|
-
*
|
|
1970
|
+
* List sessions
|
|
1971
|
+
*
|
|
1972
|
+
* Returns sessions the caller can access, optionally filtered by agent, actor and status.
|
|
1973
|
+
*/
|
|
1974
|
+
static listSessions(options) {
|
|
1975
|
+
return (options.client ?? client).get({
|
|
1976
|
+
url: "/v1/projects/{project_id}/sessions",
|
|
1977
|
+
...options
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
/**
|
|
1981
|
+
* Create a session
|
|
1929
1982
|
*
|
|
1930
|
-
*
|
|
1983
|
+
* 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.
|
|
1931
1984
|
*
|
|
1932
1985
|
*/
|
|
1933
1986
|
static createSession(options) {
|
|
1934
1987
|
return (options.client ?? client).post({
|
|
1935
|
-
url: "/v1/projects/{project_id}/
|
|
1988
|
+
url: "/v1/projects/{project_id}/sessions",
|
|
1936
1989
|
...options,
|
|
1937
1990
|
headers: {
|
|
1938
1991
|
"Content-Type": "application/json",
|
|
@@ -1941,38 +1994,52 @@ var Sessions = class {
|
|
|
1941
1994
|
});
|
|
1942
1995
|
}
|
|
1943
1996
|
/**
|
|
1944
|
-
*
|
|
1997
|
+
* Delete a session
|
|
1945
1998
|
*
|
|
1946
|
-
*
|
|
1999
|
+
* 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.
|
|
1947
2000
|
*
|
|
1948
2001
|
*/
|
|
1949
|
-
static
|
|
1950
|
-
return (options.client ?? client).
|
|
1951
|
-
url: "/v1/projects/{project_id}/
|
|
2002
|
+
static deleteSession(options) {
|
|
2003
|
+
return (options.client ?? client).delete({
|
|
2004
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
1952
2005
|
...options
|
|
1953
2006
|
});
|
|
1954
2007
|
}
|
|
1955
2008
|
/**
|
|
1956
|
-
*
|
|
1957
|
-
*
|
|
1958
|
-
* 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.
|
|
2009
|
+
* Get a session
|
|
1959
2010
|
*
|
|
2011
|
+
* Returns details of a single session.
|
|
1960
2012
|
*/
|
|
1961
|
-
static
|
|
2013
|
+
static getSession(options) {
|
|
1962
2014
|
return (options.client ?? client).get({
|
|
1963
|
-
url: "/v1/projects/{project_id}/
|
|
2015
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
1964
2016
|
...options
|
|
1965
2017
|
});
|
|
1966
2018
|
}
|
|
1967
2019
|
/**
|
|
1968
|
-
*
|
|
2020
|
+
* Update a session
|
|
2021
|
+
*
|
|
2022
|
+
* Updates the session name and/or status.
|
|
2023
|
+
*/
|
|
2024
|
+
static updateSession(options) {
|
|
2025
|
+
return (options.client ?? client).patch({
|
|
2026
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
2027
|
+
...options,
|
|
2028
|
+
headers: {
|
|
2029
|
+
"Content-Type": "application/json",
|
|
2030
|
+
...options.headers
|
|
2031
|
+
}
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Add a user message
|
|
1969
2036
|
*
|
|
1970
|
-
*
|
|
2037
|
+
* 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.
|
|
1971
2038
|
*
|
|
1972
2039
|
*/
|
|
1973
2040
|
static addSessionMessage(options) {
|
|
1974
2041
|
return (options.client ?? client).post({
|
|
1975
|
-
url: "/v1/projects/{project_id}/
|
|
2042
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/messages",
|
|
1976
2043
|
...options,
|
|
1977
2044
|
headers: {
|
|
1978
2045
|
"Content-Type": "application/json",
|
|
@@ -1981,20 +2048,14 @@ var Sessions = class {
|
|
|
1981
2048
|
});
|
|
1982
2049
|
}
|
|
1983
2050
|
/**
|
|
1984
|
-
*
|
|
2051
|
+
* Trigger agent generation
|
|
1985
2052
|
*
|
|
1986
|
-
*
|
|
1987
|
-
*
|
|
1988
|
-
* Background by default: this returns `202` immediately and the turn runs on. The reply lands in the transcript, so poll [`GET /v1/projects/{project_id}/agents/{agent_id}/sessions/{session_id}/messages`](/docs/api/sessions/list-session-messages) for the assistant message, or read the session for its `status`.
|
|
1989
|
-
*
|
|
1990
|
-
* 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.
|
|
1991
|
-
*
|
|
1992
|
-
* `model` overrides the agent's default model for this turn only.
|
|
2053
|
+
* 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.
|
|
1993
2054
|
*
|
|
1994
2055
|
*/
|
|
1995
2056
|
static generateSessionResponse(options) {
|
|
1996
2057
|
return (options.client ?? client).post({
|
|
1997
|
-
url: "/v1/projects/{project_id}/
|
|
2058
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/generate",
|
|
1998
2059
|
...options,
|
|
1999
2060
|
headers: {
|
|
2000
2061
|
"Content-Type": "application/json",
|
|
@@ -2002,29 +2063,35 @@ var Sessions = class {
|
|
|
2002
2063
|
}
|
|
2003
2064
|
});
|
|
2004
2065
|
}
|
|
2005
|
-
};
|
|
2006
|
-
var Tasks = class {
|
|
2007
2066
|
/**
|
|
2008
|
-
*
|
|
2067
|
+
* Submit tool outputs
|
|
2009
2068
|
*
|
|
2010
|
-
*
|
|
2069
|
+
* 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.
|
|
2011
2070
|
*
|
|
2012
2071
|
*/
|
|
2013
|
-
static
|
|
2014
|
-
return (options.client ?? client).
|
|
2015
|
-
url: "/v1/projects/{project_id}/
|
|
2016
|
-
...options
|
|
2072
|
+
static submitSessionToolOutputs(options) {
|
|
2073
|
+
return (options.client ?? client).post({
|
|
2074
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tool-outputs",
|
|
2075
|
+
...options,
|
|
2076
|
+
headers: {
|
|
2077
|
+
"Content-Type": "application/json",
|
|
2078
|
+
...options.headers
|
|
2079
|
+
}
|
|
2017
2080
|
});
|
|
2018
2081
|
}
|
|
2019
2082
|
/**
|
|
2020
|
-
*
|
|
2083
|
+
* Fork a session
|
|
2021
2084
|
*
|
|
2022
|
-
*
|
|
2085
|
+
* Branches a new session from a point in this session's history: same context, different continuation.
|
|
2086
|
+
*
|
|
2087
|
+
* 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.
|
|
2088
|
+
*
|
|
2089
|
+
* 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.
|
|
2023
2090
|
*
|
|
2024
2091
|
*/
|
|
2025
|
-
static
|
|
2092
|
+
static forkSession(options) {
|
|
2026
2093
|
return (options.client ?? client).post({
|
|
2027
|
-
url: "/v1/projects/{project_id}/
|
|
2094
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/fork",
|
|
2028
2095
|
...options,
|
|
2029
2096
|
headers: {
|
|
2030
2097
|
"Content-Type": "application/json",
|
|
@@ -2033,39 +2100,36 @@ var Tasks = class {
|
|
|
2033
2100
|
});
|
|
2034
2101
|
}
|
|
2035
2102
|
/**
|
|
2036
|
-
*
|
|
2103
|
+
* List a session's forks
|
|
2037
2104
|
*
|
|
2038
|
-
*
|
|
2105
|
+
* Returns the sessions forked directly from this one. One level of lineage: a fork of a fork is listed under its own parent.
|
|
2039
2106
|
*
|
|
2040
2107
|
*/
|
|
2041
|
-
static
|
|
2042
|
-
return (options.client ?? client).
|
|
2043
|
-
url: "/v1/projects/{project_id}/
|
|
2108
|
+
static listSessionForks(options) {
|
|
2109
|
+
return (options.client ?? client).get({
|
|
2110
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/forks",
|
|
2044
2111
|
...options
|
|
2045
2112
|
});
|
|
2046
2113
|
}
|
|
2047
2114
|
/**
|
|
2048
|
-
* Get
|
|
2115
|
+
* Get session tags
|
|
2049
2116
|
*
|
|
2050
|
-
*
|
|
2117
|
+
* Returns the session's tags object.
|
|
2051
2118
|
*/
|
|
2052
|
-
static
|
|
2119
|
+
static getSessionTags(options) {
|
|
2053
2120
|
return (options.client ?? client).get({
|
|
2054
|
-
url: "/v1/projects/{project_id}/
|
|
2121
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2055
2122
|
...options
|
|
2056
2123
|
});
|
|
2057
2124
|
}
|
|
2058
2125
|
/**
|
|
2059
|
-
*
|
|
2060
|
-
*
|
|
2061
|
-
* Edit the card's `title`, `assignee` or `payload`. At least one is required.
|
|
2062
|
-
* `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.
|
|
2063
|
-
* `state` and `board_id` are rejected — a card moves only through `:transition`, and it never changes boards.
|
|
2126
|
+
* Merge session tags
|
|
2064
2127
|
*
|
|
2128
|
+
* Merges the provided tags into the session's existing tags.
|
|
2065
2129
|
*/
|
|
2066
|
-
static
|
|
2130
|
+
static mergeSessionTags(options) {
|
|
2067
2131
|
return (options.client ?? client).patch({
|
|
2068
|
-
url: "/v1/projects/{project_id}/
|
|
2132
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2069
2133
|
...options,
|
|
2070
2134
|
headers: {
|
|
2071
2135
|
"Content-Type": "application/json",
|
|
@@ -2074,15 +2138,13 @@ var Tasks = class {
|
|
|
2074
2138
|
});
|
|
2075
2139
|
}
|
|
2076
2140
|
/**
|
|
2077
|
-
*
|
|
2078
|
-
*
|
|
2079
|
-
* 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.
|
|
2080
|
-
* 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.
|
|
2141
|
+
* Replace session tags
|
|
2081
2142
|
*
|
|
2143
|
+
* Replaces all tags on the session.
|
|
2082
2144
|
*/
|
|
2083
|
-
static
|
|
2084
|
-
return (options.client ?? client).
|
|
2085
|
-
url: "/v1/projects/{project_id}/
|
|
2145
|
+
static replaceSessionTags(options) {
|
|
2146
|
+
return (options.client ?? client).put({
|
|
2147
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2086
2148
|
...options,
|
|
2087
2149
|
headers: {
|
|
2088
2150
|
"Content-Type": "application/json",
|
|
@@ -2090,24 +2152,12 @@ var Tasks = class {
|
|
|
2090
2152
|
}
|
|
2091
2153
|
});
|
|
2092
2154
|
}
|
|
2093
|
-
/**
|
|
2094
|
-
* List the task's moves
|
|
2095
|
-
*
|
|
2096
|
-
* 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.
|
|
2097
|
-
*
|
|
2098
|
-
*/
|
|
2099
|
-
static listTaskTransitions(options) {
|
|
2100
|
-
return (options.client ?? client).get({
|
|
2101
|
-
url: "/v1/projects/{project_id}/tasks/{task_id}/transitions",
|
|
2102
|
-
...options
|
|
2103
|
-
});
|
|
2104
|
-
}
|
|
2105
2155
|
};
|
|
2106
2156
|
var Tools = class {
|
|
2107
2157
|
/**
|
|
2108
2158
|
* List tools
|
|
2109
2159
|
*
|
|
2110
|
-
*
|
|
2160
|
+
* Returns all tools in the project.
|
|
2111
2161
|
*/
|
|
2112
2162
|
static listTools(options) {
|
|
2113
2163
|
return (options.client ?? client).get({
|
|
@@ -2118,8 +2168,7 @@ var Tools = class {
|
|
|
2118
2168
|
/**
|
|
2119
2169
|
* Create a tool
|
|
2120
2170
|
*
|
|
2121
|
-
*
|
|
2122
|
-
*
|
|
2171
|
+
* Creates a new tool in the project.
|
|
2123
2172
|
*/
|
|
2124
2173
|
static createTool(options) {
|
|
2125
2174
|
return (options.client ?? client).post({
|
|
@@ -2134,8 +2183,7 @@ var Tools = class {
|
|
|
2134
2183
|
/**
|
|
2135
2184
|
* Delete a tool
|
|
2136
2185
|
*
|
|
2137
|
-
* Deletes
|
|
2138
|
-
*
|
|
2186
|
+
* Deletes a tool by ID.
|
|
2139
2187
|
*/
|
|
2140
2188
|
static deleteTool(options) {
|
|
2141
2189
|
return (options.client ?? client).delete({
|
|
@@ -2145,6 +2193,8 @@ var Tools = class {
|
|
|
2145
2193
|
}
|
|
2146
2194
|
/**
|
|
2147
2195
|
* Get a tool
|
|
2196
|
+
*
|
|
2197
|
+
* Returns a single tool by ID.
|
|
2148
2198
|
*/
|
|
2149
2199
|
static getTool(options) {
|
|
2150
2200
|
return (options.client ?? client).get({
|
|
@@ -2155,8 +2205,7 @@ var Tools = class {
|
|
|
2155
2205
|
/**
|
|
2156
2206
|
* Update a tool
|
|
2157
2207
|
*
|
|
2158
|
-
*
|
|
2159
|
-
*
|
|
2208
|
+
* Updates an existing tool.
|
|
2160
2209
|
*/
|
|
2161
2210
|
static updateTool(options) {
|
|
2162
2211
|
return (options.client ?? client).patch({
|
|
@@ -2168,107 +2217,17 @@ var Tools = class {
|
|
|
2168
2217
|
}
|
|
2169
2218
|
});
|
|
2170
2219
|
}
|
|
2171
|
-
};
|
|
2172
|
-
var Traces = class {
|
|
2173
|
-
/**
|
|
2174
|
-
* List traces
|
|
2175
|
-
*
|
|
2176
|
-
* Lists the project's execution traces, newest first.
|
|
2177
|
-
*/
|
|
2178
|
-
static listTraces(options) {
|
|
2179
|
-
return (options.client ?? client).get({
|
|
2180
|
-
url: "/v1/projects/{project_id}/traces",
|
|
2181
|
-
...options
|
|
2182
|
-
});
|
|
2183
|
-
}
|
|
2184
|
-
/**
|
|
2185
|
-
* Get a trace
|
|
2186
|
-
*
|
|
2187
|
-
* Returns one trace. A trace belonging to another project responds `404`, not `403` — the API never confirms that an id exists elsewhere.
|
|
2188
|
-
*
|
|
2189
|
-
*/
|
|
2190
|
-
static getTrace(options) {
|
|
2191
|
-
return (options.client ?? client).get({
|
|
2192
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}",
|
|
2193
|
-
...options
|
|
2194
|
-
});
|
|
2195
|
-
}
|
|
2196
|
-
/**
|
|
2197
|
-
* Get a trace tree
|
|
2198
|
-
*
|
|
2199
|
-
* Returns the whole execution tree. Each node is one agent's execution; `children` are the traces its sub-agent tool calls started.
|
|
2200
|
-
* 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.
|
|
2201
|
-
*
|
|
2202
|
-
*/
|
|
2203
|
-
static getTraceTree(options) {
|
|
2204
|
-
return (options.client ?? client).get({
|
|
2205
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/tree",
|
|
2206
|
-
...options
|
|
2207
|
-
});
|
|
2208
|
-
}
|
|
2209
|
-
/**
|
|
2210
|
-
* List a trace's generations
|
|
2211
|
-
*
|
|
2212
|
-
* Lists the generations recorded under this trace — the model loops the execution ran, including sub-agent generations linked by `initiator_generation_id`.
|
|
2213
|
-
*
|
|
2214
|
-
*/
|
|
2215
|
-
static listTraceGenerations(options) {
|
|
2216
|
-
return (options.client ?? client).get({
|
|
2217
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/generations",
|
|
2218
|
-
...options
|
|
2219
|
-
});
|
|
2220
|
-
}
|
|
2221
2220
|
/**
|
|
2222
|
-
*
|
|
2221
|
+
* Call a tool
|
|
2223
2222
|
*
|
|
2224
|
-
*
|
|
2225
|
-
*
|
|
2226
|
-
*
|
|
2223
|
+
* 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.
|
|
2224
|
+
* 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.
|
|
2225
|
+
* `preset_parameters` stored on the tool are merged with the caller-supplied `input` before execution; preset keys take lower precedence.
|
|
2227
2226
|
*
|
|
2228
2227
|
*/
|
|
2229
|
-
static
|
|
2230
|
-
return (options.client ?? client).get({
|
|
2231
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/steps",
|
|
2232
|
-
...options
|
|
2233
|
-
});
|
|
2234
|
-
}
|
|
2235
|
-
/**
|
|
2236
|
-
* Purge a trace's content
|
|
2237
|
-
*
|
|
2238
|
-
* Deletes the trace's step payload and clears its content columns, cascading to every descendant trace in its execution tree and to their generations. The rows survive as auditable skeletons — ids, timestamps and step counts are preserved — with `content_redacted_at` set as verifiable proof the content is gone; a purged trace still reads back with `GET /v1/projects/{project_id}/traces/{trace_id}` (a 404 there would prove nothing about what was erased).
|
|
2239
|
-
* Idempotent: purging an already-purged trace succeeds and leaves the original `content_redacted_at` in place.
|
|
2240
|
-
*
|
|
2241
|
-
*/
|
|
2242
|
-
static purgeTraceContent(options) {
|
|
2243
|
-
return (options.client ?? client).delete({
|
|
2244
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/content",
|
|
2245
|
-
...options
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
|
-
};
|
|
2249
|
-
var Triggers = class {
|
|
2250
|
-
/**
|
|
2251
|
-
* List triggers
|
|
2252
|
-
*
|
|
2253
|
-
* The project's schedule triggers, of either fronted target kind.
|
|
2254
|
-
* `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.
|
|
2255
|
-
*
|
|
2256
|
-
*/
|
|
2257
|
-
static listTriggers(options) {
|
|
2258
|
-
return (options.client ?? client).get({
|
|
2259
|
-
url: "/v1/projects/{project_id}/triggers",
|
|
2260
|
-
...options
|
|
2261
|
-
});
|
|
2262
|
-
}
|
|
2263
|
-
/**
|
|
2264
|
-
* Create a trigger
|
|
2265
|
-
*
|
|
2266
|
-
* 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.
|
|
2267
|
-
*
|
|
2268
|
-
*/
|
|
2269
|
-
static createTrigger(options) {
|
|
2228
|
+
static callTool(options) {
|
|
2270
2229
|
return (options.client ?? client).post({
|
|
2271
|
-
url: "/v1/projects/{project_id}/
|
|
2230
|
+
url: "/v1/projects/{project_id}/tools/{tool_id}/call",
|
|
2272
2231
|
...options,
|
|
2273
2232
|
headers: {
|
|
2274
2233
|
"Content-Type": "application/json",
|
|
@@ -2276,52 +2235,28 @@ var Triggers = class {
|
|
|
2276
2235
|
}
|
|
2277
2236
|
});
|
|
2278
2237
|
}
|
|
2238
|
+
};
|
|
2239
|
+
var Users = class {
|
|
2279
2240
|
/**
|
|
2280
|
-
*
|
|
2241
|
+
* Get the current user
|
|
2281
2242
|
*
|
|
2282
|
-
*
|
|
2283
|
-
*/
|
|
2284
|
-
static deleteTrigger(options) {
|
|
2285
|
-
return (options.client ?? client).delete({
|
|
2286
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}",
|
|
2287
|
-
...options
|
|
2288
|
-
});
|
|
2289
|
-
}
|
|
2290
|
-
/**
|
|
2291
|
-
* Get a trigger
|
|
2243
|
+
* Returns the account the presented credential resolves to.
|
|
2292
2244
|
*/
|
|
2293
|
-
static
|
|
2294
|
-
return (options
|
|
2295
|
-
url: "/v1/
|
|
2245
|
+
static getCurrentUser(options) {
|
|
2246
|
+
return (options?.client ?? client).get({
|
|
2247
|
+
url: "/v1/users/me",
|
|
2296
2248
|
...options
|
|
2297
2249
|
});
|
|
2298
2250
|
}
|
|
2299
2251
|
/**
|
|
2300
|
-
* Update
|
|
2252
|
+
* Update the current user
|
|
2301
2253
|
*
|
|
2302
|
-
*
|
|
2254
|
+
* 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.
|
|
2303
2255
|
*
|
|
2304
2256
|
*/
|
|
2305
|
-
static
|
|
2257
|
+
static updateCurrentUser(options) {
|
|
2306
2258
|
return (options.client ?? client).patch({
|
|
2307
|
-
url: "/v1/
|
|
2308
|
-
...options,
|
|
2309
|
-
headers: {
|
|
2310
|
-
"Content-Type": "application/json",
|
|
2311
|
-
...options.headers
|
|
2312
|
-
}
|
|
2313
|
-
});
|
|
2314
|
-
}
|
|
2315
|
-
/**
|
|
2316
|
-
* Fire a trigger manually
|
|
2317
|
-
*
|
|
2318
|
-
* 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`.
|
|
2319
|
-
* `input` is shallow-merged over the trigger's own stored `input` for this run only — the trigger's configuration is unchanged.
|
|
2320
|
-
*
|
|
2321
|
-
*/
|
|
2322
|
-
static fireTrigger(options) {
|
|
2323
|
-
return (options.client ?? client).post({
|
|
2324
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}:fire",
|
|
2259
|
+
url: "/v1/users/me",
|
|
2325
2260
|
...options,
|
|
2326
2261
|
headers: {
|
|
2327
2262
|
"Content-Type": "application/json",
|
|
@@ -2329,26 +2264,6 @@ var Triggers = class {
|
|
|
2329
2264
|
}
|
|
2330
2265
|
});
|
|
2331
2266
|
}
|
|
2332
|
-
/**
|
|
2333
|
-
* List a trigger's firings
|
|
2334
|
-
*
|
|
2335
|
-
* Every time this trigger ran, newest first — scheduled and manual alike.
|
|
2336
|
-
*/
|
|
2337
|
-
static listTriggerFirings(options) {
|
|
2338
|
-
return (options.client ?? client).get({
|
|
2339
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings",
|
|
2340
|
-
...options
|
|
2341
|
-
});
|
|
2342
|
-
}
|
|
2343
|
-
/**
|
|
2344
|
-
* Get a trigger firing
|
|
2345
|
-
*/
|
|
2346
|
-
static getTriggerFiring(options) {
|
|
2347
|
-
return (options.client ?? client).get({
|
|
2348
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings/{firing_id}",
|
|
2349
|
-
...options
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
2267
|
};
|
|
2353
2268
|
var Webhooks = class {
|
|
2354
2269
|
/**
|
|
@@ -2507,8 +2422,8 @@ const API_BASE_URL = "https://api.naturali.ai";
|
|
|
2507
2422
|
* });
|
|
2508
2423
|
*
|
|
2509
2424
|
* const { data, error } = await naturali.sessions.addSessionMessage({
|
|
2510
|
-
* path: { project_id: PROJECT_ID,
|
|
2511
|
-
* body: {
|
|
2425
|
+
* path: { project_id: PROJECT_ID, session_id: SESSION_ID },
|
|
2426
|
+
* body: { message: 'What is the capital of France?' },
|
|
2512
2427
|
* });
|
|
2513
2428
|
* ```
|
|
2514
2429
|
*
|
|
@@ -2519,22 +2434,20 @@ const API_BASE_URL = "https://api.naturali.ai";
|
|
|
2519
2434
|
var NaturaliClient = class {
|
|
2520
2435
|
actors;
|
|
2521
2436
|
agents;
|
|
2437
|
+
agentVersions;
|
|
2438
|
+
aiProviders;
|
|
2522
2439
|
apiKeys;
|
|
2523
2440
|
assistant;
|
|
2524
|
-
auth;
|
|
2525
|
-
boards;
|
|
2526
2441
|
channels;
|
|
2442
|
+
auth;
|
|
2443
|
+
conversations;
|
|
2527
2444
|
generations;
|
|
2528
|
-
|
|
2529
|
-
models;
|
|
2530
|
-
orchestrations;
|
|
2445
|
+
modelRoutes;
|
|
2531
2446
|
projects;
|
|
2532
|
-
|
|
2447
|
+
secrets;
|
|
2533
2448
|
sessions;
|
|
2534
|
-
tasks;
|
|
2535
2449
|
tools;
|
|
2536
|
-
|
|
2537
|
-
triggers;
|
|
2450
|
+
users;
|
|
2538
2451
|
webhooks;
|
|
2539
2452
|
/** The underlying HTTP client, for interceptors or one-off requests. */
|
|
2540
2453
|
http;
|
|
@@ -2548,45 +2461,41 @@ var NaturaliClient = class {
|
|
|
2548
2461
|
}));
|
|
2549
2462
|
this.actors = bindResource(Actors, this.http);
|
|
2550
2463
|
this.agents = bindResource(Agents, this.http);
|
|
2464
|
+
this.agentVersions = bindResource(AgentVersions, this.http);
|
|
2465
|
+
this.aiProviders = bindResource(AiProviders, this.http);
|
|
2551
2466
|
this.apiKeys = bindResource(ApiKeys, this.http);
|
|
2552
2467
|
this.assistant = bindResource(Assistant, this.http);
|
|
2553
|
-
this.auth = bindResource(Auth, this.http);
|
|
2554
|
-
this.boards = bindResource(Boards, this.http);
|
|
2555
2468
|
this.channels = bindResource(Channels, this.http);
|
|
2469
|
+
this.auth = bindResource(Auth, this.http);
|
|
2470
|
+
this.conversations = bindResource(Conversations, this.http);
|
|
2556
2471
|
this.generations = bindResource(Generations, this.http);
|
|
2557
|
-
this.
|
|
2558
|
-
this.models = bindResource(Models, this.http);
|
|
2559
|
-
this.orchestrations = bindResource(Orchestrations, this.http);
|
|
2472
|
+
this.modelRoutes = bindResource(ModelRoutes, this.http);
|
|
2560
2473
|
this.projects = bindResource(Projects, this.http);
|
|
2561
|
-
this.
|
|
2474
|
+
this.secrets = bindResource(Secrets, this.http);
|
|
2562
2475
|
this.sessions = bindResource(Sessions, this.http);
|
|
2563
|
-
this.tasks = bindResource(Tasks, this.http);
|
|
2564
2476
|
this.tools = bindResource(Tools, this.http);
|
|
2565
|
-
this.
|
|
2566
|
-
this.triggers = bindResource(Triggers, this.http);
|
|
2477
|
+
this.users = bindResource(Users, this.http);
|
|
2567
2478
|
this.webhooks = bindResource(Webhooks, this.http);
|
|
2568
2479
|
}
|
|
2569
2480
|
};
|
|
2570
2481
|
//#endregion
|
|
2571
2482
|
exports.Actors = Actors;
|
|
2483
|
+
exports.AgentVersions = AgentVersions;
|
|
2572
2484
|
exports.Agents = Agents;
|
|
2485
|
+
exports.AiProviders = AiProviders;
|
|
2573
2486
|
exports.ApiKeys = ApiKeys;
|
|
2574
2487
|
exports.Assistant = Assistant;
|
|
2575
2488
|
exports.Auth = Auth;
|
|
2576
|
-
exports.Boards = Boards;
|
|
2577
2489
|
exports.Channels = Channels;
|
|
2490
|
+
exports.Conversations = Conversations;
|
|
2578
2491
|
exports.Generations = Generations;
|
|
2579
|
-
exports.
|
|
2580
|
-
exports.Models = Models;
|
|
2492
|
+
exports.ModelRoutes = ModelRoutes;
|
|
2581
2493
|
exports.NaturaliClient = NaturaliClient;
|
|
2582
|
-
exports.Orchestrations = Orchestrations;
|
|
2583
2494
|
exports.Projects = Projects;
|
|
2584
|
-
exports.
|
|
2495
|
+
exports.Secrets = Secrets;
|
|
2585
2496
|
exports.Sessions = Sessions;
|
|
2586
|
-
exports.Tasks = Tasks;
|
|
2587
2497
|
exports.Tools = Tools;
|
|
2588
|
-
exports.
|
|
2589
|
-
exports.Triggers = Triggers;
|
|
2498
|
+
exports.Users = Users;
|
|
2590
2499
|
exports.Webhooks = Webhooks;
|
|
2591
2500
|
exports.createClient = createClient;
|
|
2592
2501
|
exports.createConfig = createConfig;
|