| 1 | package provider |
| 2 | |
| 3 | import "encoding/json" |
| 4 | |
| 5 | const ( |
| 6 | MaxFrameBytes = 64 << 10 |
| 7 | MaxEventBytes = 16 << 10 |
| 8 | ) |
| 9 | |
| 10 | type ReadPolicy struct { |
| 11 | DeniedPaths []string `json:"denied_paths"` |
| 12 | ConfigHash string `json:"config_hash"` |
| 13 | } |
| 14 | |
| 15 | type Workspace struct { |
| 16 | ServerID string `json:"server_id"` |
| 17 | ProjectID string `json:"project_id"` |
| 18 | WorkspaceID string `json:"workspace_id"` |
| 19 | Path string `json:"path"` |
| 20 | } |
| 21 | |
| 22 | type Agent struct { |
| 23 | ServerID string `json:"server_id"` |
| 24 | AgentID string `json:"agent_id"` |
| 25 | ProviderSessionID string `json:"provider_session_id"` |
| 26 | WorkspaceID string `json:"workspace_id"` |
| 27 | AccountID string `json:"account_id"` |
| 28 | Provider string `json:"provider"` |
| 29 | Model string `json:"model"` |
| 30 | Family string `json:"family"` |
| 31 | } |
| 32 | |
| 33 | type WorkspaceRequest struct { |
| 34 | ResourceID string `json:"resource_id,omitempty"` |
| 35 | Isolation string `json:"isolation"` |
| 36 | ProjectID string `json:"project_id"` |
| 37 | Path string `json:"path"` |
| 38 | BaseCommit string `json:"base_commit"` |
| 39 | Branch string `json:"branch"` |
| 40 | IdempotencyKey string `json:"idempotency_key"` |
| 41 | Selection Selection `json:"selection"` |
| 42 | ReadPolicy ReadPolicy `json:"read_policy"` |
| 43 | } |
| 44 | |
| 45 | type MCPServer struct { |
| 46 | Type string `json:"type"` |
| 47 | Command string `json:"command"` |
| 48 | Args []string `json:"args"` |
| 49 | Env map[string]string `json:"env"` |
| 50 | } |
| 51 | |
| 52 | type Cursor struct { |
| 53 | Epoch string `json:"epoch"` |
| 54 | Sequence int64 `json:"sequence"` |
| 55 | } |
| 56 | |
| 57 | type RecordedEvent struct { |
| 58 | Kind string `json:"kind"` |
| 59 | ServerID string `json:"server_id"` |
| 60 | AgentID string `json:"agent_id"` |
| 61 | ProviderSessionID string `json:"provider_session_id"` |
| 62 | TurnID string `json:"turn_id"` |
| 63 | PermissionID string `json:"permission_id"` |
| 64 | Epoch string `json:"epoch"` |
| 65 | Sequence *int64 `json:"sequence"` |
| 66 | Payload json.RawMessage `json:"payload"` |
| 67 | } |
| 68 | |
| 69 | type PermissionResponse struct { |
| 70 | RequestID string `json:"request_id"` |
| 71 | Behavior string `json:"behavior"` |
| 72 | UpdatedInput json.RawMessage `json:"updated_input,omitempty"` |
| 73 | } |
| 74 | |
| 75 | type Intent struct { |
| 76 | Kind string |
| 77 | Key string |
| 78 | RequestHash string |
| 79 | Request json.RawMessage |
| 80 | } |
| 81 | |
| 82 | const ( |
| 83 | ErrContract Error = "provider_contract" |
| 84 | ErrClosed Error = "provider_closed" |
| 85 | ErrUncertain Error = "provider_uncertain" |
| 86 | ErrNotReady Error = "subscription_not_ready" |
| 87 | ErrCapability Error = "unsupported_capability" |
| 88 | ErrIsolation Error = "read_isolation_required" |
| 89 | ErrCreationAbsent Error = "creation_absent" |
| 90 | ErrAccountMismatch Error = "account_mismatch" |
| 91 | ) |
| 92 | |