Documentation
¶
Overview ¶
Package client is the public Go SDK for the Wardyn control plane. It uses internal/types as the shared JSON source of truth and adds exactly one non-stdlib dependency (github.com/google/uuid, for typed ids) so it can be embedded in external tooling without friction. The in-repo `wardyn` CLI uses THIS client directly (there is no second transport); it maps APIError to process exit codes and prints APIError.Error(), which unwraps the server's {"error":...} envelope into a human-readable message.
Coverage ¶
The SDK covers these wardynd public route families (the ones external tooling automates); it is a curated subset, NOT a 1:1 mirror of every route:
- runs (/api/v1/runs): CreateRun, Preflight, GetRun, ListRuns, ListRunsPage, ListGrants, ListGrantsPage, KillRun, SynthesizeProfile, GetRecording, RunFiles, RunEvents, RunOutput, GetRunPolicy
- approvals (/api/v1/approvals): ListApprovals, ListApprovalsPage, Approve, Deny
- policies (/api/v1/policies): CreatePolicy, GetPolicy, GetDefaultPolicy, ListPolicies, ListPoliciesPage, UpdatePolicy, DeletePolicy
- workspaces (/api/v1/workspaces): CreateWorkspace, GetWorkspace, ListWorkspaces, ListWorkspacesPage, UpdateWorkspace, DeleteWorkspace, ScanWorkspace, RecordWorkspaceTask
- sources (/api/v1/sources): ListSources, CreateSource, GetSource, ScanSource, DeleteSource
- audit (/api/v1/audit): AuditEvents, AuditEventsPage, RecentAuditEvents, ExportAuditPartition, AuditRetention, DropAuditPartition
- secrets (/api/v1/secrets): ListSecrets, ListSecretsPage, ListSecretsScoped, ListSecretsScopedPage, SetSecret, DeleteSecret
- site-config (/api/v1/site-config): GetSiteConfig, PutSiteConfig, PutSiteConfigResult
- drives (/api/v1/drives): GetDrives, ApplyDrives
- presets (/api/v1/presets): ListPresets, GetPreset, PutPreset, DeletePreset, ApplyPresets
- governance (/api/v1/governance): GetGovernance, ApplyGovernance, ApplyGovernanceResult
- governance changes (/api/v1/governance/changes): ListGovernanceChanges, GetGovernanceChange, ApproveGovernanceChange, RejectGovernanceChange
- setup (/api/v1/setup): SetupStatus, ConnectManagedSubscription, DisconnectManagedSubscription
- identity (/api/v1/me): Me — and, on the same prefix, ListSSHKeys/ ListSSHKeysPage/AddSSHKey/DeleteSSHKey (/api/v1/me/ssh-keys). The rest of /api/v1/me is NOT wrapped: see below.
- health (/healthz): Healthz
- sessions (/api/v1/sessions): RevokeSessions
- devices (/api/v1/admin/devices): MintDeviceEnrolmentToken, ListDeviceEnrolmentTokens, RevokeDeviceEnrolmentToken, ListDevices, RevokeDevice
- people (/api/v1/people): ListPeople, and ErasePerson (a person's retained records, by scope, 0.8.6); the other writes below stay unwrapped
NOT covered — drive these with the CLI or raw HTTP. This half is a CENSUS of every registered route family the SDK does not wrap, not a list of highlights: it read "attach, harness-login and /internal/*" while seven whole families 0.7 added were missing from BOTH halves, so docs/sdk.md's "the exact list of what it wraps and what it does not" was exact about neither.
- /api/v1/user-types — the org's user types (0.8)
- /api/v1/key-domains — which declared key domain wraps a person's next principal key (0.8.6). Security tier
- /api/v1/approval-notify — each approval notification channel's delivery health (0.8.6). Security tier, and read by the console's Settings card rather than by tooling
- /api/v1/permissions — capability grants and per-kind enforcement (0.7)
- /api/v1/access — directory search and group->role mappings (0.7)
- /api/v1/tokens — admin-tier API tokens (0.7); /api/v1/me/tokens is the self-service half, also unwrapped
- /api/v1/people — the writes: creating a person, erasing their stored credentials (0.8, offboarding)
- /api/v1/scim — the Settings SCIM card's read-only status (0.8.6); the SCIM server itself is /scim/v2
- /api/v1/workspace-providers — the org's git-provider policy (allowed base URLs, credential lanes) and storage ceilings (0.7.2). Admin-only, and authored through the console's providers page rather than by tooling
- /api/v1/agent-providers — the org's agent roster: which coding agents this deployment offers, each one's model-access lane, and whether that credential is shared or per-person (0.7.2). Admin-only, same page
- /api/v1/model-providers — the org's model-provider records (0.8). Admin-only
- /api/v1/integrations — integration definitions (0.7)
- /api/v1/base-images — the base-image library (0.7)
- /api/v1/admin — operator maintenance (the sandbox sweep; devices is wrapped)
- /api/v1/devices — an enrolled laptop's daemon routes (enrol, audit, heartbeat)
- /api/v1/internal — the AGENT-facing plane (mint, decisions, groundtruth, scan-results, token renew). Deliberately unwrapped: it is the sandbox's surface, not an operator's.
- /api/v1/me — beyond Me and ssh-keys: capabilities, run-layout, tokens
- /api/v1/auth, /auth/login, /auth/callback — the browser SSO leg, plus the harness-login device flow. A redirect dance, not an API call.
- /api/v1/scm — the per-user Azure DevOps sign-in (0.7.10): a sign-in door and its identity-provider callback. Unwrapped for the same reason the SSO leg above is — it is a browser redirect dance whose whole point is a human at a keyboard consenting, and it binds to a browser session an SDK caller does not have.
- /api/v1/model-providers-entra — the per-row Azure Foundry sign-in door (0.8.6): a browser redirect dance whose callback is the /api/v1/scm one above. Unwrapped for the same reason.
- the attach lane under /api/v1/runs/{id} — attach, attach/ticket, attach/holder, attach/takeover, resources. A WebSocket and its ticket.
- /scim/v2/Users, /scim/v2/Users/{id}, /scim/v2/Groups, /scim/v2/Groups/{id} — the identity provider's SCIM connector (0.8.6): suspend and reactivate a person, and remove one from a group. Authenticated by its own bearer (WARDYN_SCIM_TOKEN), never by an operator's credential, so no SDK caller holds it.
- /api/v1/branding — console branding (#1125): the sign-in page's anonymous read and logo, and the Admin view Branding card's save; a console surface
- /metrics, /readyz — the operator's scrape and readiness probes
- the console SPA at / — static assets
(The AI Run Composer's /runs/compose* used to be listed here; those routes were removed in 0.5, not left unwrapped.)
TestClientCoversRouteFamilies pins that every family listed above has a method, TestRouteFamiliesCoverEveryMethod pins the reverse, and TestSDKCensusNamesEveryRouteFamily (internal/api) pins the COMPLEMENT: every route family the router actually registers appears in one of the two halves above, so a new one cannot land in neither.
Pagination ¶
The list endpoints and the audit trail accept an optional ListOpts (variadic, so existing zero-arg calls are unchanged) that sends ?limit=&offset=. A page may be truncated (the server sets X-Wardyn-Truncated); re-request with Offset advanced by len(page) to page forward.
EVERY list family surfaces that signal, through a *Page variant returning it as a bool: ListRunsPage, ListApprovalsPage, ListPoliciesPage, ListWorkspacesPage, AuditEventsPage, ListGrantsPage, ListSSHKeysPage, ListSecretsPage. The plain forms are thin wrappers that discard it, so existing callers are unchanged — but they leave the caller to infer completeness from len(page) == the limit it happened to pass, a guess that silently breaks the moment a caller omits Limit and gets the server's own default page size. This doc used to name the header as the pagination contract for the list endpoints while only the audit method honoured it: the four list families discarded the header, so `wardyn run|approvals|policy| workspace list` printed a truncated page with exit 0 and nothing on stderr.
Usage:
c := client.New("https://wardyn.example.com", "admin-token")
run, err := c.CreateRun(ctx, client.CreateRunRequest{
Agent: "claude-code",
Repo: "org/repo",
Task: "fix issue #42",
})
Index ¶
- Constants
- type APIError
- type ActorType
- type AgentRun
- type ApprovalKind
- type ApprovalRequest
- type ApprovalScope
- type ApprovalState
- type ArtifactOverridedeprecated
- type AuditEvent
- type AuditFilter
- type AutonomyLevel
- type AutonomyRubric
- type BaseImageEntry
- type BedrockSettings
- type CapabilitySubjectType
- type Client
- func (c *Client) AddSSHKey(ctx context.Context, name, publicKey string) (types.SSHPublicKey, error)
- func (c *Client) ApplyDrives(ctx context.Context, doc DrivesDocument) (DrivesDocument, error)
- func (c *Client) ApplyGovernance(ctx context.Context, doc GovernanceDocument, prune bool) (GovernanceDocument, error)
- func (c *Client) ApplyGovernanceResult(ctx context.Context, doc GovernanceDocument, prune bool) (GovernanceApplyResult, error)
- func (c *Client) ApplyPresets(ctx context.Context, doc PresetsDocument) (PresetsDocument, error)
- func (c *Client) Approve(ctx context.Context, id uuid.UUID, reason string, opts ...DecisionOpts) (types.ApprovalRequest, error)
- func (c *Client) ApproveGovernanceChange(ctx context.Context, id uuid.UUID) (GovernanceChange, error)
- func (c *Client) AuditEvents(ctx context.Context, runID uuid.UUID, opts ...ListOpts) ([]types.AuditEvent, error)
- func (c *Client) AuditEventsPage(ctx context.Context, runID uuid.UUID, filter AuditFilter, opts ...ListOpts) (events []types.AuditEvent, truncated bool, err error)
- func (c *Client) AuditRetention(ctx context.Context) (types.AuditRetentionStatus, error)
- func (c *Client) CreatePolicy(ctx context.Context, req PolicyRequest) (types.RunPolicy, error)
- func (c *Client) CreateRun(ctx context.Context, req CreateRunRequest) (CreateRunResult, error)
- func (c *Client) CreateSource(ctx context.Context, req SourceRequest) (types.Source, error)
- func (c *Client) CreateWorkspace(ctx context.Context, req WorkspaceRequest) (types.Workspace, error)
- func (c *Client) DeletePolicy(ctx context.Context, id uuid.UUID) error
- func (c *Client) DeletePreset(ctx context.Context, name string) error
- func (c *Client) DeleteSSHKey(ctx context.Context, fp string) error
- func (c *Client) DeleteSecret(ctx context.Context, name string) error
- func (c *Client) DeleteSource(ctx context.Context, id uuid.UUID, force bool) (detachedFrom []string, err error)
- func (c *Client) DeleteWorkspace(ctx context.Context, id uuid.UUID) error
- func (c *Client) Deny(ctx context.Context, id uuid.UUID, reason string, opts ...DecisionOpts) (types.ApprovalRequest, error)
- func (c *Client) DropAuditPartition(ctx context.Context, partition, digest string) (types.AuditRetentionDrop, error)
- func (c *Client) ErasePerson(ctx context.Context, principal string, scopes []string) (ErasePersonResult, error)
- func (c *Client) ExportAuditPartition(ctx context.Context, partition string, raw bool) (io.ReadCloser, error)
- func (c *Client) GetDefaultPolicy(ctx context.Context) (types.RunPolicySpec, error)
- func (c *Client) GetDrives(ctx context.Context) (DrivesDocument, error)
- func (c *Client) GetGovernance(ctx context.Context) (GovernanceDocument, error)
- func (c *Client) GetGovernanceChange(ctx context.Context, id uuid.UUID) (GovernanceChange, error)
- func (c *Client) GetPolicy(ctx context.Context, id uuid.UUID) (types.RunPolicy, error)
- func (c *Client) GetPreset(ctx context.Context, name string) (Preset, error)
- func (c *Client) GetRecording(ctx context.Context, runID uuid.UUID, session ...string) (io.ReadCloser, error)
- func (c *Client) GetRun(ctx context.Context, id uuid.UUID) (types.AgentRun, error)
- func (c *Client) GetRunPolicy(ctx context.Context, runID uuid.UUID) (RunPolicyView, error)
- func (c *Client) GetSiteConfig(ctx context.Context) (types.SiteConfig, error)
- func (c *Client) GetSource(ctx context.Context, id uuid.UUID) (types.Source, error)
- func (c *Client) GetWorkspace(ctx context.Context, id uuid.UUID) (types.Workspace, error)
- func (c *Client) Healthz(ctx context.Context) (json.RawMessage, error)
- func (c *Client) KillRun(ctx context.Context, id uuid.UUID) (KillRunResponse, error)
- func (c *Client) ListApprovals(ctx context.Context, state types.ApprovalState, runID uuid.UUID, ...) ([]types.ApprovalRequest, error)
- func (c *Client) ListApprovalsPage(ctx context.Context, state types.ApprovalState, runID uuid.UUID, ...) (aps []types.ApprovalRequest, truncated bool, err error)
- func (c *Client) ListDeviceEnrolmentTokens(ctx context.Context) ([]DeviceEnrolmentToken, error)
- func (c *Client) ListDevices(ctx context.Context) ([]Device, error)
- func (c *Client) ListGovernanceChanges(ctx context.Context, state string) ([]GovernanceChange, error)
- func (c *Client) ListGrants(ctx context.Context, runID uuid.UUID, opts ...ListOpts) ([]types.CredentialGrant, error)
- func (c *Client) ListGrantsPage(ctx context.Context, runID uuid.UUID, opts ...ListOpts) (grants []types.CredentialGrant, truncated bool, err error)
- func (c *Client) ListPeople(ctx context.Context, opts ...PeopleListOpts) (PersonList, error)
- func (c *Client) ListPolicies(ctx context.Context, opts ...ListOpts) ([]types.RunPolicy, error)
- func (c *Client) ListPoliciesPage(ctx context.Context, opts ...ListOpts) (policies []types.RunPolicy, truncated bool, err error)
- func (c *Client) ListPresets(ctx context.Context) (PresetsDocument, error)
- func (c *Client) ListRuns(ctx context.Context, opts ...ListOpts) ([]types.AgentRun, error)
- func (c *Client) ListRunsPage(ctx context.Context, opts ...ListOpts) (runs []types.AgentRun, truncated bool, err error)
- func (c *Client) ListSSHKeys(ctx context.Context, opts ...ListOpts) ([]types.SSHPublicKey, error)
- func (c *Client) ListSSHKeysPage(ctx context.Context, opts ...ListOpts) (keys []types.SSHPublicKey, truncated bool, err error)
- func (c *Client) ListSecrets(ctx context.Context, opts ...ListOpts) ([]string, error)
- func (c *Client) ListSecretsPage(ctx context.Context, opts ...ListOpts) (names []string, truncated bool, err error)
- func (c *Client) ListSecretsScoped(ctx context.Context, opts ...ListOpts) (names, mine []string, err error)
- func (c *Client) ListSecretsScopedPage(ctx context.Context, opts ...ListOpts) (names, mine []string, truncated bool, err error)
- func (c *Client) ListSources(ctx context.Context) ([]types.Source, error)
- func (c *Client) ListWorkspaces(ctx context.Context, opts ...ListOpts) ([]types.Workspace, error)
- func (c *Client) ListWorkspacesPage(ctx context.Context, opts ...ListOpts) (workspaces []types.Workspace, truncated bool, err error)
- func (c *Client) Me(ctx context.Context) (json.RawMessage, error)
- func (c *Client) MintDeviceEnrolmentToken(ctx context.Context, name string) (DeviceEnrolmentToken, error)
- func (c *Client) Preflight(ctx context.Context, req CreateRunRequest) (PreflightResult, error)
- func (c *Client) PutPreset(ctx context.Context, name string, req PresetRequest) (Preset, error)
- func (c *Client) PutSiteConfig(ctx context.Context, cfg types.SiteConfig) (out types.SiteConfig, danglingSecretRefs []string, onboardingMarkIgnored bool, ...)
- func (c *Client) PutSiteConfigResult(ctx context.Context, cfg types.SiteConfig) (SiteConfigPutResult, error)
- func (c *Client) RecentAuditEvents(ctx context.Context, opts ...ListOpts) ([]types.AuditEvent, error)
- func (c *Client) RecordWorkspaceTask(ctx context.Context, wsID uuid.UUID, taskKey string) (RecordTaskResult, error)
- func (c *Client) RejectGovernanceChange(ctx context.Context, id uuid.UUID, reason string) (GovernanceChange, error)
- func (c *Client) RevokeDevice(ctx context.Context, id uuid.UUID) error
- func (c *Client) RevokeDeviceEnrolmentToken(ctx context.Context, id uuid.UUID) error
- func (c *Client) RevokeSessions(ctx context.Context, sub string, all bool) error
- func (c *Client) RunEvents(ctx context.Context, runID uuid.UUID, afterID uint64, fn func(RunEvent) error) error
- func (c *Client) RunFiles(ctx context.Context, runID uuid.UUID) (RunFiles, error)
- func (c *Client) RunOutput(ctx context.Context, runID uuid.UUID, tail int) (RunOutput, error)
- func (c *Client) ScanSource(ctx context.Context, id uuid.UUID) (json.RawMessage, error)
- func (c *Client) ScanWorkspace(ctx context.Context, id uuid.UUID) (json.RawMessage, error)
- func (c *Client) SetSecret(ctx context.Context, name, value string) error
- func (c *Client) SetupStatus(ctx context.Context) (json.RawMessage, error)
- func (c *Client) SynthesizeProfile(ctx context.Context, runID uuid.UUID) (ProfileResult, error)
- func (c *Client) UpdatePolicy(ctx context.Context, id uuid.UUID, req PolicyRequest) (types.RunPolicy, error)
- func (c *Client) UpdateWorkspace(ctx context.Context, id uuid.UUID, req WorkspaceRequest) (types.Workspace, error)
- type ConfinementClass
- type CreateRunRequest
- type CreateRunResult
- type CredentialGrant
- type DecisionOpts
- type Device
- type DeviceEnrolmentToken
- type DeviceEnrolmentTokenRequest
- type DriveBackend
- type DriveGrantRequest
- type DriveReclaim
- type DriveRequest
- type DriveSelection
- type DrivesDocument
- type EgressRedirect
- type ErasePersonResult
- type GovernanceApplyResult
- type GovernanceAssignment
- type GovernanceAssignmentRequest
- type GovernanceChange
- type GovernanceChangeDiff
- type GovernanceDeferredWrite
- type GovernanceDocument
- type GovernanceLimits
- type GovernanceProfile
- type GovernanceProfileRequest
- type GovernanceProfileResponse
- type GrantKind
- type GrantSpec
- type HomeTemplate
- type KillRunResponse
- type ListOpts
- type ModelProvider
- type ModelProviderKind
- type ModelProviders
- type PendingApprovalError
- type PeopleListOpts
- type PersonList
- type PersonSummary
- type PolicyContact
- type PolicyRef
- type PolicyRequest
- type PreflightItem
- type PreflightResult
- type Preset
- type PresetRequest
- type PresetsDocument
- type ProfileResult
- type ProviderAuth
- type ProviderHarness
- type PushContentScope
- type PushRulesSpec
- type RecordTaskResult
- type RunEvent
- type RunFileStat
- type RunFiles
- type RunOutput
- type RunPolicy
- type RunPolicyChange
- type RunPolicySource
- type RunPolicySpec
- type RunPolicyView
- type RunState
- type SSHPublicKey
- type SiteConfig
- type SiteConfigPutResult
- type Source
- type SourceKind
- type SourceRequest
- type StoredPolicyNow
- type UserDrive
- type UserDriveGrant
- type UserDriveListItem
- type Workspace
- type WorkspaceAttachment
- type WorkspaceBaseImage
- type WorkspaceKind
- type WorkspaceLLMCred
- type WorkspaceMount
- type WorkspaceRequest
- type WorkspaceRequirement
- type WorkspaceSelection
- type WorkspaceSource
- type WorkspaceSourceType
- type WorkspaceStatus
Constants ¶
const ( RunEventProvisioning = "provisioning" // PENDING -> STARTING: sandbox being created RunEventPulling = "pulling" // the substrate reported an image pull RunEventReady = "ready" // STARTING -> RUNNING RunEventIdleStopped = "idle_stopped" // the idle reaper stopped the run RunEventFailed = "failed" // -> FAILED; Reason names the phase RunEventEnded = "ended" // terminal; State is the terminal state )
The closed RunEvent.Type vocabulary, in the order a run can reach them. Every stream finishes with RunEventEnded.
const ( RunFailedNotStarted = "not_started" // failed before provisioning began RunFailedStartFailed = "start_failed" // failed while provisioning RunFailedRunFailed = "run_failed" // failed after it was ready )
RunEventFailed reasons: which phase the run failed in.
const ( RunPolicyViewRecorded = "recorded" RunPolicyViewNotYet = "not_yet" RunPolicyViewNever = "never" )
The RunPolicyView.State values.
const ( SourceLocalDir = types.SourceLocalDir SourceRepo = types.SourceRepo )
SourceKind values (the tier-1 library's two onboardable kinds).
const ( ApprovalPending = types.ApprovalPending ApprovalApproved = types.ApprovalApproved ApprovalDenied = types.ApprovalDenied ApprovalExpired = types.ApprovalExpired // ApprovalCancelled: the approval's RUN reached a terminal state while it was // still PENDING, so nobody decided it and nothing was approved or denied. ApprovalCancelled = types.ApprovalCancelled )
ApprovalState values. ListApprovals accepts one of these (or "" for all states).
const ( ScopeOnce = types.ScopeOnce ScopeRun = types.ScopeRun ScopeUntil = types.ScopeUntil ScopeAlways = types.ScopeAlways )
ApprovalScope values, for DecisionOpts.Scope on Approve/Deny. Omitting Scope (or passing "") is ScopeRun — today's default, unchanged.
const ( RunPending = types.RunPending RunStarting = types.RunStarting RunRunning = types.RunRunning RunWaiting = types.RunWaiting RunStopped = types.RunStopped RunArchived = types.RunArchived RunFailed = types.RunFailed RunKilled = types.RunKilled RunCompleted = types.RunCompleted )
RunState values.
ConfinementClass values.
const ( GrantGitHubToken = types.GrantGitHubToken GrantGitPAT = types.GrantGitPAT GrantCloudSTS = types.GrantCloudSTS GrantAPIKey = types.GrantAPIKey GrantSSHKey = types.GrantSSHKey GrantEnvSecret = types.GrantEnvSecret )
GrantKind values.
const ( ApprovalCredential = types.ApprovalCredential ApprovalEgressDomain = types.ApprovalEgressDomain ApprovalToolCall = types.ApprovalToolCall ApprovalPushContent = types.ApprovalPushContent )
ApprovalKind values.
const ( ActorHuman = types.ActorHuman ActorAgent = types.ActorAgent ActorSystem = types.ActorSystem )
ActorType values.
const ( WorkspaceKindLocalDir = types.WorkspaceKindLocalDir WorkspaceKindRepo = types.WorkspaceKindRepo WorkspaceKindContainer = types.WorkspaceKindContainer )
WorkspaceKind values (WorkspaceRequest.Kind). Deprecated: the legacy single-source shape; a new caller should build WorkspaceSource entries with a WorkspaceSourceType value instead.
const ( WorkspaceSourceTypeLocalDir = types.WorkspaceSourceTypeLocalDir WorkspaceSourceTypeRepo = types.WorkspaceSourceTypeRepo WorkspaceSourceTypeEphemeral = types.WorkspaceSourceTypeEphemeral )
WorkspaceSourceType values (WorkspaceSource.Type).
const ( WorkspacePendingScan = types.WorkspacePendingScan WorkspaceScanning = types.WorkspaceScanning WorkspaceScanned = types.WorkspaceScanned WorkspaceError = types.WorkspaceError )
WorkspaceStatus values (Workspace.Status, Source.Status).
const ( DriveBackendDockerVolume = types.DriveBackendDockerVolume DriveBackendHostPath = types.DriveBackendHostPath DriveBackendK8sPVC = types.DriveBackendK8sPVC DriveBackendK8sPVCStatic = types.DriveBackendK8sPVCStatic )
DriveBackend values.
const ( HomeTemplateHash = types.HomeTemplateHash HomeTemplateSub = types.HomeTemplateSub HomeTemplateEmailLocal = types.HomeTemplateEmailLocal )
HomeTemplate values.
const ( DriveReclaimRetain = types.DriveReclaimRetain DriveReclaimDelete = types.DriveReclaimDelete )
DriveReclaim values.
const ( CapabilitySubjectUser = types.CapabilitySubjectUser CapabilitySubjectGroup = types.CapabilitySubjectGroup CapabilitySubjectAll = types.CapabilitySubjectAll CapabilitySubjectUserType = types.CapabilitySubjectUserType )
CapabilitySubjectType values.
const ( AutonomyL0 = types.AutonomyL0 AutonomyL1 = types.AutonomyL1 AutonomyL2 = types.AutonomyL2 AutonomyL3 = types.AutonomyL3 )
AutonomyLevel values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
// Status is the HTTP status code, e.g. 404.
Status int
// Body is the raw server response body (capped at 2048 bytes).
Body string
// Reason is the server's machine-readable refusal class (internal/api's
// errorBody.Reason), "" when the route does not send one — most do not yet
// (#204 is phasing coverage in lane by lane). A caller that needs to branch
// on WHY a call failed reads Reason, never Error()'s prose: the human
// sentence is free to reword without notice, the reason string is not.
Reason string
// Policy names the governance policy whose ceiling refused the request and
// how to ask for a change (internal/api's errorBody.Policy), nil when the
// refusal is not a ceiling refusal or the server sent none.
Policy *PolicyRef
}
APIError is returned when the server responds with a non-2xx status code. Status is the HTTP status code; Body is the raw response body (trimmed to 2 KiB) for diagnostic display. Callers may use errors.As to extract it.
func NewAPIError ¶ added in v0.8.0
NewAPIError builds an *APIError from a non-2xx status and its raw body, parsing the server's {"error", "reason"} envelope once so every call site — this package's own transport, and the CLI's own raw net/http calls that bypass it (WebSocket dial handshakes, an attach-ticket mint, a plain non-2xx read; #656 final review round L4) — need not repeat the parse and risk leaving Reason empty.
type AgentRun ¶
AgentRun is one governed execution of a coding agent. Returned by CreateRun, GetRun, and ListRuns.
type ApprovalKind ¶
type ApprovalKind = types.ApprovalKind
ApprovalKind enumerates what a human is being asked to approve (ApprovalRequest.Kind).
type ApprovalRequest ¶
type ApprovalRequest = types.ApprovalRequest
ApprovalRequest is a human-in-the-loop approval gate. Returned by ListApprovals, Approve, and Deny.
type ApprovalScope ¶ added in v0.5.0
type ApprovalScope = types.ApprovalScope
ApprovalScope is how far an Approve/Deny decision reaches: once, run (the default), until, or always. Set via DecisionOpts on Approve/Deny; read back on ApprovalRequest.DecisionScope. Meaningful only for an egress_domain approval, EXCEPT "run" on a credential approval — that one is the per-run credential lease (a git_pat approved once is re-mintable for the rest of the run). A tool_call is bounded by the clamp and carries no scope.
type ApprovalState ¶
type ApprovalState = types.ApprovalState
ApprovalState is the approval lifecycle state; ListApprovals filters on it (ApprovalRequest.State).
type ArtifactOverride
deprecated
added in
v0.4.4
type ArtifactOverride = types.ArtifactOverride
ArtifactOverride is one ecosystem's artifact-registry redirect, carried in the deprecated SiteConfig.ArtifactOverrides.
Deprecated: superseded by EgressRedirect. Kept aliased so a caller that still builds the legacy shape (PutSiteConfig folds it server-side for one release) can name the element type; GetSiteConfig itself now returns this field empty.
type AuditEvent ¶
type AuditEvent = types.AuditEvent
AuditEvent is one append-only audit record. Returned by AuditEvents.
type AuditFilter ¶ added in v0.5.0
type AuditFilter struct {
Since string // RFC3339, e.g. time.Now().UTC().Format(time.RFC3339)
Until string // RFC3339
ActionPrefix string
Actor string // exact principal, e.g. "alice@corp.example" — "everything X did"
ActorType string // "human" | "agent" | "system"
Outcome string // "success" | "denied" | "failure"
}
AuditFilter narrows an audit query by the server's optional predicates — ?since=&until=&action_prefix=&actor_type=&outcome= (see docs/sdk.md's Raw HTTP section). The zero value applies no filter. Since/Until are RFC3339 strings; a malformed one is rejected by the server as a 400, same as the raw HTTP API — the client does not duplicate that validation.
type AutonomyLevel ¶ added in v0.8.0
type AutonomyLevel = types.AutonomyLevel
AutonomyLevel is one rung on AutonomyRubric's ladder (see the AutonomyL0 .. AutonomyL3 values below).
type AutonomyRubric ¶ added in v0.8.0
type AutonomyRubric = types.AutonomyRubric
AutonomyRubric is GovernanceLimits.AutonomyRubric's pointed-to type. Aliased for the same reason as ArtifactOverride: without a nameable type a caller could not author one at all.
type BaseImageEntry ¶ added in v0.5.0
type BaseImageEntry = types.BaseImageEntry
BaseImageEntry is one tier-2 base-image catalog row: a shared, reusable image an operator saved (kind registry|custom|byo).
type BedrockSettings ¶ added in v0.8.0
type BedrockSettings = types.BedrockSettings
Domain nouns returned or accepted by Client methods.
type CapabilitySubjectType ¶ added in v0.8.0
type CapabilitySubjectType = types.CapabilitySubjectType
CapabilitySubjectType is the user/group/all vocabulary a drive grant's subject is drawn from (DriveGrantRequest.SubjectType, UserDriveGrant.SubjectType).
type Client ¶
type Client struct {
// BaseURL is the wardynd root, e.g. "https://wardyn.example.com".
// A trailing slash is stripped automatically.
BaseURL string
// Token is the admin bearer token configured in wardynd (AdminToken).
Token string
// HTTPClient, when non-nil, is used instead of the default client, and its
// redirect policy is YOURS: the default returns a 3xx as an *APIError
// rather than following it, but a client you supply is used as it is.
// Following a redirect can replay a request body (a secret value) and the
// Authorization bearer at wherever Location points, so a caller who sets
// this should set a CheckRedirect func that returns http.ErrUseLastResponse.
HTTPClient *http.Client
// Principal, when non-empty, is sent as the X-Wardyn-Principal header — a
// DEV-ONLY override for simulating different principals against a local
// wardynd. The server honors it ONLY in local (no-auth) mode. Under
// admin-token auth it is ignored and the action is attributed to
// actor_type=system / principal "admin-token" (the token is an opaque shared
// bearer, not a JWT — there is no subject to extract); under OIDC the
// verified subject wins. Use OIDC for real per-human attribution.
Principal string
}
Client is the Wardyn SDK client. Construct it with New or by filling the fields directly. BaseURL and Token are required; HTTPClient defaults to a client that never follows a redirect when nil.
All methods accept a context; the context controls cancellation and deadline for the underlying HTTP call.
func (*Client) AddSSHKey ¶ added in v0.7.0
AddSSHKey registers one authorized_keys line under the caller's own principal and returns the stored record (201). POST /api/v1/me/ssh-keys. Fails closed on the server: 422 for private-key material, more than one key, or an admin-token caller on an SSO deployment (such a key could never authorize a human's run); 409 when the fingerprint is already registered.
func (*Client) ApplyDrives ¶ added in v0.8.0
func (c *Client) ApplyDrives(ctx context.Context, doc DrivesDocument) (DrivesDocument, error)
ApplyDrives upserts every drive and grant doc names, over the existing POST /drives, PUT /drives/{id} and POST /drives/grants routes — there is no bulk-write route, and none is added. A drive is routed by the id doc carries: one already issued by GetDrives (non-nil) is REPLACED in place (PUT), a zero id is CREATED (POST) — which is what makes `wardyn drive get > f && wardyn drive set f` a no-op: the ids `get` wrote back are exactly what route the re-`set` to an update of the same rows, not a second copy under a fresh name. A grant carries no id of its own; every one is POSTed, and the server's own (subject_type, subject) upsert repoints an existing allocation rather than duplicating it.
Nothing doc omits is touched and nothing is deleted — neither POST nor PUT can express that, and this function does not attempt it by other means. Every write's saved row replaces the caller's copy in place, so a partial failure (returned as the second value) leaves doc's earlier entries holding what was actually persisted. On success, the returned document is a fresh GetDrives — the authoritative post-write state, including the derived fields (grant counts, deployment facts) a write response cannot carry.
func (*Client) ApplyGovernance ¶ added in v0.8.0
func (c *Client) ApplyGovernance(ctx context.Context, doc GovernanceDocument, prune bool) (GovernanceDocument, error)
ApplyGovernance upserts every profile and assignment doc names, over the existing POST /governance/profiles, PUT /governance/profiles/{id} and POST /governance/assignments routes — there is no bulk-write route, and none is added.
A PROFILE is routed BY NAME, not by id — the divergence from ApplyDrives, and the reason is Name's role server-side: it is the UNIQUE human handle an admin actually authors and assigns by (governance.go's own words), while a drive's id is what GetDrives/ApplyDrives round-trip on. Upserting by id would make a hand-maintained, version-controlled governance.json (written once, with no ids, and re-applied against the same install repeatedly) fail its second apply with a 409 name conflict — the exact "config lives in git next to the rest of the install" workflow #1108 exists for. So ApplyGovernance reads the CURRENT state first, and: a doc profile whose Name matches an existing one is PUT to that existing row's real id (rename is therefore not expressible through apply — Name IS the identity a file's entries are matched against); a Name with no existing match is POSTed fresh. Either way, a profile whose Ceiling and Limits are BYTE-IDENTICAL to what is already stored is skipped entirely (governanceProfileUnchanged) — the no-op contract's other half, since the server audits every profile write unconditionally.
An ASSIGNMENT carries no id on write (server-assigned, same as DriveGrantRequest), and is upserted purely by its own natural key (subject_type, subject) — skipped, the same way, when the existing row already names the same profile at the same priority. Its ProfileID is resolved against the SAME apply's own profile list before being sent: an id in doc.Assignments naming one of doc.Profiles's ORIGINAL (pre-write) ids is translated to that profile's real post-write id, so a document produced by GetGovernance against a POPULATED install reproduces both profiles and assignments when applied to an EMPTY one, even though the empty install mints entirely new profile ids. An assignment whose ProfileID names no profile in this same doc is sent exactly as given, trusting it as an already-real id on the target (the case for an assignments-only file, or one applied twice against the SAME install).
prune, when true, additionally DELETES every server-side profile or assignment doc does not name (assignments first, since a profile still referenced by a to-be-pruned assignment fails the FK restrict). Without it — the default — nothing present server-side but absent from doc is touched, matching drive set's own "nothing the file omits is touched" rule.
Every write's saved row replaces the caller's copy of doc in place, so a partial failure (returned as the second value) leaves doc's earlier entries holding what was actually persisted. On success, the returned document is a fresh GetGovernance — the authoritative post-write state.
When the deployment requires a second approver for governance writes, a write is held as a pending change instead of applied. ApplyGovernance then returns the fresh document and a *PendingApprovalError (check with errors.As) rather than reporting success: an assignment naming a profile whose write is pending is not sent, and prune does not run. Use ApplyGovernanceResult to read the pending and deferred lists as data.
func (*Client) ApplyGovernanceResult ¶ added in v0.8.6
func (c *Client) ApplyGovernanceResult(ctx context.Context, doc GovernanceDocument, prune bool) (GovernanceApplyResult, error)
ApplyGovernanceResult is ApplyGovernance with the pending-approval outcome returned as data, not an error: a 202 pending change is an expected result under four-eyes, not a failure. See ApplyGovernance for the matching and ordering rules.
A profile or assignment write the server holds for approval is recorded in Pending. An assignment naming a profile with a pending write is recorded in Deferred and never sent (its profile id is not final). Prune runs only when no write in the apply is pending, and stops at the first pending delete; PruneSkipped says so.
func (*Client) ApplyPresets ¶ added in v0.8.0
func (c *Client) ApplyPresets(ctx context.Context, doc PresetsDocument) (PresetsDocument, error)
ApplyPresets upserts every preset doc names, by name, over PUT /api/v1/presets/{name}, and returns a fresh ListPresets. Nothing doc omits is touched and nothing is deleted, and an unchanged preset keeps its version, so `wardyn preset get > f && wardyn preset set f` is a no-op.
func (*Client) Approve ¶
func (c *Client) Approve(ctx context.Context, id uuid.UUID, reason string, opts ...DecisionOpts) (types.ApprovalRequest, error)
Approve transitions an approval request to APPROVED. reason is optional; pass an empty string to omit it. opts is optional (pass at most one); omitting it keeps today's default — a run-scoped approval. See DecisionOpts for once/until/always. Returns 409/APIError when the approval has already been decided. Returns 404/APIError when the approval does not exist.
func (*Client) ApproveGovernanceChange ¶ added in v0.8.6
func (c *Client) ApproveGovernanceChange(ctx context.Context, id uuid.UUID) (GovernanceChange, error)
ApproveGovernanceChange approves a pending change, which applies it. The caller must be a different human from the proposer; the server answers 409 when the change is no longer pending or has gone stale. POST /api/v1/governance/changes/{id}/approve.
func (*Client) AuditEvents ¶
func (c *Client) AuditEvents(ctx context.Context, runID uuid.UUID, opts ...ListOpts) ([]types.AuditEvent, error)
AuditEvents returns the append-only audit trail for the specified run in chronological (seq ASC) order, unfiltered. run_id is required by the server; a zero UUID is rejected with 400. Pass a ListOpts to page a long trail: a truncated page (server sets X-Wardyn-Truncated) is walked forward with Offset += len(page), which reaches the terminal run.complete event under ASC order — prefer AuditEventsPage, which returns that signal directly instead of requiring the caller to infer it.
func (*Client) AuditEventsPage ¶ added in v0.5.0
func (c *Client) AuditEventsPage(ctx context.Context, runID uuid.UUID, filter AuditFilter, opts ...ListOpts) (events []types.AuditEvent, truncated bool, err error)
AuditEventsPage is AuditEvents plus the server's X-Wardyn-Truncated signal and the optional filter predicates (AuditFilter): truncated=true means this page did NOT reach the run's newest event (including run.complete, since the per-run trail is chronological/ASC) and the caller must page forward — Offset += len(events) — to see the rest. This is the fix for the audit-gap where a >1000-event run's newest events could silently drop with no way for a caller to even detect it: AuditEvents alone (below) cannot tell "this is everything" from "this is page 1 of more".
func (*Client) AuditRetention ¶ added in v0.8.6
AuditRetention reports the audit log's effective and pending retention policy, the cutover, every partition with its row count, state and whether a drop would take it now (and, if not, why), and how many months ahead already have a partition. Security tier only. GET /api/v1/audit/retention.
func (*Client) CreatePolicy ¶
CreatePolicy validates and persists a new policy. Returns the created RunPolicy (status 201) on success; 400 on an invalid name or spec.
func (*Client) CreateRun ¶
func (c *Client) CreateRun(ctx context.Context, req CreateRunRequest) (CreateRunResult, error)
CreateRun submits a new agent run and answers once the run row exists (state PENDING, never RUNNING) plus any advisory warnings; build and dispatch continue server-side. Status 201 on success; 400 on validation failure; 422 on policy/confinement mismatch; 503 when the runner is unavailable.
func (*Client) CreateSource ¶ added in v0.5.0
CreateSource upserts a library source by canonical identity (201 new, 200 existing row). POST /api/v1/sources.
func (*Client) CreateWorkspace ¶ added in v0.3.1
func (c *Client) CreateWorkspace(ctx context.Context, req WorkspaceRequest) (types.Workspace, error)
CreateWorkspace onboards a new workspace (status pending_scan). Returns the created row (201); 400 on an invalid body/source.
func (*Client) DeletePolicy ¶
DeletePolicy removes a policy by id. Returns nil on success (204); 404/APIError when the policy does not exist.
func (*Client) DeletePreset ¶ added in v0.8.0
DeletePreset removes a preset by name. Admin only.
func (*Client) DeleteSSHKey ¶ added in v0.8.0
DeleteSSHKey removes one of the caller's own registered SSH gateway keys. fp is ssh.FingerprintSHA256's raw form, which routinely contains '/' — it is percent-encoded here, matching the server's decode (handleDeleteSSHKey). Deleting a fingerprint registered by someone else (or one that never existed) 404s the same way — no existence leak across principals. DELETE /api/v1/me/ssh-keys/{fingerprint}.
func (*Client) DeleteSecret ¶
DeleteSecret removes a named secret. DELETE /api/v1/secrets/{name}. Returns 403 for a reserved platform-internal name.
func (*Client) DeleteSource ¶ added in v0.5.0
func (c *Client) DeleteSource(ctx context.Context, id uuid.UUID, force bool) (detachedFrom []string, err error)
DeleteSource removes a library source. In use → 409 APIError naming the attaching workspaces; force detaches them first — those workspaces just stop mounting this source, and their next runs succeed without it (there is no loud failure at run time: the mount gate has nothing to check for a source that used to be there). detachedFrom names whichever workspaces the delete actually detached (empty when the source wasn't attached to any), the only visibility into what changed. DELETE /api/v1/sources/{id}[?force=1].
func (*Client) DeleteWorkspace ¶ added in v0.3.1
DeleteWorkspace removes a workspace by id. Returns nil (204); 404 when unknown.
func (*Client) Deny ¶
func (c *Client) Deny(ctx context.Context, id uuid.UUID, reason string, opts ...DecisionOpts) (types.ApprovalRequest, error)
Deny transitions an approval request to DENIED (fail closed). reason is optional; pass an empty string to omit it. opts is optional (pass at most one); omitting it keeps today's default — a run-scoped denial. See DecisionOpts for once/until/always. Returns 409/APIError when the approval has already been decided. Returns 404/APIError when the approval does not exist.
func (*Client) DropAuditPartition ¶ added in v0.8.6
func (c *Client) DropAuditPartition(ctx context.Context, partition, digest string) (types.AuditRetentionDrop, error)
DropAuditPartition drops the oldest closed audit partition past the retention window, through the database function that checks digest (the one ExportAuditPartition's footer carries, which the operator has verified), records a chained audit.retention.partition_dropped event and an anchor, and only then drops. A refusal is a 409 APIError whose Reason is one of audit_retention_not_oldest, audit_retention_not_closed, audit_retention_inside_window, audit_retention_live_run or audit_retention_digest_mismatch; an unknown partition is 404. Security tier only. POST /api/v1/audit/retention/drop.
func (*Client) ErasePerson ¶ added in v0.8.6
func (c *Client) ErasePerson(ctx context.Context, principal string, scopes []string) (ErasePersonResult, error)
ErasePerson erases one person's retained records by scope (credentials, audit_personal_fields, run_tasks, run_outputs, recordings, mask_copies) in one audited act. principal is the person's subject (or an email the deployment knows them by) and is percent-encoded here. A scope that fails part way is a 500 whose reason is erasure_incomplete: retry with the same scopes. Security tier. POST /api/v1/people/{principal}/erasure.
func (*Client) ExportAuditPartition ¶ added in v0.8.6
func (c *Client) ExportAuditPartition(ctx context.Context, partition string, raw bool) (io.ReadCloser, error)
ExportAuditPartition streams one closed audit partition as NDJSON: a manifest line, one line per row in seq order, and a footer line carrying the partition's digest. raw selects the stored, hash-covered form an operator can re-hash independently; otherwise the readable form. The caller MUST Close the returned reader, and must treat a body that ends without the footer line as an incomplete export. Security tier only: any other caller gets an empty body. GET /api/v1/audit/export?partition=<name>[&form=raw]. Returns 404/409 APIErrors for an unknown or still-open partition.
func (*Client) GetDefaultPolicy ¶ added in v0.6.0
GetDefaultPolicy fetches the control plane's configured default policy spec — the ceiling every run created without a policy_id gets, and the ceiling composer.Clamp bounds a member-authored inline policy against (W14-S1-6: previously unexposed by UI, CLI or API).
func (*Client) GetDrives ¶ added in v0.8.0
func (c *Client) GetDrives(ctx context.Context) (DrivesDocument, error)
GetDrives returns every registered drive and EVERY allocation. GET /api/v1/drives serves allocations one page at a time (X-Wardyn-Truncated), so this reads ?offset= until the flag clears, and then refuses a result whose allocation count is not the server's grant_total: a document that silently dropped allocations would, fed back to ApplyDrives, restore a partial set.
func (*Client) GetGovernance ¶ added in v0.8.0
func (c *Client) GetGovernance(ctx context.Context) (GovernanceDocument, error)
GetGovernance returns every governance profile and assignment. GET /api/v1/governance.
func (*Client) GetGovernanceChange ¶ added in v0.8.6
GetGovernanceChange returns one governance change with its diff. GET /api/v1/governance/changes/{id}.
func (*Client) GetPolicy ¶
GetPolicy fetches a single RunPolicy by its UUID. Returns 404/APIError when the policy does not exist.
func (*Client) GetPreset ¶ added in v0.8.0
GetPreset returns one preset by name (404 when unknown, or not open to the caller's user type).
func (*Client) GetRecording ¶ added in v0.4.4
func (c *Client) GetRecording(ctx context.Context, runID uuid.UUID, session ...string) (io.ReadCloser, error)
GetRecording streams a run's terminal recording as raw asciicast bytes (the .cast a player consumes). The caller MUST Close the returned reader. GET /api/v1/runs/{id}/recording/{key} — the id really does appear twice: the route is mounted per-run and its handler takes the recording's own CAST KEY, which defaults to the bare run id (a batch run's single recording) when session is omitted — existing zero-arg callers are unaffected. An INTERACTIVE run can carry multiple recordings, one per attach session, each keyed "<runID>~<session>" (castKey above, mirroring internal/recording's own doc comment); pass that session id as the optional session argument to fetch one of those instead of the run's own bare-id cast. At most one value is meaningful; variadic only to keep it optional without a second method name. Returns 404/APIError when the run/session has no recording.
func (*Client) GetRun ¶
GetRun fetches a single AgentRun by its UUID. Returns 404/APIError when the run does not exist.
func (*Client) GetRunPolicy ¶ added in v0.8.2
GetRunPolicy returns the policy a run got (owner-or-admin; a run the caller cannot read is a 404). GET /api/v1/runs/{id}/policy.
func (*Client) GetSiteConfig ¶ added in v0.3.1
GetSiteConfig returns the operator-wide site config. GET /api/v1/site-config.
func (*Client) GetSource ¶ added in v0.5.0
GetSource fetches one library source. GET /api/v1/sources/{id}.
func (*Client) GetWorkspace ¶ added in v0.3.1
GetWorkspace fetches a single workspace by id. Returns 404/APIError when unknown.
func (*Client) Healthz ¶ added in v0.3.1
Healthz returns the control-plane health payload as raw JSON. GET /healthz (note: NOT under /api/v1, and unauthenticated).
func (*Client) KillRun ¶
KillRun initiates the kill sequence for a run: durable state transition (compare-and-swap to KILLED) first, then sandbox teardown, identity revocation, and credential revocation. Returns 202/Accepted with the final state on success. Returns 404/APIError when the run does not exist.
func (*Client) ListApprovals ¶
func (c *Client) ListApprovals(ctx context.Context, state types.ApprovalState, runID uuid.UUID, opts ...ListOpts) ([]types.ApprovalRequest, error)
ListApprovals returns approval requests filtered by state and (optionally) by run. Pass an empty state to return all states, and uuid.Nil for runID to return approvals for every run — the server's own ?run_id= filter (internal/api/approvals.go's handleListApprovals) was otherwise unreachable from the CLI. Valid states: "PENDING", "APPROVED", "DENIED", "EXPIRED", "CANCELLED" (types.ApprovalState). Prefer ListApprovalsPage, which also returns the server's truncation signal.
func (*Client) ListApprovalsPage ¶ added in v0.7.0
func (c *Client) ListApprovalsPage(ctx context.Context, state types.ApprovalState, runID uuid.UUID, opts ...ListOpts) (aps []types.ApprovalRequest, truncated bool, err error)
ListApprovalsPage is ListApprovals plus the server's X-Wardyn-Truncated signal: truncated=true means a further page exists. It matters most on this family — an approval queue read as complete when it is not is a pending decision nobody sees.
func (*Client) ListDeviceEnrolmentTokens ¶ added in v0.8.0
func (c *Client) ListDeviceEnrolmentTokens(ctx context.Context) ([]DeviceEnrolmentToken, error)
ListDeviceEnrolmentTokens returns every enrolment token still redeemable — minted, not yet redeemed, revoked or expired — newest first, never the token itself (admin or security_admin). GET /api/v1/admin/devices/enrolment-tokens.
func (*Client) ListDevices ¶ added in v0.8.0
ListDevices returns every enrolled device, revoked ones included, newest first (admin or security_admin). GET /api/v1/admin/devices.
func (*Client) ListGovernanceChanges ¶ added in v0.8.6
func (c *Client) ListGovernanceChanges(ctx context.Context, state string) ([]GovernanceChange, error)
ListGovernanceChanges lists governance changes held for, or decided by, a second approver. state narrows the list (pending, applied, rejected, expired or stale); "" leaves it to the server's default. GET /api/v1/governance/changes.
func (*Client) ListGrants ¶
func (c *Client) ListGrants(ctx context.Context, runID uuid.UUID, opts ...ListOpts) ([]types.CredentialGrant, error)
ListGrants returns the credential-grant eligibility records for a run. These are eligibility records (what the run MAY request), not issued credentials — some may never be minted. Pass a ListOpts to page; prefer ListGrantsPage, which also returns the server's truncation signal. Returns 404/APIError when the run does not exist.
func (*Client) ListGrantsPage ¶ added in v0.8.0
func (c *Client) ListGrantsPage(ctx context.Context, runID uuid.UUID, opts ...ListOpts) (grants []types.CredentialGrant, truncated bool, err error)
ListGrantsPage is ListGrants plus the server's X-Wardyn-Truncated signal: truncated=true means a further page exists and this one is not the whole list. See the package doc's "# Pagination". Returns 404/APIError when the run does not exist.
func (*Client) ListPeople ¶ added in v0.8.6
func (c *Client) ListPeople(ctx context.Context, opts ...PeopleListOpts) (PersonList, error)
ListPeople returns one page of the people this deployment knows: everyone who has signed in and everyone pre-created, each with their role, sign-in state and the counts behind the leaver actions (admin or security_admin). Pass a page's NextCursor back as PeopleListOpts.Cursor until it is empty. GET /api/v1/people.
func (*Client) ListPolicies ¶
ListPolicies returns run policies in reverse creation order. Pass a ListOpts to page. Prefer ListPoliciesPage, which also returns the server's truncation signal.
func (*Client) ListPoliciesPage ¶ added in v0.7.0
func (c *Client) ListPoliciesPage(ctx context.Context, opts ...ListOpts) (policies []types.RunPolicy, truncated bool, err error)
ListPoliciesPage is ListPolicies plus the server's X-Wardyn-Truncated signal: truncated=true means a further page exists.
func (*Client) ListPresets ¶ added in v0.8.0
func (c *Client) ListPresets(ctx context.Context) (PresetsDocument, error)
ListPresets returns every preset the caller may launch: all of them for an admin, and for anyone else the ones open to their user type.
func (*Client) ListRuns ¶
ListRuns returns runs in reverse creation order. Pass a ListOpts to page. Prefer ListRunsPage, which also returns the server's truncation signal — this form cannot tell "this is everything" from "this is page 1 of more".
func (*Client) ListRunsPage ¶ added in v0.7.0
func (c *Client) ListRunsPage(ctx context.Context, opts ...ListOpts) (runs []types.AgentRun, truncated bool, err error)
ListRunsPage is ListRuns plus the server's X-Wardyn-Truncated signal: truncated=true means a further page exists and this one is not the whole list. See the package doc's "# Pagination" for why every list family answers this and not just the audit trail.
func (*Client) ListSSHKeys ¶ added in v0.7.0
ListSSHKeys returns the caller's own registered SSH gateway keys — the gateway's entire trust root (docs/SSH.md §1). There is no admin view of another principal's keys. Pass a ListOpts to page; prefer ListSSHKeysPage, which also returns the server's truncation signal. GET /api/v1/me/ssh-keys.
func (*Client) ListSSHKeysPage ¶ added in v0.8.0
func (c *Client) ListSSHKeysPage(ctx context.Context, opts ...ListOpts) (keys []types.SSHPublicKey, truncated bool, err error)
ListSSHKeysPage is ListSSHKeys plus the server's X-Wardyn-Truncated signal: truncated=true means a further page exists and this one is not the whole list. See client.go's package doc's "# Pagination".
func (*Client) ListSecrets ¶
ListSecrets returns the managed secret NAMES (never values). Reserved platform-internal keys are excluded server-side. Pass a ListOpts to page; prefer ListSecretsPage, which also returns the server's truncation signal. GET /api/v1/secrets, which responds {"names":[...]}.
func (*Client) ListSecretsPage ¶ added in v0.8.0
func (c *Client) ListSecretsPage(ctx context.Context, opts ...ListOpts) (names []string, truncated bool, err error)
ListSecretsPage is ListSecrets plus the server's X-Wardyn-Truncated signal: truncated=true means a further page exists and this one is not the whole list. See the package doc's "# Pagination". GET /api/v1/secrets, which responds {"names":[...],"mine":[...]} — this method surfaces only names, same as ListSecrets.
func (*Client) ListSecretsScoped ¶ added in v0.8.0
func (c *Client) ListSecretsScoped(ctx context.Context, opts ...ListOpts) (names, mine []string, err error)
ListSecretsScoped is ListSecretsScopedPage without the truncation signal.
func (*Client) ListSecretsScopedPage ¶ added in v0.8.0
func (c *Client) ListSecretsScopedPage(ctx context.Context, opts ...ListOpts) (names, mine []string, truncated bool, err error)
ListSecretsScopedPage is ListSecretsPage plus the server's `mine` (the caller's own namespace): for an operator the two are identical; for a member `names` narrows to the operator-owned names an eligible grant pairs with, while `mine` is always the caller's own rows. GET /api/v1/secrets, which responds {"names":[...],"mine":[...]}.
func (*Client) ListSources ¶ added in v0.5.0
ListSources returns the whole library. GET /api/v1/sources.
func (*Client) ListWorkspaces ¶ added in v0.3.1
ListWorkspaces returns onboarded workspaces in reverse creation order. Pass a ListOpts to page. Prefer ListWorkspacesPage, which also returns the server's truncation signal.
func (*Client) ListWorkspacesPage ¶ added in v0.7.0
func (c *Client) ListWorkspacesPage(ctx context.Context, opts ...ListOpts) (workspaces []types.Workspace, truncated bool, err error)
ListWorkspacesPage is ListWorkspaces plus the server's X-Wardyn-Truncated signal: truncated=true means a further page exists.
func (*Client) Me ¶ added in v0.3.1
Me returns the caller's resolved identity/attribution as raw JSON. GET /api/v1/me.
func (*Client) MintDeviceEnrolmentToken ¶ added in v0.8.0
func (c *Client) MintDeviceEnrolmentToken(ctx context.Context, name string) (DeviceEnrolmentToken, error)
MintDeviceEnrolmentToken mints a single-use token one laptop's first boot exchanges for its device credential (admin only). The returned Token is the only copy — the server keeps a hash — and it expires unused after 72 hours. POST /api/v1/admin/devices/enrolment-tokens.
func (*Client) Preflight ¶ added in v0.4.4
func (c *Client) Preflight(ctx context.Context, req CreateRunRequest) (PreflightResult, error)
Preflight DRY-RUNs a create-run request: the server resolves the policy through the same chokepoint launch uses (so an XOR violation, an unknown secret, or a non-onboarded workspace surface as the REAL launch error) and returns the setup checklist plus the enforced confinement class. It mints nothing, persists nothing, dispatches nothing. Pass the exact CreateRunRequest you would launch with. POST /api/v1/runs/preflight.
func (*Client) PutPreset ¶ added in v0.8.0
PutPreset creates the named preset at version 1, or replaces it and moves its version by one. A body identical to the stored preset changes nothing. Admin only.
func (*Client) PutSiteConfig ¶ added in v0.3.1
func (c *Client) PutSiteConfig(ctx context.Context, cfg types.SiteConfig) ( out types.SiteConfig, danglingSecretRefs []string, onboardingMarkIgnored bool, err error, )
PutSiteConfig replaces the operator-wide site config and returns the persisted value plus the write's two advisory signals: danglingSecretRefs — the names of any secret the document now references that the secret store doesn't currently hold (e.g. a `site-config set` recovery run before the referenced secrets were restored) — and onboardingMarkIgnored, true when the body named an onboarding_completed_at the server did not keep (that mark is server-owned and always carried forward; see types.SiteConfig). Both are advisory only, never an error: the ref is still saved as given, and the write still succeeded. PUT /api/v1/site-config.
Integrations is stripped from cfg before the request: the server rejects a non-empty one outright (integrations are managed through their own endpoints, never PUT /site-config), so the documented disaster-recovery round-trip — `wardyn site-config get > f` before a reset, `wardyn site-config set f` after — 400ed outright the moment any integration was ever stored (PLATFORM-API-5). Stripped here, once, so no caller has to remember to (mirrors ui/src/app/lib/api/health.ts's identical fix on the TS side).
func (*Client) PutSiteConfigResult ¶ added in v0.8.4
func (c *Client) PutSiteConfigResult(ctx context.Context, cfg types.SiteConfig) (SiteConfigPutResult, error)
PutSiteConfigResult is PutSiteConfig with every advisory signal, including the ones added after its signature was fixed. PUT /api/v1/site-config.
func (*Client) RecentAuditEvents ¶ added in v0.3.1
func (c *Client) RecentAuditEvents(ctx context.Context, opts ...ListOpts) ([]types.AuditEvent, error)
RecentAuditEvents returns the newest-first global audit feed (all runs) — the SIEM-style tail the Audit view renders. Pass a ListOpts to page.
func (*Client) RecordWorkspaceTask ¶ added in v0.3.1
func (c *Client) RecordWorkspaceTask(ctx context.Context, wsID uuid.UUID, taskKey string) (RecordTaskResult, error)
RecordWorkspaceTask launches a named open (allow-all egress) recording session for a workspace via the import pipeline — the operator attaches, does the real activity, and stops the run to capture what it actually used. POST /api/v1/workspaces/{id}/record with body {"task_key": name}. Returns 202 with the launched run; 503 when no runner is wired; 409 while another import step is live.
func (*Client) RejectGovernanceChange ¶ added in v0.8.6
func (c *Client) RejectGovernanceChange(ctx context.Context, id uuid.UUID, reason string) (GovernanceChange, error)
RejectGovernanceChange rejects a pending change; nothing is applied. reason is optional ("" omits it). POST /api/v1/governance/changes/{id}/reject.
func (*Client) RevokeDevice ¶ added in v0.8.0
RevokeDevice cuts one device off: its next audit push or heartbeat answers 401 (admin or security_admin). 404 for an unknown or already-revoked id. DELETE /api/v1/admin/devices/{id}.
func (*Client) RevokeDeviceEnrolmentToken ¶ added in v0.8.0
RevokeDeviceEnrolmentToken cancels a token that has not been redeemed yet, so no laptop can trade it for a device credential (admin or security_admin). 404 for one already redeemed, revoked, expired or unknown. DELETE /api/v1/admin/devices/enrolment-tokens/{id}.
func (*Client) RevokeSessions ¶ added in v0.6.0
RevokeSessions is D16's "revoke a human now" admin action: POST /api/v1/sessions/revoke, admin-only. Pass exactly one of sub (revoke that one principal's sessions) or all=true (revoke every principal's sessions) — the server 400s on both or neither. 404s when the deployment has no OIDC session store wired (nothing to revoke).
func (*Client) RunEvents ¶ added in v0.8.2
func (c *Client) RunEvents(ctx context.Context, runID uuid.UUID, afterID uint64, fn func(RunEvent) error) error
RunEvents follows a run's lifecycle feed, calling fn with each event in order, starting after afterID (0 = from the first). The server closes a held stream every few minutes; RunEvents reconnects with Last-Event-ID, so fn sees every event exactly once. It returns nil after fn has seen RunEventEnded, fn's own error if fn returns one, an *APIError for a non-2xx answer (404 for a run the caller cannot read), or the transport error — pass the last ID fn saw back as afterID to resume.
Resume is within the daemon's lifetime: the feed is kept in memory, so after a wardynd restart a run that is still live replays only what happens next, and a run that had already ended answers RunEventEnded alone.
func (*Client) RunFiles ¶ added in v0.7.0
RunFiles lists a running sandbox's changed files (owner-or-admin). 409 when the run has no sandbox yet, 501 when the runner cannot exec into one.
func (*Client) RunOutput ¶ added in v0.8.2
RunOutput reads the last tail bytes of a non-interactive run's output (owner-or-admin); tail <= 0 asks for all the server keeps (WARDYN_RUN_OUTPUT_TAIL_BYTES, 64 KiB by default). 409 for an interactive run, when none is kept, or when it is off; 410 once it has expired. Each refusal carries a run_output_* reason.
func (*Client) ScanSource ¶ added in v0.5.0
ScanSource scans one source — a dir inline (200 with the profile), a repo as a governed run (202 with scan_run_id). The reply shape varies, so it is returned raw. POST /api/v1/sources/{id}/scan.
func (*Client) ScanWorkspace ¶ added in v0.3.1
ScanWorkspace triggers the workspace scan (populates the least-privilege profile). The reply shape varies (a completed profile vs an accepted async run), so it is returned as raw JSON. POST /api/v1/workspaces/{id}/scan.
func (*Client) SetSecret ¶
SetSecret stores (or overwrites) a named secret. The value is write-only — no API path ever returns it. PUT /api/v1/secrets/{name} with body {"value":...}. Returns 400 on an invalid name, 403 for a reserved platform-internal name.
func (*Client) SetupStatus ¶ added in v0.3.1
SetupStatus returns the first-run setup checklist as raw JSON (the response is a server-internal struct not exported through internal/types). GET /api/v1/setup/status.
func (*Client) SynthesizeProfile ¶ added in v0.3.1
SynthesizeProfile runs Recording Mode synthesis for a run: from its already- captured audit / egress / ground-truth events the server proposes a tightened, reusable RunPolicy ("sandbox profile"). ADVISORY and READ-ONLY — it mints nothing and persists no policy (save the proposal via CreatePolicy). POST /api/v1/runs/{id}/profile/synthesize (renamed from /profile in 0.8 — docs/sdk.md "Renamed in 0.8" — the old path still answers, as a chi alias, for one minor). Returns 404 when the run does not exist.
type ConfinementClass ¶
type ConfinementClass = types.ConfinementClass
ConfinementClass declares how strongly a sandbox confines an agent (AgentRun.ConfinementClass, RunPolicySpec.MinConfinementClass).
type CreateRunRequest ¶
type CreateRunRequest struct {
Agent string `json:"agent"`
Repo string `json:"repo"`
// Task is the agent's prompt for a non-interactive run. For an interactive
// run it is instead the OPTIONAL boot seed: interpreted per
// InteractiveStart (an initial prompt for "agent", a startup command for
// "shell") and fired once, at sandbox boot, in the same persistent session
// the human later attaches to — never re-run on attach. Empty is today's
// pure-idle behavior, unchanged.
Task string `json:"task,omitempty"`
// Title is a short human NAME for the run. Runs that share a title are
// grouped in the console's run list. OPTIONAL on the wire even though the
// console requires it: the site-config probe, harness login and workspace
// record/verify all create runs with no human to name them, and the console
// falls back to Task for display. Trimmed and stored on the run row.
Title string `json:"title,omitempty"`
// Description is optional free-text context — why this run exists. Never
// interpreted, only stored and displayed.
Description string `json:"description,omitempty"`
PolicyID *uuid.UUID `json:"policy_id,omitempty"`
// ConfinementClass, when set, requests a specific confinement class
// ("CC1"/"CC2"/"CC3"). Empty inherits the policy minimum; an unknown
// non-empty value is rejected by the server with 400.
ConfinementClass string `json:"confinement_class,omitempty"`
// Interactive requests an interactive run: the sandbox comes up idle — or,
// with a non-empty Task, runs that boot seed in a persistent session — so a
// human can attach to it (wardyn run attach <id>) either way. Pair with a
// never-reap policy (AutoStopAfterSec < 0) or the idle reaper will stop the
// idle sandbox.
Interactive bool `json:"interactive,omitempty"`
// WorkspaceID, when set, launches the run against that ONBOARDED workspace:
// the server prepends the workspace's stored source onto the resolved policy
// (a repo as a workspace_repos entry, a local dir as a read-only-by-default
// workspace_mounts entry) so the run inherits its approved egress, built image
// and bound model/harness credentials. Composes with PolicyID / InlinePolicy /
// the default policy — it seeds the source those cannot name without
// hand-reproducing the workspace's exact path. Container-kind workspaces are
// rejected: pass the image ref as Image instead.
WorkspaceID *uuid.UUID `json:"workspace_id,omitempty"`
// InlinePolicy, when set, supplies the run's full RunPolicySpec INLINE
// instead of referencing a stored PolicyID. It is MUTUALLY EXCLUSIVE with
// PolicyID (the server rejects both with 400); neither set falls back to the
// configured default. The server validates it exactly like a stored policy
// (mounts pass the same deny-list; api_key grants must reference an existing
// secret) and attaches it with no stored policy id.
InlinePolicy *RunPolicySpec `json:"inline_policy,omitempty"`
// DevcontainerRepo, when set AND an image builder is wired (WARDYN_ENVBUILD),
// triggers a devcontainer build of that git repo whose resulting image becomes
// the sandbox image. Ignored (degrades to the convention image) when no builder
// is wired. Mutually exclusive with Image.
DevcontainerRepo string `json:"devcontainer_repo,omitempty"`
// DevcontainerRef is the optional git ref (branch/tag/sha) to build for
// DevcontainerRepo.
DevcontainerRef string `json:"devcontainer_ref,omitempty"`
// Image, when set, is a USER-supplied base image (Bring Your Own Image); the
// server wraps it with the runner tools via a trusted finalize stage and
// requires an image builder to be wired (WARDYN_ENVBUILD) — an explicit
// Image with no builder wired is a hard 400 rather than a silent fallback.
// Mutually exclusive with DevcontainerRepo.
Image string `json:"image,omitempty"`
// TaskMode selects how a non-interactive run executes Task: "" / "harness"
// (default) runs the agent harness; "exec" runs Task as a plain shell
// command in the same governed sandbox (no agent, no LLM credentials — the
// BYOA/CI lane; see docs/CI.md). Ignored for an interactive run.
TaskMode string `json:"task_mode,omitempty"`
// InteractiveStart is TaskMode's interactive counterpart: what the attach
// shell opens with. "" / "shell" drops the human into a shell in the
// prepared workspace (the long-standing behavior); "agent" additionally
// launches the image's agent CLI (claude / codex) there, once, on the first
// attach. Request-scoped like TaskMode — never persisted on the run row,
// carried to the sandbox as WARDYN_INTERACTIVE_START and consumed by the
// image's attach ~/.bashrc. Ignored for a non-interactive run.
InteractiveStart string `json:"interactive_start,omitempty"`
// SeedAutoTools, when true, lets an interactive run's boot SEED (Task,
// interpreted per InteractiveStart — see Task's own doc) use tools before a
// human attaches, equivalent to --dangerously-skip-permissions for that
// pre-attach span only. Default false: the seed is supervised, so an
// unattended agent-started seed parks at its first tool-approval prompt
// until someone joins. Meaningful only for an agent-started seed with
// non-empty Task; request-scoped like InteractiveStart — never persisted on
// the run row, carried to the sandbox as WARDYN_SEED_AUTO_TOOLS.
SeedAutoTools bool `json:"seed_auto_tools,omitempty"`
// ToolApprovals governs an AUTONOMOUS (non-interactive) Claude Code run's
// own tool calls: "" / "auto" (default) is today's behavior — the sandbox
// and egress policy are the only boundary, same as
// --dangerously-skip-permissions; "hold" routes every tool call through
// Wardyn's approval FSM instead, so an operator decides each one before it
// runs. Rejected for codex-cli (no external tool-approval contract) and
// ALSO rejected for an interactive run: that run's supervised-seed posture is
// SeedAutoTools's job, so this field could never take effect there. It used
// to be accepted and silently discarded, which is worse than refusing it —
// the caller got a 201 and none of the supervision they asked for.
// Request-scoped like TaskMode — never persisted on the run row, carried to
// the sandbox as WARDYN_TOOL_APPROVALS.
ToolApprovals string `json:"tool_approvals,omitempty"`
// Workspaces carries PER-WORKSPACE options — which of a workspace's
// OPTIONAL requirements (types.Workspace.Requirements, level="optional")
// this run enables, and a read-only narrowing — for the workspaces this run
// attaches. Additive to WorkspaceID, which stays a working SINGLE-selection
// alias: a caller that sets only WorkspaceID (never touching Workspaces)
// gets exactly today's behavior — no optional requirement enabled, no
// narrowing. A REQUIRED requirement needs no entry here at all; it applies
// automatically whenever its workspace is used. A selection naming a
// workspace this run does not otherwise attach (via WorkspaceID or a
// policy's workspace_mounts/workspace_repos) does nothing.
Workspaces []WorkspaceSelection `json:"workspaces,omitempty"`
// IntegrationID no longer chooses a model credential: a run naming one is
// refused with a 422. Use ModelProvider.
IntegrationID string `json:"integration_id,omitempty"`
// ModelProvider chooses this run's model provider (GET /model-providers,
// by id), ahead of a workspace's provider pin and the agent's default. It
// must be one the caller is granted, that is on and that serves Agent —
// otherwise the run is refused, never moved to another provider. Named on a
// deployment with no model providers, or on a run that calls no model, it
// is refused rather than ignored.
ModelProvider string `json:"model_provider,omitempty"`
// Drive opts this run into the member's USER DRIVE — the per-user storage
// an admin allocated them. Nil (the default) mounts nothing, byte for byte
// today. Nothing here names a path or a drive: the server resolves which
// drive belongs to the authenticated caller and derives their home from
// their own identity, so this flag can only ever ask for the storage the
// caller was already granted.
Drive *DriveSelection `json:"drive,omitempty"`
// Preset launches the named launch preset (see Preset): the server
// expands it into the equivalent explicit request and runs the unchanged
// create path under the caller's own ceiling. Alongside it only Title,
// Task and PresetVersion may be set; any other field is refused.
Preset string `json:"preset,omitempty"`
// PresetVersion, with Preset, pins the version the caller expects: a
// preset changed since is refused (409) rather than launched. 0 launches
// the current version. The created run records the version it used.
PresetVersion int `json:"preset_version,omitempty"`
}
CreateRunRequest is the body for POST /api/v1/runs.
type CreateRunResult ¶ added in v0.4.4
type CreateRunResult struct {
types.AgentRun
// Warnings are ADVISORY notices the server raised while resolving the run —
// discouraged, never blocking: a member's inline policy narrowed to what
// they are granted (an egress host, a secret-referencing grant, a workspace
// repo), a workspace-directory collision with another active run, or an
// ssh_key grant dropped because the agent has no SSH clone lane. Surface
// them: the run is live either way, so a dropped warning is a silently
// degraded run.
Warnings []string `json:"warnings,omitempty"`
}
CreateRunResult is the decoded POST /api/v1/runs 201 reply. AgentRun is EMBEDDED (the server puts the run's fields at the top level), so .ID/.State read straight off the result.
type CredentialGrant ¶
type CredentialGrant = types.CredentialGrant
CredentialGrant is a credential-grant eligibility record. Returned by ListGrants.
type DecisionOpts ¶ added in v0.5.0
type DecisionOpts struct {
// Scope is the decision's blast radius: ScopeOnce, ScopeRun (the zero
// value, and today's default), ScopeUntil, or ScopeAlways. Meaningful
// only for an egress_domain approval; the server rejects it otherwise.
Scope ApprovalScope
// Until is the expiry for Scope == ScopeUntil: required by the server in
// that case, and rejected if set for any other scope.
Until *time.Time
}
DecisionOpts is the optional scope/expiry for Approve/Deny. This repo has no WithX functional-option precedent (see ListOpts); DecisionOpts follows the same plain-struct-passed-variadically shape. Pass at most one.
type Device ¶ added in v0.8.0
Device is one enrolled laptop in the organisation's inventory (no credential material). Returned by ListDevices.
type DeviceEnrolmentToken ¶ added in v0.8.0
type DeviceEnrolmentToken = types.DeviceEnrolmentToken
DeviceEnrolmentToken is a minted single-use enrolment token; Token holds the plaintext on the mint response only. Returned by MintDeviceEnrolmentToken.
type DeviceEnrolmentTokenRequest ¶ added in v0.8.0
type DeviceEnrolmentTokenRequest struct {
// Name is the laptop's inventory name; the device it enrols carries it.
Name string `json:"name"`
}
DeviceEnrolmentTokenRequest is the POST /api/v1/admin/devices/enrolment-tokens body. internal/api aliases it (mintEnrolmentTokenRequest), so the strict server decode and this struct are one type.
type DriveBackend ¶ added in v0.8.0
type DriveBackend = types.DriveBackend
DriveBackend names where a drive's bytes live and therefore which runner can mount it (DriveRequest.Backend, UserDrive.Backend).
type DriveGrantRequest ¶ added in v0.8.0
type DriveGrantRequest struct {
SubjectType CapabilitySubjectType `json:"subject_type"`
Subject string `json:"subject"`
DriveID uuid.UUID `json:"drive_id"`
// Priority breaks ties within a tier (higher wins) when a subject's
// membership qualifies it for more than one group-tier grant. It does not
// cross tiers (user beats group beats all).
Priority int `json:"priority"`
// SizeMiBOverride replaces the drive's allocation for this subject. 0
// means "use the drive's".
SizeMiBOverride int `json:"size_mib_override,omitempty"`
// WritableOverride is TRI-STATE: nil is "use the drive's posture", and an
// explicit false is "this subject reads only" even on a writable drive.
WritableOverride *bool `json:"writable_override,omitempty"`
// HomeOverride is TRI-STATE for the same reason: nil leaves a previously
// pinned directory name alone, and an explicit "" (or a name) states the
// field, which is itself the confirmation to change it. User-tier
// subjects only.
HomeOverride *string `json:"home_override,omitempty"`
// Enabled is TRI-STATE and defaults to true when nil: allocating a drive
// is a deliberate act, so omitting the field means "give it to them", not
// "pause it". An explicit false pauses the allocation without deleting it.
Enabled *bool `json:"enabled,omitempty"`
}
DriveGrantRequest is the POST /drives/grants body — one allocation of a drive to a subject, upserted by the natural key (subject_type, subject): a second POST for the same subject repoints its single row rather than accumulating another one.
type DriveReclaim ¶ added in v0.8.0
type DriveReclaim = types.DriveReclaim
DriveReclaim is the declared intent for a drive's storage objects when an allocation is removed (DriveRequest.Reclaim, UserDrive.Reclaim).
type DriveRequest ¶ added in v0.8.0
type DriveRequest struct {
Name string `json:"name"`
Backend DriveBackend `json:"backend"`
// HostRoot is the operator-mounted tree a host_path drive binds a
// subdirectory of. Meaningless for every other backend, and refused
// outright when it names a path outside this deployment's configured
// drive host roots.
HostRoot string `json:"host_root,omitempty"`
// StorageClass is the k8s_pvc provisioner to request; "" means the
// cluster default. Meaningless for every other backend.
StorageClass string `json:"storage_class,omitempty"`
// HomeTemplate is which identity a drive's per-user home name is derived
// from. "" means the server's default (HomeTemplateHash).
HomeTemplate HomeTemplate `json:"home_template,omitempty"`
// SizeMiB is the allocation, not a guarantee — see types.StorageEnforcement.
// Required (and enforced) on a k8s_pvc drive; advisory elsewhere.
SizeMiB int `json:"size_mib,omitempty"`
// Writable is the drive's DEFAULT posture and it defaults to false. A
// grant may narrow it and a run may narrow it again; neither may widen it.
Writable bool `json:"writable,omitempty"`
// Reclaim is the declared intent for the drive's storage objects once an
// allocation is removed. "" means the server's default (DriveReclaimRetain).
Reclaim DriveReclaim `json:"reclaim,omitempty"`
}
DriveRequest is the POST /drives / PUT /drives/{id} body — one admin-registered drive. ID/CreatedAt/UpdatedAt/CreatedBy are never accepted from the wire: the id comes from the path (an update) or the server (a create), and provenance is always server-assigned. Name and Backend are always on the wire (no omitempty); the rest default to the zero value a new drive would otherwise want.
type DriveSelection ¶ added in v0.7.0
type DriveSelection struct {
// Enabled asks for the caller's drive to be mounted. False (and an absent
// Drive) mounts nothing. A caller with no drive allocated, or one whose
// governance profile carries DenyUserDrive, is refused rather than silently
// given a run without it — asking for storage and not getting it is how
// work is lost.
Enabled bool `json:"enabled"`
// ReadOnly, when set, NARROWS this run's mount: true forces read-only even
// on a writable allocation. Nil leaves the resolved allocation's own posture
// in effect.
//
// FALSE IS NOT A NO-OP EVERYWHERE, and the difference matters to a caller
// scripting a run: against a READ-ONLY allocation it is REFUSED (422) and
// never silently honoured — a run the caller believes is writable would only
// reveal itself when the work failed to persist. On a WRITABLE allocation it
// is a no-op, since that is the posture already in force.
//
// The same direction WorkspaceSelection.ReadOnly enforces, and for the same
// reason: a run-level option may only ever narrow what an admin granted.
ReadOnly *bool `json:"read_only,omitempty"`
}
DriveSelection is the per-run user-drive option set. See CreateRunRequest.Drive.
type DrivesDocument ¶ added in v0.8.0
type DrivesDocument struct {
Drives []UserDriveListItem `json:"drives"`
Grants []UserDriveGrant `json:"grants"`
HostRootsConfigured bool `json:"host_roots_configured"`
RunnerTarget string `json:"runner_target"`
Disabled bool `json:"disabled"`
GrantTotal int `json:"grant_total"`
}
DrivesDocument is GET /drives's body and ApplyDrives's parameter: every registered drive, every allocation (GetDrives reads every page), and the deployment facts an operator cannot derive from the rows alone (whether host_path drives are even authorable here, which substrate this deployment dispatches to, and whether the org switch is off). `wardyn drive get` prints this verbatim; ApplyDrives strict-decodes it back — HostRootsConfigured, RunnerTarget, Disabled and GrantTotal are read-only and ignored on write.
type EgressRedirect ¶ added in v0.5.0
type EgressRedirect = types.EgressRedirect
EgressRedirect is one outbound redirect (package registry or otherwise), carried in SiteConfig.EgressRedirects. Aliased for the same reason as ArtifactOverride: GetSiteConfig returns a nil slice when unconfigured, so without a nameable element type a caller could not author one at all.
type ErasePersonResult ¶ added in v0.8.6
type ErasePersonResult struct {
// Person is the principal the name resolved to.
Person string `json:"person"`
// Scopes are the scopes erased, in the order they ran.
Scopes []string `json:"scopes"`
// Outcome is each scope's result: "done".
Outcome map[string]string `json:"outcome"`
// Detail is each scope's counts.
Detail map[string]any `json:"detail"`
}
ErasePersonResult is what POST /api/v1/people/{principal}/erasure answers once every scope asked for is erased.
type GovernanceApplyResult ¶ added in v0.8.6
type GovernanceApplyResult struct {
// Document is a fresh GetGovernance after the apply: what is actually in
// force, which excludes every pending write.
Document GovernanceDocument `json:"document"`
// Pending are the writes held for a second approver. Nothing in them is
// applied until they are approved.
Pending []GovernanceChange `json:"pending,omitempty"`
// Deferred are the assignments not sent because the profile they name has
// a pending write. Apply again once that change is approved.
Deferred []GovernanceDeferredWrite `json:"deferred,omitempty"`
// PruneSkipped is true when prune was requested and did not run to
// completion because a write was pending.
PruneSkipped bool `json:"prune_skipped,omitempty"`
}
GovernanceApplyResult is ApplyGovernanceResult's answer.
type GovernanceAssignment ¶ added in v0.8.0
type GovernanceAssignment = types.GovernanceAssignment
GovernanceAssignment binds one profile to one subject (GovernanceDocument.Assignments). Returned by GetGovernance and ApplyGovernance.
type GovernanceAssignmentRequest ¶ added in v0.8.0
type GovernanceAssignmentRequest struct {
SubjectType CapabilitySubjectType `json:"subject_type"`
Subject string `json:"subject"`
ProfileID uuid.UUID `json:"profile_id"`
Priority int `json:"priority"`
}
GovernanceAssignmentRequest is POST /governance/assignments's body. There is no PUT for an assignment: the natural key (subject_type, subject) upserts, repointing an existing binding rather than accumulating a second one, the same shape DriveGrantRequest already takes for a drive allocation.
type GovernanceChange ¶ added in v0.8.6
type GovernanceChange struct {
ID uuid.UUID `json:"id"`
TargetKind string `json:"target_kind"`
Op string `json:"op"`
TargetKey string `json:"target_key"`
State string `json:"state"`
ProposedBy string `json:"proposed_by"`
ProposedAt time.Time `json:"proposed_at"`
ExpiresAt time.Time `json:"expires_at"`
Diff GovernanceChangeDiff `json:"diff"`
}
GovernanceChange is one governance write held for a second approver: the body of a 202's pending_change, and the row the /governance/changes routes list, approve and reject. State is pending, applied, rejected, expired or stale.
type GovernanceChangeDiff ¶ added in v0.8.6
type GovernanceChangeDiff struct {
Before json.RawMessage `json:"before,omitempty"`
After json.RawMessage `json:"after,omitempty"`
Changed []string `json:"changed,omitempty"`
}
GovernanceChangeDiff is a pending change's server-rendered diff: the target's current and proposed rows (both redacted for read) and the changed field paths. The client never computes its own.
type GovernanceDeferredWrite ¶ added in v0.8.6
type GovernanceDeferredWrite struct {
SubjectType CapabilitySubjectType `json:"subject_type"`
Subject string `json:"subject"`
// Profile is the pending profile's name.
Profile string `json:"profile"`
// Base is set when the deferred write is a PROFILE rather than an assignment: Profile is the
// child that was not sent, Base the profile it composes on whose write is pending.
Base string `json:"base,omitempty"`
}
GovernanceDeferredWrite is a write ApplyGovernanceResult did not send because the profile it names (an assignment's profile, or a child profile's base) has a write pending approval. Apply again once that change is approved.
type GovernanceDocument ¶ added in v0.8.0
type GovernanceDocument struct {
Profiles []GovernanceProfile `json:"profiles"`
Assignments []GovernanceAssignment `json:"assignments"`
}
GovernanceDocument is GET /governance's body and ApplyGovernance's parameter: every profile plus every assignment. `wardyn governance get` prints this verbatim; ApplyGovernance strict-decodes it back.
type GovernanceLimits ¶ added in v0.8.0
type GovernanceLimits = types.GovernanceLimits
GovernanceLimits carries the request-shape autonomy switches a GovernanceProfile bounds a principal by, carried in GovernanceProfile.Limits. Aliased so a caller can author one through GovernanceProfileRequest.
type GovernanceProfile ¶ added in v0.8.0
type GovernanceProfile = types.GovernanceProfile
GovernanceProfile is one named, assignable ceiling (migration 0052's governance_profiles row), carried in GovernanceDocument.Profiles. Returned by GetGovernance and ApplyGovernance.
type GovernanceProfileRequest ¶ added in v0.8.0
type GovernanceProfileRequest struct {
Name string `json:"name"`
Ceiling RunPolicySpec `json:"ceiling"`
Limits GovernanceLimits `json:"limits"`
// Contact is who owns the profile and how a person it refuses asks for a
// change. nil leaves the stored contact unchanged (an older caller that
// never sets it cannot wipe it); a pointer to an empty Contact clears it.
Contact *PolicyContact `json:"contact,omitempty"`
// BaseProfileID, Overlay and OverlayLimits are a composed profile's members. Left nil they are
// omitted, which keeps the stored value; ApplyGovernance sets each to an explicit JSON null when
// it must clear one, so a repeat apply reproduces the document and not a merge of it.
BaseProfileID json.RawMessage `json:"base_profile_id,omitempty"`
Overlay json.RawMessage `json:"overlay,omitempty"`
OverlayLimits json.RawMessage `json:"overlay_limits,omitempty"`
}
GovernanceProfileRequest is the POST /governance/profiles / PUT /governance/profiles/{id} body — one named ceiling. ID/CreatedAt/UpdatedAt/ CreatedBy are never accepted from the wire, matching DriveRequest: the id comes from the path (an update) or the server (a create), and provenance is always server-assigned.
type GovernanceProfileResponse ¶ added in v0.8.0
type GovernanceProfileResponse struct {
Profile GovernanceProfile `json:"profile"`
Warnings []string `json:"warnings,omitempty"`
}
GovernanceProfileResponse is a profile write's body: the saved profile plus any omission warnings the write raised (a ceiling grant the deployment no longer provisions — see internal/api/governance.go's reintersect note).
type GrantSpec ¶
GrantSpec is a credential scope description carried in RunPolicySpec.EligibleGrants.
type HomeTemplate ¶ added in v0.8.0
type HomeTemplate = types.HomeTemplate
HomeTemplate names which identity a drive's per-user home name is derived from (DriveRequest.HomeTemplate, UserDrive.HomeTemplate).
type KillRunResponse ¶
KillRunResponse is the body returned by POST /api/v1/runs/{id}/kill.
type ListOpts ¶ added in v0.3.1
ListOpts carries the server's ?limit=&offset= pagination for the list and audit endpoints. The zero value sends nothing, so the server applies its default page size. Methods take it variadically; pass at most one.
type ModelProvider ¶ added in v0.8.0
type ModelProvider = types.ModelProvider
Domain nouns returned or accepted by Client methods.
type ModelProviderKind ¶ added in v0.8.0
type ModelProviderKind = types.ModelProviderKind
Domain nouns returned or accepted by Client methods.
type ModelProviders ¶ added in v0.8.0
type ModelProviders = types.ModelProviders
ModelProviders is the admin's model-provider configuration, carried in SiteConfig.ModelProviders; the types below are its parts. Aliased so a caller can author the block through PutSiteConfig. Configuration only: no credential lives on a record.
type PendingApprovalError ¶ added in v0.8.6
type PendingApprovalError struct {
// Changes are the writes held for approval.
Changes []GovernanceChange
// Deferred are the apply's writes that depend on a pending one and were
// not sent (ApplyGovernance only).
Deferred []GovernanceDeferredWrite
// PruneSkipped is true when prune was requested and did not run to
// completion because a write was pending (ApplyGovernance only).
PruneSkipped bool
}
PendingApprovalError is returned when a write was held for a second approver instead of applied (the server answered 202 with a pending_change). It is not a failure of the request: nothing is applied until the change is approved (ApproveGovernanceChange, or `wardyn governance changes approve`).
func (*PendingApprovalError) Error ¶ added in v0.8.6
func (e *PendingApprovalError) Error() string
type PeopleListOpts ¶ added in v0.8.6
type PeopleListOpts struct {
// Limit is the page size: 50 when zero, at most 200.
Limit int
// Cursor is the NextCursor of the previous page.
Cursor string
// Query keeps people whose principal or email starts with it.
Query string
// State is "active" or "deactivated"; empty keeps both.
State string
}
PeopleListOpts narrows and pages ListPeople. The zero value is the first page of everyone.
type PersonList ¶ added in v0.8.6
type PersonList = types.PersonList
Domain nouns returned or accepted by Client methods.
type PersonSummary ¶ added in v0.8.6
type PersonSummary = types.PersonSummary
PersonSummary is one row of ListPeople; PersonList is one page of it.
type PolicyContact ¶ added in v0.8.6
PolicyContact is the contact a GovernanceProfile (and SiteConfig.PolicyHelp) publishes: owner, email, request_url and request_text, validated by the server on write.
type PolicyRef ¶ added in v0.8.6
PolicyRef is the policy a ceiling refusal names: the leaf profile (or the deployment) that bound the caller, plus the contact it published. APIError.Policy carries one.
type PolicyRequest ¶
type PolicyRequest struct {
Name string `json:"name"`
Spec types.RunPolicySpec `json:"spec"`
}
PolicyRequest is the body for POST/PUT /api/v1/policies. Name is required; Spec is validated server-side before persistence (a bad spec is rejected with 400, fail closed).
type PreflightItem ¶ added in v0.4.4
type PreflightItem struct {
Kind string `json:"kind"`
ID string `json:"id"`
Label string `json:"label"`
RequiredBy string `json:"required_by"`
Status string `json:"status"` // "satisfied" | "missing" | "unverified"
Detail string `json:"detail,omitempty"`
}
PreflightItem is one row of the preflight setup checklist: something the run needs, and whether it is already satisfied. Only the fields callers render are modeled — the full server row additionally carries a structured UI "fix" action and a credential-residency label.
type PreflightResult ¶ added in v0.4.4
type PreflightResult struct {
SetupItems []PreflightItem `json:"setup_items"`
EnforcedConfinementClass types.ConfinementClass `json:"enforced_confinement_class"`
// Warnings carries resolveRunPolicy's clamp notes — a member's silently
// narrowed inline policy, a filtered grant. The same list rides
// CreateRunResult.Warnings at launch, so a preview and the real thing say
// the same words about the same drop.
Warnings []string `json:"warnings,omitempty"`
}
PreflightResult is the decoded POST /api/v1/runs/preflight reply: the setup checklist plus the confinement class the run would ACTUALLY enforce after the policy floor and blast-radius raise.
type Preset ¶ added in v0.8.0
type Preset struct {
Name string `json:"name"`
Version int `json:"version"`
Description string `json:"description,omitempty"`
// UserTypes narrows who may list and launch the preset to these user
// types; empty is every type. Admins see and launch every preset.
UserTypes []string `json:"user_types"`
// Request is the stored create-run body. It may not carry the
// per-launch fields (title, task) or a preset of its own.
Request CreateRunRequest `json:"request"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by,omitempty"`
UpdatedBy string `json:"updated_by,omitempty"`
}
Preset is one launch preset: an admin-managed, named bundle of existing CreateRunRequest fields a launcher names (CreateRunRequest.Preset) instead of sending the whole spec. The server expands it and runs the unchanged create path, so the caller's own ceiling, capabilities, secrets and drive apply exactly as they would to Request sent explicitly. Version, the timestamps and the author fields are read-only.
type PresetRequest ¶ added in v0.8.0
type PresetRequest struct {
Description string `json:"description,omitempty"`
UserTypes []string `json:"user_types,omitempty"`
Request CreateRunRequest `json:"request"`
}
PresetRequest is the PUT /api/v1/presets/{name} body.
type PresetsDocument ¶ added in v0.8.0
type PresetsDocument struct {
Presets []Preset `json:"presets"`
}
PresetsDocument is GET /api/v1/presets's body and ApplyPresets's parameter: `wardyn preset get` prints it and `wardyn preset set` reads it back.
type ProfileResult ¶ added in v0.3.1
type ProfileResult struct {
Proposed struct {
InlinePolicy RunPolicySpec `json:"inline_policy"`
} `json:"proposed"`
OverallRisk string `json:"overall_risk"`
Observations struct {
Domains []struct {
Host string `json:"host"`
Methods []string `json:"methods"`
} `json:"domains"`
Anomalies []string `json:"anomalies"`
} `json:"observations"`
Warnings []string `json:"warnings"`
}
ProfileResult is the decoded POST /api/v1/runs/{id}/profile/synthesize reply (Recording Mode): the synthesized least-privilege sandbox profile plus the observations it was built from. Only the fields callers render/save are modeled — the full server response (profileResponse) additionally carries a per-item risk breakdown the SDK does not surface.
type ProviderAuth ¶ added in v0.8.0
type ProviderAuth = types.ProviderAuth
Domain nouns returned or accepted by Client methods.
type ProviderHarness ¶ added in v0.8.0
type ProviderHarness = types.ProviderHarness
Domain nouns returned or accepted by Client methods.
type PushContentScope ¶ added in v0.8.0
type PushContentScope = types.PushContentScope
PushContentScope is a push_content approval's requested_scope: the held push's repository, refs, credential, matched paths and commits.
type PushRulesSpec ¶ added in v0.8.0
type PushRulesSpec = types.PushRulesSpec
PushRulesSpec declares content rules for a run's brokered git pushes, carried in RunPolicySpec.PushRules: deny_paths refuse, and require_review_paths hold the push for an admin's decision for up to hold_seconds.
type RecordTaskResult ¶ added in v0.3.1
type RecordTaskResult struct {
RecordRunID string `json:"record_run_id"`
TaskKey string `json:"task_key"`
Mode string `json:"mode"`
Detail string `json:"detail"`
Warnings []string `json:"warnings"`
}
RecordTaskResult is the decoded POST /api/v1/workspaces/{id}/record reply: the launched open-egress recording run plus the resolved session key/mode.
type RunEvent ¶ added in v0.8.2
type RunEvent struct {
ID uint64 `json:"id"`
Type string `json:"type"`
Reason string `json:"reason,omitempty"`
State RunState `json:"state,omitempty"`
At time.Time `json:"at"`
}
RunEvent is one entry of a run's lifecycle feed, GET /api/v1/runs/{id}/events. ID is monotonic per run. Reason is set on RunEventFailed only, State on RunEventEnded only. It never carries log or secret content.
type RunFileStat ¶ added in v0.7.0
type RunFileStat struct {
Path string `json:"path"`
// Status is git's porcelain code ("M", "A", "D", "??", …); empty when git
// listed the file in the diff but not in status.
Status string `json:"status,omitempty"`
Added *int `json:"added,omitempty"`
Deleted *int `json:"deleted,omitempty"`
// Binary marks a file git declined to count lines for.
Binary bool `json:"binary,omitempty"`
}
RunFileStat is one changed file in a RunFiles listing.
type RunFiles ¶ added in v0.7.0
type RunFiles struct {
VCS string `json:"vcs"`
Path string `json:"path,omitempty"`
Files []RunFileStat `json:"files"`
Truncated bool `json:"truncated"`
}
RunFiles is GET /api/v1/runs/{id}/files: what changed in a RUNNING sandbox's workspace, read by one exec inside the sandbox. VCS is "git" (Files is the diff-stat), "none" (Path names the directory inspected and it is not a git work tree) or "unknown" (git ran and failed — most often it is missing from the image). Path is present on every outcome so a caller can tell "no repo here" from "looked in the wrong place".
type RunOutput ¶ added in v0.8.2
type RunOutput struct {
Output string `json:"output"`
// Truncated: Output does not start at the run's first byte.
Truncated bool `json:"truncated"`
// Complete: the capture is final (a stored row, or a memory tail sealed after
// the run's last bytes), so a read never gains bytes after it. A run that
// has just finished is not Complete until then: read again.
Complete bool `json:"complete"`
// Source is where the bytes came from; "stdout" for a run's own output.
Source string `json:"source"`
// Incomplete: bytes may be missing (a copy did not end in time or failed, or
// a byte arrived after the capture was sealed).
Incomplete bool `json:"incomplete"`
// CaptureGap: the output could not be captured (no process held it), so
// Output is empty.
CaptureGap bool `json:"capture_gap"`
// MaskScope is "run" when the capture was masked against the run's complete
// manifest throughout, "globals_only" when it was not; empty when this
// deployment keeps no manifests.
MaskScope string `json:"mask_scope,omitempty"`
// CapturedAt is when the final row was written; nil while the run is live.
CapturedAt *time.Time `json:"captured_at,omitempty"`
}
RunOutput is GET /runs/{id}/output's body: the end of a non-interactive run's combined stdout/stderr.
type RunPolicy ¶
RunPolicy is a declarative policy attached to runs. Returned by the policy methods (ListPolicies, GetPolicy, CreatePolicy, UpdatePolicy).
type RunPolicyChange ¶ added in v0.8.2
type RunPolicyChange struct {
Cause string `json:"cause"`
Field string `json:"field"`
Added []string `json:"added,omitempty"`
Removed []string `json:"removed,omitempty"`
// Detail is the launch-time narrowing sentences, verbatim (Cause "limits" only).
Detail []string `json:"detail,omitempty"`
Profile string `json:"profile,omitempty"`
At *time.Time `json:"at,omitempty"` // when the run was restarted (Cause "restart")
}
RunPolicyChange is one group of entries changed at launch for one Cause: workspace, source_control, mirror, model_access, git_broker, profile, org_disk, restart, limits or launch. Field is a RunPolicySpec json name. Entries are keys that never name a hidden value: a grant is "kind:host" or "kind:repo,repo", a mount its target, a repo "repo@ref", an app its name.
type RunPolicySource ¶ added in v0.8.2
type RunPolicySource struct {
Kind string `json:"kind"`
PolicyID *uuid.UUID `json:"policy_id,omitempty"`
Name string `json:"name,omitempty"`
Deleted bool `json:"deleted,omitempty"`
Preset string `json:"preset,omitempty"`
PresetVersion int `json:"preset_version,omitempty"`
}
RunPolicySource says where a run's policy started: Kind is "stored" (a saved policy, PolicyID and Name as of launch, Deleted once it is gone), "inline", "default", "profile" (Name is the governance profile), or "unknown".
type RunPolicySpec ¶
type RunPolicySpec = types.RunPolicySpec
RunPolicySpec is the policy body carried in PolicyRequest.Spec. As a true `=` alias it carries the full wire surface, including AllowAllEgress (json:"allow_all_egress,omitempty") for the "allow all (deny-list only)" egress mode — no separate SDK struct to keep in sync.
type RunPolicyView ¶ added in v0.8.2
type RunPolicyView struct {
RunID uuid.UUID `json:"run_id"`
State string `json:"state"`
RecordedAt *time.Time `json:"recorded_at,omitempty"`
Source RunPolicySource `json:"source"`
Spec *types.RunPolicySpec `json:"spec,omitempty"`
// Redacted is true when the reader is below the security admin tier and the
// policy holds mount sources or secret names, which read as "<redacted>" or
// are dropped. Such a spec is a starting point, not a policy that validates.
Redacted bool `json:"redacted"`
// Changes is never null.
Changes []RunPolicyChange `json:"changes"`
Complete bool `json:"complete"`
// StoredPolicyNow is set when the run started from a saved policy.
StoredPolicyNow *StoredPolicyNow `json:"stored_policy_now,omitempty"`
}
RunPolicyView is GET /api/v1/runs/{id}/policy: the policy a run got, where it started from, and what Wardyn changed when it started.
State is "recorded", "not_yet" (the run has not reached sandbox setup) or "never" (it ended before that, so no policy was applied); Spec and RecordedAt are set only for "recorded". Spec is a normal policy document, with hidden values replaced (see Redacted). Complete is false for a run launched before Wardyn recorded each change, whose Changes may be missing entries.
type SSHPublicKey ¶ added in v0.7.0
type SSHPublicKey = types.SSHPublicKey
SSHPublicKey is one registered SSH gateway key (never a secret — the authorized_keys line plus its fingerprint). Returned by ListSSHKeys and AddSSHKey.
type SiteConfig ¶ added in v0.4.4
type SiteConfig = types.SiteConfig
SiteConfig is the operator-wide site config. Returned by GetSiteConfig and accepted by PutSiteConfig.
type SiteConfigPutResult ¶ added in v0.8.4
type SiteConfigPutResult struct {
types.SiteConfig
DanglingSecretRefs []string `json:"dangling_secret_refs,omitempty"`
OnboardingCompletedAtIgnored bool `json:"onboarding_completed_at_ignored,omitempty"`
// BrandingLogoPending (#1215): branding.logo_path was valid but not attached,
// because the console has no branding record yet. Apply again after saving
// the Branding card.
BrandingLogoPending bool `json:"branding_logo_pending,omitempty"`
// ModelProviderWarnings are advisories on the model_providers block, such as an azure_foundry
// endpoint that resolves to a private address no internal_hosts entry covers.
ModelProviderWarnings []string `json:"model_provider_warnings,omitempty"`
}
SiteConfigPutResult is PUT /site-config's answer: the stored document plus the write's advisory signals. A field is added here rather than a return value to PutSiteConfig, whose signature is public.
type Source ¶ added in v0.5.0
Source is one tier-1 library entry: a repo/dir configured once (its own contract + scan) and attached to many workspaces.
type SourceKind ¶ added in v0.5.0
type SourceKind = types.SourceKind
SourceKind discriminates a library source: local_dir | repo.
type SourceRequest ¶ added in v0.5.0
type SourceRequest struct {
Kind types.SourceKind `json:"kind"`
// Locator is a host directory path (local_dir) or repo slug/clone URL (repo).
Locator string `json:"locator"`
// Ref is an optional git ref; repo only. Part of the identity — the same
// repo at two refs is two sources with two contracts.
Ref string `json:"ref,omitempty"`
Name string `json:"name,omitempty"`
// Requirements seeds the source's own contract (secret:/egress:/write:
// keys; integration: keys are tier-3-only and rejected here).
Requirements map[string]types.WorkspaceRequirement `json:"requirements,omitempty"`
}
SourceRequest is the body for POST /api/v1/sources — one repo/dir configured ONCE (its own requirements contract, its own scan profile) and attached to any number of workspaces. The server dedupes on canonical identity (kind, locator, ref): re-creating an existing source answers 200 with the existing row, contract and all, rather than a duplicate.
type StoredPolicyNow ¶ added in v0.8.2
type StoredPolicyNow struct {
State string `json:"state"`
Name string `json:"name,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
StoredPolicyNow compares the saved policy a run started from with what it reads now: State is "same", "changed", "updated" (an older run whose saved policy was edited since — possibly a rename only) or "deleted".
type UserDrive ¶ added in v0.8.0
UserDrive is one admin-registered drive (migration 0054's user_drives row), embedded in UserDriveListItem. Written via DriveRequest.
type UserDriveGrant ¶ added in v0.8.0
type UserDriveGrant = types.UserDriveGrant
UserDriveGrant allocates one drive to one subject (DrivesDocument.Grants). Written via DriveGrantRequest.
type UserDriveListItem ¶ added in v0.8.0
type UserDriveListItem = types.UserDriveListItem
UserDriveListItem is one DrivesDocument.Drives row: the drive plus how many grants allocate it. Returned by GetDrives and ApplyDrives.
type Workspace ¶ added in v0.4.4
Workspace is an onboarded local dir / repo / container. Returned by ListWorkspaces, GetWorkspace, CreateWorkspace, and UpdateWorkspace.
type WorkspaceAttachment ¶ added in v0.5.0
type WorkspaceAttachment = types.WorkspaceAttachment
WorkspaceAttachment is one tier-3 composition row (Workspace.Attachments): either a library Source reference (SourceID set) or an inline ephemeral scratch row.
type WorkspaceBaseImage ¶ added in v0.5.0
type WorkspaceBaseImage = types.WorkspaceBaseImage
WorkspaceBaseImage is a Workspace's base-image choice, carried in WorkspaceRequest.BaseImage and returned in Workspace.BaseImage.
type WorkspaceKind ¶ added in v0.4.4
type WorkspaceKind = types.WorkspaceKind
WorkspaceKind is what a workspace onboards (Workspace.Kind, WorkspaceRequest.Kind). Deprecated: a DERIVED READ-ONLY MIRROR of Workspace.Sources[0] (single-source only) — see WorkspaceSourceType for the field a multi-source Workspace actually carries per-source.
type WorkspaceLLMCred ¶ added in v0.4.4
type WorkspaceLLMCred = types.WorkspaceLLMCred
WorkspaceLLMCred is the operator-owned model binding carried in WorkspaceRequest.LLMCred: ProviderRef pins the workspace's runs to one model provider. "" (or a nil WorkspaceLLMCred) means no pin. On a read, ProviderUnavailable in place of ProviderRef means the workspace is pinned to a provider the caller is not granted; a write never sets it.
type WorkspaceMount ¶
type WorkspaceMount = types.WorkspaceMount
WorkspaceMount is an operator/policy-controlled host bind mount carried in RunPolicySpec.WorkspaceMounts.
type WorkspaceRequest ¶ added in v0.3.1
type WorkspaceRequest struct {
Name string `json:"name"`
// Sources is the workspace's composition: one-or-more local_dir/repo/
// ephemeral sources. Mutually exclusive with the legacy scalar fields
// below (Kind/Source/Ref/DefaultTarget/Writable) — set one or the other,
// never both. Omitting both onboards the composition floor: one ephemeral
// scratch source.
Sources []types.WorkspaceSource `json:"sources,omitempty"`
// BaseImage is the workspace's base-image choice. Nil means the platform
// default convention image for the detected/scanned stack.
BaseImage *types.WorkspaceBaseImage `json:"base_image,omitempty"`
// Deprecated: Kind/Source/Ref/DefaultTarget/Writable are the pre-
// composition-model scalar shape — a single source, folded server-side
// into Sources[0] (legacyWorkspaceSource). Kept so
// `wardyn workspace create --kind local_dir --source /x` and existing SDK
// callers keep working; prefer Sources for a new caller, especially a
// multi-source one.
Kind types.WorkspaceKind `json:"kind,omitempty"`
Source string `json:"source,omitempty"`
Ref string `json:"ref,omitempty"`
DefaultTarget string `json:"default_target,omitempty"`
// Deprecated: see Kind. Writable opts the single legacy source into a
// READ-WRITE mount for import Record/Verify runs; omitted/false is
// read-only (the safe default). A sandboxed agent's changes then PERSIST
// to the host directory. A multi-source caller sets WorkspaceSource.Writable
// per source instead.
Writable bool `json:"writable,omitempty"`
// LLMCred is the operator-owned model/harness credential BINDING for this
// workspace/container (refs/names only). A run that picks the workspace
// inherits this model access. Nil => no binding. CREATE-ONLY: the update
// handler ignores it, so changing a binding needs the standalone
// PUT /workspaces/{id}/llm-cred route (not covered by this SDK).
LLMCred *types.WorkspaceLLMCred `json:"llm_cred,omitempty"`
}
WorkspaceRequest is the body for POST/PUT /api/v1/workspaces. Name is required, plus either Sources or the legacy scalar shape (Kind+Source); the server validates each source with the same deny-list the run path uses (local_dir bind-mount safety, repo slug/URL shape) before persisting.
internal/api aliases this type (`type workspaceRequest = client.WorkspaceRequest`) so server and SDK cannot drift; the server rejects unknown JSON fields, so a field missing here is unreachable from the SDK rather than merely undocumented.
type WorkspaceRequirement ¶ added in v0.5.0
type WorkspaceRequirement = types.WorkspaceRequirement
WorkspaceRequirement is one entry in Workspace.Requirements.
type WorkspaceSelection ¶ added in v0.5.0
type WorkspaceSelection struct {
// WorkspaceID is the workspace this selection applies to (string form of
// its uuid — matched against the run's referenced workspaces by id).
WorkspaceID string `json:"workspace_id"`
// EnabledOptional lists the workspace's OPTIONAL requirement KEYS (the
// exact "<type>:<key>" form, e.g. "egress:api.stripe.com" or
// "write:/home/user/repo") this run opts into. A key not listed here stays
// at its safe default (no egress, no grant, read-only mount).
EnabledOptional []string `json:"enabled_optional,omitempty"`
// ReadOnly, when set, NARROWS this workspace's write:<path> requirements —
// true forces every one read-only even if Required or enabled; false is a
// no-op (a selection may only narrow what the contract already grants,
// never widen it — see the fold in internal/api/runs_create.go). Nil
// leaves the contract's own resolved default in effect.
ReadOnly *bool `json:"read_only,omitempty"`
}
WorkspaceSelection is one per-run option set for an attached workspace. See CreateRunRequest.Workspaces.
type WorkspaceSource ¶ added in v0.5.0
type WorkspaceSource = types.WorkspaceSource
WorkspaceSource is one entry in a Workspace's composition, carried in WorkspaceRequest.Sources and returned in Workspace.Sources.
type WorkspaceSourceType ¶ added in v0.5.0
type WorkspaceSourceType = types.WorkspaceSourceType
WorkspaceSourceType discriminates a WorkspaceSource's kind (local_dir | repo | ephemeral).
type WorkspaceStatus ¶ added in v0.5.0
type WorkspaceStatus = types.WorkspaceStatus
WorkspaceStatus is the onboarding/scan lifecycle of a Workspace or Source (Workspace.Status, Source.Status): not-yet-scanned, mid-scan, scanned (ready to use), or errored.