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