openai 7.28.0 → 7.30.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/CHANGELOG.md +16 -0
- package/client.d.mts +3 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -0
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/helpers/standard-schema.d.mts +8 -3
- package/helpers/standard-schema.d.mts.map +1 -1
- package/helpers/standard-schema.d.ts +8 -3
- package/helpers/standard-schema.d.ts.map +1 -1
- package/helpers/standard-schema.js +1 -0
- package/helpers/standard-schema.js.map +1 -1
- package/helpers/standard-schema.mjs +1 -0
- package/helpers/standard-schema.mjs.map +1 -1
- package/helpers/zod.d.mts +2 -0
- package/helpers/zod.d.mts.map +1 -1
- package/helpers/zod.d.ts +2 -0
- package/helpers/zod.d.ts.map +1 -1
- package/helpers/zod.js +1 -0
- package/helpers/zod.js.map +1 -1
- package/helpers/zod.mjs +1 -0
- package/helpers/zod.mjs.map +1 -1
- package/lib/ChatCompletionStream.d.mts +2 -1
- package/lib/ChatCompletionStream.d.mts.map +1 -1
- package/lib/ChatCompletionStream.d.ts +2 -1
- package/lib/ChatCompletionStream.d.ts.map +1 -1
- package/lib/ChatCompletionStream.js +9 -2
- package/lib/ChatCompletionStream.js.map +1 -1
- package/lib/ChatCompletionStream.mjs +9 -2
- package/lib/ChatCompletionStream.mjs.map +1 -1
- package/lib/ResponsesParser.d.mts.map +1 -1
- package/lib/ResponsesParser.d.ts.map +1 -1
- package/lib/ResponsesParser.js +5 -0
- package/lib/ResponsesParser.js.map +1 -1
- package/lib/ResponsesParser.mjs +5 -0
- package/lib/ResponsesParser.mjs.map +1 -1
- package/lib/agents/agent-session-stream.d.mts +7 -0
- package/lib/agents/agent-session-stream.d.mts.map +1 -1
- package/lib/agents/agent-session-stream.d.ts +7 -0
- package/lib/agents/agent-session-stream.d.ts.map +1 -1
- package/lib/agents/agent-session-stream.js +8 -110
- package/lib/agents/agent-session-stream.js.map +1 -1
- package/lib/agents/agent-session-stream.mjs +9 -111
- package/lib/agents/agent-session-stream.mjs.map +1 -1
- package/lib/beta/agents/agent-session-create-stream.d.mts +41 -1
- package/lib/beta/agents/agent-session-create-stream.d.mts.map +1 -1
- package/lib/beta/agents/agent-session-create-stream.d.ts +41 -1
- package/lib/beta/agents/agent-session-create-stream.d.ts.map +1 -1
- package/lib/beta/agents/agent-session-create-stream.js +70 -2
- package/lib/beta/agents/agent-session-create-stream.js.map +1 -1
- package/lib/beta/agents/agent-session-create-stream.mjs +69 -2
- package/lib/beta/agents/agent-session-create-stream.mjs.map +1 -1
- package/lib/beta/agents/function-tool.d.mts.map +1 -1
- package/lib/beta/agents/function-tool.d.ts.map +1 -1
- package/lib/beta/agents/function-tool.js +22 -15
- package/lib/beta/agents/function-tool.js.map +1 -1
- package/lib/beta/agents/function-tool.mjs +22 -15
- package/lib/beta/agents/function-tool.mjs.map +1 -1
- package/lib/beta/agents/parse-result.d.mts +2 -0
- package/lib/beta/agents/parse-result.d.mts.map +1 -1
- package/lib/beta/agents/parse-result.d.ts +2 -0
- package/lib/beta/agents/parse-result.d.ts.map +1 -1
- package/lib/beta/agents/tool-dispatcher.d.mts +13 -0
- package/lib/beta/agents/tool-dispatcher.d.mts.map +1 -0
- package/lib/beta/agents/tool-dispatcher.d.ts +13 -0
- package/lib/beta/agents/tool-dispatcher.d.ts.map +1 -0
- package/lib/beta/agents/tool-dispatcher.js +185 -0
- package/lib/beta/agents/tool-dispatcher.js.map +1 -0
- package/lib/beta/agents/tool-dispatcher.mjs +181 -0
- package/lib/beta/agents/tool-dispatcher.mjs.map +1 -0
- package/lib/beta/agents/tool-error.d.mts +13 -0
- package/lib/beta/agents/tool-error.d.mts.map +1 -0
- package/lib/beta/agents/tool-error.d.ts +13 -0
- package/lib/beta/agents/tool-error.d.ts.map +1 -0
- package/lib/beta/agents/tool-error.js +3 -0
- package/lib/beta/agents/tool-error.js.map +1 -0
- package/lib/beta/agents/tool-error.mjs +2 -0
- package/lib/beta/agents/tool-error.mjs.map +1 -0
- package/lib/beta/agents/tool-stages.d.mts +12 -0
- package/lib/beta/agents/tool-stages.d.mts.map +1 -0
- package/lib/beta/agents/tool-stages.d.ts +12 -0
- package/lib/beta/agents/tool-stages.d.ts.map +1 -0
- package/lib/beta/agents/tool-stages.js +6 -0
- package/lib/beta/agents/tool-stages.js.map +1 -0
- package/lib/beta/agents/tool-stages.mjs +3 -0
- package/lib/beta/agents/tool-stages.mjs.map +1 -0
- package/lib/chat-completions/streaming.d.mts +11 -0
- package/lib/chat-completions/streaming.d.mts.map +1 -0
- package/lib/chat-completions/streaming.d.ts +11 -0
- package/lib/chat-completions/streaming.d.ts.map +1 -0
- package/lib/chat-completions/streaming.js +27 -0
- package/lib/chat-completions/streaming.js.map +1 -0
- package/lib/chat-completions/streaming.mjs +23 -0
- package/lib/chat-completions/streaming.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/admin/organization/usage.d.mts +304 -9
- package/resources/admin/organization/usage.d.mts.map +1 -1
- package/resources/admin/organization/usage.d.ts +304 -9
- package/resources/admin/organization/usage.d.ts.map +1 -1
- package/resources/beta/agents/agents.d.mts +12 -6
- package/resources/beta/agents/agents.d.mts.map +1 -1
- package/resources/beta/agents/agents.d.ts +12 -6
- package/resources/beta/agents/agents.d.ts.map +1 -1
- package/resources/beta/agents/agents.js.map +1 -1
- package/resources/beta/agents/agents.mjs.map +1 -1
- package/resources/beta/agents/environments/templates.d.mts +6 -8
- package/resources/beta/agents/environments/templates.d.mts.map +1 -1
- package/resources/beta/agents/environments/templates.d.ts +6 -8
- package/resources/beta/agents/environments/templates.d.ts.map +1 -1
- package/resources/beta/agents/sessions/index.d.mts +1 -1
- package/resources/beta/agents/sessions/index.d.mts.map +1 -1
- package/resources/beta/agents/sessions/index.d.ts +1 -1
- package/resources/beta/agents/sessions/index.d.ts.map +1 -1
- package/resources/beta/agents/sessions/index.js +2 -2
- package/resources/beta/agents/sessions/index.js.map +1 -1
- package/resources/beta/agents/sessions/index.mjs +1 -1
- package/resources/beta/agents/sessions/index.mjs.map +1 -1
- package/resources/beta/agents/sessions/sessions.d.mts +6 -3
- package/resources/beta/agents/sessions/sessions.d.mts.map +1 -1
- package/resources/beta/agents/sessions/sessions.d.ts +6 -3
- package/resources/beta/agents/sessions/sessions.d.ts.map +1 -1
- package/resources/beta/agents/sessions/sessions.js +7 -4
- package/resources/beta/agents/sessions/sessions.js.map +1 -1
- package/resources/beta/agents/sessions/sessions.mjs +8 -5
- package/resources/beta/agents/sessions/sessions.mjs.map +1 -1
- package/resources/beta/agents/sessions/subagents/turns/turns.d.mts +2 -2
- package/resources/beta/agents/sessions/subagents/turns/turns.d.mts.map +1 -1
- package/resources/beta/agents/sessions/subagents/turns/turns.d.ts +2 -2
- package/resources/beta/agents/sessions/subagents/turns/turns.d.ts.map +1 -1
- package/resources/beta/agents/sessions/turns/index.d.mts +3 -0
- package/resources/beta/agents/sessions/turns/index.d.mts.map +1 -0
- package/resources/beta/agents/sessions/turns/index.d.ts +3 -0
- package/resources/beta/agents/sessions/turns/index.d.ts.map +1 -0
- package/resources/beta/agents/sessions/turns/index.js +9 -0
- package/resources/beta/agents/sessions/turns/index.js.map +1 -0
- package/resources/beta/agents/sessions/turns/index.mjs +4 -0
- package/resources/beta/agents/sessions/turns/index.mjs.map +1 -0
- package/resources/beta/agents/sessions/turns/items.d.mts +43 -0
- package/resources/beta/agents/sessions/turns/items.d.mts.map +1 -0
- package/resources/beta/agents/sessions/turns/items.d.ts +43 -0
- package/resources/beta/agents/sessions/turns/items.d.ts.map +1 -0
- package/resources/beta/agents/sessions/turns/items.js +40 -0
- package/resources/beta/agents/sessions/turns/items.js.map +1 -0
- package/resources/beta/agents/sessions/turns/items.mjs +36 -0
- package/resources/beta/agents/sessions/turns/items.mjs.map +1 -0
- package/resources/beta/agents/sessions/turns/turns.d.mts +128 -0
- package/resources/beta/agents/sessions/turns/turns.d.mts.map +1 -0
- package/resources/beta/agents/sessions/turns/turns.d.ts +128 -0
- package/resources/beta/agents/sessions/turns/turns.d.ts.map +1 -0
- package/resources/beta/agents/sessions/turns/turns.js +111 -0
- package/resources/beta/agents/sessions/turns/turns.js.map +1 -0
- package/resources/beta/agents/sessions/turns/turns.mjs +106 -0
- package/resources/beta/agents/sessions/turns/turns.mjs.map +1 -0
- package/resources/beta/agents/sessions/turns.d.mts +1 -123
- package/resources/beta/agents/sessions/turns.d.mts.map +1 -1
- package/resources/beta/agents/sessions/turns.d.ts +1 -123
- package/resources/beta/agents/sessions/turns.d.ts.map +1 -1
- package/resources/beta/agents/sessions/turns.js +2 -99
- package/resources/beta/agents/sessions/turns.js.map +1 -1
- package/resources/beta/agents/sessions/turns.mjs +1 -97
- package/resources/beta/agents/sessions/turns.mjs.map +1 -1
- package/resources/beta/beta.d.mts +2 -2
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +2 -2
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.mts +1 -1
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +1 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/responses/index.d.mts +1 -1
- package/resources/beta/responses/index.d.mts.map +1 -1
- package/resources/beta/responses/index.d.ts +1 -1
- package/resources/beta/responses/index.d.ts.map +1 -1
- package/resources/beta/responses/index.js.map +1 -1
- package/resources/beta/responses/index.mjs.map +1 -1
- package/resources/beta/responses/responses.d.mts +378 -6
- package/resources/beta/responses/responses.d.mts.map +1 -1
- package/resources/beta/responses/responses.d.ts +378 -6
- package/resources/beta/responses/responses.d.ts.map +1 -1
- package/resources/beta/responses/responses.js.map +1 -1
- package/resources/beta/responses/responses.mjs.map +1 -1
- package/resources/chat/completions/completions.d.mts +42 -8
- package/resources/chat/completions/completions.d.mts.map +1 -1
- package/resources/chat/completions/completions.d.ts +42 -8
- package/resources/chat/completions/completions.d.ts.map +1 -1
- package/resources/chat/completions/completions.js +5 -2
- package/resources/chat/completions/completions.js.map +1 -1
- package/resources/chat/completions/completions.mjs +5 -2
- package/resources/chat/completions/completions.mjs.map +1 -1
- package/resources/completions.d.mts +1 -1
- package/resources/completions.d.mts.map +1 -1
- package/resources/completions.d.ts +1 -1
- package/resources/completions.d.ts.map +1 -1
- package/resources/decisions.d.mts +196 -0
- package/resources/decisions.d.mts.map +1 -0
- package/resources/decisions.d.ts +196 -0
- package/resources/decisions.d.ts.map +1 -0
- package/resources/decisions.js +32 -0
- package/resources/decisions.js.map +1 -0
- package/resources/decisions.mjs +28 -0
- package/resources/decisions.mjs.map +1 -0
- package/resources/fine-tuning/jobs/jobs.d.mts +7 -2
- package/resources/fine-tuning/jobs/jobs.d.mts.map +1 -1
- package/resources/fine-tuning/jobs/jobs.d.ts +7 -2
- package/resources/fine-tuning/jobs/jobs.d.ts.map +1 -1
- package/resources/fine-tuning/jobs/jobs.js.map +1 -1
- package/resources/fine-tuning/jobs/jobs.mjs.map +1 -1
- package/resources/graders/grader-models.d.mts +1 -1
- package/resources/graders/grader-models.d.ts +1 -1
- package/resources/images.d.mts +4 -3
- package/resources/images.d.mts.map +1 -1
- package/resources/images.d.ts +4 -3
- package/resources/images.d.ts.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/realtime/realtime.d.mts +10 -0
- package/resources/realtime/realtime.d.mts.map +1 -1
- package/resources/realtime/realtime.d.ts +10 -0
- package/resources/realtime/realtime.d.ts.map +1 -1
- package/resources/realtime/realtime.js.map +1 -1
- package/resources/realtime/realtime.mjs.map +1 -1
- package/resources/responses/responses.d.mts +380 -6
- package/resources/responses/responses.d.mts.map +1 -1
- package/resources/responses/responses.d.ts +380 -6
- package/resources/responses/responses.d.ts.map +1 -1
- package/resources/responses/responses.js.map +1 -1
- package/resources/responses/responses.mjs.map +1 -1
- package/resources/shared.d.mts +5 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +5 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/videos.d.mts +5 -0
- package/resources/videos.d.mts.map +1 -1
- package/resources/videos.d.ts +5 -0
- package/resources/videos.d.ts.map +1 -1
- package/src/client.ts +21 -0
- package/src/helpers/standard-schema.ts +11 -4
- package/src/helpers/zod.ts +4 -0
- package/src/lib/ChatCompletionStream.ts +10 -3
- package/src/lib/ResponsesParser.ts +8 -0
- package/src/lib/agents/agent-session-stream.ts +20 -124
- package/src/lib/beta/agents/agent-session-create-stream.ts +87 -1
- package/src/lib/beta/agents/function-tool.ts +23 -15
- package/src/lib/beta/agents/tool-dispatcher.ts +226 -0
- package/src/lib/beta/agents/tool-error.ts +12 -0
- package/src/lib/beta/agents/tool-stages.ts +14 -0
- package/src/lib/chat-completions/streaming.ts +35 -0
- package/src/resources/admin/organization/usage.ts +350 -9
- package/src/resources/beta/agents/agents.ts +14 -5
- package/src/resources/beta/agents/environments/templates.ts +6 -8
- package/src/resources/beta/agents/sessions/index.ts +7 -1
- package/src/resources/beta/agents/sessions/sessions.ts +16 -4
- package/src/resources/beta/agents/sessions/subagents/turns/turns.ts +2 -2
- package/src/resources/beta/agents/sessions/turns/index.ts +4 -0
- package/src/resources/beta/agents/sessions/turns/items.ts +79 -0
- package/src/resources/beta/agents/sessions/turns/turns.ts +383 -0
- package/src/resources/beta/agents/sessions/turns.ts +1 -373
- package/src/resources/beta/beta.ts +2 -0
- package/src/resources/beta/index.ts +1 -0
- package/src/resources/beta/responses/index.ts +1 -0
- package/src/resources/beta/responses/responses.ts +470 -5
- package/src/resources/chat/completions/completions.ts +65 -18
- package/src/resources/completions.ts +1 -1
- package/src/resources/decisions.ts +290 -0
- package/src/resources/fine-tuning/jobs/jobs.ts +7 -2
- package/src/resources/graders/grader-models.ts +1 -1
- package/src/resources/images.ts +4 -3
- package/src/resources/index.ts +9 -0
- package/src/resources/realtime/realtime.ts +10 -0
- package/src/resources/responses/api.md +1 -0
- package/src/resources/responses/responses.ts +472 -5
- package/src/resources/shared.ts +6 -0
- package/src/resources/videos.ts +6 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../../core/resource';
|
|
4
4
|
import * as AgentsAPI from './agents';
|
|
5
|
-
import * as TurnsAPI from './sessions/turns';
|
|
5
|
+
import * as TurnsAPI from './sessions/turns/turns';
|
|
6
6
|
import * as EnvironmentsAPI from './environments/environments';
|
|
7
7
|
import { EnvironmentInfo, Environments } from './environments/environments';
|
|
8
8
|
import * as SessionsAPI from './sessions/sessions';
|
|
@@ -3825,8 +3825,8 @@ export namespace EnvironmentParam {
|
|
|
3825
3825
|
files?: Array<AgentsAPI.HostedEnvironmentFileParam> | null;
|
|
3826
3826
|
|
|
3827
3827
|
/**
|
|
3828
|
-
* Network access policy for the environment.
|
|
3829
|
-
*
|
|
3828
|
+
* Network access policy for the environment. If omitted, the API version
|
|
3829
|
+
* determines whether network access is enabled or disabled.
|
|
3830
3830
|
*/
|
|
3831
3831
|
network?: EnvironmentParamOpenAIHosted.Network | null;
|
|
3832
3832
|
|
|
@@ -3865,8 +3865,8 @@ export namespace EnvironmentParam {
|
|
|
3865
3865
|
}
|
|
3866
3866
|
|
|
3867
3867
|
/**
|
|
3868
|
-
* Network access policy for the environment.
|
|
3869
|
-
*
|
|
3868
|
+
* Network access policy for the environment. If omitted, the API version
|
|
3869
|
+
* determines whether network access is enabled or disabled.
|
|
3870
3870
|
*/
|
|
3871
3871
|
export interface Network {
|
|
3872
3872
|
/**
|
|
@@ -5003,6 +5003,12 @@ export interface SessionTurnError {
|
|
|
5003
5003
|
* - `session_budget_exceeded` - The session has reached its usage budget.
|
|
5004
5004
|
* - `usage_limit_exceeded` - The organization has reached a usage, plan, or
|
|
5005
5005
|
* billing limit.
|
|
5006
|
+
* - `project_spend_limit_exceeded` - The project has reached its enforced spend
|
|
5007
|
+
* limit.
|
|
5008
|
+
* - `organization_spend_limit_exceeded` - The organization has reached its
|
|
5009
|
+
* enforced spend limit.
|
|
5010
|
+
* - `organization_usage_limit_exceeded` - The organization has reached its
|
|
5011
|
+
* OpenAI-assigned usage limit.
|
|
5006
5012
|
* - `credit_balance_exhausted` - The organization has no API credits remaining.
|
|
5007
5013
|
* - `rate_limit_exceeded` - The request exceeds the available rate limit.
|
|
5008
5014
|
* - `flex_unavailable` - Flex processing is temporarily unavailable.
|
|
@@ -5029,6 +5035,9 @@ export interface SessionTurnError {
|
|
|
5029
5035
|
| 'context_length_exceeded'
|
|
5030
5036
|
| 'session_budget_exceeded'
|
|
5031
5037
|
| 'usage_limit_exceeded'
|
|
5038
|
+
| 'project_spend_limit_exceeded'
|
|
5039
|
+
| 'organization_spend_limit_exceeded'
|
|
5040
|
+
| 'organization_usage_limit_exceeded'
|
|
5032
5041
|
| 'credit_balance_exhausted'
|
|
5033
5042
|
| 'rate_limit_exceeded'
|
|
5034
5043
|
| 'flex_unavailable'
|
|
@@ -601,8 +601,8 @@ export interface TemplateCreateParams {
|
|
|
601
601
|
name?: string | null;
|
|
602
602
|
|
|
603
603
|
/**
|
|
604
|
-
* Network access policy for the environment.
|
|
605
|
-
*
|
|
604
|
+
* Network access policy for the environment. If omitted, the API version
|
|
605
|
+
* determines whether network access is enabled or disabled.
|
|
606
606
|
*/
|
|
607
607
|
network?: TemplateCreateParams.Network | null;
|
|
608
608
|
|
|
@@ -641,8 +641,8 @@ export namespace TemplateCreateParams {
|
|
|
641
641
|
}
|
|
642
642
|
|
|
643
643
|
/**
|
|
644
|
-
* Network access policy for the environment.
|
|
645
|
-
*
|
|
644
|
+
* Network access policy for the environment. If omitted, the API version
|
|
645
|
+
* determines whether network access is enabled or disabled.
|
|
646
646
|
*/
|
|
647
647
|
export interface Network {
|
|
648
648
|
/**
|
|
@@ -716,8 +716,7 @@ export interface TemplateUpdateParams {
|
|
|
716
716
|
|
|
717
717
|
/**
|
|
718
718
|
* Network access available after setup completes. Omit to preserve the current
|
|
719
|
-
* policy, or pass `null` to reset to
|
|
720
|
-
* requests.
|
|
719
|
+
* policy, or pass `null` to reset to the default policy.
|
|
721
720
|
*/
|
|
722
721
|
network?: TemplateUpdateParams.Network | null;
|
|
723
722
|
|
|
@@ -755,8 +754,7 @@ export namespace TemplateUpdateParams {
|
|
|
755
754
|
|
|
756
755
|
/**
|
|
757
756
|
* Network access available after setup completes. Omit to preserve the current
|
|
758
|
-
* policy, or pass `null` to reset to
|
|
759
|
-
* requests.
|
|
757
|
+
* policy, or pass `null` to reset to the default policy.
|
|
760
758
|
*/
|
|
761
759
|
export interface Network {
|
|
762
760
|
/**
|
|
@@ -22,4 +22,10 @@ export {
|
|
|
22
22
|
} from './sessions';
|
|
23
23
|
export { Subagents, type SubagentRetrieveParams, type SubagentListParams } from './subagents/index';
|
|
24
24
|
export { Traces, type SessionTrace, type TraceListParams, type SessionTracesPage } from './traces';
|
|
25
|
-
export {
|
|
25
|
+
export {
|
|
26
|
+
Turns,
|
|
27
|
+
type Turn,
|
|
28
|
+
type TurnRetrieveParams,
|
|
29
|
+
type TurnListParams,
|
|
30
|
+
type TurnsPage,
|
|
31
|
+
} from './turns/index';
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import {
|
|
4
4
|
AgentSessionStream,
|
|
5
5
|
type AgentSessionStreamParams,
|
|
6
|
+
type AgentToolHandler,
|
|
6
7
|
} from '../../../../lib/agents/agent-session-stream';
|
|
7
8
|
import {
|
|
8
9
|
type AgentSessionCreateStream,
|
|
9
10
|
withAgentTurnResult,
|
|
11
|
+
captureCreationTools,
|
|
10
12
|
} from '../../../../lib/beta/agents/agent-session-create-stream';
|
|
11
13
|
import type { AgentOutputFormat } from '../../../../lib/beta/agents/output-format-types';
|
|
12
14
|
import { captureAgentOutput } from '../../../../lib/beta/agents/parse-result';
|
|
@@ -31,10 +33,10 @@ import * as ItemsAPI from './items';
|
|
|
31
33
|
import { ItemListParams, Items } from './items';
|
|
32
34
|
import * as TracesAPI from './traces';
|
|
33
35
|
import { SessionTrace, SessionTracesPage, TraceListParams, Traces } from './traces';
|
|
34
|
-
import * as TurnsAPI from './turns';
|
|
35
|
-
import { Turn, TurnListParams, TurnRetrieveParams, Turns, TurnsPage } from './turns';
|
|
36
36
|
import * as SubagentsAPI from './subagents/subagents';
|
|
37
37
|
import { SubagentListParams, SubagentRetrieveParams, Subagents } from './subagents/subagents';
|
|
38
|
+
import * as TurnsAPI from './turns/turns';
|
|
39
|
+
import { Turn, TurnListParams, TurnRetrieveParams, Turns, TurnsPage } from './turns/turns';
|
|
38
40
|
import { APIPromise } from '../../../../core/api-promise';
|
|
39
41
|
import { CursorPage, type CursorPageParams, PagePromise } from '../../../../core/pagination';
|
|
40
42
|
import type { Stream } from '../../../../core/streaming';
|
|
@@ -200,7 +202,8 @@ export class Sessions extends APIResource {
|
|
|
200
202
|
body: SessionCreateParams,
|
|
201
203
|
options?: RequestOptions,
|
|
202
204
|
): APIPromise<AgentsAPI.AgentSession> | APIPromise<AgentSessionCreateStream> {
|
|
203
|
-
const
|
|
205
|
+
const creation = captureCreationTools(body, options);
|
|
206
|
+
const output = captureAgentOutput(creation.body, creation.options);
|
|
204
207
|
return this._client
|
|
205
208
|
.post<AgentsAPI.AgentSession | Stream<AgentsAPI.AgentSessionEvent>>(
|
|
206
209
|
'/agents/sessions',
|
|
@@ -215,7 +218,13 @@ export class Sessions extends APIResource {
|
|
|
215
218
|
._thenUnwrap((data, { options }) =>
|
|
216
219
|
// SAFETY: defaultParseResponse uses this same resolved flag to return the configured stream instance.
|
|
217
220
|
options.stream
|
|
218
|
-
? withAgentTurnResult(
|
|
221
|
+
? withAgentTurnResult(
|
|
222
|
+
data as Stream<AgentsAPI.AgentSessionEvent>,
|
|
223
|
+
output.format,
|
|
224
|
+
creation.handlers
|
|
225
|
+
? { sessions: this, handlers: creation.handlers, options: output.options }
|
|
226
|
+
: undefined,
|
|
227
|
+
)
|
|
219
228
|
: data,
|
|
220
229
|
) as APIPromise<AgentsAPI.AgentSession> | APIPromise<AgentSessionCreateStream>;
|
|
221
230
|
}
|
|
@@ -514,6 +523,7 @@ export namespace SessionCreateParams {
|
|
|
514
523
|
}
|
|
515
524
|
|
|
516
525
|
export interface SessionCreateParamsNonStreaming extends SessionCreateParamsBase {
|
|
526
|
+
toolHandlers?: never;
|
|
517
527
|
/**
|
|
518
528
|
* Whether to stream session events as server-sent events. Defaults to `false`.
|
|
519
529
|
*/
|
|
@@ -521,6 +531,8 @@ export interface SessionCreateParamsNonStreaming extends SessionCreateParamsBase
|
|
|
521
531
|
}
|
|
522
532
|
|
|
523
533
|
export interface SessionCreateParamsStreaming extends SessionCreateParamsBase {
|
|
534
|
+
/** Beta: local function handlers run during iteration and are never sent to the API. */
|
|
535
|
+
toolHandlers?: Record<string, AgentToolHandler>;
|
|
524
536
|
/**
|
|
525
537
|
* Whether to stream session events as server-sent events. Defaults to `false`.
|
|
526
538
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../../../../../core/resource';
|
|
4
|
-
import * as TurnsAPI from '../../turns';
|
|
5
|
-
import { TurnsPage } from '../../turns';
|
|
4
|
+
import * as TurnsAPI from '../../turns/turns';
|
|
5
|
+
import { TurnsPage } from '../../turns/turns';
|
|
6
6
|
import * as ItemsAPI from './items';
|
|
7
7
|
import { ItemListParams, Items } from './items';
|
|
8
8
|
import { APIPromise } from '../../../../../../core/api-promise';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../../../core/resource';
|
|
4
|
+
import * as AgentsAPI from '../../agents';
|
|
5
|
+
import { AgentSessionItemsPage } from '../../agents';
|
|
6
|
+
import {
|
|
7
|
+
ConversationCursorPage,
|
|
8
|
+
type ConversationCursorPageParams,
|
|
9
|
+
PagePromise,
|
|
10
|
+
} from '../../../../../core/pagination';
|
|
11
|
+
import { buildHeaders } from '../../../../../internal/headers';
|
|
12
|
+
import { RequestOptions } from '../../../../../internal/request-options';
|
|
13
|
+
import { path } from '../../../../../internal/utils/path';
|
|
14
|
+
|
|
15
|
+
function resolveResourceRequestOptions(
|
|
16
|
+
options: RequestOptions | undefined,
|
|
17
|
+
buildOptions: (options: RequestOptions | undefined) => RequestOptions | Promise<RequestOptions>,
|
|
18
|
+
): Promise<RequestOptions> {
|
|
19
|
+
return Promise.resolve(options).then(buildOptions);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class Items extends APIResource {
|
|
23
|
+
/**
|
|
24
|
+
* Lists items belonging to one root-agent turn, including its interactions with
|
|
25
|
+
* subagents. See
|
|
26
|
+
* [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // Automatically fetches more pages as needed.
|
|
31
|
+
* for await (const agentSessionItem of client.beta.agents.sessions.turns.items.list(
|
|
32
|
+
* 'turn_id',
|
|
33
|
+
* { session_id: 'session_id' },
|
|
34
|
+
* )) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
list(
|
|
40
|
+
turnID: string,
|
|
41
|
+
params: ItemListParams,
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): PagePromise<AgentSessionItemsConversationCursorPage, AgentsAPI.AgentSessionItem> {
|
|
44
|
+
const { session_id, ...query } = params;
|
|
45
|
+
return this._client.getAPIList(
|
|
46
|
+
path`/agents/sessions/${session_id}/turns/${turnID}/items`,
|
|
47
|
+
ConversationCursorPage<AgentsAPI.AgentSessionItem>,
|
|
48
|
+
resolveResourceRequestOptions(options, (options) => ({
|
|
49
|
+
query,
|
|
50
|
+
...options,
|
|
51
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'agents=v1' }, options?.headers]),
|
|
52
|
+
__security: { bearerAuth: true },
|
|
53
|
+
})),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type AgentSessionItemsConversationCursorPage = ConversationCursorPage<AgentsAPI.AgentSessionItem>;
|
|
59
|
+
|
|
60
|
+
export interface ItemListParams extends ConversationCursorPageParams {
|
|
61
|
+
/**
|
|
62
|
+
* Path param: The ID of the session that owns the turn.
|
|
63
|
+
*/
|
|
64
|
+
session_id: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Query param: The order in which resources are returned. Defaults to `desc`.
|
|
68
|
+
*
|
|
69
|
+
* - `asc` - Returns resources in ascending order.
|
|
70
|
+
* - `desc` - Returns resources in descending order.
|
|
71
|
+
*/
|
|
72
|
+
order?: 'asc' | 'desc';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare namespace Items {
|
|
76
|
+
export { type ItemListParams as ItemListParams };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { type AgentSessionItemsPage };
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../../../core/resource';
|
|
4
|
+
import * as AgentsAPI from '../../agents';
|
|
5
|
+
import * as ItemsAPI from './items';
|
|
6
|
+
import { ItemListParams, Items } from './items';
|
|
7
|
+
import { APIPromise } from '../../../../../core/api-promise';
|
|
8
|
+
import { CursorPage, type CursorPageParams, PagePromise } from '../../../../../core/pagination';
|
|
9
|
+
import { buildHeaders } from '../../../../../internal/headers';
|
|
10
|
+
import { RequestOptions } from '../../../../../internal/request-options';
|
|
11
|
+
import { path } from '../../../../../internal/utils/path';
|
|
12
|
+
|
|
13
|
+
function resolveResourceRequestOptions(
|
|
14
|
+
options: RequestOptions | undefined,
|
|
15
|
+
buildOptions: (options: RequestOptions | undefined) => RequestOptions | Promise<RequestOptions>,
|
|
16
|
+
): Promise<RequestOptions> {
|
|
17
|
+
return Promise.resolve(options).then(buildOptions);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Recognizable options across SDK runtime versions. Keep this independent of
|
|
21
|
+
// private RequestOptions fields so older handwritten runtimes still compile.
|
|
22
|
+
const normalizeRequestOptionsForQueryKeys = new Set([
|
|
23
|
+
'method',
|
|
24
|
+
'path',
|
|
25
|
+
'query',
|
|
26
|
+
'body',
|
|
27
|
+
'headers',
|
|
28
|
+
'maxRetries',
|
|
29
|
+
'stream',
|
|
30
|
+
'timeout',
|
|
31
|
+
'httpAgent',
|
|
32
|
+
'fetchOptions',
|
|
33
|
+
'signal',
|
|
34
|
+
'idempotencyKey',
|
|
35
|
+
'defaultBaseURL',
|
|
36
|
+
'__metadata',
|
|
37
|
+
'__binaryRequest',
|
|
38
|
+
'__binaryResponse',
|
|
39
|
+
'__streamClass',
|
|
40
|
+
'__security',
|
|
41
|
+
'__synthesizeEventData',
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
function normalizeRequestOptionsForQuery(
|
|
45
|
+
value: unknown,
|
|
46
|
+
queryKeys: ReadonlyArray<string>,
|
|
47
|
+
options: RequestOptions | undefined,
|
|
48
|
+
):
|
|
49
|
+
| ({
|
|
50
|
+
[K in 'headers' | 'maxRetries' | 'timeout' | 'signal' | 'idempotencyKey' | 'query']?: RequestOptions[K];
|
|
51
|
+
} & {
|
|
52
|
+
[
|
|
53
|
+
K in
|
|
54
|
+
| 'method'
|
|
55
|
+
| 'path'
|
|
56
|
+
| 'body'
|
|
57
|
+
| 'stream'
|
|
58
|
+
| 'httpAgent'
|
|
59
|
+
| 'fetchOptions'
|
|
60
|
+
| 'defaultBaseURL'
|
|
61
|
+
| '__metadata'
|
|
62
|
+
| '__binaryRequest'
|
|
63
|
+
| '__binaryResponse'
|
|
64
|
+
| '__streamClass'
|
|
65
|
+
| '__security'
|
|
66
|
+
| '__synthesizeEventData'
|
|
67
|
+
]?: never;
|
|
68
|
+
})
|
|
69
|
+
| undefined {
|
|
70
|
+
if (typeof value !== 'object' || value === null) return undefined;
|
|
71
|
+
// Optional never fields can still be explicitly undefined unless consumers
|
|
72
|
+
// enable exactOptionalPropertyTypes. Snapshot data without invoking getters.
|
|
73
|
+
const entries = Object.entries(Object.getOwnPropertyDescriptors(value)).filter(
|
|
74
|
+
([, descriptor]) => descriptor.enumerable && (!('value' in descriptor) || descriptor.value !== undefined),
|
|
75
|
+
);
|
|
76
|
+
const keys = entries.map(([key]) => key);
|
|
77
|
+
const requestOnly = keys.some(
|
|
78
|
+
(key) => normalizeRequestOptionsForQueryKeys.has(key) && !queryKeys.includes(key),
|
|
79
|
+
);
|
|
80
|
+
if (!requestOnly) return undefined;
|
|
81
|
+
// Declared query fields, including stream, must use the query argument.
|
|
82
|
+
// Mixing them with request-only options is ambiguous and could change the return type.
|
|
83
|
+
if (
|
|
84
|
+
options !== undefined ||
|
|
85
|
+
keys.some((key) => !normalizeRequestOptionsForQueryKeys.has(key) || queryKeys.includes(key))
|
|
86
|
+
) {
|
|
87
|
+
throw new TypeError('Query parameters and request options must be passed as separate arguments.');
|
|
88
|
+
}
|
|
89
|
+
// The query position must not gain authority to change the request destination
|
|
90
|
+
// or transport. Those overrides require the explicit request options argument.
|
|
91
|
+
if (
|
|
92
|
+
keys.some(
|
|
93
|
+
(key) => !['headers', 'maxRetries', 'timeout', 'signal', 'idempotencyKey', 'query'].includes(key),
|
|
94
|
+
)
|
|
95
|
+
) {
|
|
96
|
+
throw new TypeError('Pass transport overrides in the explicit request options argument.');
|
|
97
|
+
}
|
|
98
|
+
// Copy only the validated fields. Spreading value would reintroduce undefined
|
|
99
|
+
// transport overrides, and deleting them would mutate the caller's object.
|
|
100
|
+
return Object.fromEntries(
|
|
101
|
+
entries.map(([key, descriptor]) => {
|
|
102
|
+
if ('value' in descriptor) return [key, descriptor.value];
|
|
103
|
+
return [key, descriptor.get ? Reflect.apply(descriptor.get, value, []) : undefined];
|
|
104
|
+
}),
|
|
105
|
+
) as {
|
|
106
|
+
[K in 'headers' | 'maxRetries' | 'timeout' | 'signal' | 'idempotencyKey' | 'query']?: RequestOptions[K];
|
|
107
|
+
} & {
|
|
108
|
+
[
|
|
109
|
+
K in
|
|
110
|
+
| 'method'
|
|
111
|
+
| 'path'
|
|
112
|
+
| 'body'
|
|
113
|
+
| 'stream'
|
|
114
|
+
| 'httpAgent'
|
|
115
|
+
| 'fetchOptions'
|
|
116
|
+
| 'defaultBaseURL'
|
|
117
|
+
| '__metadata'
|
|
118
|
+
| '__binaryRequest'
|
|
119
|
+
| '__binaryResponse'
|
|
120
|
+
| '__streamClass'
|
|
121
|
+
| '__security'
|
|
122
|
+
| '__synthesizeEventData'
|
|
123
|
+
]?: never;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export class Turns extends APIResource {
|
|
128
|
+
items: ItemsAPI.Items = new ItemsAPI.Items(this._client);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if
|
|
132
|
+
* the turn does not belong to the session. See
|
|
133
|
+
* [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const turn =
|
|
138
|
+
* await client.beta.agents.sessions.turns.retrieve(
|
|
139
|
+
* 'turn_id',
|
|
140
|
+
* { session_id: 'session_id' },
|
|
141
|
+
* );
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
retrieve(turnID: string, params: TurnRetrieveParams, options?: RequestOptions): APIPromise<Turn> {
|
|
145
|
+
const { session_id } = params;
|
|
146
|
+
return this._client.get(
|
|
147
|
+
path`/agents/sessions/${session_id}/turns/${turnID}`,
|
|
148
|
+
resolveResourceRequestOptions(options, (options) => ({
|
|
149
|
+
...options,
|
|
150
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'agents=v1' }, options?.headers]),
|
|
151
|
+
__security: { bearerAuth: true },
|
|
152
|
+
})),
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Lists turns by creation time and turn ID. The after cursor is exclusive in the
|
|
158
|
+
* selected order. See
|
|
159
|
+
* [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* // Automatically fetches more pages as needed.
|
|
164
|
+
* for await (const turn of client.beta.agents.sessions.turns.list(
|
|
165
|
+
* 'session_id',
|
|
166
|
+
* )) {
|
|
167
|
+
* // ...
|
|
168
|
+
* }
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
list(
|
|
172
|
+
sessionID: string,
|
|
173
|
+
query?:
|
|
174
|
+
| (TurnListParams &
|
|
175
|
+
(
|
|
176
|
+
| {
|
|
177
|
+
[
|
|
178
|
+
K in
|
|
179
|
+
| 'method'
|
|
180
|
+
| 'path'
|
|
181
|
+
| 'query'
|
|
182
|
+
| 'body'
|
|
183
|
+
| 'headers'
|
|
184
|
+
| 'maxRetries'
|
|
185
|
+
| 'stream'
|
|
186
|
+
| 'timeout'
|
|
187
|
+
| 'httpAgent'
|
|
188
|
+
| 'fetchOptions'
|
|
189
|
+
| 'signal'
|
|
190
|
+
| 'idempotencyKey'
|
|
191
|
+
| 'defaultBaseURL'
|
|
192
|
+
| '__metadata'
|
|
193
|
+
| '__binaryRequest'
|
|
194
|
+
| '__binaryResponse'
|
|
195
|
+
| '__streamClass'
|
|
196
|
+
| '__security'
|
|
197
|
+
| '__synthesizeEventData'
|
|
198
|
+
]?: never;
|
|
199
|
+
}
|
|
200
|
+
| null
|
|
201
|
+
| undefined
|
|
202
|
+
))
|
|
203
|
+
| null
|
|
204
|
+
| undefined,
|
|
205
|
+
options?: RequestOptions,
|
|
206
|
+
): PagePromise<TurnsPage, Turn>;
|
|
207
|
+
list(
|
|
208
|
+
sessionID: string,
|
|
209
|
+
options?: {
|
|
210
|
+
[K in 'headers' | 'maxRetries' | 'timeout' | 'signal' | 'idempotencyKey' | 'query']?: RequestOptions[K];
|
|
211
|
+
} & {
|
|
212
|
+
[
|
|
213
|
+
K in
|
|
214
|
+
| 'method'
|
|
215
|
+
| 'path'
|
|
216
|
+
| 'body'
|
|
217
|
+
| 'stream'
|
|
218
|
+
| 'httpAgent'
|
|
219
|
+
| 'fetchOptions'
|
|
220
|
+
| 'defaultBaseURL'
|
|
221
|
+
| '__metadata'
|
|
222
|
+
| '__binaryRequest'
|
|
223
|
+
| '__binaryResponse'
|
|
224
|
+
| '__streamClass'
|
|
225
|
+
| '__security'
|
|
226
|
+
| '__synthesizeEventData'
|
|
227
|
+
]?: never;
|
|
228
|
+
},
|
|
229
|
+
): PagePromise<TurnsPage, Turn>;
|
|
230
|
+
list(
|
|
231
|
+
sessionID: string,
|
|
232
|
+
query:
|
|
233
|
+
| TurnListParams
|
|
234
|
+
| ({
|
|
235
|
+
[
|
|
236
|
+
K in 'headers' | 'maxRetries' | 'timeout' | 'signal' | 'idempotencyKey' | 'query'
|
|
237
|
+
]?: RequestOptions[K];
|
|
238
|
+
} & {
|
|
239
|
+
[
|
|
240
|
+
K in
|
|
241
|
+
| 'method'
|
|
242
|
+
| 'path'
|
|
243
|
+
| 'body'
|
|
244
|
+
| 'stream'
|
|
245
|
+
| 'httpAgent'
|
|
246
|
+
| 'fetchOptions'
|
|
247
|
+
| 'defaultBaseURL'
|
|
248
|
+
| '__metadata'
|
|
249
|
+
| '__binaryRequest'
|
|
250
|
+
| '__binaryResponse'
|
|
251
|
+
| '__streamClass'
|
|
252
|
+
| '__security'
|
|
253
|
+
| '__synthesizeEventData'
|
|
254
|
+
]?: never;
|
|
255
|
+
})
|
|
256
|
+
| null
|
|
257
|
+
| undefined = {},
|
|
258
|
+
options?: RequestOptions,
|
|
259
|
+
): PagePromise<TurnsPage, Turn> {
|
|
260
|
+
const normalizeRequestOptionsForQueryOptions = normalizeRequestOptionsForQuery(
|
|
261
|
+
query,
|
|
262
|
+
['after', 'limit', 'order'],
|
|
263
|
+
options,
|
|
264
|
+
);
|
|
265
|
+
if (normalizeRequestOptionsForQueryOptions !== undefined) {
|
|
266
|
+
options = normalizeRequestOptionsForQueryOptions;
|
|
267
|
+
query = {};
|
|
268
|
+
}
|
|
269
|
+
query = query as TurnListParams | null | undefined;
|
|
270
|
+
return this._client.getAPIList(
|
|
271
|
+
path`/agents/sessions/${sessionID}/turns`,
|
|
272
|
+
CursorPage<Turn>,
|
|
273
|
+
resolveResourceRequestOptions(options, (options) => ({
|
|
274
|
+
query,
|
|
275
|
+
...options,
|
|
276
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'agents=v1' }, options?.headers]),
|
|
277
|
+
__security: { bearerAuth: true },
|
|
278
|
+
})),
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export type TurnsPage = CursorPage<Turn>;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* The canonical public representation of a session turn.
|
|
287
|
+
*/
|
|
288
|
+
export interface Turn {
|
|
289
|
+
/**
|
|
290
|
+
* The ID of the turn.
|
|
291
|
+
*/
|
|
292
|
+
id: string;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* The ID of the agent that ran the turn.
|
|
296
|
+
*/
|
|
297
|
+
agent_id: string;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* The Unix timestamp, in seconds, when the turn reached a terminal state.
|
|
301
|
+
*/
|
|
302
|
+
completed_at: number | null;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The Unix timestamp, in seconds, used to order the turn by creation time.
|
|
306
|
+
* Subagent turns use their start time, falling back to completion time or the
|
|
307
|
+
* subagent opening time when the preceding timestamps are unavailable.
|
|
308
|
+
*/
|
|
309
|
+
created_at: number;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* A customer-safe error. Non-null only for a failed turn.
|
|
313
|
+
*/
|
|
314
|
+
error: AgentsAPI.SessionTurnError | null;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* The object type. Always `agent.session.turn`.
|
|
318
|
+
*/
|
|
319
|
+
object: 'agent.session.turn';
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* The ID of the session that owns the turn.
|
|
323
|
+
*/
|
|
324
|
+
session_id: string;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* The Unix timestamp, in seconds, when the turn started.
|
|
328
|
+
*/
|
|
329
|
+
started_at: number | null;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* The current status of the turn.
|
|
333
|
+
*
|
|
334
|
+
* - `queued` - The turn is waiting to start.
|
|
335
|
+
* - `in_progress` - The turn is in progress.
|
|
336
|
+
* - `waiting` - The turn is waiting for external input.
|
|
337
|
+
* - `completed` - The turn completed successfully.
|
|
338
|
+
* - `failed` - The turn failed.
|
|
339
|
+
* - `cancelled` - The turn was cancelled.
|
|
340
|
+
*/
|
|
341
|
+
status: 'queued' | 'in_progress' | 'waiting' | 'completed' | 'failed' | 'cancelled';
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* The ID of the subagent that ran the turn, if applicable.
|
|
345
|
+
*/
|
|
346
|
+
subagent_id: string | null;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Best-effort token usage for the turn, or null if unknown. Recorded usage may
|
|
350
|
+
* change.
|
|
351
|
+
*/
|
|
352
|
+
usage: AgentsAPI.TokenUsage | null;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export interface TurnRetrieveParams {
|
|
356
|
+
/**
|
|
357
|
+
* The ID of the session that owns the turn.
|
|
358
|
+
*/
|
|
359
|
+
session_id: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export interface TurnListParams extends CursorPageParams {
|
|
363
|
+
/**
|
|
364
|
+
* The order in which resources are returned. Defaults to `desc`.
|
|
365
|
+
*
|
|
366
|
+
* - `asc` - Returns resources in ascending order.
|
|
367
|
+
* - `desc` - Returns resources in descending order.
|
|
368
|
+
*/
|
|
369
|
+
order?: 'asc' | 'desc';
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
Turns.Items = Items;
|
|
373
|
+
|
|
374
|
+
export declare namespace Turns {
|
|
375
|
+
export {
|
|
376
|
+
type Turn as Turn,
|
|
377
|
+
type TurnsPage as TurnsPage,
|
|
378
|
+
type TurnRetrieveParams as TurnRetrieveParams,
|
|
379
|
+
type TurnListParams as TurnListParams,
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
export { Items as Items, type ItemListParams as ItemListParams };
|
|
383
|
+
}
|