From a0696b127d8dc33005853f7284e1ea70077f2883 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:16:00 +0800 Subject: [PATCH] feat(api): align existing contracts for 0.8.0 --- CHANGELOG.md | 16 + convention/version.go | 2 +- docs/api/reference.md | 1000 +++++++++++++++--- forward/batch.go | 7 + forward/contract_alignment_080_test.go | 158 +++ forward/environment.go | 46 +- forward/memorystore.go | 18 + forward/schedule.go | 84 +- forward/schedulerun.go | 50 +- forward/session.go | 64 +- forward/sessionthread.go | 32 + forward/template.go | 7 + forward/testdata/contract-alignment-0.8.json | 120 +++ managed/contract_alignment_080_test.go | 217 ++++ managed/deployment.go | 94 +- managed/dream.go | 5 +- managed/environment.go | 33 +- managed/memorystore.go | 7 + managed/session.go | 55 +- managed/sessionevent.go | 195 +++- managed/sessionresource.go | 76 +- managed/sessionthread.go | 16 + managed/testdata/contract-alignment-0.8.json | 120 +++ 23 files changed, 2131 insertions(+), 291 deletions(-) create mode 100644 forward/contract_alignment_080_test.go create mode 100644 forward/testdata/contract-alignment-0.8.json create mode 100644 managed/contract_alignment_080_test.go create mode 100644 managed/testdata/contract-alignment-0.8.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d1afe4..7bd0b80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,22 @@ existing `0.1.0` release; earlier development prereleases are not listed. ## [Unreleased] +## [0.8.0] + +### Fixed + +- Align existing Managed Session and Deployment resource types with generic HTTP(S) `git_repository`, including write-only credentials, branch/commit checkout, and optional GitHub authorization for public repositories. +- Add Forward Template `max_tool_rounds`, Batch `ignore_idle_window` / `queue_reason`, and Session list `search`; preserve omitted, null, false, and zero values according to each API contract. +- Expose Forward Session outcome evaluations and Thread statistics/Credits, Schedule and Run source/input-version metadata, and trigger time boundaries. +- Support Forward MemoryStore creation with a native `mount` (Identity, Template, and optional access), preserving the create request's idempotency key for retries. +- Expose self-hosted Environment setup scripts, Forward Environment binding metadata, Managed MemoryStore status/count/size, and Dream output file paths. +- Decode flat `agent.artifact_delivered` fields and diagnostic `session.error.error.qoder_error_code` in Managed event history, Session SSE, and Thread SSE. No additional API endpoints are introduced. + +### Migration + +- Omitting `max_tool_rounds` on update preserves the configured limit; null clears it. `ignore_idle_window` accepts a boolean, with false as the server default. +- Treat an absent Schedule Run input version or Thread usage as unknown, not zero. Use `retry_status` rather than `qoder_error_code` to decide whether execution can retry. + ## [0.7.0] ### Fixed diff --git a/convention/version.go b/convention/version.go index ec5c64c..a157ffc 100644 --- a/convention/version.go +++ b/convention/version.go @@ -4,4 +4,4 @@ package convention // X-Qoder-Package-Version. It must match the released module tag, otherwise the // server-side SDK version statistics describe a version that was never shipped. // `make check-version VERSION=` validates it before release. -const packageVersion = "0.7.0" +const packageVersion = "0.8.0" diff --git a/docs/api/reference.md b/docs/api/reference.md index 0cfc698..5fd0fe1 100644 --- a/docs/api/reference.md +++ b/docs/api/reference.md @@ -200,6 +200,9 @@ import "github.com/QoderAI/qoder-cloud-agents-sdk-go/forward" - [type Environment](<#Environment>) - [func \(r Environment\) RawJSON\(\) string](<#Environment.RawJSON>) - [func \(r \*Environment\) UnmarshalJSON\(data \[\]byte\) error](<#Environment.UnmarshalJSON>) +- [type EnvironmentBindingInfo](<#EnvironmentBindingInfo>) + - [func \(r EnvironmentBindingInfo\) RawJSON\(\) string](<#EnvironmentBindingInfo.RawJSON>) + - [func \(r \*EnvironmentBindingInfo\) UnmarshalJSON\(data \[\]byte\) error](<#EnvironmentBindingInfo.UnmarshalJSON>) - [type EnvironmentConfig](<#EnvironmentConfig>) - [func \(r EnvironmentConfig\) RawJSON\(\) string](<#EnvironmentConfig.RawJSON>) - [func \(r \*EnvironmentConfig\) UnmarshalJSON\(data \[\]byte\) error](<#EnvironmentConfig.UnmarshalJSON>) @@ -412,6 +415,9 @@ import "github.com/QoderAI/qoder-cloud-agents-sdk-go/forward" - [type MemoryStoreNewParams](<#MemoryStoreNewParams>) - [func \(r MemoryStoreNewParams\) MarshalJSON\(\) \(\[\]byte, error\)](<#MemoryStoreNewParams.MarshalJSON>) - [func \(r \*MemoryStoreNewParams\) UnmarshalJSON\(data \[\]byte\) error](<#MemoryStoreNewParams.UnmarshalJSON>) +- [type MemoryStoreNewParamsMount](<#MemoryStoreNewParamsMount>) + - [func \(r MemoryStoreNewParamsMount\) MarshalJSON\(\) \(\[\]byte, error\)](<#MemoryStoreNewParamsMount.MarshalJSON>) + - [func \(r \*MemoryStoreNewParamsMount\) UnmarshalJSON\(data \[\]byte\) error](<#MemoryStoreNewParamsMount.UnmarshalJSON>) - [type MemoryStoreService](<#MemoryStoreService>) - [func NewMemoryStoreService\(opts ...option.RequestOption\) MemoryStoreService](<#NewMemoryStoreService>) - [func \(r \*MemoryStoreService\) Archive\(ctx context.Context, memoryStoreID string, opts ...option.RequestOption\) \(res \*MemoryStore, err error\)](<#MemoryStoreService.Archive>) @@ -686,6 +692,9 @@ import "github.com/QoderAI/qoder-cloud-agents-sdk-go/forward" - [type SessionNewParamsConfigParam](<#SessionNewParamsConfigParam>) - [func \(r SessionNewParamsConfigParam\) MarshalJSON\(\) \(\[\]byte, error\)](<#SessionNewParamsConfigParam.MarshalJSON>) - [func \(r \*SessionNewParamsConfigParam\) UnmarshalJSON\(data \[\]byte\) error](<#SessionNewParamsConfigParam.UnmarshalJSON>) +- [type SessionOutcomeEvaluation](<#SessionOutcomeEvaluation>) + - [func \(r SessionOutcomeEvaluation\) RawJSON\(\) string](<#SessionOutcomeEvaluation.RawJSON>) + - [func \(r \*SessionOutcomeEvaluation\) UnmarshalJSON\(data \[\]byte\) error](<#SessionOutcomeEvaluation.UnmarshalJSON>) - [type SessionResource](<#SessionResource>) - [func \(r SessionResource\) RawJSON\(\) string](<#SessionResource.RawJSON>) - [func \(r \*SessionResource\) UnmarshalJSON\(data \[\]byte\) error](<#SessionResource.UnmarshalJSON>) @@ -738,9 +747,15 @@ import "github.com/QoderAI/qoder-cloud-agents-sdk-go/forward" - [func \(r \*SessionThreadService\) Get\(ctx context.Context, sessionID string, threadID string, opts ...option.RequestOption\) \(res \*SessionThread, err error\)](<#SessionThreadService.Get>) - [func \(r \*SessionThreadService\) List\(ctx context.Context, sessionID string, params SessionThreadListParams, opts ...option.RequestOption\) \(res \*pagination.Page\[SessionThread\], err error\)](<#SessionThreadService.List>) - [func \(r \*SessionThreadService\) ListAutoPaging\(ctx context.Context, sessionID string, params SessionThreadListParams, opts ...option.RequestOption\) \*pagination.PageAutoPager\[SessionThread\]](<#SessionThreadService.ListAutoPaging>) +- [type SessionThreadStats](<#SessionThreadStats>) + - [func \(r SessionThreadStats\) RawJSON\(\) string](<#SessionThreadStats.RawJSON>) + - [func \(r \*SessionThreadStats\) UnmarshalJSON\(data \[\]byte\) error](<#SessionThreadStats.UnmarshalJSON>) - [type SessionThreadStopReason](<#SessionThreadStopReason>) - [func \(r SessionThreadStopReason\) RawJSON\(\) string](<#SessionThreadStopReason.RawJSON>) - [func \(r \*SessionThreadStopReason\) UnmarshalJSON\(data \[\]byte\) error](<#SessionThreadStopReason.UnmarshalJSON>) +- [type SessionThreadUsage](<#SessionThreadUsage>) + - [func \(r SessionThreadUsage\) RawJSON\(\) string](<#SessionThreadUsage.RawJSON>) + - [func \(r \*SessionThreadUsage\) UnmarshalJSON\(data \[\]byte\) error](<#SessionThreadUsage.UnmarshalJSON>) - [type SessionUpdateParams](<#SessionUpdateParams>) - [func \(r SessionUpdateParams\) MarshalJSON\(\) \(\[\]byte, error\)](<#SessionUpdateParams.MarshalJSON>) - [func \(r \*SessionUpdateParams\) UnmarshalJSON\(data \[\]byte\) error](<#SessionUpdateParams.UnmarshalJSON>) @@ -981,6 +996,9 @@ WithIdentityID selects identity ownership for Forward resources using a PAT. Omi ```go type Batch struct { + IgnoreIdleWindow bool `json:"ignore_idle_window"` + // Dynamic queue reason, present only when applicable to validating or queued Batches. + QueueReason string `json:"queue_reason"` // Batch ID, prefixed with `batch_`. ID string `json:"id"` // Always `batch`. @@ -1023,6 +1041,8 @@ type Batch struct { // Batch-level error description; present only in the `failed` status. ErrorMessage string `json:"error_message"` JSON struct { + IgnoreIdleWindow respjson.Field + QueueReason respjson.Field ID respjson.Field Object respjson.Field Status respjson.Field @@ -1163,6 +1183,8 @@ func (r BatchListParams) URLQuery() (url.Values, error) ```go type BatchNewParams struct { + // Ignore the scheduling time window; does not change capacity or FIFO priority. + IgnoreIdleWindow param.Opt[bool] `json:"ignore_idle_window,omitzero"` // ID of a JSONL file uploaded through the Files API. InputFileID string `json:"input_file_id" api:"required"` // Completion window: `24h`, `48h` or `72h`. The Batch moves to `expired` when it elapses. @@ -3337,17 +3359,21 @@ func (r *EffectiveConfigSessionResourcesItem) UnmarshalJSON(data []byte) error ```go type Environment struct { - ID string `json:"id"` - Type string `json:"type"` - Name string `json:"name"` - Description string `json:"description"` - Config EnvironmentConfig `json:"config"` - Metadata map[string]any `json:"metadata"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - IdentityID string `json:"identity_id" api:"nullable"` - ArchivedAt time.Time `json:"archived_at" api:"nullable" format:"date-time"` + IconURL string `json:"icon_url" api:"nullable"` + BindingInfo EnvironmentBindingInfo `json:"binding_info"` + ID string `json:"id"` + Type string `json:"type"` + Name string `json:"name"` + Description string `json:"description"` + Config EnvironmentConfig `json:"config"` + Metadata map[string]any `json:"metadata"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + IdentityID string `json:"identity_id" api:"nullable"` + ArchivedAt time.Time `json:"archived_at" api:"nullable" format:"date-time"` JSON struct { + IconURL respjson.Field + BindingInfo respjson.Field ID respjson.Field Type respjson.Field Name respjson.Field @@ -3382,6 +3408,40 @@ func (r *Environment) UnmarshalJSON(data []byte) error + +## type [EnvironmentBindingInfo]() + + + +```go +type EnvironmentBindingInfo struct { + AgentTemplateCount int64 `json:"agent_template_count"` + JSON struct { + AgentTemplateCount respjson.Field + ExtraFields map[string]respjson.Field + // contains filtered or unexported fields + } `json:"-"` +} +``` + + +### func \(EnvironmentBindingInfo\) [RawJSON]() + +```go +func (r EnvironmentBindingInfo) RawJSON() string +``` + + + + +### func \(\*EnvironmentBindingInfo\) [UnmarshalJSON]() + +```go +func (r *EnvironmentBindingInfo) UnmarshalJSON(data []byte) error +``` + + + ## type [EnvironmentConfig]() @@ -3389,9 +3449,11 @@ func (r *Environment) UnmarshalJSON(data []byte) error ```go type EnvironmentConfig struct { - Type string `json:"type"` - Packages EnvironmentConfigPackages `json:"packages"` - JSON struct { + SetupScript string `json:"setup_script"` + Type string `json:"type"` + Packages EnvironmentConfigPackages `json:"packages"` + JSON struct { + SetupScript respjson.Field Type respjson.Field Packages respjson.Field ExtraFields map[string]respjson.Field @@ -5958,6 +6020,8 @@ func (r *MemoryStoreMount) UnmarshalJSON(data []byte) error ```go type MemoryStoreNewParams struct { + // Establish this mount before returning. Retry with the same key and body to resume creation. + Mount MemoryStoreNewParamsMount `json:"mount,omitzero"` // Display name for the store, non-empty. Non-printable control characters // (`U+0000`–`U+001F`, `U+007F`) are not allowed, except newline `\n`, carriage return // `\r` and tab `\t`. @@ -5995,6 +6059,39 @@ func (r *MemoryStoreNewParams) UnmarshalJSON(data []byte) error + +## type [MemoryStoreNewParamsMount]() + + + +```go +type MemoryStoreNewParamsMount struct { + IdentityID string `json:"identity_id" api:"required"` + TemplateID string `json:"template_id" api:"required"` + // read_only (default) or read_write. + Access param.Opt[string] `json:"access,omitzero"` + // contains filtered or unexported fields +} +``` + + +### func \(MemoryStoreNewParamsMount\) [MarshalJSON]() + +```go +func (r MemoryStoreNewParamsMount) MarshalJSON() ([]byte, error) +``` + + + + +### func \(\*MemoryStoreNewParamsMount\) [UnmarshalJSON]() + +```go +func (r *MemoryStoreNewParamsMount) UnmarshalJSON(data []byte) error +``` + + + ## type [MemoryStoreService]() @@ -7586,40 +7683,48 @@ func (s *ResumableSessionEventStream) Next() bool ```go type Schedule struct { - ID string `json:"id"` - IdentityID string `json:"identity_id"` - TemplateID string `json:"template_id"` - Name string `json:"name"` - Description string `json:"description"` - Status string `json:"status"` - InitialEvents []ScheduleInitialEventsItem `json:"initial_events"` - Execution ScheduleExecution `json:"execution"` - TriggerPolicy ScheduleTriggerPolicy `json:"trigger_policy"` - EnvironmentID string `json:"environment_id"` - Sinks []ScheduleSinksItem `json:"sinks"` - Metadata map[string]any `json:"metadata"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - ArchivedAt time.Time `json:"archived_at" format:"date-time"` - PausedReason SchedulePausedReason `json:"paused_reason"` - JSON struct { - ID respjson.Field - IdentityID respjson.Field - TemplateID respjson.Field - Name respjson.Field - Description respjson.Field - Status respjson.Field - InitialEvents respjson.Field - Execution respjson.Field - TriggerPolicy respjson.Field - EnvironmentID respjson.Field - Sinks respjson.Field - Metadata respjson.Field - CreatedAt respjson.Field - UpdatedAt respjson.Field - ArchivedAt respjson.Field - PausedReason respjson.Field - ExtraFields map[string]respjson.Field + // Authoritative creation method of the Schedule: api or tool. + Source string `json:"source"` + SourceSessionID string `json:"source_session_id" api:"nullable"` + // Server-maintained input version, incremented when initial_events changes. + InitialEventsVersion int64 `json:"initial_events_version"` + ID string `json:"id"` + IdentityID string `json:"identity_id"` + TemplateID string `json:"template_id"` + Name string `json:"name"` + Description string `json:"description"` + Status string `json:"status"` + InitialEvents []ScheduleInitialEventsItem `json:"initial_events"` + Execution ScheduleExecution `json:"execution"` + TriggerPolicy ScheduleTriggerPolicy `json:"trigger_policy"` + EnvironmentID string `json:"environment_id"` + Sinks []ScheduleSinksItem `json:"sinks"` + Metadata map[string]any `json:"metadata"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + ArchivedAt time.Time `json:"archived_at" format:"date-time"` + PausedReason SchedulePausedReason `json:"paused_reason"` + JSON struct { + Source respjson.Field + SourceSessionID respjson.Field + InitialEventsVersion respjson.Field + ID respjson.Field + IdentityID respjson.Field + TemplateID respjson.Field + Name respjson.Field + Description respjson.Field + Status respjson.Field + InitialEvents respjson.Field + Execution respjson.Field + TriggerPolicy respjson.Field + EnvironmentID respjson.Field + Sinks respjson.Field + Metadata respjson.Field + CreatedAt respjson.Field + UpdatedAt respjson.Field + ArchivedAt respjson.Field + PausedReason respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -7968,6 +8073,11 @@ func (r *SchedulePausedReason) UnmarshalJSON(data []byte) error ```go type ScheduleRun struct { + // Authoritative creation method of the Schedule: api or tool. + Source string `json:"source"` + SourceSessionID string `json:"source_session_id" api:"nullable"` + // Server-selected input version; a missing Run version is unknown. + InitialEventsVersion int64 `json:"initial_events_version"` // Schedule Run ID. ID string `json:"id"` // ID of the owning Schedule. @@ -8009,26 +8119,29 @@ type ScheduleRun struct { // null|Human-readable error message; structured details stay in `error`. ErrorMessage string `json:"error_message"` JSON struct { - ID respjson.Field - ScheduleID respjson.Field - IdentityID respjson.Field - TemplateID respjson.Field - SessionID respjson.Field - Status respjson.Field - TriggerContext respjson.Field - ResultPayload respjson.Field - PushSink respjson.Field - PushStatus respjson.Field - PushFinishedAt respjson.Field - Attempt respjson.Field - TriggeredAt respjson.Field - StartedAt respjson.Field - CompletedAt respjson.Field - DurationMs respjson.Field - CreatedAt respjson.Field - Error respjson.Field - ErrorMessage respjson.Field - ExtraFields map[string]respjson.Field + Source respjson.Field + SourceSessionID respjson.Field + InitialEventsVersion respjson.Field + ID respjson.Field + ScheduleID respjson.Field + IdentityID respjson.Field + TemplateID respjson.Field + SessionID respjson.Field + Status respjson.Field + TriggerContext respjson.Field + ResultPayload respjson.Field + PushSink respjson.Field + PushStatus respjson.Field + PushFinishedAt respjson.Field + Attempt respjson.Field + TriggeredAt respjson.Field + StartedAt respjson.Field + CompletedAt respjson.Field + DurationMs respjson.Field + CreatedAt respjson.Field + Error respjson.Field + ErrorMessage respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -8410,11 +8523,17 @@ func (r *ScheduleSinksItemTarget) UnmarshalJSON(data []byte) error ```go type ScheduleTriggerPolicy struct { + StartAt time.Time `json:"start_at" format:"date-time"` + StopAt time.Time `json:"stop_at" format:"date-time"` + LastRunAt time.Time `json:"last_run_at" api:"nullable" format:"date-time"` Type string `json:"type"` Expression string `json:"expression"` Timezone string `json:"timezone"` UpcomingRunsAt []time.Time `json:"upcoming_runs_at"` JSON struct { + StartAt respjson.Field + StopAt respjson.Field + LastRunAt respjson.Field Type respjson.Field Expression respjson.Field Timezone respjson.Field @@ -8769,6 +8888,7 @@ Revoke revokes a Forward SAT binding belonging to the same Service Account. Use ```go type Session struct { + OutcomeEvaluations []SessionOutcomeEvaluation `json:"outcome_evaluations"` // Session ID. ID string `json:"id"` // Always `session`. @@ -8791,22 +8911,23 @@ type Session struct { CreatedAt time.Time `json:"created_at" format:"date-time"` UpdatedAt time.Time `json:"updated_at" format:"date-time"` JSON struct { - ID respjson.Field - Type respjson.Field - IdentityID respjson.Field - Template respjson.Field - SourceType respjson.Field - Status respjson.Field - Title respjson.Field - Metadata respjson.Field - Config respjson.Field - Resources respjson.Field - Stats respjson.Field - Usage respjson.Field - ArchivedAt respjson.Field - CreatedAt respjson.Field - UpdatedAt respjson.Field - ExtraFields map[string]respjson.Field + OutcomeEvaluations respjson.Field + ID respjson.Field + Type respjson.Field + IdentityID respjson.Field + Template respjson.Field + SourceType respjson.Field + Status respjson.Field + Title respjson.Field + Metadata respjson.Field + Config respjson.Field + Resources respjson.Field + Stats respjson.Field + Usage respjson.Field + ArchivedAt respjson.Field + CreatedAt respjson.Field + UpdatedAt respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -9275,6 +9396,8 @@ func (r SessionEventStreamParams) URLQuery() (url.Values, error) ```go type SessionListParams struct { + // Match an exact sess_ ID or search Session titles. + Search param.Opt[string] `query:"search,omitzero" json:"-"` // Filter by one or more Identity IDs, comma-separated. IdentityIDs []string `query:"identity_ids,omitzero" json:"-"` // Filter by Forward Template ID. @@ -9391,6 +9514,52 @@ func (r *SessionNewParamsConfigParam) UnmarshalJSON(data []byte) error + +## type [SessionOutcomeEvaluation]() + + + +```go +type SessionOutcomeEvaluation struct { + Type string `json:"type"` + OutcomeID string `json:"outcome_id"` + Description string `json:"description"` + Iteration int64 `json:"iteration"` + Result string `json:"result"` + Explanation string `json:"explanation" api:"nullable"` + CompletedAt time.Time `json:"completed_at" api:"nullable" format:"date-time"` + JSON struct { + Type respjson.Field + OutcomeID respjson.Field + Description respjson.Field + Iteration respjson.Field + Result respjson.Field + Explanation respjson.Field + CompletedAt respjson.Field + ExtraFields map[string]respjson.Field + // contains filtered or unexported fields + } `json:"-"` +} +``` + + +### func \(SessionOutcomeEvaluation\) [RawJSON]() + +```go +func (r SessionOutcomeEvaluation) RawJSON() string +``` + + + + +### func \(\*SessionOutcomeEvaluation\) [UnmarshalJSON]() + +```go +func (r *SessionOutcomeEvaluation) UnmarshalJSON(data []byte) error +``` + + + ## type [SessionResource]() @@ -9747,6 +9916,8 @@ func (r *SessionTemplate) UnmarshalJSON(data []byte) error ```go type SessionThread struct { + Stats SessionThreadStats `json:"stats"` + Usage SessionThreadUsage `json:"usage"` ID string `json:"id"` Type string `json:"type"` SessionID string `json:"session_id"` @@ -9761,6 +9932,8 @@ type SessionThread struct { CreatedByToolUseID string `json:"created_by_tool_use_id"` ArchivedAt time.Time `json:"archived_at" format:"date-time"` JSON struct { + Stats respjson.Field + Usage respjson.Field ID respjson.Field Type respjson.Field SessionID respjson.Field @@ -9999,6 +10172,44 @@ func (r *SessionThreadService) ListAutoPaging(ctx context.Context, sessionID str + +## type [SessionThreadStats]() + + + +```go +type SessionThreadStats struct { + ActiveSeconds int64 `json:"active_seconds"` + DurationSeconds int64 `json:"duration_seconds"` + StartupSeconds int64 `json:"startup_seconds"` + JSON struct { + ActiveSeconds respjson.Field + DurationSeconds respjson.Field + StartupSeconds respjson.Field + ExtraFields map[string]respjson.Field + // contains filtered or unexported fields + } `json:"-"` +} +``` + + +### func \(SessionThreadStats\) [RawJSON]() + +```go +func (r SessionThreadStats) RawJSON() string +``` + + + + +### func \(\*SessionThreadStats\) [UnmarshalJSON]() + +```go +func (r *SessionThreadStats) UnmarshalJSON(data []byte) error +``` + + + ## type [SessionThreadStopReason]() @@ -10033,6 +10244,40 @@ func (r *SessionThreadStopReason) UnmarshalJSON(data []byte) error + +## type [SessionThreadUsage]() + + + +```go +type SessionThreadUsage struct { + TotalCredits float64 `json:"total_credits"` + JSON struct { + TotalCredits respjson.Field + ExtraFields map[string]respjson.Field + // contains filtered or unexported fields + } `json:"-"` +} +``` + + +### func \(SessionThreadUsage\) [RawJSON]() + +```go +func (r SessionThreadUsage) RawJSON() string +``` + + + + +### func \(\*SessionThreadUsage\) [UnmarshalJSON]() + +```go +func (r *SessionThreadUsage) UnmarshalJSON(data []byte) error +``` + + + ## type [SessionUpdateParams]() @@ -10893,6 +11138,8 @@ func (r *SystemOverrideParam) UnmarshalJSON(data []byte) error ```go type Template struct { + // Maximum tool-call rounds per Turn; omitted when unset. + MaxToolRounds int64 `json:"max_tool_rounds"` ManagedToolConfig ManagedToolConfig `json:"managed_tool_config"` // Always `template`. Type string `json:"type"` @@ -10922,6 +11169,7 @@ type Template struct { // Custom metadata. Metadata map[string]any `json:"metadata"` JSON struct { + MaxToolRounds respjson.Field ManagedToolConfig respjson.Field Type respjson.Field ID respjson.Field @@ -11058,6 +11306,8 @@ func (r TemplateListParams) URLQuery() (url.Values, error) ```go type TemplateNewParams struct { + // Maximum tool-call rounds per Turn; must be positive. Omit or pass null to use the platform default. + MaxToolRounds param.Opt[int64] `json:"max_tool_rounds,omitzero" api:"nullable"` // Replaces the complete managed tool list; use an empty list to disable all. ManagedToolConfig ManagedToolConfigParam `json:"managed_tool_config,omitzero" api:"nullable"` // Template name, 1-256 characters, unique per user. @@ -11208,6 +11458,8 @@ Update Template ```go type TemplateUpdateParams struct { + // Maximum tool-call rounds per Turn; must be positive. Omit to preserve the limit; pass null to clear it. + MaxToolRounds param.Opt[int64] `json:"max_tool_rounds,omitzero" api:"nullable"` // Replaces the complete managed tool list; use an empty list to disable all. ManagedToolConfig ManagedToolConfigParam `json:"managed_tool_config,omitzero" api:"nullable"` // New Template name. @@ -12489,6 +12741,7 @@ Qoder managed API definitions. - [func \(u DeploymentNewParamsResourceUnion\) GetInstructions\(\) \*string](<#DeploymentNewParamsResourceUnion.GetInstructions>) - [func \(u DeploymentNewParamsResourceUnion\) GetMemoryStoreID\(\) \*string](<#DeploymentNewParamsResourceUnion.GetMemoryStoreID>) - [func \(u DeploymentNewParamsResourceUnion\) GetMountPath\(\) \*string](<#DeploymentNewParamsResourceUnion.GetMountPath>) + - [func \(u DeploymentNewParamsResourceUnion\) GetPassword\(\) \*string](<#DeploymentNewParamsResourceUnion.GetPassword>) - [func \(u DeploymentNewParamsResourceUnion\) GetType\(\) \*string](<#DeploymentNewParamsResourceUnion.GetType>) - [func \(u DeploymentNewParamsResourceUnion\) GetURL\(\) \*string](<#DeploymentNewParamsResourceUnion.GetURL>) - [func \(u DeploymentNewParamsResourceUnion\) MarshalJSON\(\) \(\[\]byte, error\)](<#DeploymentNewParamsResourceUnion.MarshalJSON>) @@ -12539,6 +12792,7 @@ Qoder managed API definitions. - [func \(u DeploymentUpdateParamsResourceUnion\) GetInstructions\(\) \*string](<#DeploymentUpdateParamsResourceUnion.GetInstructions>) - [func \(u DeploymentUpdateParamsResourceUnion\) GetMemoryStoreID\(\) \*string](<#DeploymentUpdateParamsResourceUnion.GetMemoryStoreID>) - [func \(u DeploymentUpdateParamsResourceUnion\) GetMountPath\(\) \*string](<#DeploymentUpdateParamsResourceUnion.GetMountPath>) + - [func \(u DeploymentUpdateParamsResourceUnion\) GetPassword\(\) \*string](<#DeploymentUpdateParamsResourceUnion.GetPassword>) - [func \(u DeploymentUpdateParamsResourceUnion\) GetType\(\) \*string](<#DeploymentUpdateParamsResourceUnion.GetType>) - [func \(u DeploymentUpdateParamsResourceUnion\) GetURL\(\) \*string](<#DeploymentUpdateParamsResourceUnion.GetURL>) - [func \(u DeploymentUpdateParamsResourceUnion\) MarshalJSON\(\) \(\[\]byte, error\)](<#DeploymentUpdateParamsResourceUnion.MarshalJSON>) @@ -12649,6 +12903,7 @@ Qoder managed API definitions. - [type EnvironmentNewParamsConfigUnion](<#EnvironmentNewParamsConfigUnion>) - [func \(u EnvironmentNewParamsConfigUnion\) GetNetworking\(\) \*CloudConfigParamsNetworkingUnion](<#EnvironmentNewParamsConfigUnion.GetNetworking>) - [func \(u EnvironmentNewParamsConfigUnion\) GetPackages\(\) \*PackagesParams](<#EnvironmentNewParamsConfigUnion.GetPackages>) + - [func \(u EnvironmentNewParamsConfigUnion\) GetSetupScript\(\) \*string](<#EnvironmentNewParamsConfigUnion.GetSetupScript>) - [func \(u EnvironmentNewParamsConfigUnion\) GetType\(\) \*string](<#EnvironmentNewParamsConfigUnion.GetType>) - [func \(u EnvironmentNewParamsConfigUnion\) MarshalJSON\(\) \(\[\]byte, error\)](<#EnvironmentNewParamsConfigUnion.MarshalJSON>) - [func \(u \*EnvironmentNewParamsConfigUnion\) UnmarshalJSON\(data \[\]byte\) error](<#EnvironmentNewParamsConfigUnion.UnmarshalJSON>) @@ -12669,6 +12924,7 @@ Qoder managed API definitions. - [type EnvironmentUpdateParamsConfigUnion](<#EnvironmentUpdateParamsConfigUnion>) - [func \(u EnvironmentUpdateParamsConfigUnion\) GetNetworking\(\) \*CloudConfigParamsNetworkingUnion](<#EnvironmentUpdateParamsConfigUnion.GetNetworking>) - [func \(u EnvironmentUpdateParamsConfigUnion\) GetPackages\(\) \*PackagesParams](<#EnvironmentUpdateParamsConfigUnion.GetPackages>) + - [func \(u EnvironmentUpdateParamsConfigUnion\) GetSetupScript\(\) \*string](<#EnvironmentUpdateParamsConfigUnion.GetSetupScript>) - [func \(u EnvironmentUpdateParamsConfigUnion\) GetType\(\) \*string](<#EnvironmentUpdateParamsConfigUnion.GetType>) - [func \(u EnvironmentUpdateParamsConfigUnion\) MarshalJSON\(\) \(\[\]byte, error\)](<#EnvironmentUpdateParamsConfigUnion.MarshalJSON>) - [func \(u \*EnvironmentUpdateParamsConfigUnion\) UnmarshalJSON\(data \[\]byte\) error](<#EnvironmentUpdateParamsConfigUnion.UnmarshalJSON>) @@ -12792,6 +13048,10 @@ Qoder managed API definitions. - [func \(r ManagedAgentsAgentArchivedRunError\) RawJSON\(\) string](<#ManagedAgentsAgentArchivedRunError.RawJSON>) - [func \(r \*ManagedAgentsAgentArchivedRunError\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsAgentArchivedRunError.UnmarshalJSON>) - [type ManagedAgentsAgentArchivedRunErrorType](<#ManagedAgentsAgentArchivedRunErrorType>) +- [type ManagedAgentsAgentArtifactDeliveredEvent](<#ManagedAgentsAgentArtifactDeliveredEvent>) + - [func \(r ManagedAgentsAgentArtifactDeliveredEvent\) RawJSON\(\) string](<#ManagedAgentsAgentArtifactDeliveredEvent.RawJSON>) + - [func \(r \*ManagedAgentsAgentArtifactDeliveredEvent\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsAgentArtifactDeliveredEvent.UnmarshalJSON>) +- [type ManagedAgentsAgentArtifactDeliveredEventType](<#ManagedAgentsAgentArtifactDeliveredEventType>) - [type ManagedAgentsAgentCustomToolUseEvent](<#ManagedAgentsAgentCustomToolUseEvent>) - [func \(r ManagedAgentsAgentCustomToolUseEvent\) RawJSON\(\) string](<#ManagedAgentsAgentCustomToolUseEvent.RawJSON>) - [func \(r \*ManagedAgentsAgentCustomToolUseEvent\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsAgentCustomToolUseEvent.UnmarshalJSON>) @@ -13489,6 +13749,21 @@ Qoder managed API definitions. - [func \(u \*ManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion.UnmarshalJSON>) - [type ManagedAgentsGitHubRepositoryResourceParamsType](<#ManagedAgentsGitHubRepositoryResourceParamsType>) - [type ManagedAgentsGitHubRepositoryResourceType](<#ManagedAgentsGitHubRepositoryResourceType>) +- [type ManagedAgentsGitRepositoryResource](<#ManagedAgentsGitRepositoryResource>) + - [func \(r ManagedAgentsGitRepositoryResource\) RawJSON\(\) string](<#ManagedAgentsGitRepositoryResource.RawJSON>) + - [func \(r \*ManagedAgentsGitRepositoryResource\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsGitRepositoryResource.UnmarshalJSON>) +- [type ManagedAgentsGitRepositoryResourceCheckoutUnion](<#ManagedAgentsGitRepositoryResourceCheckoutUnion>) +- [type ManagedAgentsGitRepositoryResourceConfig](<#ManagedAgentsGitRepositoryResourceConfig>) + - [func \(r ManagedAgentsGitRepositoryResourceConfig\) RawJSON\(\) string](<#ManagedAgentsGitRepositoryResourceConfig.RawJSON>) + - [func \(r \*ManagedAgentsGitRepositoryResourceConfig\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsGitRepositoryResourceConfig.UnmarshalJSON>) +- [type ManagedAgentsGitRepositoryResourceConfigCheckoutUnion](<#ManagedAgentsGitRepositoryResourceConfigCheckoutUnion>) +- [type ManagedAgentsGitRepositoryResourceConfigType](<#ManagedAgentsGitRepositoryResourceConfigType>) +- [type ManagedAgentsGitRepositoryResourceParams](<#ManagedAgentsGitRepositoryResourceParams>) + - [func \(r ManagedAgentsGitRepositoryResourceParams\) MarshalJSON\(\) \(\[\]byte, error\)](<#ManagedAgentsGitRepositoryResourceParams.MarshalJSON>) + - [func \(r \*ManagedAgentsGitRepositoryResourceParams\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsGitRepositoryResourceParams.UnmarshalJSON>) +- [type ManagedAgentsGitRepositoryResourceParamsCheckoutUnion](<#ManagedAgentsGitRepositoryResourceParamsCheckoutUnion>) +- [type ManagedAgentsGitRepositoryResourceParamsType](<#ManagedAgentsGitRepositoryResourceParamsType>) +- [type ManagedAgentsGitRepositoryResourceType](<#ManagedAgentsGitRepositoryResourceType>) - [type ManagedAgentsGlobToolConfig](<#ManagedAgentsGlobToolConfig>) - [func \(r ManagedAgentsGlobToolConfig\) RawJSON\(\) string](<#ManagedAgentsGlobToolConfig.RawJSON>) - [func \(r \*ManagedAgentsGlobToolConfig\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsGlobToolConfig.UnmarshalJSON>) @@ -14037,6 +14312,7 @@ Qoder managed API definitions. - [func \(r \*ManagedAgentsSessionErrorEventErrorUnionRetryStatus\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsSessionErrorEventErrorUnionRetryStatus.UnmarshalJSON>) - [type ManagedAgentsSessionErrorEventType](<#ManagedAgentsSessionErrorEventType>) - [type ManagedAgentsSessionEventUnion](<#ManagedAgentsSessionEventUnion>) + - [func \(u ManagedAgentsSessionEventUnion\) AsAgentArtifactDelivered\(\) \(v ManagedAgentsAgentArtifactDeliveredEvent\)](<#ManagedAgentsSessionEventUnion.AsAgentArtifactDelivered>) - [func \(u ManagedAgentsSessionEventUnion\) AsAgentCustomToolUse\(\) \(v ManagedAgentsAgentCustomToolUseEvent\)](<#ManagedAgentsSessionEventUnion.AsAgentCustomToolUse>) - [func \(u ManagedAgentsSessionEventUnion\) AsAgentMCPToolResult\(\) \(v ManagedAgentsAgentMCPToolResultEvent\)](<#ManagedAgentsSessionEventUnion.AsAgentMCPToolResult>) - [func \(u ManagedAgentsSessionEventUnion\) AsAgentMCPToolUse\(\) \(v ManagedAgentsAgentMCPToolUseEvent\)](<#ManagedAgentsSessionEventUnion.AsAgentMCPToolUse>) @@ -14105,6 +14381,7 @@ Qoder managed API definitions. - [func \(u ManagedAgentsSessionResourceConfigUnion\) AsAny\(\) anyManagedAgentsSessionResourceConfig](<#ManagedAgentsSessionResourceConfigUnion.AsAny>) - [func \(u ManagedAgentsSessionResourceConfigUnion\) AsFile\(\) \(v ManagedAgentsFileResourceConfig\)](<#ManagedAgentsSessionResourceConfigUnion.AsFile>) - [func \(u ManagedAgentsSessionResourceConfigUnion\) AsGitHubRepository\(\) \(v ManagedAgentsGitHubRepositoryResourceConfig\)](<#ManagedAgentsSessionResourceConfigUnion.AsGitHubRepository>) + - [func \(u ManagedAgentsSessionResourceConfigUnion\) AsGitRepository\(\) \(v ManagedAgentsGitRepositoryResourceConfig\)](<#ManagedAgentsSessionResourceConfigUnion.AsGitRepository>) - [func \(u ManagedAgentsSessionResourceConfigUnion\) AsMemoryStore\(\) \(v ManagedAgentsMemoryStoreResourceConfig\)](<#ManagedAgentsSessionResourceConfigUnion.AsMemoryStore>) - [func \(u ManagedAgentsSessionResourceConfigUnion\) RawJSON\(\) string](<#ManagedAgentsSessionResourceConfigUnion.RawJSON>) - [func \(r \*ManagedAgentsSessionResourceConfigUnion\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsSessionResourceConfigUnion.UnmarshalJSON>) @@ -14120,6 +14397,7 @@ Qoder managed API definitions. - [func \(u ManagedAgentsSessionResourceUnion\) AsAny\(\) anyManagedAgentsSessionResource](<#ManagedAgentsSessionResourceUnion.AsAny>) - [func \(u ManagedAgentsSessionResourceUnion\) AsFile\(\) \(v ManagedAgentsFileResource\)](<#ManagedAgentsSessionResourceUnion.AsFile>) - [func \(u ManagedAgentsSessionResourceUnion\) AsGitHubRepository\(\) \(v ManagedAgentsGitHubRepositoryResource\)](<#ManagedAgentsSessionResourceUnion.AsGitHubRepository>) + - [func \(u ManagedAgentsSessionResourceUnion\) AsGitRepository\(\) \(v ManagedAgentsGitRepositoryResource\)](<#ManagedAgentsSessionResourceUnion.AsGitRepository>) - [func \(u ManagedAgentsSessionResourceUnion\) AsMemoryStore\(\) \(v ManagedAgentsMemoryStoreResource\)](<#ManagedAgentsSessionResourceUnion.AsMemoryStore>) - [func \(u ManagedAgentsSessionResourceUnion\) RawJSON\(\) string](<#ManagedAgentsSessionResourceUnion.RawJSON>) - [func \(r \*ManagedAgentsSessionResourceUnion\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsSessionResourceUnion.UnmarshalJSON>) @@ -14303,6 +14581,7 @@ Qoder managed API definitions. - [func \(r \*ManagedAgentsStaticBearerUpdateParams\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsStaticBearerUpdateParams.UnmarshalJSON>) - [type ManagedAgentsStaticBearerUpdateParamsType](<#ManagedAgentsStaticBearerUpdateParamsType>) - [type ManagedAgentsStreamSessionEventsUnion](<#ManagedAgentsStreamSessionEventsUnion>) + - [func \(u ManagedAgentsStreamSessionEventsUnion\) AsAgentArtifactDelivered\(\) \(v ManagedAgentsAgentArtifactDeliveredEvent\)](<#ManagedAgentsStreamSessionEventsUnion.AsAgentArtifactDelivered>) - [func \(u ManagedAgentsStreamSessionEventsUnion\) AsAgentCustomToolUse\(\) \(v ManagedAgentsAgentCustomToolUseEvent\)](<#ManagedAgentsStreamSessionEventsUnion.AsAgentCustomToolUse>) - [func \(u ManagedAgentsStreamSessionEventsUnion\) AsAgentMCPToolResult\(\) \(v ManagedAgentsAgentMCPToolResultEvent\)](<#ManagedAgentsStreamSessionEventsUnion.AsAgentMCPToolResult>) - [func \(u ManagedAgentsStreamSessionEventsUnion\) AsAgentMCPToolUse\(\) \(v ManagedAgentsAgentMCPToolUseEvent\)](<#ManagedAgentsStreamSessionEventsUnion.AsAgentMCPToolUse>) @@ -14350,6 +14629,7 @@ Qoder managed API definitions. - [type ManagedAgentsStreamSessionEventsUnionUsage](<#ManagedAgentsStreamSessionEventsUnionUsage>) - [func \(r \*ManagedAgentsStreamSessionEventsUnionUsage\) UnmarshalJSON\(data \[\]byte\) error](<#ManagedAgentsStreamSessionEventsUnionUsage.UnmarshalJSON>) - [type ManagedAgentsStreamSessionThreadEventsUnion](<#ManagedAgentsStreamSessionThreadEventsUnion>) + - [func \(u ManagedAgentsStreamSessionThreadEventsUnion\) AsAgentArtifactDelivered\(\) \(v ManagedAgentsAgentArtifactDeliveredEvent\)](<#ManagedAgentsStreamSessionThreadEventsUnion.AsAgentArtifactDelivered>) - [func \(u ManagedAgentsStreamSessionThreadEventsUnion\) AsAgentCustomToolUse\(\) \(v ManagedAgentsAgentCustomToolUseEvent\)](<#ManagedAgentsStreamSessionThreadEventsUnion.AsAgentCustomToolUse>) - [func \(u ManagedAgentsStreamSessionThreadEventsUnion\) AsAgentMCPToolResult\(\) \(v ManagedAgentsAgentMCPToolResultEvent\)](<#ManagedAgentsStreamSessionThreadEventsUnion.AsAgentMCPToolResult>) - [func \(u ManagedAgentsStreamSessionThreadEventsUnion\) AsAgentMCPToolUse\(\) \(v ManagedAgentsAgentMCPToolUseEvent\)](<#ManagedAgentsStreamSessionThreadEventsUnion.AsAgentMCPToolUse>) @@ -14985,6 +15265,7 @@ Qoder managed API definitions. - [func \(u SessionNewParamsResourceUnion\) GetInstructions\(\) \*string](<#SessionNewParamsResourceUnion.GetInstructions>) - [func \(u SessionNewParamsResourceUnion\) GetMemoryStoreID\(\) \*string](<#SessionNewParamsResourceUnion.GetMemoryStoreID>) - [func \(u SessionNewParamsResourceUnion\) GetMountPath\(\) \*string](<#SessionNewParamsResourceUnion.GetMountPath>) + - [func \(u SessionNewParamsResourceUnion\) GetPassword\(\) \*string](<#SessionNewParamsResourceUnion.GetPassword>) - [func \(u SessionNewParamsResourceUnion\) GetType\(\) \*string](<#SessionNewParamsResourceUnion.GetType>) - [func \(u SessionNewParamsResourceUnion\) GetURL\(\) \*string](<#SessionNewParamsResourceUnion.GetURL>) - [func \(u SessionNewParamsResourceUnion\) MarshalJSON\(\) \(\[\]byte, error\)](<#SessionNewParamsResourceUnion.MarshalJSON>) @@ -14998,6 +15279,7 @@ Qoder managed API definitions. - [func \(u SessionResourceGetResponseUnion\) AsAny\(\) anySessionResourceGetResponse](<#SessionResourceGetResponseUnion.AsAny>) - [func \(u SessionResourceGetResponseUnion\) AsFile\(\) \(v ManagedAgentsFileResource\)](<#SessionResourceGetResponseUnion.AsFile>) - [func \(u SessionResourceGetResponseUnion\) AsGitHubRepository\(\) \(v ManagedAgentsGitHubRepositoryResource\)](<#SessionResourceGetResponseUnion.AsGitHubRepository>) + - [func \(u SessionResourceGetResponseUnion\) AsGitRepository\(\) \(v ManagedAgentsGitRepositoryResource\)](<#SessionResourceGetResponseUnion.AsGitRepository>) - [func \(u SessionResourceGetResponseUnion\) AsMemoryStore\(\) \(v ManagedAgentsMemoryStoreResource\)](<#SessionResourceGetResponseUnion.AsMemoryStore>) - [func \(u SessionResourceGetResponseUnion\) RawJSON\(\) string](<#SessionResourceGetResponseUnion.RawJSON>) - [func \(r \*SessionResourceGetResponseUnion\) UnmarshalJSON\(data \[\]byte\) error](<#SessionResourceGetResponseUnion.UnmarshalJSON>) @@ -15018,6 +15300,7 @@ Qoder managed API definitions. - [func \(u SessionResourceUpdateResponseUnion\) AsAny\(\) anySessionResourceUpdateResponse](<#SessionResourceUpdateResponseUnion.AsAny>) - [func \(u SessionResourceUpdateResponseUnion\) AsFile\(\) \(v ManagedAgentsFileResource\)](<#SessionResourceUpdateResponseUnion.AsFile>) - [func \(u SessionResourceUpdateResponseUnion\) AsGitHubRepository\(\) \(v ManagedAgentsGitHubRepositoryResource\)](<#SessionResourceUpdateResponseUnion.AsGitHubRepository>) + - [func \(u SessionResourceUpdateResponseUnion\) AsGitRepository\(\) \(v ManagedAgentsGitRepositoryResource\)](<#SessionResourceUpdateResponseUnion.AsGitRepository>) - [func \(u SessionResourceUpdateResponseUnion\) AsMemoryStore\(\) \(v ManagedAgentsMemoryStoreResource\)](<#SessionResourceUpdateResponseUnion.AsMemoryStore>) - [func \(u SessionResourceUpdateResponseUnion\) RawJSON\(\) string](<#SessionResourceUpdateResponseUnion.RawJSON>) - [func \(r \*SessionResourceUpdateResponseUnion\) UnmarshalJSON\(data \[\]byte\) error](<#SessionResourceUpdateResponseUnion.UnmarshalJSON>) @@ -18475,6 +18758,7 @@ Use \[param.IsOmitted\] to confirm if a field is set. ```go type DeploymentNewParamsResourceUnion struct { + OfGitRepository *ManagedAgentsGitRepositoryResourceParams `json:",omitzero,inline"` OfGitHubRepository *ManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"` OfFile *ManagedAgentsFileResourceParams `json:",omitzero,inline"` OfMemoryStore *ManagedAgentsMemoryStoreResourceParam `json:",omitzero,inline"` @@ -18545,6 +18829,15 @@ func (u DeploymentNewParamsResourceUnion) GetMountPath() *string Returns a pointer to the underlying variant's property, if present. + +### func \(DeploymentNewParamsResourceUnion\) [GetPassword]() + +```go +func (u DeploymentNewParamsResourceUnion) GetPassword() *string +``` + + + ### func \(DeploymentNewParamsResourceUnion\) [GetType]() @@ -19043,6 +19336,7 @@ Use \[param.IsOmitted\] to confirm if a field is set. ```go type DeploymentUpdateParamsResourceUnion struct { + OfGitRepository *ManagedAgentsGitRepositoryResourceParams `json:",omitzero,inline"` OfGitHubRepository *ManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"` OfFile *ManagedAgentsFileResourceParams `json:",omitzero,inline"` OfMemoryStore *ManagedAgentsMemoryStoreResourceParam `json:",omitzero,inline"` @@ -19113,6 +19407,15 @@ func (u DeploymentUpdateParamsResourceUnion) GetMountPath() *string Returns a pointer to the underlying variant's property, if present. + +### func \(DeploymentUpdateParamsResourceUnion\) [GetPassword]() + +```go +func (u DeploymentUpdateParamsResourceUnion) GetPassword() *string +``` + + + ### func \(DeploymentUpdateParamsResourceUnion\) [GetType]() @@ -19835,11 +20138,14 @@ An output memory store the dream writes consolidated memories into. ```go type DreamOutput struct { - MemoryStoreID string `json:"memory_store_id" api:"required"` + // Paths of memory files created, modified or deleted. + FilesTouched []string `json:"files_touched"` + MemoryStoreID string `json:"memory_store_id" api:"required"` // Any of "memory_store". Type DreamOutputType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + FilesTouched respjson.Field MemoryStoreID respjson.Field Type respjson.Field ExtraFields map[string]respjson.Field @@ -20321,6 +20627,7 @@ Use the methods beginning with 'As' to cast the union to one of its variants. ```go type EnvironmentConfigUnion struct { + SetupScript string `json:"setup_script"` // This field is from variant [CloudConfig]. Networking CloudConfigNetworkingUnion `json:"networking"` // This field is from variant [CloudConfig]. @@ -20328,9 +20635,10 @@ type EnvironmentConfigUnion struct { // Any of "cloud", "self_hosted". Type string `json:"type"` JSON struct { - Networking respjson.Field - Packages respjson.Field - Type respjson.Field + SetupScript respjson.Field + Networking respjson.Field + Packages respjson.Field + Type respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -20585,6 +20893,15 @@ func (u EnvironmentNewParamsConfigUnion) GetPackages() *PackagesParams Returns a pointer to the underlying variant's property, if present. + +### func \(EnvironmentNewParamsConfigUnion\) [GetSetupScript]() + +```go +func (u EnvironmentNewParamsConfigUnion) GetSetupScript() *string +``` + +Returns the setup script from the selected configuration, if present. + ### func \(EnvironmentNewParamsConfigUnion\) [GetType]() @@ -20814,6 +21131,15 @@ func (u EnvironmentUpdateParamsConfigUnion) GetPackages() *PackagesParams Returns a pointer to the underlying variant's property, if present. + +### func \(EnvironmentUpdateParamsConfigUnion\) [GetSetupScript]() + +```go +func (u EnvironmentUpdateParamsConfigUnion) GetSetupScript() *string +``` + +Returns the setup script from the selected configuration, if present. + ### func \(EnvironmentUpdateParamsConfigUnion\) [GetType]() @@ -22442,6 +22768,67 @@ const ( ) ``` + +## type [ManagedAgentsAgentArtifactDeliveredEvent]() + + + +```go +type ManagedAgentsAgentArtifactDeliveredEvent struct { + ID string `json:"id" api:"required"` + Type ManagedAgentsAgentArtifactDeliveredEventType `json:"type" api:"required"` + FileID string `json:"file_id" api:"required"` + OriginalFilename string `json:"original_filename" api:"required"` + Size int64 `json:"size" api:"required"` + ContentType string `json:"content_type" api:"required"` + ProcessedAt time.Time `json:"processed_at" format:"date-time"` + JSON struct { + ID respjson.Field + Type respjson.Field + FileID respjson.Field + OriginalFilename respjson.Field + Size respjson.Field + ContentType respjson.Field + ProcessedAt respjson.Field + ExtraFields map[string]respjson.Field + // contains filtered or unexported fields + } `json:"-"` +} +``` + + +### func \(ManagedAgentsAgentArtifactDeliveredEvent\) [RawJSON]() + +```go +func (r ManagedAgentsAgentArtifactDeliveredEvent) RawJSON() string +``` + + + + +### func \(\*ManagedAgentsAgentArtifactDeliveredEvent\) [UnmarshalJSON]() + +```go +func (r *ManagedAgentsAgentArtifactDeliveredEvent) UnmarshalJSON(data []byte) error +``` + + + + +## type [ManagedAgentsAgentArtifactDeliveredEventType]() + + + +```go +type ManagedAgentsAgentArtifactDeliveredEventType string +``` + + + +```go +const ManagedAgentsAgentArtifactDeliveredEventTypeAgentArtifactDelivered ManagedAgentsAgentArtifactDeliveredEventType = "agent.artifact_delivered" +``` + ## type [ManagedAgentsAgentCustomToolUseEvent]() @@ -26001,6 +26388,8 @@ The caller's organization or workspace cannot make model requests — out of cre ```go type ManagedAgentsBillingError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -26009,10 +26398,11 @@ type ManagedAgentsBillingError struct { Type ManagedAgentsBillingErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -26646,6 +27036,8 @@ An \`environment\_variable\` credential's \`auth.networking.allowed\_hosts\` inc ```go type ManagedAgentsCredentialHostUnreachableError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // ID of the affected credential. CredentialID string `json:"credential_id" api:"required"` // Human-readable error description. @@ -26658,12 +27050,13 @@ type ManagedAgentsCredentialHostUnreachableError struct { VaultID string `json:"vault_id" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - CredentialID respjson.Field - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - VaultID respjson.Field - ExtraFields map[string]respjson.Field + QoderErrorCode respjson.Field + CredentialID respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + VaultID respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -31703,12 +32096,12 @@ const ( Mount a GitHub repository into the session's container. -The properties AuthorizationToken, Type, URL are required. +The properties Type and URL are required. ```go type ManagedAgentsGitHubRepositoryResourceParams struct { // GitHub authorization token used to clone the repository. - AuthorizationToken string `json:"authorization_token" api:"required"` + AuthorizationToken string `json:"authorization_token,omitzero"` // Any of "github_repository". Type ManagedAgentsGitHubRepositoryResourceParamsType `json:"type,omitzero" api:"required"` // Github URL of the repository @@ -31833,6 +32226,211 @@ const ( ) ``` + +## type [ManagedAgentsGitRepositoryResource]() + + + +```go +type ManagedAgentsGitRepositoryResource struct { + ID string `json:"id" api:"required"` + // A timestamp in RFC 3339 format + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` + MountPath string `json:"mount_path" api:"required"` + // Any of "git_repository". + Type ManagedAgentsGitRepositoryResourceType `json:"type" api:"required"` + // A timestamp in RFC 3339 format + UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"` + URL string `json:"url" api:"required"` + Checkout ManagedAgentsGitRepositoryResourceCheckoutUnion `json:"checkout" api:"nullable"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + ID respjson.Field + CreatedAt respjson.Field + MountPath respjson.Field + Type respjson.Field + UpdatedAt respjson.Field + URL respjson.Field + Checkout respjson.Field + ExtraFields map[string]respjson.Field + // contains filtered or unexported fields + } `json:"-"` +} +``` + + +### func \(ManagedAgentsGitRepositoryResource\) [RawJSON]() + +```go +func (r ManagedAgentsGitRepositoryResource) RawJSON() string +``` + +Returns the unmodified JSON received from the API + + +### func \(\*ManagedAgentsGitRepositoryResource\) [UnmarshalJSON]() + +```go +func (r *ManagedAgentsGitRepositoryResource) UnmarshalJSON(data []byte) error +``` + + + + +## type [ManagedAgentsGitRepositoryResourceCheckoutUnion]() + + + +```go +type ManagedAgentsGitRepositoryResourceCheckoutUnion = ManagedAgentsGitHubRepositoryResourceCheckoutUnion +``` + + +## type [ManagedAgentsGitRepositoryResourceConfig]() + + + +```go +type ManagedAgentsGitRepositoryResourceConfig struct { + // Any of "git_repository". + Type ManagedAgentsGitRepositoryResourceConfigType `json:"type" api:"required"` + // HTTP(S) URL of the repository + URL string `json:"url" api:"required"` + // Branch or commit to check out. Defaults to the repository's default branch. + Checkout ManagedAgentsGitRepositoryResourceConfigCheckoutUnion `json:"checkout" api:"nullable"` + // Mount path in the container. Derived from the repository name when omitted. + MountPath string `json:"mount_path" api:"nullable"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Type respjson.Field + URL respjson.Field + Checkout respjson.Field + MountPath respjson.Field + ExtraFields map[string]respjson.Field + // contains filtered or unexported fields + } `json:"-"` +} +``` + + +### func \(ManagedAgentsGitRepositoryResourceConfig\) [RawJSON]() + +```go +func (r ManagedAgentsGitRepositoryResourceConfig) RawJSON() string +``` + +Returns the unmodified JSON received from the API + + +### func \(\*ManagedAgentsGitRepositoryResourceConfig\) [UnmarshalJSON]() + +```go +func (r *ManagedAgentsGitRepositoryResourceConfig) UnmarshalJSON(data []byte) error +``` + + + + +## type [ManagedAgentsGitRepositoryResourceConfigCheckoutUnion]() + + + +```go +type ManagedAgentsGitRepositoryResourceConfigCheckoutUnion = ManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion +``` + + +## type [ManagedAgentsGitRepositoryResourceConfigType]() + + + +```go +type ManagedAgentsGitRepositoryResourceConfigType string +``` + + + +```go +const ( + ManagedAgentsGitRepositoryResourceConfigTypeGitRepository ManagedAgentsGitRepositoryResourceConfigType = "git_repository" +) +``` + + +## type [ManagedAgentsGitRepositoryResourceParams]() + +Mount an HTTP\(S\) Git repository. For authenticated access, put the username in the URL and supply a password or access token; credentials are never returned. + +```go +type ManagedAgentsGitRepositoryResourceParams struct { + Type ManagedAgentsGitRepositoryResourceParamsType `json:"type,omitzero" api:"required"` + URL string `json:"url" api:"required"` + Password param.Opt[string] `json:"password,omitzero"` + MountPath param.Opt[string] `json:"mount_path,omitzero"` + Checkout ManagedAgentsGitRepositoryResourceParamsCheckoutUnion `json:"checkout,omitzero"` + // contains filtered or unexported fields +} +``` + + +### func \(ManagedAgentsGitRepositoryResourceParams\) [MarshalJSON]() + +```go +func (r ManagedAgentsGitRepositoryResourceParams) MarshalJSON() ([]byte, error) +``` + + + + +### func \(\*ManagedAgentsGitRepositoryResourceParams\) [UnmarshalJSON]() + +```go +func (r *ManagedAgentsGitRepositoryResourceParams) UnmarshalJSON(data []byte) error +``` + + + + +## type [ManagedAgentsGitRepositoryResourceParamsCheckoutUnion]() + + + +```go +type ManagedAgentsGitRepositoryResourceParamsCheckoutUnion = ManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion +``` + + +## type [ManagedAgentsGitRepositoryResourceParamsType]() + + + +```go +type ManagedAgentsGitRepositoryResourceParamsType string +``` + + + +```go +const ManagedAgentsGitRepositoryResourceParamsTypeGitRepository ManagedAgentsGitRepositoryResourceParamsType = "git_repository" +``` + + +## type [ManagedAgentsGitRepositoryResourceType]() + + + +```go +type ManagedAgentsGitRepositoryResourceType string +``` + + + +```go +const ( + ManagedAgentsGitRepositoryResourceTypeGitRepository ManagedAgentsGitRepositoryResourceType = "git_repository" +) +``` + ## type [ManagedAgentsGlobToolConfig]() @@ -32769,6 +33367,8 @@ Authentication to an MCP server failed. ```go type ManagedAgentsMCPAuthenticationFailedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Name of the MCP server that failed authentication. MCPServerName string `json:"mcp_server_name" api:"required"` // Human-readable error description. @@ -32779,11 +33379,12 @@ type ManagedAgentsMCPAuthenticationFailedError struct { Type ManagedAgentsMCPAuthenticationFailedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - MCPServerName respjson.Field - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field + QoderErrorCode respjson.Field + MCPServerName respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -32915,6 +33516,8 @@ Failed to connect to an MCP server. ```go type ManagedAgentsMCPConnectionFailedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Name of the MCP server that failed to connect. MCPServerName string `json:"mcp_server_name" api:"required"` // Human-readable error description. @@ -32925,11 +33528,12 @@ type ManagedAgentsMCPConnectionFailedError struct { Type ManagedAgentsMCPConnectionFailedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - MCPServerName respjson.Field - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field + QoderErrorCode respjson.Field + MCPServerName respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -34595,6 +35199,10 @@ A \`memory\_store\`: a named container for agent memories, scoped to a workspace ```go type ManagedAgentsMemoryStore struct { + // active or archived. + Status string `json:"status"` + EntryCount int64 `json:"entry_count"` + TotalSize int64 `json:"total_size"` // Unique identifier for the memory store (a `memstore_...` tagged ID). Use this // when attaching the store to a session, or in the `{memory_store_id}` path // parameter of subsequent calls. @@ -34620,6 +35228,9 @@ type ManagedAgentsMemoryStore struct { Metadata map[string]string `json:"metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + Status respjson.Field + EntryCount respjson.Field + TotalSize respjson.Field ID respjson.Field CreatedAt respjson.Field Name respjson.Field @@ -35536,6 +36147,8 @@ The model is currently overloaded. Emitted after automatic retries are exhausted ```go type ManagedAgentsModelOverloadedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -35544,10 +36157,11 @@ type ManagedAgentsModelOverloadedError struct { Type ManagedAgentsModelOverloadedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -35679,6 +36293,8 @@ The model request was rate\-limited. ```go type ManagedAgentsModelRateLimitedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -35687,10 +36303,11 @@ type ManagedAgentsModelRateLimitedError struct { Type ManagedAgentsModelRateLimitedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -35822,6 +36439,8 @@ A model request failed for a reason other than overload or rate\-limiting. ```go type ManagedAgentsModelRequestFailedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -35830,10 +36449,11 @@ type ManagedAgentsModelRequestFailedError struct { Type ManagedAgentsModelRequestFailedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -39195,7 +39815,9 @@ Use the methods beginning with 'As' to cast the union to one of its variants. ```go type ManagedAgentsSessionErrorEventErrorUnion struct { - Message string `json:"message"` + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` + Message string `json:"message"` // This field is a union of [ManagedAgentsUnknownErrorRetryStatusUnion], // [ManagedAgentsModelOverloadedErrorRetryStatusUnion], // [ManagedAgentsModelRateLimitedErrorRetryStatusUnion], @@ -39216,12 +39838,13 @@ type ManagedAgentsSessionErrorEventErrorUnion struct { // This field is from variant [ManagedAgentsCredentialHostUnreachableError]. VaultID string `json:"vault_id"` JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - MCPServerName respjson.Field - CredentialID respjson.Field - VaultID respjson.Field + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + MCPServerName respjson.Field + CredentialID respjson.Field + VaultID respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -39395,6 +40018,10 @@ Use the methods beginning with 'As' to cast the union to one of its variants. ```go type ManagedAgentsSessionEventUnion struct { + FileID string `json:"file_id"` + OriginalFilename string `json:"original_filename"` + Size int64 `json:"size"` + ContentType string `json:"content_type"` ModelCredits float64 `json:"model_credits"` SandboxRuntimeCredits float64 `json:"sandbox_runtime_credits"` TotalCredits float64 `json:"total_credits"` @@ -39483,6 +40110,10 @@ type ManagedAgentsSessionEventUnion struct { // This field is from variant [ManagedAgentsSessionUpdatedEvent]. Title string `json:"title"` JSON struct { + FileID respjson.Field + OriginalFilename respjson.Field + Size respjson.Field + ContentType respjson.Field ModelCredits respjson.Field SandboxRuntimeCredits respjson.Field TotalCredits respjson.Field @@ -39527,6 +40158,15 @@ type ManagedAgentsSessionEventUnion struct { } ``` + +### func \(ManagedAgentsSessionEventUnion\) [AsAgentArtifactDelivered]() + +```go +func (u ManagedAgentsSessionEventUnion) AsAgentArtifactDelivered() (v ManagedAgentsAgentArtifactDeliveredEvent) +``` + + + ### func \(ManagedAgentsSessionEventUnion\) [AsAgentCustomToolUse]() @@ -40444,6 +41084,15 @@ func (u ManagedAgentsSessionResourceConfigUnion) AsGitHubRepository() (v Managed + +### func \(ManagedAgentsSessionResourceConfigUnion\) [AsGitRepository]() + +```go +func (u ManagedAgentsSessionResourceConfigUnion) AsGitRepository() (v ManagedAgentsGitRepositoryResourceConfig) +``` + + + ### func \(ManagedAgentsSessionResourceConfigUnion\) [AsMemoryStore]() @@ -40583,7 +41232,7 @@ const ( ## type [ManagedAgentsSessionResourceUnion]() -ManagedAgentsSessionResourceUnion contains all possible properties and values from [ManagedAgentsGitHubRepositoryResource](<#ManagedAgentsGitHubRepositoryResource>), [ManagedAgentsFileResource](<#ManagedAgentsFileResource>), [ManagedAgentsMemoryStoreResource](<#ManagedAgentsMemoryStoreResource>). +ManagedAgentsSessionResourceUnion includes [ManagedAgentsGitRepositoryResource](<#ManagedAgentsGitRepositoryResource>) and contains all possible properties and values from [ManagedAgentsGitHubRepositoryResource](<#ManagedAgentsGitHubRepositoryResource>), [ManagedAgentsFileResource](<#ManagedAgentsFileResource>), [ManagedAgentsMemoryStoreResource](<#ManagedAgentsMemoryStoreResource>). Use the [ManagedAgentsSessionResourceUnion.AsAny](<#ManagedAgentsSessionResourceUnion.AsAny>) method to switch on the variant. @@ -40669,6 +41318,15 @@ func (u ManagedAgentsSessionResourceUnion) AsGitHubRepository() (v ManagedAgents + +### func \(ManagedAgentsSessionResourceUnion\) [AsGitRepository]() + +```go +func (u ManagedAgentsSessionResourceUnion) AsGitRepository() (v ManagedAgentsGitRepositoryResource) +``` + + + ### func \(ManagedAgentsSessionResourceUnion\) [AsMemoryStore]() @@ -43462,6 +44120,10 @@ Use the methods beginning with 'As' to cast the union to one of its variants. ```go type ManagedAgentsStreamSessionEventsUnion struct { + FileID string `json:"file_id"` + OriginalFilename string `json:"original_filename"` + Size int64 `json:"size"` + ContentType string `json:"content_type"` ModelCredits float64 `json:"model_credits"` SandboxRuntimeCredits float64 `json:"sandbox_runtime_credits"` TotalCredits float64 `json:"total_credits"` @@ -43556,6 +44218,10 @@ type ManagedAgentsStreamSessionEventsUnion struct { // This field is from variant [ManagedAgentsDeltaEvent]. EventID string `json:"event_id"` JSON struct { + FileID respjson.Field + OriginalFilename respjson.Field + Size respjson.Field + ContentType respjson.Field ModelCredits respjson.Field SandboxRuntimeCredits respjson.Field TotalCredits respjson.Field @@ -43603,6 +44269,15 @@ type ManagedAgentsStreamSessionEventsUnion struct { } ``` + +### func \(ManagedAgentsStreamSessionEventsUnion\) [AsAgentArtifactDelivered]() + +```go +func (u ManagedAgentsStreamSessionEventsUnion) AsAgentArtifactDelivered() (v ManagedAgentsAgentArtifactDeliveredEvent) +``` + + + ### func \(ManagedAgentsStreamSessionEventsUnion\) [AsAgentCustomToolUse]() @@ -44163,6 +44838,10 @@ Use the methods beginning with 'As' to cast the union to one of its variants. ```go type ManagedAgentsStreamSessionThreadEventsUnion struct { + FileID string `json:"file_id"` + OriginalFilename string `json:"original_filename"` + Size int64 `json:"size"` + ContentType string `json:"content_type"` ModelCredits float64 `json:"model_credits"` SandboxRuntimeCredits float64 `json:"sandbox_runtime_credits"` TotalCredits float64 `json:"total_credits"` @@ -44257,6 +44936,10 @@ type ManagedAgentsStreamSessionThreadEventsUnion struct { // This field is from variant [ManagedAgentsDeltaEvent]. EventID string `json:"event_id"` JSON struct { + FileID respjson.Field + OriginalFilename respjson.Field + Size respjson.Field + ContentType respjson.Field ModelCredits respjson.Field SandboxRuntimeCredits respjson.Field TotalCredits respjson.Field @@ -44304,6 +44987,15 @@ type ManagedAgentsStreamSessionThreadEventsUnion struct { } ``` + +### func \(ManagedAgentsStreamSessionThreadEventsUnion\) [AsAgentArtifactDelivered]() + +```go +func (u ManagedAgentsStreamSessionThreadEventsUnion) AsAgentArtifactDelivered() (v ManagedAgentsAgentArtifactDeliveredEvent) +``` + + + ### func \(ManagedAgentsStreamSessionThreadEventsUnion\) [AsAgentCustomToolUse]() @@ -46111,6 +46803,8 @@ An unknown or unexpected error occurred during session execution. A fallback var ```go type ManagedAgentsUnknownError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -46119,10 +46813,11 @@ type ManagedAgentsUnknownError struct { Type ManagedAgentsUnknownErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` } @@ -51402,10 +52097,12 @@ Configuration for self\-hosted environments. ```go type SelfHostedConfig struct { + SetupScript string `json:"setup_script"` // Environment type Type constant.SelfHosted `json:"type" default:"self_hosted"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + SetupScript respjson.Field Type respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields @@ -51440,6 +52137,7 @@ This struct has a constant value, construct it with [NewSelfHostedConfigParams]( ```go type SelfHostedConfigParams struct { + SetupScript param.Opt[string] `json:"setup_script,omitzero"` // Environment type Type constant.SelfHosted `json:"type" default:"self_hosted"` // contains filtered or unexported fields @@ -52588,6 +53286,7 @@ Use \[param.IsOmitted\] to confirm if a field is set. ```go type SessionNewParamsResourceUnion struct { + OfGitRepository *ManagedAgentsGitRepositoryResourceParams `json:",omitzero,inline"` OfGitHubRepository *ManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"` OfFile *ManagedAgentsFileResourceParams `json:",omitzero,inline"` OfMemoryStore *ManagedAgentsMemoryStoreResourceParam `json:",omitzero,inline"` @@ -52658,6 +53357,15 @@ func (u SessionNewParamsResourceUnion) GetMountPath() *string Returns a pointer to the underlying variant's property, if present. + +### func \(SessionNewParamsResourceUnion\) [GetPassword]() + +```go +func (u SessionNewParamsResourceUnion) GetPassword() *string +``` + + + ### func \(SessionNewParamsResourceUnion\) [GetType]() @@ -52758,7 +53466,7 @@ type SessionResourceGetParams struct { ## type [SessionResourceGetResponseUnion]() -SessionResourceGetResponseUnion contains all possible properties and values from [ManagedAgentsGitHubRepositoryResource](<#ManagedAgentsGitHubRepositoryResource>), [ManagedAgentsFileResource](<#ManagedAgentsFileResource>), [ManagedAgentsMemoryStoreResource](<#ManagedAgentsMemoryStoreResource>). +SessionResourceGetResponseUnion includes [ManagedAgentsGitRepositoryResource](<#ManagedAgentsGitRepositoryResource>) and contains all possible properties and values from [ManagedAgentsGitHubRepositoryResource](<#ManagedAgentsGitHubRepositoryResource>), [ManagedAgentsFileResource](<#ManagedAgentsFileResource>), [ManagedAgentsMemoryStoreResource](<#ManagedAgentsMemoryStoreResource>). Use the [SessionResourceGetResponseUnion.AsAny](<#SessionResourceGetResponseUnion.AsAny>) method to switch on the variant. @@ -52844,6 +53552,15 @@ func (u SessionResourceGetResponseUnion) AsGitHubRepository() (v ManagedAgentsGi + +### func \(SessionResourceGetResponseUnion\) [AsGitRepository]() + +```go +func (u SessionResourceGetResponseUnion) AsGitRepository() (v ManagedAgentsGitRepositoryResource) +``` + + + ### func \(SessionResourceGetResponseUnion\) [AsMemoryStore]() @@ -52987,8 +53704,8 @@ type SessionResourceUpdateParams struct { Password param.Opt[string] `json:"password,omitzero"` SessionID string `path:"session_id" api:"required" json:"-"` - // New authorization token for the resource. Currently only `github_repository` - // resources support token rotation. + // GitHub access token; also accepted for legacy generic Git clients. + // For generic Git, prefer Password and do not send conflicting credentials. AuthorizationToken string `json:"authorization_token,omitzero"` // Optional header to specify the beta version(s) you want to use. Betas []QoderBeta `header:"x-qoder-beta,omitzero" json:"-"` @@ -53017,7 +53734,7 @@ func (r *SessionResourceUpdateParams) UnmarshalJSON(data []byte) error ## type [SessionResourceUpdateResponseUnion]() -SessionResourceUpdateResponseUnion contains all possible properties and values from [ManagedAgentsGitHubRepositoryResource](<#ManagedAgentsGitHubRepositoryResource>), [ManagedAgentsFileResource](<#ManagedAgentsFileResource>), [ManagedAgentsMemoryStoreResource](<#ManagedAgentsMemoryStoreResource>). +SessionResourceUpdateResponseUnion includes [ManagedAgentsGitRepositoryResource](<#ManagedAgentsGitRepositoryResource>) and contains all possible properties and values from [ManagedAgentsGitHubRepositoryResource](<#ManagedAgentsGitHubRepositoryResource>), [ManagedAgentsFileResource](<#ManagedAgentsFileResource>), [ManagedAgentsMemoryStoreResource](<#ManagedAgentsMemoryStoreResource>). Use the [SessionResourceUpdateResponseUnion.AsAny](<#SessionResourceUpdateResponseUnion.AsAny>) method to switch on the variant. @@ -53103,6 +53820,15 @@ func (u SessionResourceUpdateResponseUnion) AsGitHubRepository() (v ManagedAgent + +### func \(SessionResourceUpdateResponseUnion\) [AsGitRepository]() + +```go +func (u SessionResourceUpdateResponseUnion) AsGitRepository() (v ManagedAgentsGitRepositoryResource) +``` + + + ### func \(SessionResourceUpdateResponseUnion\) [AsMemoryStore]() diff --git a/forward/batch.go b/forward/batch.go index f2e1514..433a47b 100644 --- a/forward/batch.go +++ b/forward/batch.go @@ -76,6 +76,8 @@ func (r *BatchService) New(ctx context.Context, params BatchNewParams, opts ...o } type BatchNewParams struct { + // Ignore the scheduling time window; does not change capacity or FIFO priority. + IgnoreIdleWindow param.Opt[bool] `json:"ignore_idle_window,omitzero"` // ID of a JSONL file uploaded through the Files API. InputFileID string `json:"input_file_id" api:"required"` // Completion window: `24h`, `48h` or `72h`. The Batch moves to `expired` when it elapses. @@ -172,6 +174,9 @@ func (r BatchFile) RawJSON() string { return r.JSON.raw } func (r *BatchFile) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } type Batch struct { + IgnoreIdleWindow bool `json:"ignore_idle_window"` + // Dynamic queue reason, present only when applicable to validating or queued Batches. + QueueReason string `json:"queue_reason"` // Batch ID, prefixed with `batch_`. ID string `json:"id"` // Always `batch`. @@ -214,6 +219,8 @@ type Batch struct { // Batch-level error description; present only in the `failed` status. ErrorMessage string `json:"error_message"` JSON struct { + IgnoreIdleWindow respjson.Field + QueueReason respjson.Field ID respjson.Field Object respjson.Field Status respjson.Field diff --git a/forward/contract_alignment_080_test.go b/forward/contract_alignment_080_test.go new file mode 100644 index 0000000..d21e591 --- /dev/null +++ b/forward/contract_alignment_080_test.go @@ -0,0 +1,158 @@ +package forward_test + +import ( + "context" + "encoding/json" + "io" + "net/http" + "os" + "reflect" + "testing" + + "github.com/QoderAI/qoder-cloud-agents-sdk-go/convention/param" + "github.com/QoderAI/qoder-cloud-agents-sdk-go/forward" +) + +// Existing API contracts from docs.qoder.com/cloud-agents/api, 2026-10-20. +func alignmentFixture(t *testing.T) map[string]json.RawMessage { + t.Helper() + data, err := os.ReadFile("testdata/contract-alignment-0.8.json") + if err != nil { + t.Fatal(err) + } + var fixture map[string]json.RawMessage + if err := json.Unmarshal(data, &fixture); err != nil { + t.Fatal(err) + } + return fixture +} + +func TestForwardContractAlignment080Requests(t *testing.T) { + ctx := context.Background() + var body map[string]any + var requests int + client := testClient(func(r *http.Request) (*http.Response, error) { + requests++ + if r.Method == "GET" { + if r.URL.Query().Get("search") != "report & 中文" { + t.Fatal(r.URL) + } + return reply(r, 200, `{"data":[],"has_more":false}`), nil + } + data, err := io.ReadAll(r.Body) + if err != nil { + t.Fatal(err) + } + body = nil + if err := json.Unmarshal(data, &body); err != nil { + t.Fatal(err) + } + if r.URL.Path == "/api/v1/forward/memory_stores" && r.Header.Get("Idempotency-Key") != "mount-one" { + t.Fatal("missing idempotency key") + } + return reply(r, 200, `{"id":"contract_one"}`), nil + }) + for _, value := range []param.Opt[int64]{{}, param.Null[int64](), forward.Int(3)} { + _, err := client.Templates.New(ctx, forward.TemplateNewParams{Name: "sdk-contract", EnvironmentID: "env_one", Model: forward.ModelConfigUnionParam{OfString: forward.String("model")}, MaxToolRounds: value}) + if err != nil { + t.Fatal(err) + } + got, present := body["max_tool_rounds"] + if value.Valid() && got != float64(3) { + t.Fatal(body) + } + if param.IsNull(value) && (!present || got != nil) { + t.Fatal(body) + } + if param.IsOmitted(value) && present { + t.Fatal(body) + } + _, err = client.Templates.Update(ctx, "tmpl_one", forward.TemplateUpdateParams{MaxToolRounds: value}) + if err != nil { + t.Fatal(err) + } + got, present = body["max_tool_rounds"] + if value.Valid() && got != float64(3) || param.IsNull(value) && (!present || got != nil) || param.IsOmitted(value) && present { + t.Fatal(body) + } + } + for _, value := range []param.Opt[bool]{{}, forward.Bool(false), forward.Bool(true)} { + _, err := client.Batches.New(ctx, forward.BatchNewParams{InputFileID: "file_one", CompletionWindow: "24h", IgnoreIdleWindow: value}) + if err != nil { + t.Fatal(err) + } + got, present := body["ignore_idle_window"] + if present != value.Valid() || present && got != value.Value { + t.Fatal(body) + } + } + if _, err := client.Sessions.List(ctx, forward.SessionListParams{Search: forward.String("report & 中文")}); err != nil { + t.Fatal(err) + } + before := requests + for i := 0; i < 2; i++ { + _, err := client.MemoryStores.New(ctx, forward.MemoryStoreNewParams{Name: "sdk-contract", IdempotencyKey: "mount-one", Mount: forward.MemoryStoreNewParamsMount{IdentityID: "idn_one", TemplateID: "tmpl_one", Access: forward.String("read_write")}}) + if err != nil { + t.Fatal(err) + } + var mount any + if err := json.Unmarshal(alignmentFixture(t)["mount"], &mount); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(body, map[string]any{"name": "sdk-contract", "mount": mount}) { + t.Fatal(body) + } + } + if requests != before+2 { + t.Fatal("mount must use a single native operation") + } +} + +func TestForwardContractAlignment080Responses(t *testing.T) { + f := alignmentFixture(t) + decode := func(key string, dst any) { + t.Helper() + if err := json.Unmarshal(f[key], dst); err != nil { + t.Fatal(err) + } + } + var session forward.Session + decode("session", &session) + if len(session.OutcomeEvaluations) != 1 || !session.OutcomeEvaluations[0].JSON.Iteration.Valid() || session.OutcomeEvaluations[0].JSON.Explanation.Raw() != "null" { + t.Fatal(session) + } + var thread forward.SessionThread + decode("thread", &thread) + if !thread.Usage.JSON.TotalCredits.Valid() || thread.Usage.TotalCredits != 0 || !thread.Stats.JSON.StartupSeconds.Valid() { + t.Fatal(thread) + } + var absent forward.SessionThread + if err := json.Unmarshal([]byte(`{"id":"empty"}`), &absent); err != nil { + t.Fatal(err) + } + if absent.JSON.Usage.Valid() || absent.JSON.Stats.Valid() { + t.Fatal("absent must remain unknown") + } + var schedule forward.Schedule + decode("schedule", &schedule) + if schedule.Source != "api" || schedule.JSON.SourceSessionID.Raw() != "null" || schedule.InitialEventsVersion != 2 || schedule.TriggerPolicy.StartAt.Day() != 20 || schedule.TriggerPolicy.StopAt.Day() != 21 || schedule.TriggerPolicy.JSON.LastRunAt.Raw() != "null" { + t.Fatal(schedule) + } + var run forward.ScheduleRun + decode("run", &run) + if run.Source != "tool" || run.SourceSessionID != "sess_one" || run.JSON.InitialEventsVersion.Valid() { + t.Fatal(run) + } + var env forward.Environment + decode("environment", &env) + if env.Config.SetupScript != "echo sdk-contract" || !env.BindingInfo.JSON.AgentTemplateCount.Valid() { + t.Fatal(env) + } + var batch forward.Batch + if err := json.Unmarshal([]byte(`{"ignore_idle_window":false,"queue_reason":"capacity"}`), &batch); err != nil { + t.Fatal(err) + } + if batch.IgnoreIdleWindow || !batch.JSON.IgnoreIdleWindow.Valid() || batch.QueueReason != "capacity" { + t.Fatal(batch) + } +} diff --git a/forward/environment.go b/forward/environment.go index 541945c..66041c9 100644 --- a/forward/environment.go +++ b/forward/environment.go @@ -177,17 +177,21 @@ func (r *EnvironmentService) Delete(ctx context.Context, id string, opts ...opti } type Environment struct { - ID string `json:"id"` - Type string `json:"type"` - Name string `json:"name"` - Description string `json:"description"` - Config EnvironmentConfig `json:"config"` - Metadata map[string]any `json:"metadata"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - IdentityID string `json:"identity_id" api:"nullable"` - ArchivedAt time.Time `json:"archived_at" api:"nullable" format:"date-time"` + IconURL string `json:"icon_url" api:"nullable"` + BindingInfo EnvironmentBindingInfo `json:"binding_info"` + ID string `json:"id"` + Type string `json:"type"` + Name string `json:"name"` + Description string `json:"description"` + Config EnvironmentConfig `json:"config"` + Metadata map[string]any `json:"metadata"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + IdentityID string `json:"identity_id" api:"nullable"` + ArchivedAt time.Time `json:"archived_at" api:"nullable" format:"date-time"` JSON struct { + IconURL respjson.Field + BindingInfo respjson.Field ID respjson.Field Type respjson.Field Name respjson.Field @@ -207,9 +211,11 @@ func (r Environment) RawJSON() string { return r.JSON.raw } func (r *Environment) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } type EnvironmentConfig struct { - Type string `json:"type"` - Packages EnvironmentConfigPackages `json:"packages"` - JSON struct { + SetupScript string `json:"setup_script"` + Type string `json:"type"` + Packages EnvironmentConfigPackages `json:"packages"` + JSON struct { + SetupScript respjson.Field Type respjson.Field Packages respjson.Field ExtraFields map[string]respjson.Field @@ -253,3 +259,17 @@ func (r EnvironmentNewParams) URLQuery() (url.Values, error) { func (r EnvironmentUpdateParams) URLQuery() (url.Values, error) { return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ArrayFormat: apiquery.ArrayQueryFormatRepeat, NestedFormat: apiquery.NestedQueryFormatBrackets}) } + +type EnvironmentBindingInfo struct { + AgentTemplateCount int64 `json:"agent_template_count"` + JSON struct { + AgentTemplateCount respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +func (r EnvironmentBindingInfo) RawJSON() string { return r.JSON.raw } +func (r *EnvironmentBindingInfo) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} diff --git a/forward/memorystore.go b/forward/memorystore.go index bc2159b..a180688 100644 --- a/forward/memorystore.go +++ b/forward/memorystore.go @@ -76,6 +76,8 @@ func (r *MemoryStoreService) New(ctx context.Context, params MemoryStoreNewParam } type MemoryStoreNewParams struct { + // Establish this mount before returning. Retry with the same key and body to resume creation. + Mount MemoryStoreNewParamsMount `json:"mount,omitzero"` // Display name for the store, non-empty. Non-printable control characters // (`U+0000`–`U+001F`, `U+007F`) are not allowed, except newline `\n`, carriage return // `\r` and tab `\t`. @@ -225,3 +227,19 @@ type MemoryStore struct { func (r MemoryStore) RawJSON() string { return r.JSON.raw } func (r *MemoryStore) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } + +type MemoryStoreNewParamsMount struct { + IdentityID string `json:"identity_id" api:"required"` + TemplateID string `json:"template_id" api:"required"` + // read_only (default) or read_write. + Access param.Opt[string] `json:"access,omitzero"` + paramObj +} + +func (r MemoryStoreNewParamsMount) MarshalJSON() ([]byte, error) { + type shadow MemoryStoreNewParamsMount + return param.MarshalObject(r, (*shadow)(&r)) +} +func (r *MemoryStoreNewParamsMount) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} diff --git a/forward/schedule.go b/forward/schedule.go index d1d1cc4..bba10ae 100644 --- a/forward/schedule.go +++ b/forward/schedule.go @@ -321,41 +321,49 @@ func (r *ScheduleArchiveManyResponse) UnmarshalJSON(data []byte) error { } type Schedule struct { - ID string `json:"id"` - IdentityID string `json:"identity_id"` - TemplateID string `json:"template_id"` - Name string `json:"name"` - Description string `json:"description"` - Status string `json:"status"` - InitialEvents []ScheduleInitialEventsItem `json:"initial_events"` - Execution ScheduleExecution `json:"execution"` - TriggerPolicy ScheduleTriggerPolicy `json:"trigger_policy"` - EnvironmentID string `json:"environment_id"` - Sinks []ScheduleSinksItem `json:"sinks"` - Metadata map[string]any `json:"metadata"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - ArchivedAt time.Time `json:"archived_at" format:"date-time"` - PausedReason SchedulePausedReason `json:"paused_reason"` - JSON struct { - ID respjson.Field - IdentityID respjson.Field - TemplateID respjson.Field - Name respjson.Field - Description respjson.Field - Status respjson.Field - InitialEvents respjson.Field - Execution respjson.Field - TriggerPolicy respjson.Field - EnvironmentID respjson.Field - Sinks respjson.Field - Metadata respjson.Field - CreatedAt respjson.Field - UpdatedAt respjson.Field - ArchivedAt respjson.Field - PausedReason respjson.Field - ExtraFields map[string]respjson.Field - raw string + // Authoritative creation method of the Schedule: api or tool. + Source string `json:"source"` + SourceSessionID string `json:"source_session_id" api:"nullable"` + // Server-maintained input version, incremented when initial_events changes. + InitialEventsVersion int64 `json:"initial_events_version"` + ID string `json:"id"` + IdentityID string `json:"identity_id"` + TemplateID string `json:"template_id"` + Name string `json:"name"` + Description string `json:"description"` + Status string `json:"status"` + InitialEvents []ScheduleInitialEventsItem `json:"initial_events"` + Execution ScheduleExecution `json:"execution"` + TriggerPolicy ScheduleTriggerPolicy `json:"trigger_policy"` + EnvironmentID string `json:"environment_id"` + Sinks []ScheduleSinksItem `json:"sinks"` + Metadata map[string]any `json:"metadata"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + ArchivedAt time.Time `json:"archived_at" format:"date-time"` + PausedReason SchedulePausedReason `json:"paused_reason"` + JSON struct { + Source respjson.Field + SourceSessionID respjson.Field + InitialEventsVersion respjson.Field + ID respjson.Field + IdentityID respjson.Field + TemplateID respjson.Field + Name respjson.Field + Description respjson.Field + Status respjson.Field + InitialEvents respjson.Field + Execution respjson.Field + TriggerPolicy respjson.Field + EnvironmentID respjson.Field + Sinks respjson.Field + Metadata respjson.Field + CreatedAt respjson.Field + UpdatedAt respjson.Field + ArchivedAt respjson.Field + PausedReason respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -409,11 +417,17 @@ func (r *ScheduleSinksItemTarget) UnmarshalJSON(data []byte) error { } type ScheduleTriggerPolicy struct { + StartAt time.Time `json:"start_at" format:"date-time"` + StopAt time.Time `json:"stop_at" format:"date-time"` + LastRunAt time.Time `json:"last_run_at" api:"nullable" format:"date-time"` Type string `json:"type"` Expression string `json:"expression"` Timezone string `json:"timezone"` UpcomingRunsAt []time.Time `json:"upcoming_runs_at"` JSON struct { + StartAt respjson.Field + StopAt respjson.Field + LastRunAt respjson.Field Type respjson.Field Expression respjson.Field Timezone respjson.Field diff --git a/forward/schedulerun.go b/forward/schedulerun.go index 0cd3555..8a2d705 100644 --- a/forward/schedulerun.go +++ b/forward/schedulerun.go @@ -98,6 +98,11 @@ func (r ScheduleRunGetParams) URLQuery() (url.Values, error) { } type ScheduleRun struct { + // Authoritative creation method of the Schedule: api or tool. + Source string `json:"source"` + SourceSessionID string `json:"source_session_id" api:"nullable"` + // Server-selected input version; a missing Run version is unknown. + InitialEventsVersion int64 `json:"initial_events_version"` // Schedule Run ID. ID string `json:"id"` // ID of the owning Schedule. @@ -139,27 +144,30 @@ type ScheduleRun struct { // null|Human-readable error message; structured details stay in `error`. ErrorMessage string `json:"error_message"` JSON struct { - ID respjson.Field - ScheduleID respjson.Field - IdentityID respjson.Field - TemplateID respjson.Field - SessionID respjson.Field - Status respjson.Field - TriggerContext respjson.Field - ResultPayload respjson.Field - PushSink respjson.Field - PushStatus respjson.Field - PushFinishedAt respjson.Field - Attempt respjson.Field - TriggeredAt respjson.Field - StartedAt respjson.Field - CompletedAt respjson.Field - DurationMs respjson.Field - CreatedAt respjson.Field - Error respjson.Field - ErrorMessage respjson.Field - ExtraFields map[string]respjson.Field - raw string + Source respjson.Field + SourceSessionID respjson.Field + InitialEventsVersion respjson.Field + ID respjson.Field + ScheduleID respjson.Field + IdentityID respjson.Field + TemplateID respjson.Field + SessionID respjson.Field + Status respjson.Field + TriggerContext respjson.Field + ResultPayload respjson.Field + PushSink respjson.Field + PushStatus respjson.Field + PushFinishedAt respjson.Field + Attempt respjson.Field + TriggeredAt respjson.Field + StartedAt respjson.Field + CompletedAt respjson.Field + DurationMs respjson.Field + CreatedAt respjson.Field + Error respjson.Field + ErrorMessage respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } diff --git a/forward/session.go b/forward/session.go index 32cb425..e3313db 100644 --- a/forward/session.go +++ b/forward/session.go @@ -51,6 +51,8 @@ func (r *SessionService) ListAutoPaging(ctx context.Context, params SessionListP } type SessionListParams struct { + // Match an exact sess_ ID or search Session titles. + Search param.Opt[string] `query:"search,omitzero" json:"-"` // Filter by one or more Identity IDs, comma-separated. IdentityIDs []string `query:"identity_ids,omitzero" json:"-"` // Filter by Forward Template ID. @@ -241,6 +243,7 @@ func (r SessionCancelParams) URLQuery() (url.Values, error) { } type Session struct { + OutcomeEvaluations []SessionOutcomeEvaluation `json:"outcome_evaluations"` // Session ID. ID string `json:"id"` // Always `session`. @@ -263,23 +266,24 @@ type Session struct { CreatedAt time.Time `json:"created_at" format:"date-time"` UpdatedAt time.Time `json:"updated_at" format:"date-time"` JSON struct { - ID respjson.Field - Type respjson.Field - IdentityID respjson.Field - Template respjson.Field - SourceType respjson.Field - Status respjson.Field - Title respjson.Field - Metadata respjson.Field - Config respjson.Field - Resources respjson.Field - Stats respjson.Field - Usage respjson.Field - ArchivedAt respjson.Field - CreatedAt respjson.Field - UpdatedAt respjson.Field - ExtraFields map[string]respjson.Field - raw string + OutcomeEvaluations respjson.Field + ID respjson.Field + Type respjson.Field + IdentityID respjson.Field + Template respjson.Field + SourceType respjson.Field + Status respjson.Field + Title respjson.Field + Metadata respjson.Field + Config respjson.Field + Resources respjson.Field + Stats respjson.Field + Usage respjson.Field + ArchivedAt respjson.Field + CreatedAt respjson.Field + UpdatedAt respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -347,3 +351,29 @@ type SessionTemplate struct { func (r SessionTemplate) RawJSON() string { return r.JSON.raw } func (r *SessionTemplate) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } + +type SessionOutcomeEvaluation struct { + Type string `json:"type"` + OutcomeID string `json:"outcome_id"` + Description string `json:"description"` + Iteration int64 `json:"iteration"` + Result string `json:"result"` + Explanation string `json:"explanation" api:"nullable"` + CompletedAt time.Time `json:"completed_at" api:"nullable" format:"date-time"` + JSON struct { + Type respjson.Field + OutcomeID respjson.Field + Description respjson.Field + Iteration respjson.Field + Result respjson.Field + Explanation respjson.Field + CompletedAt respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +func (r SessionOutcomeEvaluation) RawJSON() string { return r.JSON.raw } +func (r *SessionOutcomeEvaluation) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} diff --git a/forward/sessionthread.go b/forward/sessionthread.go index 913e5fc..a49999e 100644 --- a/forward/sessionthread.go +++ b/forward/sessionthread.go @@ -109,6 +109,8 @@ func (r SessionThreadArchiveParams) URLQuery() (url.Values, error) { } type SessionThread struct { + Stats SessionThreadStats `json:"stats"` + Usage SessionThreadUsage `json:"usage"` ID string `json:"id"` Type string `json:"type"` SessionID string `json:"session_id"` @@ -123,6 +125,8 @@ type SessionThread struct { CreatedByToolUseID string `json:"created_by_tool_use_id"` ArchivedAt time.Time `json:"archived_at" format:"date-time"` JSON struct { + Stats respjson.Field + Usage respjson.Field ID respjson.Field Type respjson.Field SessionID respjson.Field @@ -157,3 +161,31 @@ func (r SessionThreadStopReason) RawJSON() string { return r.JSON.raw } func (r *SessionThreadStopReason) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } + +type SessionThreadStats struct { + ActiveSeconds int64 `json:"active_seconds"` + DurationSeconds int64 `json:"duration_seconds"` + StartupSeconds int64 `json:"startup_seconds"` + JSON struct { + ActiveSeconds respjson.Field + DurationSeconds respjson.Field + StartupSeconds respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +func (r SessionThreadStats) RawJSON() string { return r.JSON.raw } +func (r *SessionThreadStats) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } + +type SessionThreadUsage struct { + TotalCredits float64 `json:"total_credits"` + JSON struct { + TotalCredits respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +func (r SessionThreadUsage) RawJSON() string { return r.JSON.raw } +func (r *SessionThreadUsage) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } diff --git a/forward/template.go b/forward/template.go index 388d562..753f8e7 100644 --- a/forward/template.go +++ b/forward/template.go @@ -78,6 +78,8 @@ func (r *TemplateService) New(ctx context.Context, params TemplateNewParams, opt } type TemplateNewParams struct { + // Maximum tool-call rounds per Turn; must be positive. Omit or pass null to use the platform default. + MaxToolRounds param.Opt[int64] `json:"max_tool_rounds,omitzero" api:"nullable"` // Replaces the complete managed tool list; use an empty list to disable all. ManagedToolConfig ManagedToolConfigParam `json:"managed_tool_config,omitzero" api:"nullable"` // Template name, 1-256 characters, unique per user. @@ -155,6 +157,8 @@ func (r *TemplateService) Update(ctx context.Context, templateID string, params } type TemplateUpdateParams struct { + // Maximum tool-call rounds per Turn; must be positive. Omit to preserve the limit; pass null to clear it. + MaxToolRounds param.Opt[int64] `json:"max_tool_rounds,omitzero" api:"nullable"` // Replaces the complete managed tool list; use an empty list to disable all. ManagedToolConfig ManagedToolConfigParam `json:"managed_tool_config,omitzero" api:"nullable"` // New Template name. @@ -261,6 +265,8 @@ func (r TemplateCloneParams) MarshalJSON() ([]byte, error) { func (r *TemplateCloneParams) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } type Template struct { + // Maximum tool-call rounds per Turn; omitted when unset. + MaxToolRounds int64 `json:"max_tool_rounds"` ManagedToolConfig ManagedToolConfig `json:"managed_tool_config"` // Always `template`. Type string `json:"type"` @@ -290,6 +296,7 @@ type Template struct { // Custom metadata. Metadata map[string]any `json:"metadata"` JSON struct { + MaxToolRounds respjson.Field ManagedToolConfig respjson.Field Type respjson.Field ID respjson.Field diff --git a/forward/testdata/contract-alignment-0.8.json b/forward/testdata/contract-alignment-0.8.json new file mode 100644 index 0000000..53b2050 --- /dev/null +++ b/forward/testdata/contract-alignment-0.8.json @@ -0,0 +1,120 @@ +{ + "source": "https://docs.qoder.com/cloud-agents/api/sessions/schemas", + "retrieved_at": "2026-10-20", + "git": { + "type": "git_repository", + "url": "https://user@git.example.test/team/repo.git", + "password": "contract-placeholder", + "mount_path": "/repos/demo", + "checkout": { + "type": "branch", + "name": "main" + } + }, + "github": { + "type": "github_repository", + "url": "https://github.com/QoderAI/forward-quickstart" + }, + "mount": { + "identity_id": "idn_one", + "template_id": "tmpl_one", + "access": "read_write" + }, + "environment": { + "id": "env_one", + "config": { + "type": "self_hosted", + "setup_script": "echo sdk-contract" + }, + "icon_url": null, + "binding_info": { + "agent_template_count": 0 + } + }, + "session": { + "id": "sess_one", + "outcome_evaluations": [ + { + "type": "outcome_evaluation", + "outcome_id": "out_one", + "description": "Deliver report", + "iteration": 0, + "result": "pending", + "explanation": null, + "completed_at": null + } + ] + }, + "thread": { + "id": "sthr_one", + "stats": { + "active_seconds": 0, + "duration_seconds": 0, + "startup_seconds": 0 + }, + "usage": { + "total_credits": 0 + } + }, + "schedule": { + "id": "sch_one", + "source": "api", + "source_session_id": null, + "initial_events_version": 2, + "trigger_policy": { + "type": "cron", + "expression": "0 * * * *", + "timezone": "UTC", + "start_at": "2026-10-20T00:00:00Z", + "stop_at": "2026-10-21T00:00:00Z", + "last_run_at": null + } + }, + "run": { + "id": "run_one", + "source": "tool", + "source_session_id": "sess_one" + }, + "memory_store": { + "id": "mem_one", + "status": "active", + "entry_count": 0, + "total_size": 0 + }, + "dream": { + "id": "dream_one", + "outputs": [ + { + "type": "memory_store", + "memory_store_id": "mem_one", + "files_touched": [ + "notes.md", + "summary.md" + ] + } + ] + }, + "events": [ + { + "id": "evt_artifact", + "type": "agent.artifact_delivered", + "file_id": "file_one", + "original_filename": "report.txt", + "size": 0, + "content_type": "text/plain", + "processed_at": "2026-10-20T00:00:00Z" + }, + { + "id": "evt_error", + "type": "session.error", + "error": { + "type": "model_request_failed_error", + "message": "Contract fixture", + "qoder_error_code": "TEST_DIAGNOSTIC", + "retry_status": { + "type": "terminal" + } + } + } + ] +} diff --git a/managed/contract_alignment_080_test.go b/managed/contract_alignment_080_test.go new file mode 100644 index 0000000..9430bb1 --- /dev/null +++ b/managed/contract_alignment_080_test.go @@ -0,0 +1,217 @@ +package managed_test + +import ( + "bytes" + "context" + "encoding/json" + "io" + "net/http" + "os" + "reflect" + "strings" + "testing" + + "github.com/QoderAI/qoder-cloud-agents-sdk-go/managed" +) + +func alignmentFixture(t *testing.T) map[string]json.RawMessage { + t.Helper() + data, err := os.ReadFile("testdata/contract-alignment-0.8.json") + if err != nil { + t.Fatal(err) + } + var fixture map[string]json.RawMessage + if err := json.Unmarshal(data, &fixture); err != nil { + t.Fatal(err) + } + return fixture +} + +func TestManagedContractAlignment080Resources(t *testing.T) { + f := alignmentFixture(t) + git := managed.ManagedAgentsGitRepositoryResourceParams{Type: "git_repository", URL: "https://user@git.example.test/team/repo.git", Password: managed.String("contract-placeholder"), MountPath: managed.String("/repos/demo"), Checkout: managed.ManagedAgentsGitRepositoryResourceParamsCheckoutUnion{OfBranch: &managed.ManagedAgentsBranchCheckoutParam{Type: "branch", Name: "main"}}} + github := managed.ManagedAgentsGitHubRepositoryResourceParams{Type: "github_repository", URL: "https://github.com/QoderAI/forward-quickstart"} + var expected []any + if err := json.Unmarshal([]byte("["+string(f["git"])+","+string(f["github"])+"]"), &expected); err != nil { + t.Fatal(err) + } + client := testClient(func(r *http.Request) (*http.Response, error) { + data, err := io.ReadAll(r.Body) + if err != nil { + t.Fatal(err) + } + var body map[string]any + if err := json.Unmarshal(data, &body); err != nil { + t.Fatal(err) + } + if strings.Contains(r.URL.Path, "environments") { + if !reflect.DeepEqual(body["config"], map[string]any{"type": "self_hosted", "setup_script": "echo sdk-contract"}) { + t.Fatal(body) + } + } else if !reflect.DeepEqual(body["resources"], expected) { + t.Fatalf("resources=%s", data) + } + return reply(r, 200, `{"id":"contract_one"}`), nil + }) + ctx := context.Background() + _, err := client.Sessions.New(ctx, managed.SessionNewParams{Agent: managed.SessionNewParamsAgentUnion{OfString: managed.String("agent_one")}, EnvironmentID: "env_one", Resources: []managed.SessionNewParamsResourceUnion{{OfGitRepository: &git}, {OfGitHubRepository: &github}}}) + if err != nil { + t.Fatal(err) + } + _, err = client.Deployments.New(ctx, managed.DeploymentNewParams{Resources: []managed.DeploymentNewParamsResourceUnion{{OfGitRepository: &git}, {OfGitHubRepository: &github}}}) + if err != nil { + t.Fatal(err) + } + _, err = client.Deployments.Update(ctx, "dep_one", managed.DeploymentUpdateParams{Resources: []managed.DeploymentUpdateParamsResourceUnion{{OfGitRepository: &git}, {OfGitHubRepository: &github}}}) + if err != nil { + t.Fatal(err) + } + config := managed.SelfHostedConfigParams{Type: "self_hosted", SetupScript: managed.String("echo sdk-contract")} + _, err = client.Environments.New(ctx, managed.EnvironmentNewParams{Name: "sdk-contract", Config: managed.EnvironmentNewParamsConfigUnion{OfSelfHosted: &config}}) + if err != nil { + t.Fatal(err) + } + _, err = client.Environments.Update(ctx, "env_one", managed.EnvironmentUpdateParams{Config: managed.EnvironmentUpdateParamsConfigUnion{OfSelfHosted: &config}}) + if err != nil { + t.Fatal(err) + } + for _, dst := range []any{&managed.ManagedAgentsSessionResourceUnion{}, &managed.SessionResourceGetResponseUnion{}, &managed.SessionResourceUpdateResponseUnion{}, &managed.ManagedAgentsSessionResourceConfigUnion{}} { + if err := json.Unmarshal([]byte(`{"type":"git_repository","url":"https://git.example.test/repo.git","mount_path":"/repos/demo","checkout":{"type":"branch","name":"main"}}`), dst); err != nil { + t.Fatal(err) + } + switch v := dst.(type) { + case *managed.ManagedAgentsSessionResourceUnion: + if _, ok := v.AsAny().(managed.ManagedAgentsGitRepositoryResource); !ok { + t.Fatalf("%T", v.AsAny()) + } + case *managed.SessionResourceGetResponseUnion: + if v.AsGitRepository().Checkout.AsBranch().Name != "main" { + t.Fatal(v) + } + case *managed.SessionResourceUpdateResponseUnion: + if v.AsGitRepository().MountPath != "/repos/demo" { + t.Fatal(v) + } + case *managed.ManagedAgentsSessionResourceConfigUnion: + if _, ok := v.AsAny().(managed.ManagedAgentsGitRepositoryResourceConfig); !ok { + t.Fatalf("%T", v.AsAny()) + } + } + } +} + +func TestManagedContractAlignment080ResponsesAndStreams(t *testing.T) { + f := alignmentFixture(t) + var memory managed.ManagedAgentsMemoryStore + if err := json.Unmarshal(f["memory_store"], &memory); err != nil { + t.Fatal(err) + } + if memory.Status != "active" || !memory.JSON.EntryCount.Valid() || memory.EntryCount != 0 || !memory.JSON.TotalSize.Valid() { + t.Fatal(memory) + } + var dream managed.Dream + if err := json.Unmarshal(f["dream"], &dream); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(dream.Outputs[0].FilesTouched, []string{"notes.md", "summary.md"}) { + t.Fatal(dream) + } + var env managed.Environment + if err := json.Unmarshal(f["environment"], &env); err != nil { + t.Fatal(err) + } + if env.Config.SetupScript != "echo sdk-contract" || env.Config.AsSelfHosted().SetupScript != "echo sdk-contract" { + t.Fatal(env) + } + var events []json.RawMessage + if err := json.Unmarshal(f["events"], &events); err != nil { + t.Fatal(err) + } + var wire strings.Builder + for _, e := range events { + var compact bytes.Buffer + if err := json.Compact(&compact, e); err != nil { + t.Fatal(err) + } + wire.WriteString("data: " + compact.String() + "\n\n") + } + client := testClient(func(r *http.Request) (*http.Response, error) { + if strings.HasSuffix(r.URL.Path, "/stream") { + res := reply(r, 200, wire.String()) + res.Header.Set("Content-Type", "text/event-stream") + return res, nil + } + return reply(r, 200, `{"data":`+string(f["events"])+`,"has_more":false}`), nil + }) + checkArtifact := func(v managed.ManagedAgentsAgentArtifactDeliveredEvent) { + t.Helper() + if v.FileID != "file_one" || v.Size != 0 || !v.JSON.Size.Valid() || v.OriginalFilename != "report.txt" || v.ContentType != "text/plain" { + t.Fatal(v) + } + } + page, err := client.Sessions.Events.List(context.Background(), "sess_one", managed.SessionEventListParams{}) + if err != nil { + t.Fatal(err) + } + checkArtifact(page.Data[0].AsAgentArtifactDelivered()) + if _, ok := page.Data[0].AsAny().(managed.ManagedAgentsAgentArtifactDeliveredEvent); !ok { + t.Fatal("history discriminator") + } + if page.Data[1].Error.QoderErrorCode != "TEST_DIAGNOSTIC" || page.Data[1].AsSessionError().Error.AsModelRequestFailedError().QoderErrorCode != "TEST_DIAGNOSTIC" { + t.Fatal(page.Data[1]) + } + stream := client.Sessions.Events.StreamEvents(context.Background(), "sess_one", managed.SessionEventStreamParams{}) + defer stream.Close() + count := 0 + for stream.Next() { + e := stream.Current() + if count == 0 { + checkArtifact(e.AsAgentArtifactDelivered()) + } else if e.Error.QoderErrorCode != "TEST_DIAGNOSTIC" || e.Error.RetryStatus.Type != "terminal" { + t.Fatal(e) + } + count++ + } + if stream.Err() != nil || count != 2 { + t.Fatalf("stream count=%d err=%v", count, stream.Err()) + } + thread := client.Sessions.Threads.Events.StreamEvents(context.Background(), "sthr_one", managed.SessionThreadEventStreamParams{SessionID: "sess_one"}) + defer thread.Close() + count = 0 + for thread.Next() { + e := thread.Current() + if count == 0 { + checkArtifact(e.AsAgentArtifactDelivered()) + } else if e.Error.QoderErrorCode != "TEST_DIAGNOSTIC" { + t.Fatal(e) + } + count++ + } + if thread.Err() != nil || count != 2 { + t.Fatalf("thread count=%d err=%v", count, thread.Err()) + } +} + +func TestManagedContractAlignment080CredentialRotation(t *testing.T) { + client := testClient(func(r *http.Request) (*http.Response, error) { + data, err := io.ReadAll(r.Body) + if err != nil { + t.Fatal(err) + } + var body map[string]any + if err := json.Unmarshal(data, &body); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(body, map[string]any{"password": " token with spaces "}) { + t.Fatal(body) + } + return reply(r, 200, `{"type":"git_repository","url":"https://user@git.example.test/repo.git"}`), nil + }) + resource, err := client.Sessions.Resources.Update(context.Background(), "sesr_one", managed.SessionResourceUpdateParams{SessionID: "sess_one", Password: managed.String(" token with spaces ")}) + if err != nil { + t.Fatal(err) + } + if resource.AsGitRepository().URL != "https://user@git.example.test/repo.git" { + t.Fatal(resource) + } +} diff --git a/managed/deployment.go b/managed/deployment.go index 71e998b..61fea7f 100644 --- a/managed/deployment.go +++ b/managed/deployment.go @@ -1644,6 +1644,8 @@ func (ManagedAgentsMemoryStoreResourceConfig) implManagedAgentsSessionResourceCo // } func (u ManagedAgentsSessionResourceConfigUnion) AsAny() anyManagedAgentsSessionResourceConfig { switch u.Type { + case "git_repository": + return u.AsGitRepository() case "github_repository": return u.AsGitHubRepository() case "file": @@ -1905,6 +1907,7 @@ func (u *DeploymentNewParamsAgentUnion) asAny() any { // // Use [param.IsOmitted] to confirm if a field is set. type DeploymentNewParamsResourceUnion struct { + OfGitRepository *ManagedAgentsGitRepositoryResourceParams `json:",omitzero,inline"` OfGitHubRepository *ManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"` OfFile *ManagedAgentsFileResourceParams `json:",omitzero,inline"` OfMemoryStore *ManagedAgentsMemoryStoreResourceParam `json:",omitzero,inline"` @@ -1912,13 +1915,16 @@ type DeploymentNewParamsResourceUnion struct { } func (u DeploymentNewParamsResourceUnion) MarshalJSON() ([]byte, error) { - return param.MarshalUnion(u, u.OfGitHubRepository, u.OfFile, u.OfMemoryStore) + return param.MarshalUnion(u, u.OfGitRepository, u.OfGitHubRepository, u.OfFile, u.OfMemoryStore) } func (u *DeploymentNewParamsResourceUnion) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, u) } func (u *DeploymentNewParamsResourceUnion) asAny() any { + if !param.IsOmitted(u.OfGitRepository) { + return u.OfGitRepository + } if !param.IsOmitted(u.OfGitHubRepository) { return u.OfGitHubRepository } else if !param.IsOmitted(u.OfFile) { @@ -1939,6 +1945,9 @@ func (u DeploymentNewParamsResourceUnion) GetAuthorizationToken() *string { // Returns a pointer to the underlying variant's property, if present. func (u DeploymentNewParamsResourceUnion) GetURL() *string { + if v := u.OfGitRepository; v != nil { + return &v.URL + } if vt := u.OfGitHubRepository; vt != nil { return &vt.URL } @@ -1947,6 +1956,9 @@ func (u DeploymentNewParamsResourceUnion) GetURL() *string { // Returns a pointer to the underlying variant's property, if present. func (u DeploymentNewParamsResourceUnion) GetCheckout() *ManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion { + if v := u.OfGitRepository; v != nil { + return &v.Checkout + } if vt := u.OfGitHubRepository; vt != nil { return &vt.Checkout } @@ -1987,6 +1999,9 @@ func (u DeploymentNewParamsResourceUnion) GetInstructions() *string { // Returns a pointer to the underlying variant's property, if present. func (u DeploymentNewParamsResourceUnion) GetType() *string { + if v := u.OfGitRepository; v != nil { + return (*string)(&v.Type) + } if vt := u.OfGitHubRepository; vt != nil { return (*string)(&vt.Type) } else if vt := u.OfFile; vt != nil { @@ -1999,6 +2014,9 @@ func (u DeploymentNewParamsResourceUnion) GetType() *string { // Returns a pointer to the underlying variant's property, if present. func (u DeploymentNewParamsResourceUnion) GetMountPath() *string { + if v := u.OfGitRepository; v != nil && v.MountPath.Valid() { + return &v.MountPath.Value + } if vt := u.OfGitHubRepository; vt != nil && vt.MountPath.Valid() { return &vt.MountPath.Value } else if vt := u.OfFile; vt != nil && vt.MountPath.Valid() { @@ -2010,6 +2028,7 @@ func (u DeploymentNewParamsResourceUnion) GetMountPath() *string { func init() { apijson.RegisterUnion[DeploymentNewParamsResourceUnion]( "type", + apijson.Discriminator[ManagedAgentsGitRepositoryResourceParams]("git_repository"), apijson.Discriminator[ManagedAgentsGitHubRepositoryResourceParams]("github_repository"), apijson.Discriminator[ManagedAgentsFileResourceParams]("file"), apijson.Discriminator[ManagedAgentsMemoryStoreResourceParam]("memory_store"), @@ -2096,6 +2115,7 @@ func (u *DeploymentUpdateParamsAgentUnion) asAny() any { // // Use [param.IsOmitted] to confirm if a field is set. type DeploymentUpdateParamsResourceUnion struct { + OfGitRepository *ManagedAgentsGitRepositoryResourceParams `json:",omitzero,inline"` OfGitHubRepository *ManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"` OfFile *ManagedAgentsFileResourceParams `json:",omitzero,inline"` OfMemoryStore *ManagedAgentsMemoryStoreResourceParam `json:",omitzero,inline"` @@ -2103,13 +2123,16 @@ type DeploymentUpdateParamsResourceUnion struct { } func (u DeploymentUpdateParamsResourceUnion) MarshalJSON() ([]byte, error) { - return param.MarshalUnion(u, u.OfGitHubRepository, u.OfFile, u.OfMemoryStore) + return param.MarshalUnion(u, u.OfGitRepository, u.OfGitHubRepository, u.OfFile, u.OfMemoryStore) } func (u *DeploymentUpdateParamsResourceUnion) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, u) } func (u *DeploymentUpdateParamsResourceUnion) asAny() any { + if !param.IsOmitted(u.OfGitRepository) { + return u.OfGitRepository + } if !param.IsOmitted(u.OfGitHubRepository) { return u.OfGitHubRepository } else if !param.IsOmitted(u.OfFile) { @@ -2130,6 +2153,9 @@ func (u DeploymentUpdateParamsResourceUnion) GetAuthorizationToken() *string { // Returns a pointer to the underlying variant's property, if present. func (u DeploymentUpdateParamsResourceUnion) GetURL() *string { + if v := u.OfGitRepository; v != nil { + return &v.URL + } if vt := u.OfGitHubRepository; vt != nil { return &vt.URL } @@ -2138,6 +2164,9 @@ func (u DeploymentUpdateParamsResourceUnion) GetURL() *string { // Returns a pointer to the underlying variant's property, if present. func (u DeploymentUpdateParamsResourceUnion) GetCheckout() *ManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion { + if v := u.OfGitRepository; v != nil { + return &v.Checkout + } if vt := u.OfGitHubRepository; vt != nil { return &vt.Checkout } @@ -2178,6 +2207,9 @@ func (u DeploymentUpdateParamsResourceUnion) GetInstructions() *string { // Returns a pointer to the underlying variant's property, if present. func (u DeploymentUpdateParamsResourceUnion) GetType() *string { + if v := u.OfGitRepository; v != nil { + return (*string)(&v.Type) + } if vt := u.OfGitHubRepository; vt != nil { return (*string)(&vt.Type) } else if vt := u.OfFile; vt != nil { @@ -2190,6 +2222,9 @@ func (u DeploymentUpdateParamsResourceUnion) GetType() *string { // Returns a pointer to the underlying variant's property, if present. func (u DeploymentUpdateParamsResourceUnion) GetMountPath() *string { + if v := u.OfGitRepository; v != nil && v.MountPath.Valid() { + return &v.MountPath.Value + } if vt := u.OfGitHubRepository; vt != nil && vt.MountPath.Valid() { return &vt.MountPath.Value } else if vt := u.OfFile; vt != nil && vt.MountPath.Valid() { @@ -2201,6 +2236,7 @@ func (u DeploymentUpdateParamsResourceUnion) GetMountPath() *string { func init() { apijson.RegisterUnion[DeploymentUpdateParamsResourceUnion]( "type", + apijson.Discriminator[ManagedAgentsGitRepositoryResourceParams]("git_repository"), apijson.Discriminator[ManagedAgentsGitHubRepositoryResourceParams]("github_repository"), apijson.Discriminator[ManagedAgentsFileResourceParams]("file"), apijson.Discriminator[ManagedAgentsMemoryStoreResourceParam]("memory_store"), @@ -2265,3 +2301,57 @@ type DeploymentUnpauseParams struct { Betas []QoderBeta `header:"x-qoder-beta,omitzero" json:"-"` paramObj } + +type ManagedAgentsGitRepositoryResourceConfig struct { + // Any of "git_repository". + Type ManagedAgentsGitRepositoryResourceConfigType `json:"type" api:"required"` + // HTTP(S) URL of the repository + URL string `json:"url" api:"required"` + // Branch or commit to check out. Defaults to the repository's default branch. + Checkout ManagedAgentsGitRepositoryResourceConfigCheckoutUnion `json:"checkout" api:"nullable"` + // Mount path in the container. Derived from the repository name when omitted. + MountPath string `json:"mount_path" api:"nullable"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Type respjson.Field + URL respjson.Field + Checkout respjson.Field + MountPath respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r ManagedAgentsGitRepositoryResourceConfig) RawJSON() string { return r.JSON.raw } +func (r *ManagedAgentsGitRepositoryResourceConfig) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type ManagedAgentsGitRepositoryResourceConfigType string + +const ( + ManagedAgentsGitRepositoryResourceConfigTypeGitRepository ManagedAgentsGitRepositoryResourceConfigType = "git_repository" +) + +type ManagedAgentsGitRepositoryResourceConfigCheckoutUnion = ManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion + +func (ManagedAgentsGitRepositoryResourceConfig) implManagedAgentsSessionResourceConfigUnion() {} +func (u ManagedAgentsSessionResourceConfigUnion) AsGitRepository() (v ManagedAgentsGitRepositoryResourceConfig) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} + +func (u DeploymentNewParamsResourceUnion) GetPassword() *string { + if v := u.OfGitRepository; v != nil && v.Password.Valid() { + return &v.Password.Value + } + return nil +} + +func (u DeploymentUpdateParamsResourceUnion) GetPassword() *string { + if v := u.OfGitRepository; v != nil && v.Password.Valid() { + return &v.Password.Value + } + return nil +} diff --git a/managed/dream.go b/managed/dream.go index baf37ec..b154b98 100644 --- a/managed/dream.go +++ b/managed/dream.go @@ -486,11 +486,14 @@ const ( // An output memory store the dream writes consolidated memories into. type DreamOutput struct { - MemoryStoreID string `json:"memory_store_id" api:"required"` + // Paths of memory files created, modified or deleted. + FilesTouched []string `json:"files_touched"` + MemoryStoreID string `json:"memory_store_id" api:"required"` // Any of "memory_store". Type DreamOutputType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + FilesTouched respjson.Field MemoryStoreID respjson.Field Type respjson.Field ExtraFields map[string]respjson.Field diff --git a/managed/environment.go b/managed/environment.go index d1ed5e1..54b601d 100644 --- a/managed/environment.go +++ b/managed/environment.go @@ -395,6 +395,7 @@ func (r *Environment) UnmarshalJSON(data []byte) error { // // Use the methods beginning with 'As' to cast the union to one of its variants. type EnvironmentConfigUnion struct { + SetupScript string `json:"setup_script"` // This field is from variant [CloudConfig]. Networking CloudConfigNetworkingUnion `json:"networking"` // This field is from variant [CloudConfig]. @@ -402,10 +403,11 @@ type EnvironmentConfigUnion struct { // Any of "cloud", "self_hosted". Type string `json:"type"` JSON struct { - Networking respjson.Field - Packages respjson.Field - Type respjson.Field - raw string + SetupScript respjson.Field + Networking respjson.Field + Packages respjson.Field + Type respjson.Field + raw string } `json:"-"` } @@ -642,10 +644,12 @@ const ( // Configuration for self-hosted environments. type SelfHostedConfig struct { + SetupScript string `json:"setup_script"` // Environment type Type constant.SelfHosted `json:"type" default:"self_hosted"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + SetupScript respjson.Field Type respjson.Field ExtraFields map[string]respjson.Field raw string @@ -669,6 +673,7 @@ func NewSelfHostedConfigParams() SelfHostedConfigParams { // This struct has a constant value, construct it with // [NewSelfHostedConfigParams]. type SelfHostedConfigParams struct { + SetupScript param.Opt[string] `json:"setup_script,omitzero"` // Environment type Type constant.SelfHosted `json:"type" default:"self_hosted"` paramObj @@ -973,3 +978,23 @@ type EnvironmentArchiveParams struct { Betas []QoderBeta `header:"x-qoder-beta,omitzero" json:"-"` paramObj } + +// Returns the setup script from the selected configuration, if present. +func (u EnvironmentNewParamsConfigUnion) GetSetupScript() *string { + if v := u.OfCloud; v != nil && v.SetupScript.Valid() { + return &v.SetupScript.Value + } else if v := u.OfSelfHosted; v != nil && v.SetupScript.Valid() { + return &v.SetupScript.Value + } + return nil +} + +// Returns the setup script from the selected configuration, if present. +func (u EnvironmentUpdateParamsConfigUnion) GetSetupScript() *string { + if v := u.OfCloud; v != nil && v.SetupScript.Valid() { + return &v.SetupScript.Value + } else if v := u.OfSelfHosted; v != nil && v.SetupScript.Valid() { + return &v.SetupScript.Value + } + return nil +} diff --git a/managed/memorystore.go b/managed/memorystore.go index ebd8cc5..0a9d0dc 100644 --- a/managed/memorystore.go +++ b/managed/memorystore.go @@ -176,6 +176,10 @@ const ( // Attach a store to a session via `resources[]` to mount it as a directory the // agent can read and write. type ManagedAgentsMemoryStore struct { + // active or archived. + Status string `json:"status"` + EntryCount int64 `json:"entry_count"` + TotalSize int64 `json:"total_size"` // Unique identifier for the memory store (a `memstore_...` tagged ID). Use this // when attaching the store to a session, or in the `{memory_store_id}` path // parameter of subsequent calls. @@ -201,6 +205,9 @@ type ManagedAgentsMemoryStore struct { Metadata map[string]string `json:"metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + Status respjson.Field + EntryCount respjson.Field + TotalSize respjson.Field ID respjson.Field CreatedAt respjson.Field Name respjson.Field diff --git a/managed/session.go b/managed/session.go index 9064603..3d7f5fd 100644 --- a/managed/session.go +++ b/managed/session.go @@ -804,10 +804,10 @@ const ( // Mount a GitHub repository into the session's container. // -// The properties AuthorizationToken, Type, URL are required. +// The properties Type and URL are required. type ManagedAgentsGitHubRepositoryResourceParams struct { // GitHub authorization token used to clone the repository. - AuthorizationToken string `json:"authorization_token" api:"required"` + AuthorizationToken string `json:"authorization_token,omitzero"` // Any of "github_repository". Type ManagedAgentsGitHubRepositoryResourceParamsType `json:"type,omitzero" api:"required"` // Github URL of the repository @@ -2690,6 +2690,7 @@ func init() { // // Use [param.IsOmitted] to confirm if a field is set. type SessionNewParamsResourceUnion struct { + OfGitRepository *ManagedAgentsGitRepositoryResourceParams `json:",omitzero,inline"` OfGitHubRepository *ManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"` OfFile *ManagedAgentsFileResourceParams `json:",omitzero,inline"` OfMemoryStore *ManagedAgentsMemoryStoreResourceParam `json:",omitzero,inline"` @@ -2697,13 +2698,16 @@ type SessionNewParamsResourceUnion struct { } func (u SessionNewParamsResourceUnion) MarshalJSON() ([]byte, error) { - return param.MarshalUnion(u, u.OfGitHubRepository, u.OfFile, u.OfMemoryStore) + return param.MarshalUnion(u, u.OfGitRepository, u.OfGitHubRepository, u.OfFile, u.OfMemoryStore) } func (u *SessionNewParamsResourceUnion) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, u) } func (u *SessionNewParamsResourceUnion) asAny() any { + if !param.IsOmitted(u.OfGitRepository) { + return u.OfGitRepository + } if !param.IsOmitted(u.OfGitHubRepository) { return u.OfGitHubRepository } else if !param.IsOmitted(u.OfFile) { @@ -2724,6 +2728,9 @@ func (u SessionNewParamsResourceUnion) GetAuthorizationToken() *string { // Returns a pointer to the underlying variant's property, if present. func (u SessionNewParamsResourceUnion) GetURL() *string { + if v := u.OfGitRepository; v != nil { + return &v.URL + } if vt := u.OfGitHubRepository; vt != nil { return &vt.URL } @@ -2732,6 +2739,9 @@ func (u SessionNewParamsResourceUnion) GetURL() *string { // Returns a pointer to the underlying variant's property, if present. func (u SessionNewParamsResourceUnion) GetCheckout() *ManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion { + if v := u.OfGitRepository; v != nil { + return &v.Checkout + } if vt := u.OfGitHubRepository; vt != nil { return &vt.Checkout } @@ -2772,6 +2782,9 @@ func (u SessionNewParamsResourceUnion) GetInstructions() *string { // Returns a pointer to the underlying variant's property, if present. func (u SessionNewParamsResourceUnion) GetType() *string { + if v := u.OfGitRepository; v != nil { + return (*string)(&v.Type) + } if vt := u.OfGitHubRepository; vt != nil { return (*string)(&vt.Type) } else if vt := u.OfFile; vt != nil { @@ -2784,6 +2797,9 @@ func (u SessionNewParamsResourceUnion) GetType() *string { // Returns a pointer to the underlying variant's property, if present. func (u SessionNewParamsResourceUnion) GetMountPath() *string { + if v := u.OfGitRepository; v != nil && v.MountPath.Valid() { + return &v.MountPath.Value + } if vt := u.OfGitHubRepository; vt != nil && vt.MountPath.Valid() { return &vt.MountPath.Value } else if vt := u.OfFile; vt != nil && vt.MountPath.Valid() { @@ -2795,6 +2811,7 @@ func (u SessionNewParamsResourceUnion) GetMountPath() *string { func init() { apijson.RegisterUnion[SessionNewParamsResourceUnion]( "type", + apijson.Discriminator[ManagedAgentsGitRepositoryResourceParams]("git_repository"), apijson.Discriminator[ManagedAgentsGitHubRepositoryResourceParams]("github_repository"), apijson.Discriminator[ManagedAgentsFileResourceParams]("file"), apijson.Discriminator[ManagedAgentsMemoryStoreResourceParam]("memory_store"), @@ -2948,3 +2965,35 @@ func (r SessionCancelResponse) RawJSON() string { return r.JSON.raw } func (r *SessionCancelResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } + +// Mount an HTTP(S) Git repository. For authenticated access, put the username in +// the URL and supply a password or access token; credentials are never returned. +type ManagedAgentsGitRepositoryResourceParams struct { + Type ManagedAgentsGitRepositoryResourceParamsType `json:"type,omitzero" api:"required"` + URL string `json:"url" api:"required"` + Password param.Opt[string] `json:"password,omitzero"` + MountPath param.Opt[string] `json:"mount_path,omitzero"` + Checkout ManagedAgentsGitRepositoryResourceParamsCheckoutUnion `json:"checkout,omitzero"` + paramObj +} + +func (r ManagedAgentsGitRepositoryResourceParams) MarshalJSON() ([]byte, error) { + type shadow ManagedAgentsGitRepositoryResourceParams + return param.MarshalObject(r, (*shadow)(&r)) +} +func (r *ManagedAgentsGitRepositoryResourceParams) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type ManagedAgentsGitRepositoryResourceParamsType string + +const ManagedAgentsGitRepositoryResourceParamsTypeGitRepository ManagedAgentsGitRepositoryResourceParamsType = "git_repository" + +type ManagedAgentsGitRepositoryResourceParamsCheckoutUnion = ManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion + +func (u SessionNewParamsResourceUnion) GetPassword() *string { + if v := u.OfGitRepository; v != nil && v.Password.Valid() { + return &v.Password.Value + } + return nil +} diff --git a/managed/sessionevent.go b/managed/sessionevent.go index d9a1e48..a42fe5e 100644 --- a/managed/sessionevent.go +++ b/managed/sessionevent.go @@ -1234,6 +1234,8 @@ func (r *ManagedAgentsBase64ImageSourceParam) UnmarshalJSON(data []byte) error { // credits or spend limit reached. Retrying with the same credentials will not // succeed; the caller must resolve the billing state. type ManagedAgentsBillingError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -1242,11 +1244,12 @@ type ManagedAgentsBillingError struct { Type ManagedAgentsBillingErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field - raw string + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -1336,6 +1339,8 @@ const ( // An `environment_variable` credential's `auth.networking.allowed_hosts` includes // a host the environment's network policy does not permit. type ManagedAgentsCredentialHostUnreachableError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // ID of the affected credential. CredentialID string `json:"credential_id" api:"required"` // Human-readable error description. @@ -1348,13 +1353,14 @@ type ManagedAgentsCredentialHostUnreachableError struct { VaultID string `json:"vault_id" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - CredentialID respjson.Field - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - VaultID respjson.Field - ExtraFields map[string]respjson.Field - raw string + QoderErrorCode respjson.Field + CredentialID respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + VaultID respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -2327,6 +2333,8 @@ func init() { // Authentication to an MCP server failed. type ManagedAgentsMCPAuthenticationFailedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Name of the MCP server that failed authentication. MCPServerName string `json:"mcp_server_name" api:"required"` // Human-readable error description. @@ -2337,12 +2345,13 @@ type ManagedAgentsMCPAuthenticationFailedError struct { Type ManagedAgentsMCPAuthenticationFailedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - MCPServerName respjson.Field - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field - raw string + QoderErrorCode respjson.Field + MCPServerName respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -2437,6 +2446,8 @@ const ( // Failed to connect to an MCP server. type ManagedAgentsMCPConnectionFailedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Name of the MCP server that failed to connect. MCPServerName string `json:"mcp_server_name" api:"required"` // Human-readable error description. @@ -2447,12 +2458,13 @@ type ManagedAgentsMCPConnectionFailedError struct { Type ManagedAgentsMCPConnectionFailedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - MCPServerName respjson.Field - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field - raw string + QoderErrorCode respjson.Field + MCPServerName respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -2548,6 +2560,8 @@ const ( // The model is currently overloaded. Emitted after automatic retries are // exhausted. type ManagedAgentsModelOverloadedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -2556,11 +2570,12 @@ type ManagedAgentsModelOverloadedError struct { Type ManagedAgentsModelOverloadedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field - raw string + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -2653,6 +2668,8 @@ const ( // The model request was rate-limited. type ManagedAgentsModelRateLimitedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -2661,11 +2678,12 @@ type ManagedAgentsModelRateLimitedError struct { Type ManagedAgentsModelRateLimitedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field - raw string + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -2758,6 +2776,8 @@ const ( // A model request failed for a reason other than overload or rate-limiting. type ManagedAgentsModelRequestFailedError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -2766,11 +2786,12 @@ type ManagedAgentsModelRequestFailedError struct { Type ManagedAgentsModelRequestFailedErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field - raw string + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -3565,7 +3586,9 @@ func (r *ManagedAgentsSessionErrorEvent) UnmarshalJSON(data []byte) error { // // Use the methods beginning with 'As' to cast the union to one of its variants. type ManagedAgentsSessionErrorEventErrorUnion struct { - Message string `json:"message"` + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` + Message string `json:"message"` // This field is a union of [ManagedAgentsUnknownErrorRetryStatusUnion], // [ManagedAgentsModelOverloadedErrorRetryStatusUnion], // [ManagedAgentsModelRateLimitedErrorRetryStatusUnion], @@ -3586,13 +3609,14 @@ type ManagedAgentsSessionErrorEventErrorUnion struct { // This field is from variant [ManagedAgentsCredentialHostUnreachableError]. VaultID string `json:"vault_id"` JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - MCPServerName respjson.Field - CredentialID respjson.Field - VaultID respjson.Field - raw string + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + MCPServerName respjson.Field + CredentialID respjson.Field + VaultID respjson.Field + raw string } `json:"-"` } @@ -3760,6 +3784,10 @@ const ( // // Use the methods beginning with 'As' to cast the union to one of its variants. type ManagedAgentsSessionEventUnion struct { + FileID string `json:"file_id"` + OriginalFilename string `json:"original_filename"` + Size int64 `json:"size"` + ContentType string `json:"content_type"` ModelCredits float64 `json:"model_credits"` SandboxRuntimeCredits float64 `json:"sandbox_runtime_credits"` TotalCredits float64 `json:"total_credits"` @@ -3848,6 +3876,10 @@ type ManagedAgentsSessionEventUnion struct { // This field is from variant [ManagedAgentsSessionUpdatedEvent]. Title string `json:"title"` JSON struct { + FileID respjson.Field + OriginalFilename respjson.Field + Size respjson.Field + ContentType respjson.Field ModelCredits respjson.Field SandboxRuntimeCredits respjson.Field TotalCredits respjson.Field @@ -3978,6 +4010,8 @@ func (ManagedAgentsSessionUsageEvent) implManagedAgentsSessionEventUnion() {} // } func (u ManagedAgentsSessionEventUnion) AsAny() anyManagedAgentsSessionEvent { switch u.Type { + case "agent.artifact_delivered": + return u.AsAgentArtifactDelivered() case "user.message": return u.AsUserMessage() case "user.interrupt": @@ -5243,6 +5277,10 @@ const ( // // Use the methods beginning with 'As' to cast the union to one of its variants. type ManagedAgentsStreamSessionEventsUnion struct { + FileID string `json:"file_id"` + OriginalFilename string `json:"original_filename"` + Size int64 `json:"size"` + ContentType string `json:"content_type"` ModelCredits float64 `json:"model_credits"` SandboxRuntimeCredits float64 `json:"sandbox_runtime_credits"` TotalCredits float64 `json:"total_credits"` @@ -5337,6 +5375,10 @@ type ManagedAgentsStreamSessionEventsUnion struct { // This field is from variant [ManagedAgentsDeltaEvent]. EventID string `json:"event_id"` JSON struct { + FileID respjson.Field + OriginalFilename respjson.Field + Size respjson.Field + ContentType respjson.Field ModelCredits respjson.Field SandboxRuntimeCredits respjson.Field TotalCredits respjson.Field @@ -5484,6 +5526,8 @@ func (ManagedAgentsSessionUsageEvent) implManagedAgentsStreamSessionEventsUnion( // } func (u ManagedAgentsStreamSessionEventsUnion) AsAny() anyManagedAgentsStreamSessionEvents { switch u.Type { + case "agent.artifact_delivered": + return u.AsAgentArtifactDelivered() case "user.message": return u.AsUserMessage() case "user.interrupt": @@ -6030,6 +6074,8 @@ const ( // variant; clients that don't recognize a new error code can match on // `retry_status` and `message` alone. type ManagedAgentsUnknownError struct { + // Diagnostic only; use retry_status to determine retry behavior. + QoderErrorCode string `json:"qoder_error_code"` // Human-readable error description. Message string `json:"message" api:"required"` // What the client should do next in response to this error. @@ -6038,11 +6084,12 @@ type ManagedAgentsUnknownError struct { Type ManagedAgentsUnknownErrorType `json:"type" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Message respjson.Field - RetryStatus respjson.Field - Type respjson.Field - ExtraFields map[string]respjson.Field - raw string + QoderErrorCode respjson.Field + Message respjson.Field + RetryStatus respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -7675,3 +7722,47 @@ func (r SessionEventStreamParams) URLQuery() (v url.Values, err error) { NestedFormat: apiquery.NestedQueryFormatBrackets, }) } + +// A server-generated event for one successfully delivered artifact file. + +type ManagedAgentsAgentArtifactDeliveredEvent struct { + ID string `json:"id" api:"required"` + Type ManagedAgentsAgentArtifactDeliveredEventType `json:"type" api:"required"` + FileID string `json:"file_id" api:"required"` + OriginalFilename string `json:"original_filename" api:"required"` + Size int64 `json:"size" api:"required"` + ContentType string `json:"content_type" api:"required"` + ProcessedAt time.Time `json:"processed_at" format:"date-time"` + JSON struct { + ID respjson.Field + Type respjson.Field + FileID respjson.Field + OriginalFilename respjson.Field + Size respjson.Field + ContentType respjson.Field + ProcessedAt respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +func (r ManagedAgentsAgentArtifactDeliveredEvent) RawJSON() string { return r.JSON.raw } +func (r *ManagedAgentsAgentArtifactDeliveredEvent) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type ManagedAgentsAgentArtifactDeliveredEventType string + +const ManagedAgentsAgentArtifactDeliveredEventTypeAgentArtifactDelivered ManagedAgentsAgentArtifactDeliveredEventType = "agent.artifact_delivered" + +func (ManagedAgentsAgentArtifactDeliveredEvent) implManagedAgentsSessionEventUnion() {} +func (u ManagedAgentsSessionEventUnion) AsAgentArtifactDelivered() (v ManagedAgentsAgentArtifactDeliveredEvent) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} + +func (ManagedAgentsAgentArtifactDeliveredEvent) implManagedAgentsStreamSessionEventsUnion() {} +func (u ManagedAgentsStreamSessionEventsUnion) AsAgentArtifactDelivered() (v ManagedAgentsAgentArtifactDeliveredEvent) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} diff --git a/managed/sessionresource.go b/managed/sessionresource.go index 7054e41..5109986 100644 --- a/managed/sessionresource.go +++ b/managed/sessionresource.go @@ -369,7 +369,7 @@ const ( ManagedAgentsMemoryStoreResourceAccessReadOnly ManagedAgentsMemoryStoreResourceAccess = "read_only" ) -// ManagedAgentsSessionResourceUnion contains all possible properties and +// ManagedAgentsSessionResourceUnion includes [ManagedAgentsGitRepositoryResource] and contains all possible properties and // values from [ManagedAgentsGitHubRepositoryResource], // [ManagedAgentsFileResource], [ManagedAgentsMemoryStoreResource]. // @@ -440,6 +440,8 @@ func (ManagedAgentsMemoryStoreResource) implManagedAgentsSessionResourceUnion() // } func (u ManagedAgentsSessionResourceUnion) AsAny() anyManagedAgentsSessionResource { switch u.Type { + case "git_repository": + return u.AsGitRepository() case "github_repository": return u.AsGitHubRepository() case "file": @@ -472,7 +474,7 @@ func (r *ManagedAgentsSessionResourceUnion) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } -// SessionResourceGetResponseUnion contains all possible properties and values +// SessionResourceGetResponseUnion includes [ManagedAgentsGitRepositoryResource] and contains all possible properties and values // from [ManagedAgentsGitHubRepositoryResource], // [ManagedAgentsFileResource], [ManagedAgentsMemoryStoreResource]. // @@ -543,6 +545,8 @@ func (ManagedAgentsMemoryStoreResource) implSessionResourceGetResponseUnion() // } func (u SessionResourceGetResponseUnion) AsAny() anySessionResourceGetResponse { switch u.Type { + case "git_repository": + return u.AsGitRepository() case "github_repository": return u.AsGitHubRepository() case "file": @@ -575,7 +579,7 @@ func (r *SessionResourceGetResponseUnion) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } -// SessionResourceUpdateResponseUnion contains all possible properties and +// SessionResourceUpdateResponseUnion includes [ManagedAgentsGitRepositoryResource] and contains all possible properties and // values from [ManagedAgentsGitHubRepositoryResource], // [ManagedAgentsFileResource], [ManagedAgentsMemoryStoreResource]. // @@ -646,6 +650,8 @@ func (ManagedAgentsMemoryStoreResource) implSessionResourceUpdateResponseUnion() // } func (u SessionResourceUpdateResponseUnion) AsAny() anySessionResourceUpdateResponse { switch u.Type { + case "git_repository": + return u.AsGitRepository() case "github_repository": return u.AsGitHubRepository() case "file": @@ -689,8 +695,8 @@ type SessionResourceUpdateParams struct { Password param.Opt[string] `json:"password,omitzero"` SessionID string `path:"session_id" api:"required" json:"-"` - // New authorization token for the resource. Currently only `github_repository` - // resources support token rotation. + // GitHub access token; also accepted for legacy generic Git clients. + // For generic Git, prefer Password and do not send conflicting credentials. AuthorizationToken string `json:"authorization_token,omitzero"` // Optional header to specify the beta version(s) you want to use. Betas []QoderBeta `header:"x-qoder-beta,omitzero" json:"-"` @@ -749,3 +755,63 @@ func (r SessionResourceAddParams) MarshalJSON() (data []byte, err error) { func (r *SessionResourceAddParams) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, &r.ManagedAgentsFileResourceParams) } + +type ManagedAgentsGitRepositoryResource struct { + ID string `json:"id" api:"required"` + // A timestamp in RFC 3339 format + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` + MountPath string `json:"mount_path" api:"required"` + // Any of "git_repository". + Type ManagedAgentsGitRepositoryResourceType `json:"type" api:"required"` + // A timestamp in RFC 3339 format + UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"` + URL string `json:"url" api:"required"` + Checkout ManagedAgentsGitRepositoryResourceCheckoutUnion `json:"checkout" api:"nullable"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + ID respjson.Field + CreatedAt respjson.Field + MountPath respjson.Field + Type respjson.Field + UpdatedAt respjson.Field + URL respjson.Field + Checkout respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r ManagedAgentsGitRepositoryResource) RawJSON() string { return r.JSON.raw } +func (r *ManagedAgentsGitRepositoryResource) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type ManagedAgentsGitRepositoryResourceType string + +const ( + ManagedAgentsGitRepositoryResourceTypeGitRepository ManagedAgentsGitRepositoryResourceType = "git_repository" +) + +type ManagedAgentsGitRepositoryResourceCheckoutUnion = ManagedAgentsGitHubRepositoryResourceCheckoutUnion + +func (ManagedAgentsGitRepositoryResource) implManagedAgentsSessionResourceUnion() {} + +func (u ManagedAgentsSessionResourceUnion) AsGitRepository() (v ManagedAgentsGitRepositoryResource) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} + +func (ManagedAgentsGitRepositoryResource) implSessionResourceGetResponseUnion() {} + +func (u SessionResourceGetResponseUnion) AsGitRepository() (v ManagedAgentsGitRepositoryResource) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} + +func (ManagedAgentsGitRepositoryResource) implSessionResourceUpdateResponseUnion() {} + +func (u SessionResourceUpdateResponseUnion) AsGitRepository() (v ManagedAgentsGitRepositoryResource) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} diff --git a/managed/sessionthread.go b/managed/sessionthread.go index 9e5ac57..5d646aa 100644 --- a/managed/sessionthread.go +++ b/managed/sessionthread.go @@ -407,6 +407,10 @@ func (r *ManagedAgentsSessionThreadUsage) UnmarshalJSON(data []byte) error { // // Use the methods beginning with 'As' to cast the union to one of its variants. type ManagedAgentsStreamSessionThreadEventsUnion struct { + FileID string `json:"file_id"` + OriginalFilename string `json:"original_filename"` + Size int64 `json:"size"` + ContentType string `json:"content_type"` ModelCredits float64 `json:"model_credits"` SandboxRuntimeCredits float64 `json:"sandbox_runtime_credits"` TotalCredits float64 `json:"total_credits"` @@ -501,6 +505,10 @@ type ManagedAgentsStreamSessionThreadEventsUnion struct { // This field is from variant [ManagedAgentsDeltaEvent]. EventID string `json:"event_id"` JSON struct { + FileID respjson.Field + OriginalFilename respjson.Field + Size respjson.Field + ContentType respjson.Field ModelCredits respjson.Field SandboxRuntimeCredits respjson.Field TotalCredits respjson.Field @@ -659,6 +667,8 @@ func (ManagedAgentsSessionUsageEvent) implManagedAgentsStreamSessionThreadEvents // } func (u ManagedAgentsStreamSessionThreadEventsUnion) AsAny() anyManagedAgentsStreamSessionThreadEvents { switch u.Type { + case "agent.artifact_delivered": + return u.AsAgentArtifactDelivered() case "user.message": return u.AsUserMessage() case "user.interrupt": @@ -1094,3 +1104,9 @@ type SessionThreadArchiveParams struct { Betas []QoderBeta `header:"x-qoder-beta,omitzero" json:"-"` paramObj } + +func (ManagedAgentsAgentArtifactDeliveredEvent) implManagedAgentsStreamSessionThreadEventsUnion() {} +func (u ManagedAgentsStreamSessionThreadEventsUnion) AsAgentArtifactDelivered() (v ManagedAgentsAgentArtifactDeliveredEvent) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} diff --git a/managed/testdata/contract-alignment-0.8.json b/managed/testdata/contract-alignment-0.8.json new file mode 100644 index 0000000..53b2050 --- /dev/null +++ b/managed/testdata/contract-alignment-0.8.json @@ -0,0 +1,120 @@ +{ + "source": "https://docs.qoder.com/cloud-agents/api/sessions/schemas", + "retrieved_at": "2026-10-20", + "git": { + "type": "git_repository", + "url": "https://user@git.example.test/team/repo.git", + "password": "contract-placeholder", + "mount_path": "/repos/demo", + "checkout": { + "type": "branch", + "name": "main" + } + }, + "github": { + "type": "github_repository", + "url": "https://github.com/QoderAI/forward-quickstart" + }, + "mount": { + "identity_id": "idn_one", + "template_id": "tmpl_one", + "access": "read_write" + }, + "environment": { + "id": "env_one", + "config": { + "type": "self_hosted", + "setup_script": "echo sdk-contract" + }, + "icon_url": null, + "binding_info": { + "agent_template_count": 0 + } + }, + "session": { + "id": "sess_one", + "outcome_evaluations": [ + { + "type": "outcome_evaluation", + "outcome_id": "out_one", + "description": "Deliver report", + "iteration": 0, + "result": "pending", + "explanation": null, + "completed_at": null + } + ] + }, + "thread": { + "id": "sthr_one", + "stats": { + "active_seconds": 0, + "duration_seconds": 0, + "startup_seconds": 0 + }, + "usage": { + "total_credits": 0 + } + }, + "schedule": { + "id": "sch_one", + "source": "api", + "source_session_id": null, + "initial_events_version": 2, + "trigger_policy": { + "type": "cron", + "expression": "0 * * * *", + "timezone": "UTC", + "start_at": "2026-10-20T00:00:00Z", + "stop_at": "2026-10-21T00:00:00Z", + "last_run_at": null + } + }, + "run": { + "id": "run_one", + "source": "tool", + "source_session_id": "sess_one" + }, + "memory_store": { + "id": "mem_one", + "status": "active", + "entry_count": 0, + "total_size": 0 + }, + "dream": { + "id": "dream_one", + "outputs": [ + { + "type": "memory_store", + "memory_store_id": "mem_one", + "files_touched": [ + "notes.md", + "summary.md" + ] + } + ] + }, + "events": [ + { + "id": "evt_artifact", + "type": "agent.artifact_delivered", + "file_id": "file_one", + "original_filename": "report.txt", + "size": 0, + "content_type": "text/plain", + "processed_at": "2026-10-20T00:00:00Z" + }, + { + "id": "evt_error", + "type": "session.error", + "error": { + "type": "model_request_failed_error", + "message": "Contract fixture", + "qoder_error_code": "TEST_DIAGNOSTIC", + "retry_status": { + "type": "terminal" + } + } + } + ] +}