mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
[codex][device-stable-id][12/n] Send source stable ID with managed auth requests
This commit is contained in:
@@ -1227,6 +1227,13 @@
|
||||
"refreshToken": {
|
||||
"description": "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
@@ -1442,6 +1449,13 @@
|
||||
"codexStreamlinedLogin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"chatgpt"
|
||||
@@ -1458,6 +1472,13 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"chatgptDeviceCode"
|
||||
|
||||
+21
@@ -10220,6 +10220,13 @@
|
||||
"refreshToken": {
|
||||
"description": "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"title": "GetAccountParams",
|
||||
@@ -11364,6 +11371,13 @@
|
||||
"codexStreamlinedLogin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"chatgpt"
|
||||
@@ -11380,6 +11394,13 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"chatgptDeviceCode"
|
||||
|
||||
+21
@@ -6616,6 +6616,13 @@
|
||||
"refreshToken": {
|
||||
"description": "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"title": "GetAccountParams",
|
||||
@@ -7809,6 +7816,13 @@
|
||||
"codexStreamlinedLogin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"chatgpt"
|
||||
@@ -7825,6 +7839,13 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"chatgptDeviceCode"
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
"refreshToken": {
|
||||
"description": "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"title": "GetAccountParams",
|
||||
|
||||
@@ -26,6 +26,13 @@
|
||||
"codexStreamlinedLogin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"chatgpt"
|
||||
@@ -42,6 +49,13 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sourceSurfaceStableId": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"chatgptDeviceCode"
|
||||
|
||||
@@ -10,4 +10,4 @@ export type GetAccountParams = {
|
||||
* external auth mode this flag is ignored. Clients should refresh tokens
|
||||
* themselves and call `account/login/start` with `chatgptAuthTokens`.
|
||||
*/
|
||||
refreshToken?: boolean, };
|
||||
refreshToken?: boolean, sourceSurfaceStableId?: string | null, };
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type LoginAccountParams = { "type": "apiKey", apiKey: string, } | { "type": "chatgpt", codexStreamlinedLogin?: boolean, } | { "type": "chatgptDeviceCode" } | { "type": "chatgptAuthTokens",
|
||||
export type LoginAccountParams = { "type": "apiKey", apiKey: string, } | { "type": "chatgpt", codexStreamlinedLogin?: boolean, sourceSurfaceStableId?: string | null, } | { "type": "chatgptDeviceCode", sourceSurfaceStableId?: string | null, } | { "type": "chatgptAuthTokens",
|
||||
/**
|
||||
* Access token (JWT) supplied by the client.
|
||||
* This token is used for backend API requests and email extraction.
|
||||
|
||||
@@ -1924,6 +1924,7 @@ mod tests {
|
||||
request_id: request_id(),
|
||||
params: v2::GetAccountParams {
|
||||
refresh_token: false,
|
||||
source_surface_stable_id: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -2624,6 +2625,7 @@ mod tests {
|
||||
request_id: RequestId::Integer(3),
|
||||
params: v2::LoginAccountParams::Chatgpt {
|
||||
codex_streamlined_login: false,
|
||||
source_surface_stable_id: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -2631,7 +2633,8 @@ mod tests {
|
||||
"method": "account/login/start",
|
||||
"id": 3,
|
||||
"params": {
|
||||
"type": "chatgpt"
|
||||
"type": "chatgpt",
|
||||
"sourceSurfaceStableId": null
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&request)?,
|
||||
@@ -2645,6 +2648,7 @@ mod tests {
|
||||
request_id: RequestId::Integer(3),
|
||||
params: v2::LoginAccountParams::Chatgpt {
|
||||
codex_streamlined_login: true,
|
||||
source_surface_stable_id: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -2653,7 +2657,8 @@ mod tests {
|
||||
"id": 3,
|
||||
"params": {
|
||||
"type": "chatgpt",
|
||||
"codexStreamlinedLogin": true
|
||||
"codexStreamlinedLogin": true,
|
||||
"sourceSurfaceStableId": null
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&request)?,
|
||||
@@ -2665,14 +2670,17 @@ mod tests {
|
||||
fn serialize_account_login_chatgpt_device_code() -> Result<()> {
|
||||
let request = ClientRequest::LoginAccount {
|
||||
request_id: RequestId::Integer(4),
|
||||
params: v2::LoginAccountParams::ChatgptDeviceCode,
|
||||
params: v2::LoginAccountParams::ChatgptDeviceCode {
|
||||
source_surface_stable_id: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "account/login/start",
|
||||
"id": 4,
|
||||
"params": {
|
||||
"type": "chatgptDeviceCode"
|
||||
"type": "chatgptDeviceCode",
|
||||
"sourceSurfaceStableId": null
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&request)?,
|
||||
@@ -2728,13 +2736,16 @@ mod tests {
|
||||
request_id: RequestId::Integer(6),
|
||||
params: v2::GetAccountParams {
|
||||
refresh_token: false,
|
||||
source_surface_stable_id: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "account/read",
|
||||
"id": 6,
|
||||
"params": {}
|
||||
"params": {
|
||||
"sourceSurfaceStableId": null
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&request)?,
|
||||
);
|
||||
@@ -2742,6 +2753,7 @@ mod tests {
|
||||
request_id: RequestId::Integer(7),
|
||||
params: v2::GetAccountParams {
|
||||
refresh_token: true,
|
||||
source_surface_stable_id: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -2749,7 +2761,8 @@ mod tests {
|
||||
"method": "account/read",
|
||||
"id": 7,
|
||||
"params": {
|
||||
"refreshToken": true
|
||||
"refreshToken": true,
|
||||
"sourceSurfaceStableId": null
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&request)?,
|
||||
|
||||
@@ -68,10 +68,17 @@ pub enum LoginAccountParams {
|
||||
Chatgpt {
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
codex_streamlined_login: bool,
|
||||
#[serde(default)]
|
||||
#[ts(optional = nullable)]
|
||||
source_surface_stable_id: Option<String>,
|
||||
},
|
||||
#[serde(rename = "chatgptDeviceCode", rename_all = "camelCase")]
|
||||
#[ts(rename = "chatgptDeviceCode", rename_all = "camelCase")]
|
||||
ChatgptDeviceCode {
|
||||
#[serde(default)]
|
||||
#[ts(optional = nullable)]
|
||||
source_surface_stable_id: Option<String>,
|
||||
},
|
||||
#[serde(rename = "chatgptDeviceCode")]
|
||||
#[ts(rename = "chatgptDeviceCode")]
|
||||
ChatgptDeviceCode,
|
||||
/// [UNSTABLE] FOR OPENAI INTERNAL USE ONLY - DO NOT USE.
|
||||
/// The access token must contain the same scopes that Codex-managed ChatGPT auth tokens have.
|
||||
#[experimental("account/login/start.chatgptAuthTokens")]
|
||||
@@ -374,6 +381,9 @@ pub struct GetAccountParams {
|
||||
/// themselves and call `account/login/start` with `chatgptAuthTokens`.
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub refresh_token: bool,
|
||||
#[serde(default)]
|
||||
#[ts(optional = nullable)]
|
||||
pub source_surface_stable_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
|
||||
Reference in New Issue
Block a user