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