@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.mjs
CHANGED
|
@@ -606,8 +606,7 @@ var Actors = class {
|
|
|
606
606
|
/**
|
|
607
607
|
* List actors
|
|
608
608
|
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
609
|
+
* Returns all actors the caller has access to. If projectId is provided, returns only actors in that project. project keys are scoped to a single project automatically. JWT users without projectId receive actors across all their accessible projects.
|
|
611
610
|
*/
|
|
612
611
|
static listActors(options) {
|
|
613
612
|
return (options.client ?? client).get({
|
|
@@ -618,9 +617,7 @@ var Actors = class {
|
|
|
618
617
|
/**
|
|
619
618
|
* Create an actor
|
|
620
619
|
*
|
|
621
|
-
* Creates
|
|
622
|
-
* `external_id` may not start with a channel prefix (`whatsapp:`, `discord:`, …) or `address:` — those name actors that belong to an [address](/docs/api/addresses/get-address), which owns its own.
|
|
623
|
-
*
|
|
620
|
+
* Creates a new actor. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
|
|
624
621
|
*/
|
|
625
622
|
static createActor(options) {
|
|
626
623
|
return (options.client ?? client).post({
|
|
@@ -633,11 +630,9 @@ var Actors = class {
|
|
|
633
630
|
});
|
|
634
631
|
}
|
|
635
632
|
/**
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
* Removes the actor and the sessions it holds. Erasure of one identity as this API knows it — narrower than "erase this human everywhere", since naturali does not know that two identities are the same person and does not claim to.
|
|
639
|
-
* An actor that belongs to an [address](/docs/api/addresses/get-address) responds `409`: erase it through `DELETE /v1/projects/{project_id}/addresses/{identifier}`, which also removes the address and its conversations. Deleting it here would leave those behind, pointing at an identity that no longer exists.
|
|
633
|
+
* Delete an actor
|
|
640
634
|
*
|
|
635
|
+
* Deletes an actor by its ID
|
|
641
636
|
*/
|
|
642
637
|
static deleteActor(options) {
|
|
643
638
|
return (options.client ?? client).delete({
|
|
@@ -646,10 +641,9 @@ var Actors = class {
|
|
|
646
641
|
});
|
|
647
642
|
}
|
|
648
643
|
/**
|
|
649
|
-
* Get an actor
|
|
650
|
-
*
|
|
651
|
-
* Returns one actor. An actor belonging to another project responds `404`, not `403` — the API never confirms that an id exists elsewhere.
|
|
644
|
+
* Get an actor by ID
|
|
652
645
|
*
|
|
646
|
+
* Returns an actor by its ID
|
|
653
647
|
*/
|
|
654
648
|
static getActor(options) {
|
|
655
649
|
return (options.client ?? client).get({
|
|
@@ -660,8 +654,7 @@ var Actors = class {
|
|
|
660
654
|
/**
|
|
661
655
|
* Update an actor
|
|
662
656
|
*
|
|
663
|
-
* Updates
|
|
664
|
-
*
|
|
657
|
+
* Updates an actor's properties
|
|
665
658
|
*/
|
|
666
659
|
static updateActor(options) {
|
|
667
660
|
return (options.client ?? client).patch({
|
|
@@ -673,6 +666,47 @@ var Actors = class {
|
|
|
673
666
|
}
|
|
674
667
|
});
|
|
675
668
|
}
|
|
669
|
+
/**
|
|
670
|
+
* Get actor tags
|
|
671
|
+
*
|
|
672
|
+
* Returns all tags attached to the actor
|
|
673
|
+
*/
|
|
674
|
+
static getActorTags(options) {
|
|
675
|
+
return (options.client ?? client).get({
|
|
676
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
677
|
+
...options
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Merge actor tags
|
|
682
|
+
*
|
|
683
|
+
* Merges provided tags with existing tags (existing tags are preserved unless overridden)
|
|
684
|
+
*/
|
|
685
|
+
static mergeActorTags(options) {
|
|
686
|
+
return (options.client ?? client).patch({
|
|
687
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
688
|
+
...options,
|
|
689
|
+
headers: {
|
|
690
|
+
"Content-Type": "application/json",
|
|
691
|
+
...options.headers
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Replace actor tags
|
|
697
|
+
*
|
|
698
|
+
* Replaces all tags on the actor with the provided tags (not merged)
|
|
699
|
+
*/
|
|
700
|
+
static replaceActorTags(options) {
|
|
701
|
+
return (options.client ?? client).put({
|
|
702
|
+
url: "/v1/projects/{project_id}/actors/{actor_id}/tags",
|
|
703
|
+
...options,
|
|
704
|
+
headers: {
|
|
705
|
+
"Content-Type": "application/json",
|
|
706
|
+
...options.headers
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
676
710
|
};
|
|
677
711
|
var Channels = class {
|
|
678
712
|
/**
|
|
@@ -816,22 +850,6 @@ var Channels = class {
|
|
|
816
850
|
});
|
|
817
851
|
}
|
|
818
852
|
/**
|
|
819
|
-
* Open a conversation
|
|
820
|
-
*
|
|
821
|
-
* The outbound-first path (CHANNELS-ROUTING.md §3.11): open a conversation for `{ channel_id, identifier }` ahead of any inbound message, which falls out of making the identifier the unit rather than the message. Resolves the same three-layer action an inbound would (§3.6); a `409` when that does not land on an agent — there is nothing to open for a `message`/`silence` outcome.
|
|
822
|
-
*
|
|
823
|
-
*/
|
|
824
|
-
static createConversation(options) {
|
|
825
|
-
return (options.client ?? client).post({
|
|
826
|
-
url: "/v1/projects/{project_id}/conversations",
|
|
827
|
-
...options,
|
|
828
|
-
headers: {
|
|
829
|
-
"Content-Type": "application/json",
|
|
830
|
-
...options.headers
|
|
831
|
-
}
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
853
|
* List channels
|
|
836
854
|
*
|
|
837
855
|
* Lists the channels connected in the project.
|
|
@@ -919,6 +937,22 @@ var Channels = class {
|
|
|
919
937
|
});
|
|
920
938
|
}
|
|
921
939
|
/**
|
|
940
|
+
* Open a conversation
|
|
941
|
+
*
|
|
942
|
+
* The outbound-first path: open a conversation for an `identifier` ahead of any inbound message, which falls out of making the identifier the unit rather than the message. Resolves the same three-layer action an inbound would; a `409` when that does not land on an agent — there is nothing to open for a `message`/`silence` outcome.
|
|
943
|
+
*
|
|
944
|
+
*/
|
|
945
|
+
static openChannelConversation(options) {
|
|
946
|
+
return (options.client ?? client).post({
|
|
947
|
+
url: "/v1/projects/{project_id}/channels/{channel_id}/conversations",
|
|
948
|
+
...options,
|
|
949
|
+
headers: {
|
|
950
|
+
"Content-Type": "application/json",
|
|
951
|
+
...options.headers
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
922
956
|
* Get a conversation
|
|
923
957
|
*/
|
|
924
958
|
static getChannelConversation(options) {
|
|
@@ -944,7 +978,7 @@ var Agents = class {
|
|
|
944
978
|
/**
|
|
945
979
|
* List agents
|
|
946
980
|
*
|
|
947
|
-
*
|
|
981
|
+
* Returns all agents in the project.
|
|
948
982
|
*/
|
|
949
983
|
static listAgents(options) {
|
|
950
984
|
return (options.client ?? client).get({
|
|
@@ -955,8 +989,7 @@ var Agents = class {
|
|
|
955
989
|
/**
|
|
956
990
|
* Create an agent
|
|
957
991
|
*
|
|
958
|
-
*
|
|
959
|
-
*
|
|
992
|
+
* Creates a new agent bound to an AI provider.
|
|
960
993
|
*/
|
|
961
994
|
static createAgent(options) {
|
|
962
995
|
return (options.client ?? client).post({
|
|
@@ -971,7 +1004,7 @@ var Agents = class {
|
|
|
971
1004
|
/**
|
|
972
1005
|
* Delete an agent
|
|
973
1006
|
*
|
|
974
|
-
* Deletes
|
|
1007
|
+
* Deletes an agent by ID. Fails with `409` if the agent has dependent generations or traces, unless `force=true` is passed, in which case those generations and traces are deleted along with the agent.
|
|
975
1008
|
*
|
|
976
1009
|
*/
|
|
977
1010
|
static deleteAgent(options) {
|
|
@@ -982,6 +1015,8 @@ var Agents = class {
|
|
|
982
1015
|
}
|
|
983
1016
|
/**
|
|
984
1017
|
* Get an agent
|
|
1018
|
+
*
|
|
1019
|
+
* Returns a single agent by ID.
|
|
985
1020
|
*/
|
|
986
1021
|
static getAgent(options) {
|
|
987
1022
|
return (options.client ?? client).get({
|
|
@@ -990,12 +1025,11 @@ var Agents = class {
|
|
|
990
1025
|
});
|
|
991
1026
|
}
|
|
992
1027
|
/**
|
|
993
|
-
*
|
|
994
|
-
*
|
|
995
|
-
* 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.
|
|
1028
|
+
* Partially update an agent
|
|
996
1029
|
*
|
|
1030
|
+
* Partially updates an existing agent. Identical to PUT — both perform partial updates.
|
|
997
1031
|
*/
|
|
998
|
-
static
|
|
1032
|
+
static patchAgent(options) {
|
|
999
1033
|
return (options.client ?? client).patch({
|
|
1000
1034
|
url: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
1001
1035
|
...options,
|
|
@@ -1005,29 +1039,14 @@ var Agents = class {
|
|
|
1005
1039
|
}
|
|
1006
1040
|
});
|
|
1007
1041
|
}
|
|
1008
|
-
};
|
|
1009
|
-
var ApiKeys = class {
|
|
1010
|
-
/**
|
|
1011
|
-
* List API keys
|
|
1012
|
-
*
|
|
1013
|
-
* 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.
|
|
1014
|
-
*
|
|
1015
|
-
*/
|
|
1016
|
-
static listApiKeys(options) {
|
|
1017
|
-
return (options?.client ?? client).get({
|
|
1018
|
-
url: "/v1/api-keys",
|
|
1019
|
-
...options
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
1042
|
/**
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
* 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.
|
|
1043
|
+
* Update an agent
|
|
1026
1044
|
*
|
|
1045
|
+
* Updates an existing agent. Identical to PATCH — both perform partial updates.
|
|
1027
1046
|
*/
|
|
1028
|
-
static
|
|
1029
|
-
return (options.client ?? client).
|
|
1030
|
-
url: "/v1/
|
|
1047
|
+
static updateAgent(options) {
|
|
1048
|
+
return (options.client ?? client).put({
|
|
1049
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
1031
1050
|
...options,
|
|
1032
1051
|
headers: {
|
|
1033
1052
|
"Content-Type": "application/json",
|
|
@@ -1036,35 +1055,14 @@ var ApiKeys = class {
|
|
|
1036
1055
|
});
|
|
1037
1056
|
}
|
|
1038
1057
|
/**
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
* Revokes an API key immediately. Subsequent use returns 401.
|
|
1042
|
-
*/
|
|
1043
|
-
static deleteApiKey(options) {
|
|
1044
|
-
return (options.client ?? client).delete({
|
|
1045
|
-
url: "/v1/api-keys/{api_key_id}",
|
|
1046
|
-
...options
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Get an API key
|
|
1058
|
+
* Run an agent generation
|
|
1051
1059
|
*
|
|
1052
|
-
*
|
|
1053
|
-
*/
|
|
1054
|
-
static getApiKey(options) {
|
|
1055
|
-
return (options.client ?? client).get({
|
|
1056
|
-
url: "/v1/api-keys/{api_key_id}",
|
|
1057
|
-
...options
|
|
1058
|
-
});
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* Update an API key
|
|
1060
|
+
* Sends messages to the agent, resolves its tools, and runs the AI model loop. Background by default: returns `202 Accepted` with a `generation_id` to poll via `GET /v1/projects/{project_id}/generations/{generation_id}`. Pass `?wait=true` to block and receive the result inline, where client tools pause the generation and return `requires_action`. Streaming (`stream: true`) implies waiting.
|
|
1062
1061
|
*
|
|
1063
|
-
* Rename an API key or replace its capability set. The scope (project vs account) is immutable.
|
|
1064
1062
|
*/
|
|
1065
|
-
static
|
|
1066
|
-
return (options.client ?? client).
|
|
1067
|
-
url: "/v1/
|
|
1063
|
+
static createAgentGeneration(options) {
|
|
1064
|
+
return (options.client ?? client).post({
|
|
1065
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/generate",
|
|
1068
1066
|
...options,
|
|
1069
1067
|
headers: {
|
|
1070
1068
|
"Content-Type": "application/json",
|
|
@@ -1073,66 +1071,58 @@ var ApiKeys = class {
|
|
|
1073
1071
|
});
|
|
1074
1072
|
}
|
|
1075
1073
|
/**
|
|
1076
|
-
*
|
|
1074
|
+
* Submit tool outputs for a paused generation
|
|
1077
1075
|
*
|
|
1078
|
-
*
|
|
1076
|
+
* Resumes a generation that was paused due to client tool calls. Provide tool outputs for each pending tool call.
|
|
1079
1077
|
*
|
|
1080
1078
|
*/
|
|
1081
|
-
static
|
|
1079
|
+
static submitAgentToolOutputs(options) {
|
|
1082
1080
|
return (options.client ?? client).post({
|
|
1083
|
-
url: "/v1/
|
|
1084
|
-
...options
|
|
1081
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/generate/{generation_id}/tool-outputs",
|
|
1082
|
+
...options,
|
|
1083
|
+
headers: {
|
|
1084
|
+
"Content-Type": "application/json",
|
|
1085
|
+
...options.headers
|
|
1086
|
+
}
|
|
1085
1087
|
});
|
|
1086
1088
|
}
|
|
1087
1089
|
};
|
|
1088
|
-
var
|
|
1089
|
-
/**
|
|
1090
|
-
* List linked identities
|
|
1091
|
-
*
|
|
1092
|
-
* 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.
|
|
1093
|
-
*
|
|
1094
|
-
*/
|
|
1095
|
-
static listAssistantGrants(options) {
|
|
1096
|
-
return (options?.client ?? client).get({
|
|
1097
|
-
url: "/v1/assistant/grants",
|
|
1098
|
-
...options
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1090
|
+
var AgentVersions = class {
|
|
1101
1091
|
/**
|
|
1102
|
-
*
|
|
1092
|
+
* List an agent's config versions
|
|
1103
1093
|
*
|
|
1104
|
-
*
|
|
1094
|
+
* Returns the agent's archived configurations, newest first. A version is written on create and on every subsequent write that changes the config — through the REST API or a formation apply alike. See [Versioning and Staged Rollout](/docs/modules/agents#versioning-and-staged-rollout).
|
|
1105
1095
|
*
|
|
1106
1096
|
*/
|
|
1107
|
-
static
|
|
1108
|
-
return (options.client ?? client).
|
|
1109
|
-
url: "/v1/
|
|
1097
|
+
static listAgentVersions(options) {
|
|
1098
|
+
return (options.client ?? client).get({
|
|
1099
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions",
|
|
1110
1100
|
...options
|
|
1111
1101
|
});
|
|
1112
1102
|
}
|
|
1113
1103
|
/**
|
|
1114
|
-
*
|
|
1104
|
+
* Get an archived agent config version
|
|
1115
1105
|
*
|
|
1116
|
-
*
|
|
1117
|
-
* 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.
|
|
1106
|
+
* Returns the exact configuration the agent held at a given version, so a generation can be traced back to the config that produced it.
|
|
1118
1107
|
*
|
|
1119
1108
|
*/
|
|
1120
|
-
static
|
|
1109
|
+
static getAgentVersion(options) {
|
|
1121
1110
|
return (options.client ?? client).get({
|
|
1122
|
-
url: "/v1/
|
|
1111
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions/{version}",
|
|
1123
1112
|
...options
|
|
1124
1113
|
});
|
|
1125
1114
|
}
|
|
1126
1115
|
/**
|
|
1127
|
-
*
|
|
1116
|
+
* Restore an archived config as a new version
|
|
1128
1117
|
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1118
|
+
* Copies the named version's configuration onto the agent as a **new** version rather than rewinding the counter, so history stays append-only and the versions in between remain retrievable. Restoring the config the agent already holds is a no-op and creates no version.
|
|
1119
|
+
*
|
|
1120
|
+
* The restored config fully replaces the current one: a field the archived version did not set is cleared, not merged. Restore re-validates the config, so a tool, provider, or guardrail deleted since the snapshot was taken fails the request instead of writing a broken agent.
|
|
1131
1121
|
*
|
|
1132
1122
|
*/
|
|
1133
|
-
static
|
|
1123
|
+
static restoreAgentVersion(options) {
|
|
1134
1124
|
return (options.client ?? client).post({
|
|
1135
|
-
url: "/v1/
|
|
1125
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/versions/{version}/restore",
|
|
1136
1126
|
...options,
|
|
1137
1127
|
headers: {
|
|
1138
1128
|
"Content-Type": "application/json",
|
|
@@ -1140,17 +1130,19 @@ var Assistant = class {
|
|
|
1140
1130
|
}
|
|
1141
1131
|
});
|
|
1142
1132
|
}
|
|
1143
|
-
};
|
|
1144
|
-
var Auth = class {
|
|
1145
1133
|
/**
|
|
1146
|
-
*
|
|
1134
|
+
* Set or replace a staged rollout
|
|
1147
1135
|
*
|
|
1148
|
-
*
|
|
1136
|
+
* Starts serving two archived versions side by side: `canary_percent` of traffic gets `canary_version`, the rest gets `stable_version`.
|
|
1137
|
+
*
|
|
1138
|
+
* Assignment is deterministic — it hashes the actor behind the request's session (falling back to the session itself), so one end user never flip-flops between configs mid-conversation. Requests with neither are split randomly.
|
|
1139
|
+
*
|
|
1140
|
+
* While a release is active the agent's live columns act as a **draft**: further edits archive new versions but do not disturb either side of the running split. End the rollout with `promote` or `abort`.
|
|
1149
1141
|
*
|
|
1150
1142
|
*/
|
|
1151
|
-
static
|
|
1152
|
-
return (options.client ?? client).
|
|
1153
|
-
url: "/v1/
|
|
1143
|
+
static setAgentRelease(options) {
|
|
1144
|
+
return (options.client ?? client).put({
|
|
1145
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release",
|
|
1154
1146
|
...options,
|
|
1155
1147
|
headers: {
|
|
1156
1148
|
"Content-Type": "application/json",
|
|
@@ -1159,86 +1151,92 @@ var Auth = class {
|
|
|
1159
1151
|
});
|
|
1160
1152
|
}
|
|
1161
1153
|
/**
|
|
1162
|
-
*
|
|
1154
|
+
* Promote the canary and end the rollout
|
|
1163
1155
|
*
|
|
1164
|
-
*
|
|
1156
|
+
* Makes the canary version's config the agent's live config and clears the release. The canary is pinned by version, so an edit that landed mid-rollout is not promoted in its place — it stays an unreleased draft in the version history.
|
|
1157
|
+
*
|
|
1158
|
+
* When the release carries a `promotion_gate`, the eval it names must have a run that finished `completed` with `passed: true` **and** was pinned to the canary version (`agent_version`); otherwise the call is a `409` and the rollout is left running untouched. The run that cleared the gate is recorded as `eval_run_id` on the version that goes live.
|
|
1165
1159
|
*
|
|
1166
1160
|
*/
|
|
1167
|
-
static
|
|
1161
|
+
static promoteAgentRelease(options) {
|
|
1168
1162
|
return (options.client ?? client).post({
|
|
1169
|
-
url: "/v1/
|
|
1170
|
-
...options
|
|
1171
|
-
headers: {
|
|
1172
|
-
"Content-Type": "application/json",
|
|
1173
|
-
...options.headers
|
|
1174
|
-
}
|
|
1163
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release/promote",
|
|
1164
|
+
...options
|
|
1175
1165
|
});
|
|
1176
1166
|
}
|
|
1177
1167
|
/**
|
|
1178
|
-
*
|
|
1168
|
+
* Abort the rollout and roll back to stable
|
|
1179
1169
|
*
|
|
1180
|
-
*
|
|
1170
|
+
* Restores the stable version's config as the agent's live config and clears the release, so all traffic returns to the configuration the rollout was measured against — not to whatever draft the live columns happened to hold.
|
|
1181
1171
|
*
|
|
1182
1172
|
*/
|
|
1183
|
-
static
|
|
1173
|
+
static abortAgentRelease(options) {
|
|
1184
1174
|
return (options.client ?? client).post({
|
|
1185
|
-
url: "/v1/
|
|
1186
|
-
...options
|
|
1187
|
-
headers: {
|
|
1188
|
-
"Content-Type": "application/json",
|
|
1189
|
-
...options.headers
|
|
1190
|
-
}
|
|
1175
|
+
url: "/v1/projects/{project_id}/agents/{agent_id}/release/abort",
|
|
1176
|
+
...options
|
|
1191
1177
|
});
|
|
1192
1178
|
}
|
|
1179
|
+
};
|
|
1180
|
+
var AiProviders = class {
|
|
1193
1181
|
/**
|
|
1194
|
-
*
|
|
1182
|
+
* List AI providers
|
|
1195
1183
|
*
|
|
1196
|
-
*
|
|
1184
|
+
* Returns a list of AI provider configurations for a project
|
|
1185
|
+
*/
|
|
1186
|
+
static listAiProviders(options) {
|
|
1187
|
+
return (options.client ?? client).get({
|
|
1188
|
+
url: "/v1/projects/{project_id}/ai-providers",
|
|
1189
|
+
...options
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Create an AI provider
|
|
1197
1194
|
*
|
|
1195
|
+
* Creates a new LLM provider configuration
|
|
1198
1196
|
*/
|
|
1199
|
-
static
|
|
1200
|
-
return (options
|
|
1201
|
-
url: "/v1/
|
|
1197
|
+
static createAiProvider(options) {
|
|
1198
|
+
return (options.client ?? client).post({
|
|
1199
|
+
url: "/v1/projects/{project_id}/ai-providers",
|
|
1202
1200
|
...options,
|
|
1203
1201
|
headers: {
|
|
1204
1202
|
"Content-Type": "application/json",
|
|
1205
|
-
...options
|
|
1203
|
+
...options.headers
|
|
1206
1204
|
}
|
|
1207
1205
|
});
|
|
1208
1206
|
}
|
|
1209
1207
|
/**
|
|
1210
|
-
*
|
|
1208
|
+
* Delete an AI provider
|
|
1209
|
+
*
|
|
1210
|
+
* Deletes an AI provider configuration.
|
|
1211
|
+
*
|
|
1212
|
+
* Live references — chats, agents, and model routes whose targets name this provider — always block deletion with `409 AI_PROVIDER_HAS_DEPENDENTS`; `force` does not override them, so delete or repoint those resources first. Soft dependents — price overrides and usage/generation records — also block with `409` unless `force=true`, which deletes the provider's price overrides and unlinks (nulls) its usage history, preserving those rows. The `409` body's `error.meta` reports the counts, a sample of offending IDs, and a `forcible` flag that is `true` when a `force=true` retry would succeed.
|
|
1211
1213
|
*
|
|
1212
|
-
* Returns the user behind the presented access token.
|
|
1213
1214
|
*/
|
|
1214
|
-
static
|
|
1215
|
-
return (options
|
|
1216
|
-
url: "/v1/
|
|
1215
|
+
static deleteAiProvider(options) {
|
|
1216
|
+
return (options.client ?? client).delete({
|
|
1217
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1217
1218
|
...options
|
|
1218
1219
|
});
|
|
1219
1220
|
}
|
|
1220
|
-
};
|
|
1221
|
-
var Boards = class {
|
|
1222
1221
|
/**
|
|
1223
|
-
*
|
|
1222
|
+
* Get an AI provider
|
|
1224
1223
|
*
|
|
1225
|
-
*
|
|
1224
|
+
* Returns a specific AI provider configuration
|
|
1226
1225
|
*/
|
|
1227
|
-
static
|
|
1226
|
+
static getAiProvider(options) {
|
|
1228
1227
|
return (options.client ?? client).get({
|
|
1229
|
-
url: "/v1/projects/{project_id}/
|
|
1228
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1230
1229
|
...options
|
|
1231
1230
|
});
|
|
1232
1231
|
}
|
|
1233
1232
|
/**
|
|
1234
|
-
*
|
|
1235
|
-
*
|
|
1236
|
-
* Define a board's columns and moves. Exactly one column must be `initial: true`; any number may be `terminal: true` (a card closes when it enters one). Every agent or tool a column dispatches must belong to this project, and every move a column routes to must be declared in `transitions`.
|
|
1233
|
+
* Update an AI provider
|
|
1237
1234
|
*
|
|
1235
|
+
* Updates an AI provider configuration
|
|
1238
1236
|
*/
|
|
1239
|
-
static
|
|
1240
|
-
return (options.client ?? client).
|
|
1241
|
-
url: "/v1/projects/{project_id}/
|
|
1237
|
+
static updateAiProvider(options) {
|
|
1238
|
+
return (options.client ?? client).patch({
|
|
1239
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}",
|
|
1242
1240
|
...options,
|
|
1243
1241
|
headers: {
|
|
1244
1242
|
"Content-Type": "application/json",
|
|
@@ -1247,39 +1245,42 @@ var Boards = class {
|
|
|
1247
1245
|
});
|
|
1248
1246
|
}
|
|
1249
1247
|
/**
|
|
1250
|
-
*
|
|
1248
|
+
* List the models this provider can run
|
|
1251
1249
|
*
|
|
1252
|
-
*
|
|
1250
|
+
* Asks the provider which models it can run, using this provider record's own credentials and configuration, and returns provider-native model ids — the same strings `default_model` and an agent's `model` carry.
|
|
1251
|
+
* Which models are reachable is a property of the credential, not of the provider type: a Vertex provider sees only the publisher models its Google Cloud project and location serve, and a Bedrock provider only the foundation models enabled in its region. Reading the list is how a caller avoids pinning a model that fails at generation time.
|
|
1252
|
+
* Not every provider type can answer. `azure` lists deployments an operator named rather than models, and `ollama` lists whatever was pulled onto that host, so both return `400 MODEL_LISTING_UNSUPPORTED`.
|
|
1253
|
+
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret when there is one — IAM keys or a Bedrock API key, a Google service-account key — and otherwise fall back to the server environment (the AWS default credential chain, Google Application Default Credentials), so a record with no `secret_id` can still list.
|
|
1254
|
+
* A Vertex record needs no `config.project` when its secret is a service-account key, since the key file names its own project. A Vertex record in express mode (API key) cannot list at all: express mode is a global, project-less endpoint and the publisher-model catalogue is per-project, so it returns `400 MODEL_LISTING_UNSUPPORTED`.
|
|
1253
1255
|
*
|
|
1254
1256
|
*/
|
|
1255
|
-
static
|
|
1256
|
-
return (options.client ?? client).
|
|
1257
|
-
url: "/v1/projects/{project_id}/
|
|
1257
|
+
static listAiProviderModels(options) {
|
|
1258
|
+
return (options.client ?? client).get({
|
|
1259
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/models",
|
|
1258
1260
|
...options
|
|
1259
1261
|
});
|
|
1260
1262
|
}
|
|
1261
1263
|
/**
|
|
1262
|
-
*
|
|
1264
|
+
* List per-provider price overrides
|
|
1263
1265
|
*
|
|
1264
|
-
*
|
|
1266
|
+
* Returns the per-provider price overrides for this AI provider instance. An override prices this specific provider (e.g. an enterprise-negotiated rate or a gateway with markup) and wins over the global default at cost time. Authorized by the caller's access to the provider's project — so, unlike the global price book, a project's own overrides are visible here.
|
|
1265
1267
|
*
|
|
1266
1268
|
*/
|
|
1267
|
-
static
|
|
1269
|
+
static getAiProviderPrices(options) {
|
|
1268
1270
|
return (options.client ?? client).get({
|
|
1269
|
-
url: "/v1/projects/{project_id}/
|
|
1271
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/prices",
|
|
1270
1272
|
...options
|
|
1271
1273
|
});
|
|
1272
1274
|
}
|
|
1273
1275
|
/**
|
|
1274
|
-
*
|
|
1276
|
+
* Upsert per-provider price overrides
|
|
1275
1277
|
*
|
|
1276
|
-
*
|
|
1277
|
-
* Cards already on the board are not moved. A card sitting in a column the new definition drops stays where it is and can only leave through a move the new definition declares: the definition is the sole authority at the moment a move is fired.
|
|
1278
|
+
* Upserts price overrides for this AI provider instance, keyed on (model, effective_from). The provider slug is taken from the AI provider itself, so only the model, rates, and effective_from are supplied. Authorized by the caller's access to the provider's project. `effective_from` must be in the future — past prices are immutable, so ship corrections as new future-dated rows.
|
|
1278
1279
|
*
|
|
1279
1280
|
*/
|
|
1280
|
-
static
|
|
1281
|
-
return (options.client ?? client).
|
|
1282
|
-
url: "/v1/projects/{project_id}/
|
|
1281
|
+
static updateAiProviderPrices(options) {
|
|
1282
|
+
return (options.client ?? client).put({
|
|
1283
|
+
url: "/v1/projects/{project_id}/ai-providers/{ai_provider_id}/prices",
|
|
1283
1284
|
...options,
|
|
1284
1285
|
headers: {
|
|
1285
1286
|
"Content-Type": "application/json",
|
|
@@ -1288,34 +1289,29 @@ var Boards = class {
|
|
|
1288
1289
|
});
|
|
1289
1290
|
}
|
|
1290
1291
|
};
|
|
1291
|
-
var
|
|
1292
|
+
var ApiKeys = class {
|
|
1292
1293
|
/**
|
|
1293
|
-
* List
|
|
1294
|
+
* List API keys
|
|
1294
1295
|
*
|
|
1295
|
-
* Lists
|
|
1296
|
+
* 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.
|
|
1296
1297
|
*
|
|
1297
1298
|
*/
|
|
1298
|
-
static
|
|
1299
|
-
return (options
|
|
1300
|
-
url: "/v1/
|
|
1299
|
+
static listApiKeys(options) {
|
|
1300
|
+
return (options?.client ?? client).get({
|
|
1301
|
+
url: "/v1/api-keys",
|
|
1301
1302
|
...options
|
|
1302
1303
|
});
|
|
1303
1304
|
}
|
|
1304
1305
|
/**
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
* Sends messages to the agent, resolves its tools, and runs the model loop.
|
|
1308
|
-
*
|
|
1309
|
-
* Background by default: this returns `202` immediately with a `generation_id`, and the turn runs on. Poll [`GET /v1/projects/{project_id}/generations/{generation_id}`](/docs/api/generations/get-generation) until its `status` leaves `in_progress`.
|
|
1310
|
-
*
|
|
1311
|
-
* Pass `?wait=true` to block instead and receive the turn itself — the final text when `status` is `completed` (plus `object` when the agent has an output schema), or the pending `tool_calls` when `status` is `requires_action`.
|
|
1306
|
+
* Create an API key
|
|
1312
1307
|
*
|
|
1313
|
-
*
|
|
1308
|
+
* Creates an API key. When `project_id` is set the key is scoped to that project (the default and recommended stance); omit it for an account-scoped key. `capabilities` narrows what the key may do; when omitted the key inherits the creator's capabilities. The raw `key` (nat_sk_…) is returned only in this response.
|
|
1309
|
+
* A project-scoped key requires the `admin` role in that project: the key is a standing credential for everything the project can do, so handing one out is an administrative act rather than something a read-only `member` can do for themselves. An account-scoped key requires a credential that is not itself confined to one project.
|
|
1314
1310
|
*
|
|
1315
1311
|
*/
|
|
1316
|
-
static
|
|
1312
|
+
static createApiKey(options) {
|
|
1317
1313
|
return (options.client ?? client).post({
|
|
1318
|
-
url: "/v1/
|
|
1314
|
+
url: "/v1/api-keys",
|
|
1319
1315
|
...options,
|
|
1320
1316
|
headers: {
|
|
1321
1317
|
"Content-Type": "application/json",
|
|
@@ -1324,107 +1320,103 @@ var Generations = class {
|
|
|
1324
1320
|
});
|
|
1325
1321
|
}
|
|
1326
1322
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1329
|
-
* 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.
|
|
1330
|
-
* A generation belonging to another project responds `404`, not `403` — the API never confirms that an id exists elsewhere.
|
|
1323
|
+
* Revoke an API key
|
|
1331
1324
|
*
|
|
1325
|
+
* Revokes an API key immediately. Subsequent use returns 401.
|
|
1332
1326
|
*/
|
|
1333
|
-
static
|
|
1334
|
-
return (options.client ?? client).
|
|
1335
|
-
url: "/v1/
|
|
1327
|
+
static deleteApiKey(options) {
|
|
1328
|
+
return (options.client ?? client).delete({
|
|
1329
|
+
url: "/v1/api-keys/{api_key_id}",
|
|
1336
1330
|
...options
|
|
1337
1331
|
});
|
|
1338
1332
|
}
|
|
1339
1333
|
/**
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
1342
|
-
* Clears the generation's content — `metadata`, `error`, `extraction` and the internal recovery state of a paused run — and stamps `content_redacted_at` as verifiable proof the content is gone.
|
|
1343
|
-
* The billing and audit skeleton is preserved: ids, timestamps, status, stop reason and the attribution fields (`action_id`, `trigger_id`) the usage ledger reads. A purged generation still reads back with `GET /v1/projects/{project_id}/generations/{generation_id}` — a `404` there would prove nothing about what was erased.
|
|
1344
|
-
* This is the narrow erasure, scoped to one model turn. It does **not** delete the parent trace's step payload, which holds this generation's content alongside its siblings'. To erase a whole run's content, purge the trace with `DELETE /v1/projects/{project_id}/traces/{trace_id}/content`, which cascades to every descendant trace and all of their generations.
|
|
1345
|
-
* Idempotent: purging an already-purged generation succeeds and leaves the original `content_redacted_at` in place.
|
|
1346
|
-
* A generation belonging to another project responds `404`, not `403`, and nothing is purged.
|
|
1334
|
+
* Get an API key
|
|
1347
1335
|
*
|
|
1336
|
+
* Returns metadata for an API key. The raw secret is never returned after creation.
|
|
1348
1337
|
*/
|
|
1349
|
-
static
|
|
1350
|
-
return (options.client ?? client).
|
|
1351
|
-
url: "/v1/
|
|
1338
|
+
static getApiKey(options) {
|
|
1339
|
+
return (options.client ?? client).get({
|
|
1340
|
+
url: "/v1/api-keys/{api_key_id}",
|
|
1352
1341
|
...options
|
|
1353
1342
|
});
|
|
1354
1343
|
}
|
|
1355
1344
|
/**
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1358
|
-
* What this one generation cost, and the tokens it was charged on — the billing-grade receipt the runtime froze at write time, per model line item.
|
|
1359
|
-
* This is the per-generation grain that `GET /v1/projects/{project_id}/usage` cannot express: that meter buckets a whole project by model, agent, run, day or meter type, and a run can hold more than one generation. Use this to price a single turn, and the project meter to roll spend up.
|
|
1360
|
-
* `cost_usd` is `null` when nothing was priced — never that the work was free. Only naturali-managed providers are priced; a BYOK generation runs on your own provider account, so it carries no LLM cost here (its tokens are still reported).
|
|
1361
|
-
* A generation belonging to another project responds `404`, not `403`.
|
|
1345
|
+
* Update an API key
|
|
1362
1346
|
*
|
|
1347
|
+
* Rename an API key or replace its capability set. The scope (project vs account) is immutable.
|
|
1363
1348
|
*/
|
|
1364
|
-
static
|
|
1365
|
-
return (options.client ?? client).
|
|
1366
|
-
url: "/v1/
|
|
1367
|
-
...options
|
|
1349
|
+
static updateApiKey(options) {
|
|
1350
|
+
return (options.client ?? client).patch({
|
|
1351
|
+
url: "/v1/api-keys/{api_key_id}",
|
|
1352
|
+
...options,
|
|
1353
|
+
headers: {
|
|
1354
|
+
"Content-Type": "application/json",
|
|
1355
|
+
...options.headers
|
|
1356
|
+
}
|
|
1368
1357
|
});
|
|
1369
1358
|
}
|
|
1370
|
-
};
|
|
1371
|
-
var Knowledge = class {
|
|
1372
1359
|
/**
|
|
1373
|
-
*
|
|
1360
|
+
* Rotate an API key
|
|
1361
|
+
*
|
|
1362
|
+
* 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.
|
|
1374
1363
|
*
|
|
1375
|
-
* Lists the knowledge collections in the project.
|
|
1376
1364
|
*/
|
|
1377
|
-
static
|
|
1378
|
-
return (options.client ?? client).
|
|
1379
|
-
url: "/v1/
|
|
1365
|
+
static rotateApiKey(options) {
|
|
1366
|
+
return (options.client ?? client).post({
|
|
1367
|
+
url: "/v1/api-keys/{api_key_id}:rotate",
|
|
1380
1368
|
...options
|
|
1381
1369
|
});
|
|
1382
1370
|
}
|
|
1371
|
+
};
|
|
1372
|
+
var Assistant = class {
|
|
1383
1373
|
/**
|
|
1384
|
-
*
|
|
1374
|
+
* List linked identities
|
|
1385
1375
|
*
|
|
1386
|
-
*
|
|
1376
|
+
* 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.
|
|
1387
1377
|
*
|
|
1388
1378
|
*/
|
|
1389
|
-
static
|
|
1390
|
-
return (options
|
|
1391
|
-
url: "/v1/
|
|
1392
|
-
...options
|
|
1393
|
-
headers: {
|
|
1394
|
-
"Content-Type": "application/json",
|
|
1395
|
-
...options.headers
|
|
1396
|
-
}
|
|
1379
|
+
static listAssistantGrants(options) {
|
|
1380
|
+
return (options?.client ?? client).get({
|
|
1381
|
+
url: "/v1/assistant/grants",
|
|
1382
|
+
...options
|
|
1397
1383
|
});
|
|
1398
1384
|
}
|
|
1399
1385
|
/**
|
|
1400
|
-
*
|
|
1386
|
+
* Revoke a linked identity
|
|
1401
1387
|
*
|
|
1402
|
-
*
|
|
1388
|
+
* 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.
|
|
1403
1389
|
*
|
|
1404
1390
|
*/
|
|
1405
|
-
static
|
|
1391
|
+
static revokeAssistantGrant(options) {
|
|
1406
1392
|
return (options.client ?? client).delete({
|
|
1407
|
-
url: "/v1/
|
|
1393
|
+
url: "/v1/assistant/grants/{grant_id}",
|
|
1408
1394
|
...options
|
|
1409
1395
|
});
|
|
1410
1396
|
}
|
|
1411
1397
|
/**
|
|
1412
|
-
*
|
|
1398
|
+
* Resolve a pending link
|
|
1399
|
+
*
|
|
1400
|
+
* 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.
|
|
1401
|
+
* 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.
|
|
1402
|
+
*
|
|
1413
1403
|
*/
|
|
1414
|
-
static
|
|
1404
|
+
static previewAssistantLink(options) {
|
|
1415
1405
|
return (options.client ?? client).get({
|
|
1416
|
-
url: "/v1/
|
|
1406
|
+
url: "/v1/assistant/link",
|
|
1417
1407
|
...options
|
|
1418
1408
|
});
|
|
1419
1409
|
}
|
|
1420
1410
|
/**
|
|
1421
|
-
*
|
|
1411
|
+
* Redeem a link token
|
|
1412
|
+
*
|
|
1413
|
+
* 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.
|
|
1414
|
+
* The token is the idempotency key: it is single-use, so a replay of this request fails rather than creating a second grant.
|
|
1422
1415
|
*
|
|
1423
|
-
* Rename the collection or edit its description. At least one field is required.
|
|
1424
1416
|
*/
|
|
1425
|
-
static
|
|
1426
|
-
return (options.client ?? client).
|
|
1427
|
-
url: "/v1/
|
|
1417
|
+
static redeemAssistantLink(options) {
|
|
1418
|
+
return (options.client ?? client).post({
|
|
1419
|
+
url: "/v1/assistant/link",
|
|
1428
1420
|
...options,
|
|
1429
1421
|
headers: {
|
|
1430
1422
|
"Content-Type": "application/json",
|
|
@@ -1432,15 +1424,17 @@ var Knowledge = class {
|
|
|
1432
1424
|
}
|
|
1433
1425
|
});
|
|
1434
1426
|
}
|
|
1427
|
+
};
|
|
1428
|
+
var Auth = class {
|
|
1435
1429
|
/**
|
|
1436
|
-
*
|
|
1430
|
+
* Email a sign-in code
|
|
1437
1431
|
*
|
|
1438
|
-
*
|
|
1432
|
+
* 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.
|
|
1439
1433
|
*
|
|
1440
1434
|
*/
|
|
1441
|
-
static
|
|
1435
|
+
static requestSignInCode(options) {
|
|
1442
1436
|
return (options.client ?? client).post({
|
|
1443
|
-
url: "/v1/
|
|
1437
|
+
url: "/v1/auth/code",
|
|
1444
1438
|
...options,
|
|
1445
1439
|
headers: {
|
|
1446
1440
|
"Content-Type": "application/json",
|
|
@@ -1449,29 +1443,30 @@ var Knowledge = class {
|
|
|
1449
1443
|
});
|
|
1450
1444
|
}
|
|
1451
1445
|
/**
|
|
1452
|
-
*
|
|
1446
|
+
* Redeem a sign-in code
|
|
1447
|
+
*
|
|
1448
|
+
* 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.
|
|
1453
1449
|
*
|
|
1454
|
-
* Lists the documents in the collection, with their ingestion status.
|
|
1455
1450
|
*/
|
|
1456
|
-
static
|
|
1457
|
-
return (options.client ?? client).
|
|
1458
|
-
url: "/v1/
|
|
1459
|
-
...options
|
|
1451
|
+
static verifySignInCode(options) {
|
|
1452
|
+
return (options.client ?? client).post({
|
|
1453
|
+
url: "/v1/auth/code/verify",
|
|
1454
|
+
...options,
|
|
1455
|
+
headers: {
|
|
1456
|
+
"Content-Type": "application/json",
|
|
1457
|
+
...options.headers
|
|
1458
|
+
}
|
|
1460
1459
|
});
|
|
1461
1460
|
}
|
|
1462
1461
|
/**
|
|
1463
|
-
*
|
|
1464
|
-
*
|
|
1465
|
-
* Add a document to the collection, from **inline text** (`content`) or from an **uploaded file** (`file`, base64, plus `content_type` and `filename`) — exactly one of the two.
|
|
1466
|
-
*
|
|
1467
|
-
* `application/pdf`, `text/plain` and `text/markdown` are extracted natively. Any other media type needs a converter (`POST /v1/projects/{project_id}/knowledge/converters`) registered for it in the project; without one the request is rejected with `unsupported_content_type` and no document is created.
|
|
1462
|
+
* Refresh a session
|
|
1468
1463
|
*
|
|
1469
|
-
*
|
|
1464
|
+
* 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.
|
|
1470
1465
|
*
|
|
1471
1466
|
*/
|
|
1472
|
-
static
|
|
1467
|
+
static refreshSession(options) {
|
|
1473
1468
|
return (options.client ?? client).post({
|
|
1474
|
-
url: "/v1/
|
|
1469
|
+
url: "/v1/auth/refresh",
|
|
1475
1470
|
...options,
|
|
1476
1471
|
headers: {
|
|
1477
1472
|
"Content-Type": "application/json",
|
|
@@ -1480,73 +1475,79 @@ var Knowledge = class {
|
|
|
1480
1475
|
});
|
|
1481
1476
|
}
|
|
1482
1477
|
/**
|
|
1483
|
-
*
|
|
1478
|
+
* Log out
|
|
1479
|
+
*
|
|
1480
|
+
* 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.
|
|
1481
|
+
*
|
|
1484
1482
|
*/
|
|
1485
|
-
static
|
|
1486
|
-
return (options
|
|
1487
|
-
url: "/v1/
|
|
1488
|
-
...options
|
|
1483
|
+
static logout(options) {
|
|
1484
|
+
return (options?.client ?? client).post({
|
|
1485
|
+
url: "/v1/auth/logout",
|
|
1486
|
+
...options,
|
|
1487
|
+
headers: {
|
|
1488
|
+
"Content-Type": "application/json",
|
|
1489
|
+
...options?.headers
|
|
1490
|
+
}
|
|
1489
1491
|
});
|
|
1490
1492
|
}
|
|
1493
|
+
};
|
|
1494
|
+
var Conversations = class {
|
|
1491
1495
|
/**
|
|
1492
|
-
*
|
|
1496
|
+
* List conversations
|
|
1493
1497
|
*
|
|
1494
|
-
* Returns the
|
|
1498
|
+
* Returns all conversations the caller has access to. If projectId is provided, returns only conversations in that project. project keys are scoped to a single project automatically.
|
|
1495
1499
|
*/
|
|
1496
|
-
static
|
|
1500
|
+
static listConversations(options) {
|
|
1497
1501
|
return (options.client ?? client).get({
|
|
1498
|
-
url: "/v1/projects/{project_id}/
|
|
1502
|
+
url: "/v1/projects/{project_id}/conversations",
|
|
1499
1503
|
...options
|
|
1500
1504
|
});
|
|
1501
1505
|
}
|
|
1502
1506
|
/**
|
|
1503
|
-
*
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1507
|
+
* Create a conversation
|
|
1508
|
+
*
|
|
1509
|
+
* Creates a new conversation. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
|
|
1510
|
+
*/
|
|
1511
|
+
static createConversation(options) {
|
|
1512
|
+
return (options.client ?? client).post({
|
|
1513
|
+
url: "/v1/projects/{project_id}/conversations",
|
|
1514
|
+
...options,
|
|
1515
|
+
headers: {
|
|
1516
|
+
"Content-Type": "application/json",
|
|
1517
|
+
...options.headers
|
|
1518
|
+
}
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Delete a conversation
|
|
1506
1523
|
*
|
|
1524
|
+
* Deletes a conversation by its ID
|
|
1507
1525
|
*/
|
|
1508
|
-
static
|
|
1509
|
-
return (options.client ?? client).
|
|
1510
|
-
url: "/v1/projects/{project_id}/
|
|
1526
|
+
static deleteConversation(options) {
|
|
1527
|
+
return (options.client ?? client).delete({
|
|
1528
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1511
1529
|
...options
|
|
1512
1530
|
});
|
|
1513
1531
|
}
|
|
1514
1532
|
/**
|
|
1515
|
-
*
|
|
1533
|
+
* Get a conversation by ID
|
|
1516
1534
|
*
|
|
1517
|
-
*
|
|
1535
|
+
* Returns a conversation by its ID
|
|
1518
1536
|
*/
|
|
1519
|
-
static
|
|
1537
|
+
static getConversation(options) {
|
|
1520
1538
|
return (options.client ?? client).get({
|
|
1521
|
-
url: "/v1/projects/{project_id}/
|
|
1539
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1522
1540
|
...options
|
|
1523
1541
|
});
|
|
1524
1542
|
}
|
|
1525
1543
|
/**
|
|
1526
|
-
*
|
|
1527
|
-
*
|
|
1528
|
-
* Register a converter for a media type the platform cannot extract natively, so files of that type become ingestable documents like any other. A converter maps a `content_type` glob (`image*`, `audio/mpeg`, …) onto one of two workers:
|
|
1529
|
-
*
|
|
1530
|
-
* - an **agent** (`agent_id`) — the file is handed to a
|
|
1531
|
-
* multimodal model with a fixed "extract all the text" instruction and
|
|
1532
|
-
* its answer becomes the document text. The shortest path for images
|
|
1533
|
-
* and scanned PDFs; nothing to map.
|
|
1534
|
-
*
|
|
1535
|
-
* - a **tool** (`tool_id`) — the file is passed to an
|
|
1536
|
-
* `http` tool as `{ content_type, filename, data_base64 }`, and
|
|
1537
|
-
* whatever string the tool returns becomes the document text. The path
|
|
1538
|
-
* for dedicated non-chat APIs (speech-to-text, a specialist OCR
|
|
1539
|
-
* engine); use the tool's `execute.body_mode: multipart` for
|
|
1540
|
-
* form-data endpoints and its `output_mapping` to reduce a JSON
|
|
1541
|
-
* response to the bare string.
|
|
1542
|
-
*
|
|
1543
|
-
*
|
|
1544
|
-
* Exactly one of `agent_id` / `tool_id`, and one converter per `content_type` in a project.
|
|
1544
|
+
* Update a conversation
|
|
1545
1545
|
*
|
|
1546
|
+
* Updates the status of a conversation
|
|
1546
1547
|
*/
|
|
1547
|
-
static
|
|
1548
|
-
return (options.client ?? client).
|
|
1549
|
-
url: "/v1/projects/{project_id}/
|
|
1548
|
+
static updateConversation(options) {
|
|
1549
|
+
return (options.client ?? client).patch({
|
|
1550
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}",
|
|
1550
1551
|
...options,
|
|
1551
1552
|
headers: {
|
|
1552
1553
|
"Content-Type": "application/json",
|
|
@@ -1555,35 +1556,24 @@ var Knowledge = class {
|
|
|
1555
1556
|
});
|
|
1556
1557
|
}
|
|
1557
1558
|
/**
|
|
1558
|
-
*
|
|
1559
|
+
* List conversation messages
|
|
1559
1560
|
*
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1562
|
-
*/
|
|
1563
|
-
static deleteKnowledgeConverter(options) {
|
|
1564
|
-
return (options.client ?? client).delete({
|
|
1565
|
-
url: "/v1/projects/{project_id}/knowledge/converters/{converter_id}",
|
|
1566
|
-
...options
|
|
1567
|
-
});
|
|
1568
|
-
}
|
|
1569
|
-
/**
|
|
1570
|
-
* Get a converter
|
|
1561
|
+
* Returns all messages (documents) attached to a conversation, ordered by position
|
|
1571
1562
|
*/
|
|
1572
|
-
static
|
|
1563
|
+
static listConversationMessages(options) {
|
|
1573
1564
|
return (options.client ?? client).get({
|
|
1574
|
-
url: "/v1/projects/{project_id}/
|
|
1565
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages",
|
|
1575
1566
|
...options
|
|
1576
1567
|
});
|
|
1577
1568
|
}
|
|
1578
1569
|
/**
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1581
|
-
* Change the worker or the chunking defaults. At least one field is required; `agent_id` and `tool_id` stay mutually exclusive, so setting one clears the other.
|
|
1570
|
+
* Add a message to a conversation
|
|
1582
1571
|
*
|
|
1572
|
+
* Creates a document from the message text and attaches it to the conversation at the given position. If position is omitted, it is appended at the end.
|
|
1583
1573
|
*/
|
|
1584
|
-
static
|
|
1585
|
-
return (options.client ?? client).
|
|
1586
|
-
url: "/v1/projects/{project_id}/
|
|
1574
|
+
static addConversationMessage(options) {
|
|
1575
|
+
return (options.client ?? client).post({
|
|
1576
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages",
|
|
1587
1577
|
...options,
|
|
1588
1578
|
headers: {
|
|
1589
1579
|
"Content-Type": "application/json",
|
|
@@ -1591,50 +1581,60 @@ var Knowledge = class {
|
|
|
1591
1581
|
}
|
|
1592
1582
|
});
|
|
1593
1583
|
}
|
|
1594
|
-
};
|
|
1595
|
-
var Models = class {
|
|
1596
1584
|
/**
|
|
1597
|
-
*
|
|
1585
|
+
* Generate the next message in a conversation
|
|
1598
1586
|
*
|
|
1599
|
-
*
|
|
1587
|
+
* Generates the next message using the specified actor's linked agent or chat.
|
|
1588
|
+
* Background by default: returns `202 Accepted` immediately and the reply
|
|
1589
|
+
* lands as a new ConversationMessage when it completes — poll
|
|
1590
|
+
* `GET /v1/projects/{project_id}/conversations/{conversation_id}/messages` for it.
|
|
1591
|
+
* Pass `?wait=true` to block and receive the result inline. On
|
|
1592
|
+
* `completed`, the reply is persisted as a new ConversationMessage
|
|
1593
|
+
* authored by that actor. On `requires_action`, nothing is persisted; the
|
|
1594
|
+
* caller must submit tool outputs via the Agents module and re-invoke
|
|
1595
|
+
* generate — so a flow using client tools should pass `?wait=true`.
|
|
1600
1596
|
*
|
|
1601
1597
|
*/
|
|
1602
|
-
static
|
|
1603
|
-
return (options
|
|
1604
|
-
url: "/v1/
|
|
1605
|
-
...options
|
|
1598
|
+
static generateConversationMessage(options) {
|
|
1599
|
+
return (options.client ?? client).post({
|
|
1600
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/generate",
|
|
1601
|
+
...options,
|
|
1602
|
+
headers: {
|
|
1603
|
+
"Content-Type": "application/json",
|
|
1604
|
+
...options.headers
|
|
1605
|
+
}
|
|
1606
1606
|
});
|
|
1607
1607
|
}
|
|
1608
1608
|
/**
|
|
1609
|
-
*
|
|
1609
|
+
* Remove a message from a conversation
|
|
1610
|
+
*
|
|
1611
|
+
* Removes a document from a conversation
|
|
1610
1612
|
*/
|
|
1611
|
-
static
|
|
1612
|
-
return (options.client ?? client).
|
|
1613
|
-
url: "/v1/
|
|
1613
|
+
static removeConversationMessage(options) {
|
|
1614
|
+
return (options.client ?? client).delete({
|
|
1615
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/messages/{document_id}",
|
|
1614
1616
|
...options
|
|
1615
1617
|
});
|
|
1616
1618
|
}
|
|
1617
|
-
};
|
|
1618
|
-
var Orchestrations = class {
|
|
1619
1619
|
/**
|
|
1620
|
-
*
|
|
1620
|
+
* Get conversation tags
|
|
1621
1621
|
*
|
|
1622
|
-
*
|
|
1622
|
+
* Returns all tags attached to the conversation
|
|
1623
1623
|
*/
|
|
1624
|
-
static
|
|
1624
|
+
static getConversationTags(options) {
|
|
1625
1625
|
return (options.client ?? client).get({
|
|
1626
|
-
url: "/v1/projects/{project_id}/
|
|
1626
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1627
1627
|
...options
|
|
1628
1628
|
});
|
|
1629
1629
|
}
|
|
1630
1630
|
/**
|
|
1631
|
-
*
|
|
1631
|
+
* Merge conversation tags
|
|
1632
1632
|
*
|
|
1633
|
-
*
|
|
1633
|
+
* Merges provided tags with existing tags
|
|
1634
1634
|
*/
|
|
1635
|
-
static
|
|
1636
|
-
return (options.client ?? client).
|
|
1637
|
-
url: "/v1/projects/{project_id}/
|
|
1635
|
+
static mergeConversationTags(options) {
|
|
1636
|
+
return (options.client ?? client).patch({
|
|
1637
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1638
1638
|
...options,
|
|
1639
1639
|
headers: {
|
|
1640
1640
|
"Content-Type": "application/json",
|
|
@@ -1643,14 +1643,13 @@ var Orchestrations = class {
|
|
|
1643
1643
|
});
|
|
1644
1644
|
}
|
|
1645
1645
|
/**
|
|
1646
|
-
*
|
|
1647
|
-
*
|
|
1648
|
-
* 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`.
|
|
1646
|
+
* Replace conversation tags
|
|
1649
1647
|
*
|
|
1648
|
+
* Replaces all tags on the conversation with the provided tags
|
|
1650
1649
|
*/
|
|
1651
|
-
static
|
|
1652
|
-
return (options.client ?? client).
|
|
1653
|
-
url: "/v1/projects/{project_id}/
|
|
1650
|
+
static replaceConversationTags(options) {
|
|
1651
|
+
return (options.client ?? client).put({
|
|
1652
|
+
url: "/v1/projects/{project_id}/conversations/{conversation_id}/tags",
|
|
1654
1653
|
...options,
|
|
1655
1654
|
headers: {
|
|
1656
1655
|
"Content-Type": "application/json",
|
|
@@ -1658,37 +1657,41 @@ var Orchestrations = class {
|
|
|
1658
1657
|
}
|
|
1659
1658
|
});
|
|
1660
1659
|
}
|
|
1660
|
+
};
|
|
1661
|
+
var Generations = class {
|
|
1661
1662
|
/**
|
|
1662
|
-
*
|
|
1663
|
+
* List generations
|
|
1664
|
+
*
|
|
1665
|
+
* 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).
|
|
1663
1666
|
*
|
|
1664
|
-
* Deletes the orchestration definition and all of its runs.
|
|
1665
1667
|
*/
|
|
1666
|
-
static
|
|
1667
|
-
return (options.client ?? client).
|
|
1668
|
-
url: "/v1/projects/{project_id}/
|
|
1668
|
+
static listGenerations(options) {
|
|
1669
|
+
return (options.client ?? client).get({
|
|
1670
|
+
url: "/v1/projects/{project_id}/generations",
|
|
1669
1671
|
...options
|
|
1670
1672
|
});
|
|
1671
1673
|
}
|
|
1672
1674
|
/**
|
|
1673
|
-
* Get
|
|
1675
|
+
* Get a generation
|
|
1674
1676
|
*
|
|
1675
|
-
* Returns
|
|
1677
|
+
* 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).
|
|
1676
1678
|
*
|
|
1677
1679
|
*/
|
|
1678
|
-
static
|
|
1680
|
+
static getGeneration(options) {
|
|
1679
1681
|
return (options.client ?? client).get({
|
|
1680
|
-
url: "/v1/projects/{project_id}/
|
|
1682
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1681
1683
|
...options
|
|
1682
1684
|
});
|
|
1683
1685
|
}
|
|
1684
1686
|
/**
|
|
1685
|
-
* Update
|
|
1687
|
+
* Update generation metadata
|
|
1688
|
+
*
|
|
1689
|
+
* 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.
|
|
1686
1690
|
*
|
|
1687
|
-
* Partially updates an orchestration's definition.
|
|
1688
1691
|
*/
|
|
1689
|
-
static
|
|
1692
|
+
static updateGeneration(options) {
|
|
1690
1693
|
return (options.client ?? client).patch({
|
|
1691
|
-
url: "/v1/projects/{project_id}/
|
|
1694
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}",
|
|
1692
1695
|
...options,
|
|
1693
1696
|
headers: {
|
|
1694
1697
|
"Content-Type": "application/json",
|
|
@@ -1697,73 +1700,97 @@ var Orchestrations = class {
|
|
|
1697
1700
|
});
|
|
1698
1701
|
}
|
|
1699
1702
|
/**
|
|
1700
|
-
*
|
|
1703
|
+
* Purge generation content
|
|
1701
1704
|
*
|
|
1702
|
-
*
|
|
1705
|
+
* Clears the generation's content — `metadata`, `error`, `extraction`, and the internal recovery state of a paused run — and stamps `content_redacted_at`.
|
|
1706
|
+
*
|
|
1707
|
+
* 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.
|
|
1708
|
+
*
|
|
1709
|
+
* 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.
|
|
1710
|
+
*
|
|
1711
|
+
* Idempotent — purging an already-purged generation succeeds and leaves the original `content_redacted_at` in place.
|
|
1703
1712
|
*
|
|
1704
1713
|
*/
|
|
1705
|
-
static
|
|
1706
|
-
return (options.client ?? client).
|
|
1707
|
-
url: "/v1/projects/{project_id}/
|
|
1714
|
+
static purgeGenerationContent(options) {
|
|
1715
|
+
return (options.client ?? client).delete({
|
|
1716
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}/content",
|
|
1708
1717
|
...options
|
|
1709
1718
|
});
|
|
1710
1719
|
}
|
|
1711
1720
|
/**
|
|
1712
|
-
*
|
|
1721
|
+
* Get a generation's transcript
|
|
1722
|
+
*
|
|
1723
|
+
* 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.
|
|
1724
|
+
*
|
|
1725
|
+
* 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.
|
|
1726
|
+
*
|
|
1727
|
+
* 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.
|
|
1713
1728
|
*
|
|
1714
|
-
* 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.
|
|
1715
1729
|
*/
|
|
1716
|
-
static
|
|
1717
|
-
return (options.client ?? client).
|
|
1718
|
-
url: "/v1/projects/{project_id}/
|
|
1719
|
-
...options
|
|
1720
|
-
headers: {
|
|
1721
|
-
"Content-Type": "application/json",
|
|
1722
|
-
...options.headers
|
|
1723
|
-
}
|
|
1730
|
+
static getGenerationTranscript(options) {
|
|
1731
|
+
return (options.client ?? client).get({
|
|
1732
|
+
url: "/v1/projects/{project_id}/generations/{generation_id}/transcript",
|
|
1733
|
+
...options
|
|
1724
1734
|
});
|
|
1725
1735
|
}
|
|
1736
|
+
};
|
|
1737
|
+
var ModelRoutes = class {
|
|
1726
1738
|
/**
|
|
1727
|
-
*
|
|
1739
|
+
* List model routes
|
|
1728
1740
|
*
|
|
1729
|
-
* Returns the
|
|
1741
|
+
* Returns the model routes defined in a project
|
|
1730
1742
|
*/
|
|
1731
|
-
static
|
|
1743
|
+
static listModelRoutes(options) {
|
|
1732
1744
|
return (options.client ?? client).get({
|
|
1733
|
-
url: "/v1/projects/{project_id}/
|
|
1745
|
+
url: "/v1/projects/{project_id}/model-routes",
|
|
1734
1746
|
...options
|
|
1735
1747
|
});
|
|
1736
1748
|
}
|
|
1737
1749
|
/**
|
|
1738
|
-
*
|
|
1750
|
+
* Create a model route
|
|
1739
1751
|
*
|
|
1740
|
-
*
|
|
1752
|
+
* 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.
|
|
1741
1753
|
*/
|
|
1742
|
-
static
|
|
1754
|
+
static createModelRoute(options) {
|
|
1743
1755
|
return (options.client ?? client).post({
|
|
1744
|
-
url: "/v1/projects/{project_id}/
|
|
1756
|
+
url: "/v1/projects/{project_id}/model-routes",
|
|
1757
|
+
...options,
|
|
1758
|
+
headers: {
|
|
1759
|
+
"Content-Type": "application/json",
|
|
1760
|
+
...options.headers
|
|
1761
|
+
}
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Delete a model route
|
|
1766
|
+
*
|
|
1767
|
+
* 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.
|
|
1768
|
+
*/
|
|
1769
|
+
static deleteModelRoute(options) {
|
|
1770
|
+
return (options.client ?? client).delete({
|
|
1771
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1745
1772
|
...options
|
|
1746
1773
|
});
|
|
1747
1774
|
}
|
|
1748
1775
|
/**
|
|
1749
|
-
*
|
|
1776
|
+
* Get a model route
|
|
1750
1777
|
*
|
|
1751
|
-
*
|
|
1778
|
+
* Returns a specific model route
|
|
1752
1779
|
*/
|
|
1753
|
-
static
|
|
1754
|
-
return (options.client ?? client).
|
|
1755
|
-
url: "/v1/projects/{project_id}/
|
|
1780
|
+
static getModelRoute(options) {
|
|
1781
|
+
return (options.client ?? client).get({
|
|
1782
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1756
1783
|
...options
|
|
1757
1784
|
});
|
|
1758
1785
|
}
|
|
1759
1786
|
/**
|
|
1760
|
-
*
|
|
1787
|
+
* Update a model route
|
|
1761
1788
|
*
|
|
1762
|
-
*
|
|
1789
|
+
* Updates a model route's name, targets, retry classes, or breaker configuration. Omitted fields are left unchanged.
|
|
1763
1790
|
*/
|
|
1764
|
-
static
|
|
1765
|
-
return (options.client ?? client).
|
|
1766
|
-
url: "/v1/projects/{project_id}/
|
|
1791
|
+
static updateModelRoute(options) {
|
|
1792
|
+
return (options.client ?? client).put({
|
|
1793
|
+
url: "/v1/projects/{project_id}/model-routes/{route_id}",
|
|
1767
1794
|
...options,
|
|
1768
1795
|
headers: {
|
|
1769
1796
|
"Content-Type": "application/json",
|
|
@@ -1776,7 +1803,8 @@ var Projects = class {
|
|
|
1776
1803
|
/**
|
|
1777
1804
|
* List projects
|
|
1778
1805
|
*
|
|
1779
|
-
* Lists projects
|
|
1806
|
+
* Lists the projects the caller is a member of. A project-scoped API key lists only its own project.
|
|
1807
|
+
*
|
|
1780
1808
|
*/
|
|
1781
1809
|
static listProjects(options) {
|
|
1782
1810
|
return (options?.client ?? client).get({
|
|
@@ -1803,6 +1831,7 @@ var Projects = class {
|
|
|
1803
1831
|
* Delete a project
|
|
1804
1832
|
*
|
|
1805
1833
|
* 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.
|
|
1834
|
+
* Requires the `owner` role — an `admin` runs the project day to day, but destroying it is the billing owner's call.
|
|
1806
1835
|
*
|
|
1807
1836
|
*/
|
|
1808
1837
|
static deleteProject(options) {
|
|
@@ -1814,8 +1843,8 @@ var Projects = class {
|
|
|
1814
1843
|
/**
|
|
1815
1844
|
* Get a project
|
|
1816
1845
|
*
|
|
1817
|
-
* Returns one project. An id you
|
|
1818
|
-
* `403` is reserved for the
|
|
1846
|
+
* 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.
|
|
1847
|
+
* `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.
|
|
1819
1848
|
*
|
|
1820
1849
|
*/
|
|
1821
1850
|
static getProject(options) {
|
|
@@ -1828,6 +1857,7 @@ var Projects = class {
|
|
|
1828
1857
|
* Update a project
|
|
1829
1858
|
*
|
|
1830
1859
|
* 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.
|
|
1860
|
+
* Requires the `admin` role in the project (an `owner` has it too).
|
|
1831
1861
|
* 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.
|
|
1832
1862
|
*
|
|
1833
1863
|
*/
|
|
@@ -1842,6 +1872,19 @@ var Projects = class {
|
|
|
1842
1872
|
});
|
|
1843
1873
|
}
|
|
1844
1874
|
/**
|
|
1875
|
+
* List project members
|
|
1876
|
+
*
|
|
1877
|
+
* 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.
|
|
1878
|
+
* Read-only for now — adding and removing members arrives with the invitation flow, since an invitee may not have an account yet.
|
|
1879
|
+
*
|
|
1880
|
+
*/
|
|
1881
|
+
static listProjectMembers(options) {
|
|
1882
|
+
return (options.client ?? client).get({
|
|
1883
|
+
url: "/v1/projects/{project_id}/members",
|
|
1884
|
+
...options
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1845
1888
|
* Get per-project usage
|
|
1846
1889
|
*
|
|
1847
1890
|
* 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.
|
|
@@ -1856,27 +1899,26 @@ var Projects = class {
|
|
|
1856
1899
|
});
|
|
1857
1900
|
}
|
|
1858
1901
|
};
|
|
1859
|
-
var
|
|
1902
|
+
var Secrets = class {
|
|
1860
1903
|
/**
|
|
1861
|
-
* List
|
|
1904
|
+
* List secrets
|
|
1862
1905
|
*
|
|
1863
|
-
*
|
|
1906
|
+
* Returns a list of secrets for a project
|
|
1864
1907
|
*/
|
|
1865
|
-
static
|
|
1908
|
+
static listSecrets(options) {
|
|
1866
1909
|
return (options.client ?? client).get({
|
|
1867
|
-
url: "/v1/projects/{project_id}/
|
|
1910
|
+
url: "/v1/projects/{project_id}/secrets",
|
|
1868
1911
|
...options
|
|
1869
1912
|
});
|
|
1870
1913
|
}
|
|
1871
1914
|
/**
|
|
1872
|
-
*
|
|
1873
|
-
*
|
|
1874
|
-
* 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.
|
|
1915
|
+
* Create a secret
|
|
1875
1916
|
*
|
|
1917
|
+
* Creates a new encrypted secret in a project
|
|
1876
1918
|
*/
|
|
1877
|
-
static
|
|
1919
|
+
static createSecret(options) {
|
|
1878
1920
|
return (options.client ?? client).post({
|
|
1879
|
-
url: "/v1/projects/{project_id}/
|
|
1921
|
+
url: "/v1/projects/{project_id}/secrets",
|
|
1880
1922
|
...options,
|
|
1881
1923
|
headers: {
|
|
1882
1924
|
"Content-Type": "application/json",
|
|
@@ -1885,35 +1927,35 @@ var Providers = class {
|
|
|
1885
1927
|
});
|
|
1886
1928
|
}
|
|
1887
1929
|
/**
|
|
1888
|
-
* Delete a
|
|
1889
|
-
*
|
|
1890
|
-
* 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.
|
|
1930
|
+
* Delete a secret
|
|
1891
1931
|
*
|
|
1932
|
+
* Deletes a secret
|
|
1892
1933
|
*/
|
|
1893
|
-
static
|
|
1934
|
+
static deleteSecret(options) {
|
|
1894
1935
|
return (options.client ?? client).delete({
|
|
1895
|
-
url: "/v1/projects/{project_id}/
|
|
1936
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1896
1937
|
...options
|
|
1897
1938
|
});
|
|
1898
1939
|
}
|
|
1899
1940
|
/**
|
|
1900
|
-
* Get a
|
|
1941
|
+
* Get a secret
|
|
1942
|
+
*
|
|
1943
|
+
* Returns a specific secret
|
|
1901
1944
|
*/
|
|
1902
|
-
static
|
|
1945
|
+
static getSecret(options) {
|
|
1903
1946
|
return (options.client ?? client).get({
|
|
1904
|
-
url: "/v1/projects/{project_id}/
|
|
1947
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1905
1948
|
...options
|
|
1906
1949
|
});
|
|
1907
1950
|
}
|
|
1908
1951
|
/**
|
|
1909
|
-
* Update a
|
|
1910
|
-
*
|
|
1911
|
-
* Change the model, name or base URL, or rotate the credentials (api_key). At least one field is required.
|
|
1952
|
+
* Update a secret
|
|
1912
1953
|
*
|
|
1954
|
+
* Updates a secret's name and/or value
|
|
1913
1955
|
*/
|
|
1914
|
-
static
|
|
1956
|
+
static updateSecret(options) {
|
|
1915
1957
|
return (options.client ?? client).patch({
|
|
1916
|
-
url: "/v1/projects/{project_id}/
|
|
1958
|
+
url: "/v1/projects/{project_id}/secrets/{secret_id}",
|
|
1917
1959
|
...options,
|
|
1918
1960
|
headers: {
|
|
1919
1961
|
"Content-Type": "application/json",
|
|
@@ -1924,14 +1966,25 @@ var Providers = class {
|
|
|
1924
1966
|
};
|
|
1925
1967
|
var Sessions = class {
|
|
1926
1968
|
/**
|
|
1927
|
-
*
|
|
1969
|
+
* List sessions
|
|
1970
|
+
*
|
|
1971
|
+
* Returns sessions the caller can access, optionally filtered by agent, actor and status.
|
|
1972
|
+
*/
|
|
1973
|
+
static listSessions(options) {
|
|
1974
|
+
return (options.client ?? client).get({
|
|
1975
|
+
url: "/v1/projects/{project_id}/sessions",
|
|
1976
|
+
...options
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Create a session
|
|
1928
1981
|
*
|
|
1929
|
-
*
|
|
1982
|
+
* 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.
|
|
1930
1983
|
*
|
|
1931
1984
|
*/
|
|
1932
1985
|
static createSession(options) {
|
|
1933
1986
|
return (options.client ?? client).post({
|
|
1934
|
-
url: "/v1/projects/{project_id}/
|
|
1987
|
+
url: "/v1/projects/{project_id}/sessions",
|
|
1935
1988
|
...options,
|
|
1936
1989
|
headers: {
|
|
1937
1990
|
"Content-Type": "application/json",
|
|
@@ -1940,38 +1993,52 @@ var Sessions = class {
|
|
|
1940
1993
|
});
|
|
1941
1994
|
}
|
|
1942
1995
|
/**
|
|
1943
|
-
*
|
|
1996
|
+
* Delete a session
|
|
1944
1997
|
*
|
|
1945
|
-
*
|
|
1998
|
+
* 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.
|
|
1946
1999
|
*
|
|
1947
2000
|
*/
|
|
1948
|
-
static
|
|
1949
|
-
return (options.client ?? client).
|
|
1950
|
-
url: "/v1/projects/{project_id}/
|
|
2001
|
+
static deleteSession(options) {
|
|
2002
|
+
return (options.client ?? client).delete({
|
|
2003
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
1951
2004
|
...options
|
|
1952
2005
|
});
|
|
1953
2006
|
}
|
|
1954
2007
|
/**
|
|
1955
|
-
*
|
|
1956
|
-
*
|
|
1957
|
-
* 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.
|
|
2008
|
+
* Get a session
|
|
1958
2009
|
*
|
|
2010
|
+
* Returns details of a single session.
|
|
1959
2011
|
*/
|
|
1960
|
-
static
|
|
2012
|
+
static getSession(options) {
|
|
1961
2013
|
return (options.client ?? client).get({
|
|
1962
|
-
url: "/v1/projects/{project_id}/
|
|
2014
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
1963
2015
|
...options
|
|
1964
2016
|
});
|
|
1965
2017
|
}
|
|
1966
2018
|
/**
|
|
1967
|
-
*
|
|
2019
|
+
* Update a session
|
|
2020
|
+
*
|
|
2021
|
+
* Updates the session name and/or status.
|
|
2022
|
+
*/
|
|
2023
|
+
static updateSession(options) {
|
|
2024
|
+
return (options.client ?? client).patch({
|
|
2025
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}",
|
|
2026
|
+
...options,
|
|
2027
|
+
headers: {
|
|
2028
|
+
"Content-Type": "application/json",
|
|
2029
|
+
...options.headers
|
|
2030
|
+
}
|
|
2031
|
+
});
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* Add a user message
|
|
1968
2035
|
*
|
|
1969
|
-
*
|
|
2036
|
+
* 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.
|
|
1970
2037
|
*
|
|
1971
2038
|
*/
|
|
1972
2039
|
static addSessionMessage(options) {
|
|
1973
2040
|
return (options.client ?? client).post({
|
|
1974
|
-
url: "/v1/projects/{project_id}/
|
|
2041
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/messages",
|
|
1975
2042
|
...options,
|
|
1976
2043
|
headers: {
|
|
1977
2044
|
"Content-Type": "application/json",
|
|
@@ -1980,20 +2047,14 @@ var Sessions = class {
|
|
|
1980
2047
|
});
|
|
1981
2048
|
}
|
|
1982
2049
|
/**
|
|
1983
|
-
*
|
|
2050
|
+
* Trigger agent generation
|
|
1984
2051
|
*
|
|
1985
|
-
*
|
|
1986
|
-
*
|
|
1987
|
-
* 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`.
|
|
1988
|
-
*
|
|
1989
|
-
* 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.
|
|
1990
|
-
*
|
|
1991
|
-
* `model` overrides the agent's default model for this turn only.
|
|
2052
|
+
* 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.
|
|
1992
2053
|
*
|
|
1993
2054
|
*/
|
|
1994
2055
|
static generateSessionResponse(options) {
|
|
1995
2056
|
return (options.client ?? client).post({
|
|
1996
|
-
url: "/v1/projects/{project_id}/
|
|
2057
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/generate",
|
|
1997
2058
|
...options,
|
|
1998
2059
|
headers: {
|
|
1999
2060
|
"Content-Type": "application/json",
|
|
@@ -2001,29 +2062,35 @@ var Sessions = class {
|
|
|
2001
2062
|
}
|
|
2002
2063
|
});
|
|
2003
2064
|
}
|
|
2004
|
-
};
|
|
2005
|
-
var Tasks = class {
|
|
2006
2065
|
/**
|
|
2007
|
-
*
|
|
2066
|
+
* Submit tool outputs
|
|
2008
2067
|
*
|
|
2009
|
-
*
|
|
2068
|
+
* 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.
|
|
2010
2069
|
*
|
|
2011
2070
|
*/
|
|
2012
|
-
static
|
|
2013
|
-
return (options.client ?? client).
|
|
2014
|
-
url: "/v1/projects/{project_id}/
|
|
2015
|
-
...options
|
|
2071
|
+
static submitSessionToolOutputs(options) {
|
|
2072
|
+
return (options.client ?? client).post({
|
|
2073
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tool-outputs",
|
|
2074
|
+
...options,
|
|
2075
|
+
headers: {
|
|
2076
|
+
"Content-Type": "application/json",
|
|
2077
|
+
...options.headers
|
|
2078
|
+
}
|
|
2016
2079
|
});
|
|
2017
2080
|
}
|
|
2018
2081
|
/**
|
|
2019
|
-
*
|
|
2082
|
+
* Fork a session
|
|
2020
2083
|
*
|
|
2021
|
-
*
|
|
2084
|
+
* Branches a new session from a point in this session's history: same context, different continuation.
|
|
2085
|
+
*
|
|
2086
|
+
* 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.
|
|
2087
|
+
*
|
|
2088
|
+
* 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.
|
|
2022
2089
|
*
|
|
2023
2090
|
*/
|
|
2024
|
-
static
|
|
2091
|
+
static forkSession(options) {
|
|
2025
2092
|
return (options.client ?? client).post({
|
|
2026
|
-
url: "/v1/projects/{project_id}/
|
|
2093
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/fork",
|
|
2027
2094
|
...options,
|
|
2028
2095
|
headers: {
|
|
2029
2096
|
"Content-Type": "application/json",
|
|
@@ -2032,39 +2099,36 @@ var Tasks = class {
|
|
|
2032
2099
|
});
|
|
2033
2100
|
}
|
|
2034
2101
|
/**
|
|
2035
|
-
*
|
|
2102
|
+
* List a session's forks
|
|
2036
2103
|
*
|
|
2037
|
-
*
|
|
2104
|
+
* Returns the sessions forked directly from this one. One level of lineage: a fork of a fork is listed under its own parent.
|
|
2038
2105
|
*
|
|
2039
2106
|
*/
|
|
2040
|
-
static
|
|
2041
|
-
return (options.client ?? client).
|
|
2042
|
-
url: "/v1/projects/{project_id}/
|
|
2107
|
+
static listSessionForks(options) {
|
|
2108
|
+
return (options.client ?? client).get({
|
|
2109
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/forks",
|
|
2043
2110
|
...options
|
|
2044
2111
|
});
|
|
2045
2112
|
}
|
|
2046
2113
|
/**
|
|
2047
|
-
* Get
|
|
2114
|
+
* Get session tags
|
|
2048
2115
|
*
|
|
2049
|
-
*
|
|
2116
|
+
* Returns the session's tags object.
|
|
2050
2117
|
*/
|
|
2051
|
-
static
|
|
2118
|
+
static getSessionTags(options) {
|
|
2052
2119
|
return (options.client ?? client).get({
|
|
2053
|
-
url: "/v1/projects/{project_id}/
|
|
2120
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2054
2121
|
...options
|
|
2055
2122
|
});
|
|
2056
2123
|
}
|
|
2057
2124
|
/**
|
|
2058
|
-
*
|
|
2059
|
-
*
|
|
2060
|
-
* Edit the card's `title`, `assignee` or `payload`. At least one is required.
|
|
2061
|
-
* `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.
|
|
2062
|
-
* `state` and `board_id` are rejected — a card moves only through `:transition`, and it never changes boards.
|
|
2125
|
+
* Merge session tags
|
|
2063
2126
|
*
|
|
2127
|
+
* Merges the provided tags into the session's existing tags.
|
|
2064
2128
|
*/
|
|
2065
|
-
static
|
|
2129
|
+
static mergeSessionTags(options) {
|
|
2066
2130
|
return (options.client ?? client).patch({
|
|
2067
|
-
url: "/v1/projects/{project_id}/
|
|
2131
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2068
2132
|
...options,
|
|
2069
2133
|
headers: {
|
|
2070
2134
|
"Content-Type": "application/json",
|
|
@@ -2073,15 +2137,13 @@ var Tasks = class {
|
|
|
2073
2137
|
});
|
|
2074
2138
|
}
|
|
2075
2139
|
/**
|
|
2076
|
-
*
|
|
2077
|
-
*
|
|
2078
|
-
* 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.
|
|
2079
|
-
* 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.
|
|
2140
|
+
* Replace session tags
|
|
2080
2141
|
*
|
|
2142
|
+
* Replaces all tags on the session.
|
|
2081
2143
|
*/
|
|
2082
|
-
static
|
|
2083
|
-
return (options.client ?? client).
|
|
2084
|
-
url: "/v1/projects/{project_id}/
|
|
2144
|
+
static replaceSessionTags(options) {
|
|
2145
|
+
return (options.client ?? client).put({
|
|
2146
|
+
url: "/v1/projects/{project_id}/sessions/{session_id}/tags",
|
|
2085
2147
|
...options,
|
|
2086
2148
|
headers: {
|
|
2087
2149
|
"Content-Type": "application/json",
|
|
@@ -2089,24 +2151,12 @@ var Tasks = class {
|
|
|
2089
2151
|
}
|
|
2090
2152
|
});
|
|
2091
2153
|
}
|
|
2092
|
-
/**
|
|
2093
|
-
* List the task's moves
|
|
2094
|
-
*
|
|
2095
|
-
* 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.
|
|
2096
|
-
*
|
|
2097
|
-
*/
|
|
2098
|
-
static listTaskTransitions(options) {
|
|
2099
|
-
return (options.client ?? client).get({
|
|
2100
|
-
url: "/v1/projects/{project_id}/tasks/{task_id}/transitions",
|
|
2101
|
-
...options
|
|
2102
|
-
});
|
|
2103
|
-
}
|
|
2104
2154
|
};
|
|
2105
2155
|
var Tools = class {
|
|
2106
2156
|
/**
|
|
2107
2157
|
* List tools
|
|
2108
2158
|
*
|
|
2109
|
-
*
|
|
2159
|
+
* Returns all tools in the project.
|
|
2110
2160
|
*/
|
|
2111
2161
|
static listTools(options) {
|
|
2112
2162
|
return (options.client ?? client).get({
|
|
@@ -2117,8 +2167,7 @@ var Tools = class {
|
|
|
2117
2167
|
/**
|
|
2118
2168
|
* Create a tool
|
|
2119
2169
|
*
|
|
2120
|
-
*
|
|
2121
|
-
*
|
|
2170
|
+
* Creates a new tool in the project.
|
|
2122
2171
|
*/
|
|
2123
2172
|
static createTool(options) {
|
|
2124
2173
|
return (options.client ?? client).post({
|
|
@@ -2133,8 +2182,7 @@ var Tools = class {
|
|
|
2133
2182
|
/**
|
|
2134
2183
|
* Delete a tool
|
|
2135
2184
|
*
|
|
2136
|
-
* Deletes
|
|
2137
|
-
*
|
|
2185
|
+
* Deletes a tool by ID.
|
|
2138
2186
|
*/
|
|
2139
2187
|
static deleteTool(options) {
|
|
2140
2188
|
return (options.client ?? client).delete({
|
|
@@ -2144,6 +2192,8 @@ var Tools = class {
|
|
|
2144
2192
|
}
|
|
2145
2193
|
/**
|
|
2146
2194
|
* Get a tool
|
|
2195
|
+
*
|
|
2196
|
+
* Returns a single tool by ID.
|
|
2147
2197
|
*/
|
|
2148
2198
|
static getTool(options) {
|
|
2149
2199
|
return (options.client ?? client).get({
|
|
@@ -2154,8 +2204,7 @@ var Tools = class {
|
|
|
2154
2204
|
/**
|
|
2155
2205
|
* Update a tool
|
|
2156
2206
|
*
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2207
|
+
* Updates an existing tool.
|
|
2159
2208
|
*/
|
|
2160
2209
|
static updateTool(options) {
|
|
2161
2210
|
return (options.client ?? client).patch({
|
|
@@ -2167,107 +2216,17 @@ var Tools = class {
|
|
|
2167
2216
|
}
|
|
2168
2217
|
});
|
|
2169
2218
|
}
|
|
2170
|
-
};
|
|
2171
|
-
var Traces = class {
|
|
2172
|
-
/**
|
|
2173
|
-
* List traces
|
|
2174
|
-
*
|
|
2175
|
-
* Lists the project's execution traces, newest first.
|
|
2176
|
-
*/
|
|
2177
|
-
static listTraces(options) {
|
|
2178
|
-
return (options.client ?? client).get({
|
|
2179
|
-
url: "/v1/projects/{project_id}/traces",
|
|
2180
|
-
...options
|
|
2181
|
-
});
|
|
2182
|
-
}
|
|
2183
|
-
/**
|
|
2184
|
-
* Get a trace
|
|
2185
|
-
*
|
|
2186
|
-
* Returns one trace. A trace belonging to another project responds `404`, not `403` — the API never confirms that an id exists elsewhere.
|
|
2187
|
-
*
|
|
2188
|
-
*/
|
|
2189
|
-
static getTrace(options) {
|
|
2190
|
-
return (options.client ?? client).get({
|
|
2191
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}",
|
|
2192
|
-
...options
|
|
2193
|
-
});
|
|
2194
|
-
}
|
|
2195
|
-
/**
|
|
2196
|
-
* Get a trace tree
|
|
2197
|
-
*
|
|
2198
|
-
* Returns the whole execution tree. Each node is one agent's execution; `children` are the traces its sub-agent tool calls started.
|
|
2199
|
-
* 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.
|
|
2200
|
-
*
|
|
2201
|
-
*/
|
|
2202
|
-
static getTraceTree(options) {
|
|
2203
|
-
return (options.client ?? client).get({
|
|
2204
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/tree",
|
|
2205
|
-
...options
|
|
2206
|
-
});
|
|
2207
|
-
}
|
|
2208
|
-
/**
|
|
2209
|
-
* List a trace's generations
|
|
2210
|
-
*
|
|
2211
|
-
* Lists the generations recorded under this trace — the model loops the execution ran, including sub-agent generations linked by `initiator_generation_id`.
|
|
2212
|
-
*
|
|
2213
|
-
*/
|
|
2214
|
-
static listTraceGenerations(options) {
|
|
2215
|
-
return (options.client ?? client).get({
|
|
2216
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/generations",
|
|
2217
|
-
...options
|
|
2218
|
-
});
|
|
2219
|
-
}
|
|
2220
2219
|
/**
|
|
2221
|
-
*
|
|
2220
|
+
* Call a tool
|
|
2222
2221
|
*
|
|
2223
|
-
*
|
|
2224
|
-
*
|
|
2225
|
-
*
|
|
2222
|
+
* 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.
|
|
2223
|
+
* 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.
|
|
2224
|
+
* `preset_parameters` stored on the tool are merged with the caller-supplied `input` before execution; preset keys take lower precedence.
|
|
2226
2225
|
*
|
|
2227
2226
|
*/
|
|
2228
|
-
static
|
|
2229
|
-
return (options.client ?? client).get({
|
|
2230
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/steps",
|
|
2231
|
-
...options
|
|
2232
|
-
});
|
|
2233
|
-
}
|
|
2234
|
-
/**
|
|
2235
|
-
* Purge a trace's content
|
|
2236
|
-
*
|
|
2237
|
-
* 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).
|
|
2238
|
-
* Idempotent: purging an already-purged trace succeeds and leaves the original `content_redacted_at` in place.
|
|
2239
|
-
*
|
|
2240
|
-
*/
|
|
2241
|
-
static purgeTraceContent(options) {
|
|
2242
|
-
return (options.client ?? client).delete({
|
|
2243
|
-
url: "/v1/projects/{project_id}/traces/{trace_id}/content",
|
|
2244
|
-
...options
|
|
2245
|
-
});
|
|
2246
|
-
}
|
|
2247
|
-
};
|
|
2248
|
-
var Triggers = class {
|
|
2249
|
-
/**
|
|
2250
|
-
* List triggers
|
|
2251
|
-
*
|
|
2252
|
-
* The project's schedule triggers, of either fronted target kind.
|
|
2253
|
-
* `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.
|
|
2254
|
-
*
|
|
2255
|
-
*/
|
|
2256
|
-
static listTriggers(options) {
|
|
2257
|
-
return (options.client ?? client).get({
|
|
2258
|
-
url: "/v1/projects/{project_id}/triggers",
|
|
2259
|
-
...options
|
|
2260
|
-
});
|
|
2261
|
-
}
|
|
2262
|
-
/**
|
|
2263
|
-
* Create a trigger
|
|
2264
|
-
*
|
|
2265
|
-
* 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.
|
|
2266
|
-
*
|
|
2267
|
-
*/
|
|
2268
|
-
static createTrigger(options) {
|
|
2227
|
+
static callTool(options) {
|
|
2269
2228
|
return (options.client ?? client).post({
|
|
2270
|
-
url: "/v1/projects/{project_id}/
|
|
2229
|
+
url: "/v1/projects/{project_id}/tools/{tool_id}/call",
|
|
2271
2230
|
...options,
|
|
2272
2231
|
headers: {
|
|
2273
2232
|
"Content-Type": "application/json",
|
|
@@ -2275,52 +2234,28 @@ var Triggers = class {
|
|
|
2275
2234
|
}
|
|
2276
2235
|
});
|
|
2277
2236
|
}
|
|
2237
|
+
};
|
|
2238
|
+
var Users = class {
|
|
2278
2239
|
/**
|
|
2279
|
-
*
|
|
2240
|
+
* Get the current user
|
|
2280
2241
|
*
|
|
2281
|
-
*
|
|
2282
|
-
*/
|
|
2283
|
-
static deleteTrigger(options) {
|
|
2284
|
-
return (options.client ?? client).delete({
|
|
2285
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}",
|
|
2286
|
-
...options
|
|
2287
|
-
});
|
|
2288
|
-
}
|
|
2289
|
-
/**
|
|
2290
|
-
* Get a trigger
|
|
2242
|
+
* Returns the account the presented credential resolves to.
|
|
2291
2243
|
*/
|
|
2292
|
-
static
|
|
2293
|
-
return (options
|
|
2294
|
-
url: "/v1/
|
|
2244
|
+
static getCurrentUser(options) {
|
|
2245
|
+
return (options?.client ?? client).get({
|
|
2246
|
+
url: "/v1/users/me",
|
|
2295
2247
|
...options
|
|
2296
2248
|
});
|
|
2297
2249
|
}
|
|
2298
2250
|
/**
|
|
2299
|
-
* Update
|
|
2251
|
+
* Update the current user
|
|
2300
2252
|
*
|
|
2301
|
-
*
|
|
2253
|
+
* 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.
|
|
2302
2254
|
*
|
|
2303
2255
|
*/
|
|
2304
|
-
static
|
|
2256
|
+
static updateCurrentUser(options) {
|
|
2305
2257
|
return (options.client ?? client).patch({
|
|
2306
|
-
url: "/v1/
|
|
2307
|
-
...options,
|
|
2308
|
-
headers: {
|
|
2309
|
-
"Content-Type": "application/json",
|
|
2310
|
-
...options.headers
|
|
2311
|
-
}
|
|
2312
|
-
});
|
|
2313
|
-
}
|
|
2314
|
-
/**
|
|
2315
|
-
* Fire a trigger manually
|
|
2316
|
-
*
|
|
2317
|
-
* 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`.
|
|
2318
|
-
* `input` is shallow-merged over the trigger's own stored `input` for this run only — the trigger's configuration is unchanged.
|
|
2319
|
-
*
|
|
2320
|
-
*/
|
|
2321
|
-
static fireTrigger(options) {
|
|
2322
|
-
return (options.client ?? client).post({
|
|
2323
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}:fire",
|
|
2258
|
+
url: "/v1/users/me",
|
|
2324
2259
|
...options,
|
|
2325
2260
|
headers: {
|
|
2326
2261
|
"Content-Type": "application/json",
|
|
@@ -2328,26 +2263,6 @@ var Triggers = class {
|
|
|
2328
2263
|
}
|
|
2329
2264
|
});
|
|
2330
2265
|
}
|
|
2331
|
-
/**
|
|
2332
|
-
* List a trigger's firings
|
|
2333
|
-
*
|
|
2334
|
-
* Every time this trigger ran, newest first — scheduled and manual alike.
|
|
2335
|
-
*/
|
|
2336
|
-
static listTriggerFirings(options) {
|
|
2337
|
-
return (options.client ?? client).get({
|
|
2338
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings",
|
|
2339
|
-
...options
|
|
2340
|
-
});
|
|
2341
|
-
}
|
|
2342
|
-
/**
|
|
2343
|
-
* Get a trigger firing
|
|
2344
|
-
*/
|
|
2345
|
-
static getTriggerFiring(options) {
|
|
2346
|
-
return (options.client ?? client).get({
|
|
2347
|
-
url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings/{firing_id}",
|
|
2348
|
-
...options
|
|
2349
|
-
});
|
|
2350
|
-
}
|
|
2351
2266
|
};
|
|
2352
2267
|
var Webhooks = class {
|
|
2353
2268
|
/**
|
|
@@ -2506,8 +2421,8 @@ const API_BASE_URL = "https://api.naturali.ai";
|
|
|
2506
2421
|
* });
|
|
2507
2422
|
*
|
|
2508
2423
|
* const { data, error } = await naturali.sessions.addSessionMessage({
|
|
2509
|
-
* path: { project_id: PROJECT_ID,
|
|
2510
|
-
* body: {
|
|
2424
|
+
* path: { project_id: PROJECT_ID, session_id: SESSION_ID },
|
|
2425
|
+
* body: { message: 'What is the capital of France?' },
|
|
2511
2426
|
* });
|
|
2512
2427
|
* ```
|
|
2513
2428
|
*
|
|
@@ -2518,22 +2433,20 @@ const API_BASE_URL = "https://api.naturali.ai";
|
|
|
2518
2433
|
var NaturaliClient = class {
|
|
2519
2434
|
actors;
|
|
2520
2435
|
agents;
|
|
2436
|
+
agentVersions;
|
|
2437
|
+
aiProviders;
|
|
2521
2438
|
apiKeys;
|
|
2522
2439
|
assistant;
|
|
2523
|
-
auth;
|
|
2524
|
-
boards;
|
|
2525
2440
|
channels;
|
|
2441
|
+
auth;
|
|
2442
|
+
conversations;
|
|
2526
2443
|
generations;
|
|
2527
|
-
|
|
2528
|
-
models;
|
|
2529
|
-
orchestrations;
|
|
2444
|
+
modelRoutes;
|
|
2530
2445
|
projects;
|
|
2531
|
-
|
|
2446
|
+
secrets;
|
|
2532
2447
|
sessions;
|
|
2533
|
-
tasks;
|
|
2534
2448
|
tools;
|
|
2535
|
-
|
|
2536
|
-
triggers;
|
|
2449
|
+
users;
|
|
2537
2450
|
webhooks;
|
|
2538
2451
|
/** The underlying HTTP client, for interceptors or one-off requests. */
|
|
2539
2452
|
http;
|
|
@@ -2547,24 +2460,22 @@ var NaturaliClient = class {
|
|
|
2547
2460
|
}));
|
|
2548
2461
|
this.actors = bindResource(Actors, this.http);
|
|
2549
2462
|
this.agents = bindResource(Agents, this.http);
|
|
2463
|
+
this.agentVersions = bindResource(AgentVersions, this.http);
|
|
2464
|
+
this.aiProviders = bindResource(AiProviders, this.http);
|
|
2550
2465
|
this.apiKeys = bindResource(ApiKeys, this.http);
|
|
2551
2466
|
this.assistant = bindResource(Assistant, this.http);
|
|
2552
|
-
this.auth = bindResource(Auth, this.http);
|
|
2553
|
-
this.boards = bindResource(Boards, this.http);
|
|
2554
2467
|
this.channels = bindResource(Channels, this.http);
|
|
2468
|
+
this.auth = bindResource(Auth, this.http);
|
|
2469
|
+
this.conversations = bindResource(Conversations, this.http);
|
|
2555
2470
|
this.generations = bindResource(Generations, this.http);
|
|
2556
|
-
this.
|
|
2557
|
-
this.models = bindResource(Models, this.http);
|
|
2558
|
-
this.orchestrations = bindResource(Orchestrations, this.http);
|
|
2471
|
+
this.modelRoutes = bindResource(ModelRoutes, this.http);
|
|
2559
2472
|
this.projects = bindResource(Projects, this.http);
|
|
2560
|
-
this.
|
|
2473
|
+
this.secrets = bindResource(Secrets, this.http);
|
|
2561
2474
|
this.sessions = bindResource(Sessions, this.http);
|
|
2562
|
-
this.tasks = bindResource(Tasks, this.http);
|
|
2563
2475
|
this.tools = bindResource(Tools, this.http);
|
|
2564
|
-
this.
|
|
2565
|
-
this.triggers = bindResource(Triggers, this.http);
|
|
2476
|
+
this.users = bindResource(Users, this.http);
|
|
2566
2477
|
this.webhooks = bindResource(Webhooks, this.http);
|
|
2567
2478
|
}
|
|
2568
2479
|
};
|
|
2569
2480
|
//#endregion
|
|
2570
|
-
export { Actors, Agents, ApiKeys, Assistant, Auth,
|
|
2481
|
+
export { Actors, AgentVersions, Agents, AiProviders, ApiKeys, Assistant, Auth, Channels, Conversations, Generations, ModelRoutes, NaturaliClient, Projects, Secrets, Sessions, Tools, Users, Webhooks, createClient, createConfig };
|