mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
feat(app-server): expose live thread proxy runtime
This commit is contained in:
@@ -3826,6 +3826,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadGoal": {
|
||||
@@ -4685,6 +4698,27 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadRealtimeAudioChunk": {
|
||||
"description": "EXPERIMENTAL - thread realtime audio chunk.",
|
||||
"properties": {
|
||||
@@ -4950,6 +4984,17 @@
|
||||
},
|
||||
"ThreadSettingsUpdatedNotification": {
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Latest live managed-proxy runtime, or `null` when the proxy is inactive."
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
+45
@@ -17230,6 +17230,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadForkParams": {
|
||||
@@ -18659,6 +18672,27 @@
|
||||
"title": "ThreadNameUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadReadParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
@@ -19295,6 +19329,17 @@
|
||||
"ThreadSettingsUpdatedNotification": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Latest live managed-proxy runtime, or `null` when the proxy is inactive."
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
+45
@@ -15009,6 +15009,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadForkParams": {
|
||||
@@ -16438,6 +16451,27 @@
|
||||
"title": "ThreadNameUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadReadParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
@@ -17074,6 +17108,17 @@
|
||||
"ThreadSettingsUpdatedNotification": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Latest live managed-proxy runtime, or `null` when the proxy is inactive."
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -1186,6 +1186,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1939,6 +1952,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -993,6 +993,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1746,6 +1759,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
+34
@@ -993,6 +993,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1746,6 +1759,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -993,6 +993,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1746,6 +1759,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -1186,6 +1186,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1939,6 +1952,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -993,6 +993,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1746,6 +1759,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
+32
@@ -283,6 +283,27 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSettings": {
|
||||
"properties": {
|
||||
"activePermissionProfile": {
|
||||
@@ -366,6 +387,17 @@
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Latest live managed-proxy runtime, or `null` when the proxy is inactive."
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -1186,6 +1186,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1939,6 +1952,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -993,6 +993,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1746,6 +1759,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -993,6 +993,19 @@
|
||||
},
|
||||
"ThreadExtra": {
|
||||
"description": "Extra app-server data for a thread.",
|
||||
"properties": {
|
||||
"networkProxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ThreadNetworkProxyRuntime"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Runtime endpoints for the managed network proxy owned by this live thread."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadHistoryMode": {
|
||||
@@ -1746,6 +1759,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"ThreadNetworkProxyRuntime": {
|
||||
"description": "Live managed-proxy details for a thread running on the app-server host.",
|
||||
"properties": {
|
||||
"httpAddr": {
|
||||
"type": "string"
|
||||
},
|
||||
"mitm": {
|
||||
"description": "Whether the proxy intercepts TLS with a managed certificate authority.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"socksAddr": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"httpAddr",
|
||||
"mitm",
|
||||
"socksAddr"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadSource": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ThreadNetworkProxyRuntime } from "./ThreadNetworkProxyRuntime";
|
||||
|
||||
/**
|
||||
* Extra app-server data for a thread.
|
||||
*/
|
||||
export type ThreadExtra = Record<string, never>;
|
||||
export type ThreadExtra = {
|
||||
/**
|
||||
* Runtime endpoints for the managed network proxy owned by this live thread.
|
||||
*/
|
||||
networkProxy: ThreadNetworkProxyRuntime | null, };
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Live managed-proxy details for a thread running on the app-server host.
|
||||
*/
|
||||
export type ThreadNetworkProxyRuntime = { httpAddr: string, socksAddr: string,
|
||||
/**
|
||||
* Whether the proxy intercepts TLS with a managed certificate authority.
|
||||
*/
|
||||
mitm: boolean, };
|
||||
+6
-1
@@ -1,6 +1,11 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ThreadNetworkProxyRuntime } from "./ThreadNetworkProxyRuntime";
|
||||
import type { ThreadSettings } from "./ThreadSettings";
|
||||
|
||||
export type ThreadSettingsUpdatedNotification = { threadId: string, threadSettings: ThreadSettings, };
|
||||
export type ThreadSettingsUpdatedNotification = { threadId: string, threadSettings: ThreadSettings,
|
||||
/**
|
||||
* Latest live managed-proxy runtime, or `null` when the proxy is inactive.
|
||||
*/
|
||||
networkProxy: ThreadNetworkProxyRuntime | null, };
|
||||
|
||||
@@ -424,6 +424,7 @@ export type { ThreadMetadataGitInfoUpdateParams } from "./ThreadMetadataGitInfoU
|
||||
export type { ThreadMetadataUpdateParams } from "./ThreadMetadataUpdateParams";
|
||||
export type { ThreadMetadataUpdateResponse } from "./ThreadMetadataUpdateResponse";
|
||||
export type { ThreadNameUpdatedNotification } from "./ThreadNameUpdatedNotification";
|
||||
export type { ThreadNetworkProxyRuntime } from "./ThreadNetworkProxyRuntime";
|
||||
export type { ThreadReadParams } from "./ThreadReadParams";
|
||||
export type { ThreadReadResponse } from "./ThreadReadResponse";
|
||||
export type { ThreadRealtimeAudioChunk } from "./ThreadRealtimeAudioChunk";
|
||||
|
||||
@@ -3632,6 +3632,7 @@ mod tests {
|
||||
multi_agent_mode: Default::default(),
|
||||
personality: None,
|
||||
},
|
||||
network_proxy: None,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
|
||||
@@ -6,6 +6,7 @@ use super::SandboxPolicy;
|
||||
use super::Thread;
|
||||
use super::ThreadHistoryMode;
|
||||
use super::ThreadItem;
|
||||
use super::ThreadNetworkProxyRuntime;
|
||||
use super::ThreadSource;
|
||||
use super::Turn;
|
||||
use super::TurnEnvironmentParams;
|
||||
@@ -300,6 +301,8 @@ pub struct ThreadSettings {
|
||||
pub struct ThreadSettingsUpdatedNotification {
|
||||
pub thread_id: String,
|
||||
pub thread_settings: ThreadSettings,
|
||||
/// Latest live managed-proxy runtime, or `null` when the proxy is inactive.
|
||||
pub network_proxy: Option<ThreadNetworkProxyRuntime>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
|
||||
@@ -3,6 +3,7 @@ use super::ThreadItem;
|
||||
use super::ThreadStatus;
|
||||
use super::TurnStatus;
|
||||
use codex_experimental_api_macros::ExperimentalApi;
|
||||
use codex_protocol::protocol::SessionNetworkProxyRuntime as CoreSessionNetworkProxyRuntime;
|
||||
use codex_protocol::protocol::SessionSource as CoreSessionSource;
|
||||
use codex_protocol::protocol::SubAgentSource as CoreSubAgentSource;
|
||||
use codex_protocol::protocol::ThreadHistoryMode as CoreThreadHistoryMode;
|
||||
@@ -150,10 +151,34 @@ impl From<ThreadSource> for CoreThreadSource {
|
||||
}
|
||||
|
||||
/// Extra app-server data for a thread.
|
||||
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase", export_to = "v2/")]
|
||||
pub struct ThreadExtra {
|
||||
/// Runtime endpoints for the managed network proxy owned by this live thread.
|
||||
pub network_proxy: Option<ThreadNetworkProxyRuntime>,
|
||||
}
|
||||
|
||||
/// Live managed-proxy details for a thread running on the app-server host.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase", export_to = "v2/")]
|
||||
pub struct ThreadExtra {}
|
||||
pub struct ThreadNetworkProxyRuntime {
|
||||
pub http_addr: String,
|
||||
pub socks_addr: String,
|
||||
/// Whether the proxy intercepts TLS with a managed certificate authority.
|
||||
pub mitm: bool,
|
||||
}
|
||||
|
||||
impl From<CoreSessionNetworkProxyRuntime> for ThreadNetworkProxyRuntime {
|
||||
fn from(value: CoreSessionNetworkProxyRuntime) -> Self {
|
||||
Self {
|
||||
http_addr: value.http_addr,
|
||||
socks_addr: value.socks_addr,
|
||||
mitm: value.mitm,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
@@ -140,7 +140,7 @@ Example with notification opt-out:
|
||||
- `thread/start` — create a new thread; emits `thread/started` (including the current `thread.status`) and auto-subscribes you to turn/item events for that thread. When the request includes a `cwd` and the resolved sandbox is `workspace-write` or full access, app-server also marks that project as trusted in the user `config.toml`. Pass `sessionStartSource: "clear"` when starting a replacement thread after clearing the current session so `SessionStart` hooks receive `source: "clear"` instead of the default `"startup"`. Experimental `allowProviderModelFallback` lets providers backed by an authoritative static model catalog replace an unavailable requested `model` with the catalog default; dynamic or cached catalogs preserve the requested model. Experimental `runtimeWorkspaceRoots` replaces the thread-scoped runtime workspace roots used to materialize `:workspace_roots`; paths must be absolute. For permissions, prefer experimental `permissions` profile selection by id; the legacy `sandbox` shorthand is still accepted but cannot be combined with `permissions`. Deprecated experimental `multiAgentMode` is ignored; use Ultra reasoning effort for proactive multi-agent behavior. Experimental `environments` selects the sticky execution environments for turns on the thread; omit it to use the server default, pass `[]` to disable environments, or pass explicit environment ids with per-environment `cwd`. Experimental `selectedCapabilityRoots` selects environment-owned plugin or standalone-skill roots using environment-native absolute paths. Skills found below those roots are listed and read through the owning environment. Stdio MCP servers declared by selected plugins are started in that environment, and HTTP MCP connections use that environment's HTTP client.
|
||||
- `thread/resume` — reopen an existing thread by id so subsequent `turn/start` calls append to it. Accepts the same permission override rules as `thread/start`.
|
||||
- `thread/fork` — fork an existing thread into a new thread id by copying the stored history; pass an optional `lastTurnId` to copy history only through that turn, inclusive, and drop later turns from the fork. An in-progress `lastTurnId` is rejected. If `lastTurnId` is null while the source thread is mid-turn, the fork records the same interruption marker as `turn/interrupt` instead of inheriting an unmarked partial turn suffix. The returned `thread.forkedFromId` points at the source thread when known. Accepts `ephemeral: true` for an in-memory temporary fork, emits `thread/started` (including the current `thread.status`), and auto-subscribes you to turn/item events for the new thread. Experimental clients can pass `excludeTurns: true` when they plan to page fork history via `thread/turns/list` instead of receiving the full turn array immediately. Accepts the same permission override rules as `thread/start`.
|
||||
- `thread/start`, `thread/resume`, and `thread/fork` responses include the legacy `sandbox` compatibility projection. `instructionSources` lists loaded instruction files using each source environment's native absolute path syntax, including files loaded from remote environments. Experimental clients can read `runtimeWorkspaceRoots` for the thread-scoped runtime roots and `activePermissionProfile` for the named or implicit built-in profile identity/provenance when known. Their deprecated experimental `multiAgentMode` field, and the corresponding thread setting, always report `explicitRequestOnly`; Ultra reasoning effort is the source of proactive multi-agent behavior.
|
||||
- `thread/start`, `thread/resume`, and `thread/fork` responses include the legacy `sandbox` compatibility projection. `instructionSources` lists loaded instruction files using each source environment's native absolute path syntax, including files loaded from remote environments. Experimental clients can read `runtimeWorkspaceRoots` for the thread-scoped runtime roots and `activePermissionProfile` for the named or implicit built-in profile identity/provenance when known. When a live thread owns a managed network proxy, experimental `thread.extra.networkProxy` reports its runtime `httpAddr`, `socksAddr`, and whether TLS `mitm` interception is active; these host-local endpoints are omitted from stored/listed thread metadata. Their deprecated experimental `multiAgentMode` field, and the corresponding thread setting, always report `explicitRequestOnly`; Ultra reasoning effort is the source of proactive multi-agent behavior.
|
||||
- `thread/list` — page through stored threads; supports cursor-based pagination and optional `modelProviders`, `sourceKinds`, `archived`, `cwd`, and `searchTerm` filters. Experimental clients can use `parentThreadId` for direct spawned children or `ancestorThreadId` for spawned descendants at any depth; the two filters are mutually exclusive. Review and Guardian threads are not included because they do not participate in that spawn-edge lifecycle. Each returned `thread` includes `status` (`ThreadStatus`), defaulting to `notLoaded` when the thread is not currently loaded. Subagent threads also include `parentThreadId` when the immediate parent is known.
|
||||
- `thread/loaded/list` — list the thread ids currently loaded in memory.
|
||||
- `thread/read` — read a stored thread by id without resuming it; optionally include turns via `includeTurns`. The returned `thread` includes `status` (`ThreadStatus`), defaulting to `notLoaded` when the thread is not currently loaded.
|
||||
@@ -155,7 +155,7 @@ Example with notification opt-out:
|
||||
- `thread/goal/clear` — clear the current persisted goal for a materialized thread; returns whether a goal was removed and emits `thread/goal/cleared` when state changes.
|
||||
- `thread/goal/updated` — notification emitted whenever a thread goal changes; includes the full current goal.
|
||||
- `thread/goal/cleared` — notification emitted whenever a thread goal is removed.
|
||||
- `thread/settings/updated` — experimental notification emitted to subscribed clients when a loaded thread’s effective next-turn settings change; includes `threadId` and the full `threadSettings`.
|
||||
- `thread/settings/updated` — experimental notification emitted to subscribed clients when a loaded thread’s effective next-turn settings change; includes `threadId`, the full `threadSettings`, and the latest live managed-proxy runtime in `networkProxy` (or `null` when inactive).
|
||||
- `thread/status/changed` — notification emitted when a loaded thread’s status changes (`threadId` + new `status`).
|
||||
- `thread/archive` — move a thread’s rollout file into the archived directory and attempt to move any spawned descendant thread rollout files; returns `{}` on success and emits `thread/archived` for each archived thread.
|
||||
- `thread/delete` — hard-delete an active or archived thread and any spawned descendant threads; returns `{}` on success and emits `thread/deleted` for each deleted thread.
|
||||
|
||||
@@ -1267,11 +1267,16 @@ pub(crate) async fn apply_bespoke_event_handling(
|
||||
state.note_thread_settings(thread_settings.clone())
|
||||
};
|
||||
if changed {
|
||||
let network_proxy = conversation
|
||||
.current_network_proxy_runtime()
|
||||
.await
|
||||
.map(Into::into);
|
||||
outgoing
|
||||
.send_server_notification(ServerNotification::ThreadSettingsUpdated(
|
||||
ThreadSettingsUpdatedNotification {
|
||||
thread_id: conversation_id.to_string(),
|
||||
thread_settings,
|
||||
network_proxy,
|
||||
},
|
||||
))
|
||||
.await;
|
||||
|
||||
@@ -196,6 +196,7 @@ use codex_app_server_protocol::ThreadDecrementElicitationResponse;
|
||||
use codex_app_server_protocol::ThreadDeleteParams;
|
||||
use codex_app_server_protocol::ThreadDeleteResponse;
|
||||
use codex_app_server_protocol::ThreadDeletedNotification;
|
||||
use codex_app_server_protocol::ThreadExtra;
|
||||
use codex_app_server_protocol::ThreadForkParams;
|
||||
use codex_app_server_protocol::ThreadForkResponse;
|
||||
use codex_app_server_protocol::ThreadGoal;
|
||||
@@ -618,6 +619,15 @@ pub(crate) use self::thread_summary::summary_to_thread;
|
||||
pub(crate) use self::thread_summary::thread_settings_from_config_snapshot;
|
||||
pub(crate) use self::thread_summary::thread_settings_from_core_snapshot;
|
||||
|
||||
async fn thread_extra_from_live_thread(thread: &CodexThread) -> Option<ThreadExtra> {
|
||||
thread
|
||||
.current_network_proxy_runtime()
|
||||
.await
|
||||
.map(|network_proxy| ThreadExtra {
|
||||
network_proxy: Some(network_proxy.into()),
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn build_api_turns_from_rollout_items(items: &[RolloutItem]) -> Vec<Turn> {
|
||||
let mut builder = ThreadHistoryBuilder::new();
|
||||
for item in items {
|
||||
|
||||
@@ -649,6 +649,7 @@ pub(super) async fn handle_pending_thread_resume_request(
|
||||
thread_response_active_permission_profile(active_permission_profile);
|
||||
let session_id = conversation.session_configured().session_id.to_string();
|
||||
thread.session_id = session_id;
|
||||
thread.extra = thread_extra_from_live_thread(conversation.as_ref()).await;
|
||||
|
||||
let response = ThreadResumeResponse {
|
||||
thread,
|
||||
|
||||
@@ -1220,6 +1220,7 @@ impl ThreadRequestProcessor {
|
||||
otel.name = "app_server.thread_start.config_snapshot",
|
||||
))
|
||||
.await;
|
||||
let thread_extra = thread_extra_from_live_thread(thread.as_ref()).await;
|
||||
let mut thread = build_thread_from_snapshot(
|
||||
thread_id,
|
||||
session_configured.session_id.to_string(),
|
||||
@@ -1266,6 +1267,7 @@ impl ThreadRequestProcessor {
|
||||
.await,
|
||||
/*has_in_progress_turn*/ false,
|
||||
);
|
||||
thread.extra = thread_extra;
|
||||
|
||||
let sandbox = thread_response_sandbox_policy(
|
||||
&config_snapshot.permission_profile,
|
||||
@@ -2268,6 +2270,11 @@ impl ThreadRequestProcessor {
|
||||
thread_status,
|
||||
has_live_in_progress_turn,
|
||||
);
|
||||
thread.extra = if let Some(loaded_thread) = loaded_thread.as_ref() {
|
||||
thread_extra_from_live_thread(loaded_thread.as_ref()).await
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Ok(thread)
|
||||
}
|
||||
|
||||
@@ -2784,6 +2791,7 @@ impl ThreadRequestProcessor {
|
||||
return Ok(());
|
||||
}
|
||||
let instruction_sources = codex_thread.legacy_instruction_sources().await;
|
||||
let thread_extra = thread_extra_from_live_thread(codex_thread.as_ref()).await;
|
||||
let SessionConfiguredEvent { rollout_path, .. } = session_configured;
|
||||
let Some(rollout_path) = rollout_path else {
|
||||
let error =
|
||||
@@ -2843,6 +2851,7 @@ impl ThreadRequestProcessor {
|
||||
thread_status,
|
||||
/*has_live_in_progress_turn*/ false,
|
||||
);
|
||||
thread.extra = thread_extra;
|
||||
let config_snapshot = codex_thread.config_snapshot().await;
|
||||
let sandbox = thread_response_sandbox_policy(
|
||||
&config_snapshot.permission_profile,
|
||||
@@ -3600,6 +3609,7 @@ impl ThreadRequestProcessor {
|
||||
.await,
|
||||
/*has_in_progress_turn*/ false,
|
||||
);
|
||||
thread.extra = thread_extra_from_live_thread(forked_thread.as_ref()).await;
|
||||
let config_snapshot = forked_thread.config_snapshot().await;
|
||||
let sandbox = thread_response_sandbox_policy(
|
||||
&config_snapshot.permission_profile,
|
||||
|
||||
@@ -27,6 +27,7 @@ use core_test_support::responses;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::Value;
|
||||
use std::collections::BTreeMap;
|
||||
use std::net::SocketAddr;
|
||||
use std::time::Duration;
|
||||
use tempfile::TempDir;
|
||||
use tokio::time::timeout;
|
||||
@@ -291,6 +292,105 @@ async fn thread_settings_update_rejects_sandbox_policy_with_permissions() -> Res
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||
#[tokio::test]
|
||||
async fn thread_settings_update_reports_current_managed_proxy_runtime() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
r#"
|
||||
default_permissions = ":danger-full-access"
|
||||
|
||||
[features]
|
||||
network_proxy = true
|
||||
|
||||
[permissions.networked.filesystem]
|
||||
":root" = "read"
|
||||
|
||||
[permissions.networked.network]
|
||||
enabled = true
|
||||
proxy_url = "http://127.0.0.1:0"
|
||||
enable_socks5 = false
|
||||
"#,
|
||||
)?;
|
||||
let mut mcp = TestAppServer::new_with_auto_env(codex_home.path()).await?;
|
||||
timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;
|
||||
|
||||
let request_id = mcp
|
||||
.send_thread_start_request_with_auto_env(ThreadStartParams::default())
|
||||
.await?;
|
||||
let response: JSONRPCResponse = timeout(
|
||||
DEFAULT_TIMEOUT,
|
||||
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
|
||||
)
|
||||
.await??;
|
||||
let thread = to_response::<ThreadStartResponse>(response)?.thread;
|
||||
assert_eq!(thread.extra, None);
|
||||
|
||||
send_thread_settings_update(
|
||||
&mut mcp,
|
||||
ThreadSettingsUpdateParams {
|
||||
thread_id: thread.id.clone(),
|
||||
permissions: Some("networked".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
let enabled = read_thread_settings_updated(&mut mcp).await?;
|
||||
let enabled_proxy = enabled
|
||||
.network_proxy
|
||||
.context("managed profile should report a live proxy")?;
|
||||
let http_addr = enabled_proxy.http_addr.parse::<SocketAddr>()?;
|
||||
assert!(http_addr.ip().is_loopback());
|
||||
assert_ne!(http_addr.port(), 0);
|
||||
assert!(!enabled_proxy.mitm);
|
||||
tokio::net::TcpStream::connect(http_addr).await?;
|
||||
|
||||
let read = read_thread(&mut mcp, &thread.id).await?;
|
||||
assert_eq!(
|
||||
read.thread.extra.and_then(|extra| extra.network_proxy),
|
||||
Some(enabled_proxy)
|
||||
);
|
||||
|
||||
send_thread_settings_update(
|
||||
&mut mcp,
|
||||
ThreadSettingsUpdateParams {
|
||||
thread_id: thread.id.clone(),
|
||||
permissions: Some(":danger-full-access".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
let disabled = read_thread_settings_updated(&mut mcp).await?;
|
||||
assert_eq!(disabled.network_proxy, None);
|
||||
assert_eq!(read_thread(&mut mcp, &thread.id).await?.thread.extra, None);
|
||||
|
||||
send_thread_settings_update(
|
||||
&mut mcp,
|
||||
ThreadSettingsUpdateParams {
|
||||
thread_id: thread.id.clone(),
|
||||
permissions: Some("networked".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
let reenabled = read_thread_settings_updated(&mut mcp).await?;
|
||||
let reenabled_proxy = reenabled
|
||||
.network_proxy
|
||||
.context("restored managed profile should report its current proxy")?;
|
||||
let http_addr = reenabled_proxy.http_addr.parse::<SocketAddr>()?;
|
||||
tokio::net::TcpStream::connect(http_addr).await?;
|
||||
assert_eq!(
|
||||
read_thread(&mut mcp, &thread.id)
|
||||
.await?
|
||||
.thread
|
||||
.extra
|
||||
.and_then(|extra| extra.network_proxy),
|
||||
Some(reenabled_proxy)
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn turn_start_settings_override_emits_thread_settings_updated() -> Result<()> {
|
||||
let server = create_mock_responses_server_sequence_unchecked(vec![
|
||||
@@ -409,6 +509,21 @@ async fn read_thread_with_turns(
|
||||
to_response(response)
|
||||
}
|
||||
|
||||
async fn read_thread(mcp: &mut TestAppServer, thread_id: &str) -> Result<ThreadReadResponse> {
|
||||
let request_id = mcp
|
||||
.send_thread_read_request(ThreadReadParams {
|
||||
thread_id: thread_id.to_string(),
|
||||
include_turns: false,
|
||||
})
|
||||
.await?;
|
||||
let response: JSONRPCResponse = timeout(
|
||||
DEFAULT_TIMEOUT,
|
||||
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
|
||||
)
|
||||
.await??;
|
||||
to_response(response)
|
||||
}
|
||||
|
||||
async fn read_thread_settings_updated(
|
||||
mcp: &mut TestAppServer,
|
||||
) -> Result<ThreadSettingsUpdatedNotification> {
|
||||
|
||||
@@ -37,6 +37,7 @@ use codex_protocol::openai_models::ReasoningEffort;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::net::SocketAddr;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use tempfile::TempDir;
|
||||
@@ -75,6 +76,52 @@ async fn start_thread_with_model(
|
||||
to_response(response)
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||
#[tokio::test]
|
||||
async fn thread_start_returns_live_managed_proxy_in_experimental_extra() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
r#"
|
||||
default_permissions = "workspace"
|
||||
|
||||
[features]
|
||||
network_proxy = true
|
||||
|
||||
[permissions.workspace.network]
|
||||
enabled = true
|
||||
mode = "full"
|
||||
proxy_url = "http://127.0.0.1:0"
|
||||
enable_socks5 = false
|
||||
"#,
|
||||
)?;
|
||||
let mut mcp = TestAppServer::new_with_auto_env(codex_home.path()).await?;
|
||||
timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??;
|
||||
|
||||
let request_id = mcp
|
||||
.send_thread_start_request_with_auto_env(ThreadStartParams::default())
|
||||
.await?;
|
||||
let response: JSONRPCResponse = timeout(
|
||||
DEFAULT_READ_TIMEOUT,
|
||||
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
|
||||
)
|
||||
.await??;
|
||||
let response: ThreadStartResponse = to_response(response)?;
|
||||
let network_proxy = response
|
||||
.thread
|
||||
.extra
|
||||
.and_then(|extra| extra.network_proxy)
|
||||
.context("thread.extra.networkProxy should contain the live managed proxy")?;
|
||||
let http_addr = network_proxy.http_addr.parse::<SocketAddr>()?;
|
||||
let socks_addr = network_proxy.socks_addr.parse::<SocketAddr>()?;
|
||||
|
||||
assert!(http_addr.ip().is_loopback());
|
||||
assert_ne!(http_addr.port(), 0);
|
||||
assert!(socks_addr.ip().is_loopback());
|
||||
assert!(!network_proxy.mitm);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_start_provider_model_fallback_applies_to_configured_model() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
|
||||
@@ -27,6 +27,7 @@ use codex_protocol::protocol::Op;
|
||||
use codex_protocol::protocol::RolloutItem;
|
||||
use codex_protocol::protocol::SandboxPolicy;
|
||||
use codex_protocol::protocol::SessionConfiguredEvent;
|
||||
use codex_protocol::protocol::SessionNetworkProxyRuntime;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
use codex_protocol::protocol::Submission;
|
||||
use codex_protocol::protocol::ThreadHistoryMode;
|
||||
@@ -495,6 +496,14 @@ impl CodexThread {
|
||||
self.session_configured.clone()
|
||||
}
|
||||
|
||||
/// Returns the managed network proxy runtime currently active for this thread.
|
||||
///
|
||||
/// Unlike [`Self::session_configured`], this reflects live permission-profile and proxy
|
||||
/// configuration changes made after the thread started.
|
||||
pub async fn current_network_proxy_runtime(&self) -> Option<SessionNetworkProxyRuntime> {
|
||||
self.codex.session.current_network_proxy_runtime().await
|
||||
}
|
||||
|
||||
pub(crate) fn is_running(&self) -> bool {
|
||||
!self.codex.tx_sub.is_closed()
|
||||
}
|
||||
|
||||
@@ -85,6 +85,11 @@ impl NetworkProxySpec {
|
||||
self.config.network.enable_socks5
|
||||
}
|
||||
|
||||
/// Returns whether this proxy intercepts TLS instead of tunneling it end to end.
|
||||
pub fn mitm_enabled(&self) -> bool {
|
||||
self.config.network.mitm
|
||||
}
|
||||
|
||||
pub(crate) fn from_config_and_constraints(
|
||||
config: NetworkProxyConfig,
|
||||
requirements: Option<NetworkConstraints>,
|
||||
|
||||
@@ -1058,6 +1058,7 @@ impl Session {
|
||||
SessionNetworkProxyRuntime {
|
||||
http_addr: proxy.http_addr().to_string(),
|
||||
socks_addr: proxy.socks_addr().to_string(),
|
||||
mitm: spec.mitm_enabled(),
|
||||
}
|
||||
};
|
||||
Ok((network_proxy, session_network_proxy))
|
||||
@@ -1089,6 +1090,7 @@ impl Session {
|
||||
Ok(spec) => spec,
|
||||
Err(err) => {
|
||||
warn!("failed to rebuild managed network proxy policy for sandbox change: {err}");
|
||||
self.services.network_proxy.store(None);
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -1105,6 +1107,7 @@ impl Session {
|
||||
if let Some(started_proxy) = self.services.network_proxy.load_full() {
|
||||
if let Err(err) = spec.apply_to_started_proxy(started_proxy.as_ref()).await {
|
||||
warn!("failed to refresh managed network proxy for sandbox change: {err}");
|
||||
self.services.network_proxy.store(None);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1135,6 +1138,39 @@ impl Session {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn current_network_proxy_runtime(&self) -> Option<SessionNetworkProxyRuntime> {
|
||||
let Ok(_refresh_guard) = self.managed_network_proxy_refresh_lock.acquire().await else {
|
||||
warn!("managed network proxy refresh semaphore closed while reading runtime");
|
||||
return None;
|
||||
};
|
||||
let permission_profile = {
|
||||
let state = self.state.lock().await;
|
||||
state.session_configuration.permission_profile()
|
||||
};
|
||||
if !Self::managed_network_proxy_active_for_permission_profile(&permission_profile) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let started_proxy = self.services.network_proxy.load_full()?;
|
||||
let proxy = started_proxy.proxy();
|
||||
let config = match proxy.current_cfg().await {
|
||||
Ok(config) => config,
|
||||
Err(err) => {
|
||||
warn!("failed to read managed network proxy runtime config: {err}");
|
||||
return None;
|
||||
}
|
||||
};
|
||||
if !config.network.enabled {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(SessionNetworkProxyRuntime {
|
||||
http_addr: proxy.http_addr().to_string(),
|
||||
socks_addr: proxy.socks_addr().to_string(),
|
||||
mitm: config.network.mitm,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) async fn codex_home(&self) -> AbsolutePathBuf {
|
||||
let state = self.state.lock().await;
|
||||
|
||||
@@ -99,6 +99,10 @@ use codex_config::permissions_toml::PermissionsToml;
|
||||
use codex_execpolicy::Decision;
|
||||
use codex_execpolicy::NetworkRuleProtocol;
|
||||
use codex_execpolicy::Policy;
|
||||
use codex_network_proxy::InjectedHeaderConfig;
|
||||
use codex_network_proxy::MitmHookActionsConfig;
|
||||
use codex_network_proxy::MitmHookConfig;
|
||||
use codex_network_proxy::MitmHookMatchConfig;
|
||||
use codex_network_proxy::NetworkProxyConfig;
|
||||
use codex_otel::MetricsClient;
|
||||
use codex_otel::MetricsConfig;
|
||||
@@ -993,6 +997,130 @@ async fn new_turn_refreshes_managed_network_proxy_for_sandbox_change() -> anyhow
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn current_network_proxy_runtime_tracks_live_configuration() -> anyhow::Result<()> {
|
||||
let permission_profile = PermissionProfile::workspace_write();
|
||||
let spec = crate::config::NetworkProxySpec::from_config_and_constraints(
|
||||
NetworkProxyConfig::default(),
|
||||
Some(NetworkConstraints {
|
||||
enabled: Some(true),
|
||||
..Default::default()
|
||||
}),
|
||||
&permission_profile,
|
||||
)?;
|
||||
let session = make_session_with_config({
|
||||
let permission_profile = permission_profile.clone();
|
||||
let spec = spec.clone();
|
||||
move |config| {
|
||||
config
|
||||
.permissions
|
||||
.set_permission_profile(permission_profile)
|
||||
.expect("test setup should allow permission profile");
|
||||
config.permissions.network = Some(spec);
|
||||
}
|
||||
})
|
||||
.await?;
|
||||
let initial_runtime = session
|
||||
.current_network_proxy_runtime()
|
||||
.await
|
||||
.expect("managed network proxy should be active");
|
||||
assert!(!initial_runtime.mitm);
|
||||
|
||||
let started_proxy = session
|
||||
.services
|
||||
.network_proxy
|
||||
.load_full()
|
||||
.expect("managed network proxy should be present");
|
||||
let mut mitm_config = NetworkProxyConfig::default();
|
||||
mitm_config.network.mitm = true;
|
||||
let mitm_spec = crate::config::NetworkProxySpec::from_config_and_constraints(
|
||||
mitm_config,
|
||||
Some(NetworkConstraints {
|
||||
enabled: Some(true),
|
||||
..Default::default()
|
||||
}),
|
||||
&permission_profile,
|
||||
)?;
|
||||
mitm_spec
|
||||
.apply_to_started_proxy(started_proxy.as_ref())
|
||||
.await?;
|
||||
assert_eq!(
|
||||
session.current_network_proxy_runtime().await,
|
||||
Some(SessionNetworkProxyRuntime {
|
||||
http_addr: started_proxy.proxy().http_addr().to_string(),
|
||||
socks_addr: started_proxy.proxy().socks_addr().to_string(),
|
||||
mitm: true,
|
||||
})
|
||||
);
|
||||
|
||||
session
|
||||
.update_settings(SessionSettingsUpdate {
|
||||
permission_profile: Some(PermissionProfile::Disabled),
|
||||
..Default::default()
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.current_network_proxy_runtime().await, None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn managed_network_proxy_refresh_failure_clears_stale_runtime() -> anyhow::Result<()> {
|
||||
let secret_dir = tempfile::tempdir()?;
|
||||
let secret_path = secret_dir.path().join("proxy-secret");
|
||||
std::fs::write(&secret_path, "secret")?;
|
||||
|
||||
let permission_profile = PermissionProfile::workspace_write();
|
||||
let mut network_config = NetworkProxyConfig::default();
|
||||
network_config.network.mitm = true;
|
||||
network_config.network.mitm_hooks = vec![MitmHookConfig {
|
||||
host: "api.example.com".to_string(),
|
||||
matcher: MitmHookMatchConfig {
|
||||
methods: vec!["POST".to_string()],
|
||||
path_prefixes: vec!["/v1/".to_string()],
|
||||
..Default::default()
|
||||
},
|
||||
actions: MitmHookActionsConfig {
|
||||
inject_request_headers: vec![InjectedHeaderConfig {
|
||||
name: "authorization".to_string(),
|
||||
secret_file: Some(secret_path.display().to_string()),
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
},
|
||||
}];
|
||||
let spec = crate::config::NetworkProxySpec::from_config_and_constraints(
|
||||
network_config,
|
||||
Some(NetworkConstraints {
|
||||
enabled: Some(true),
|
||||
..Default::default()
|
||||
}),
|
||||
&permission_profile,
|
||||
)?;
|
||||
let session = make_session_with_config(move |config| {
|
||||
config
|
||||
.permissions
|
||||
.set_permission_profile(permission_profile)
|
||||
.expect("test setup should allow permission profile");
|
||||
config.permissions.network = Some(spec);
|
||||
})
|
||||
.await?;
|
||||
assert!(session.current_network_proxy_runtime().await.is_some());
|
||||
|
||||
std::fs::remove_file(secret_path)?;
|
||||
session
|
||||
.update_settings(SessionSettingsUpdate {
|
||||
permission_profile: Some(PermissionProfile::read_only()),
|
||||
..Default::default()
|
||||
})
|
||||
.await?;
|
||||
|
||||
assert!(session.services.network_proxy.load_full().is_none());
|
||||
assert_eq!(session.current_network_proxy_runtime().await, None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn danger_full_access_turns_do_not_expose_managed_network_proxy() -> anyhow::Result<()> {
|
||||
let network_spec = crate::config::NetworkProxySpec::from_config_and_constraints(
|
||||
|
||||
@@ -3848,6 +3848,9 @@ pub struct SkillToolDependency {
|
||||
pub struct SessionNetworkProxyRuntime {
|
||||
pub http_addr: String,
|
||||
pub socks_addr: String,
|
||||
/// Whether the runtime proxy intercepts TLS with its managed CA.
|
||||
#[serde(default)]
|
||||
pub mitm: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, JsonSchema, TS)]
|
||||
|
||||
Reference in New Issue
Block a user