feat: session detail API (#23203)

This commit is contained in:
Danny Kopping
2026-03-26 18:09:53 +02:00
committed by GitHub
parent e937f89081
commit 801e57d430
19 changed files with 2759 additions and 91 deletions
+121
View File
@@ -207,3 +207,124 @@ curl -X GET http://coder-server:8080/api/v2/aibridge/sessions \
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.AIBridgeListSessionsResponse](schemas.md#codersdkaibridgelistsessionsresponse) |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get AI Bridge session threads
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/aibridge/sessions/{session_id} \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /aibridge/sessions/{session_id}`
### Parameters
| Name | In | Type | Required | Description |
|--------------|-------|---------|----------|-----------------------------------------------------|
| `session_id` | path | string | true | Session ID (client_session_id or interception UUID) |
| `after_id` | query | string | false | Thread pagination cursor (forward/older) |
| `before_id` | query | string | false | Thread pagination cursor (backward/newer) |
| `limit` | query | integer | false | Number of threads per page (default 50) |
### Example responses
> 200 Response
```json
{
"client": "string",
"ended_at": "2019-08-24T14:15:22Z",
"id": "string",
"initiator": {
"avatar_url": "http://example.com",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"username": "string"
},
"metadata": {
"property1": null,
"property2": null
},
"models": [
"string"
],
"page_ended_at": "2019-08-24T14:15:22Z",
"page_started_at": "2019-08-24T14:15:22Z",
"providers": [
"string"
],
"started_at": "2019-08-24T14:15:22Z",
"threads": [
{
"agentic_actions": [
{
"model": "string",
"thinking": [
{
"text": "string"
}
],
"token_usage": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
},
"tool_calls": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"injected": true,
"input": "string",
"interception_id": "34d9b688-63ad-46f4-88b5-665c1e7f7824",
"metadata": {
"property1": null,
"property2": null
},
"provider_response_id": "string",
"server_url": "string",
"tool": "string"
}
]
}
],
"ended_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"model": "string",
"prompt": "string",
"provider": "string",
"started_at": "2019-08-24T14:15:22Z",
"token_usage": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
}
}
],
"token_usage_summary": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
}
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.AIBridgeSessionThreadsResponse](schemas.md#codersdkaibridgesessionthreadsresponse) |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
+291
View File
@@ -337,6 +337,52 @@
| `groups` | array of [codersdk.Group](#codersdkgroup) | false | | |
| `users` | array of [codersdk.ReducedUser](#codersdkreduceduser) | false | | |
## codersdk.AIBridgeAgenticAction
```json
{
"model": "string",
"thinking": [
{
"text": "string"
}
],
"token_usage": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
},
"tool_calls": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"injected": true,
"input": "string",
"interception_id": "34d9b688-63ad-46f4-88b5-665c1e7f7824",
"metadata": {
"property1": null,
"property2": null
},
"provider_response_id": "string",
"server_url": "string",
"tool": "string"
}
]
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|---------------|----------------------------------------------------------------------------------------|----------|--------------|-------------|
| `model` | string | false | | |
| `thinking` | array of [codersdk.AIBridgeModelThought](#codersdkaibridgemodelthought) | false | | |
| `token_usage` | [codersdk.AIBridgeSessionThreadsTokenUsage](#codersdkaibridgesessionthreadstokenusage) | false | | |
| `tool_calls` | array of [codersdk.AIBridgeToolCall](#codersdkaibridgetoolcall) | false | | |
## codersdk.AIBridgeAnthropicConfig
```json
@@ -643,6 +689,20 @@
| `count` | integer | false | | |
| `sessions` | array of [codersdk.AIBridgeSession](#codersdkaibridgesession) | false | | |
## codersdk.AIBridgeModelThought
```json
{
"text": "string"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|--------|--------|----------|--------------|-------------|
| `text` | string | false | | |
## codersdk.AIBridgeOpenAIConfig
```json
@@ -745,6 +805,135 @@
| `threads` | integer | false | | |
| `token_usage_summary` | [codersdk.AIBridgeSessionTokenUsageSummary](#codersdkaibridgesessiontokenusagesummary) | false | | |
## codersdk.AIBridgeSessionThreadsResponse
```json
{
"client": "string",
"ended_at": "2019-08-24T14:15:22Z",
"id": "string",
"initiator": {
"avatar_url": "http://example.com",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"username": "string"
},
"metadata": {
"property1": null,
"property2": null
},
"models": [
"string"
],
"page_ended_at": "2019-08-24T14:15:22Z",
"page_started_at": "2019-08-24T14:15:22Z",
"providers": [
"string"
],
"started_at": "2019-08-24T14:15:22Z",
"threads": [
{
"agentic_actions": [
{
"model": "string",
"thinking": [
{
"text": "string"
}
],
"token_usage": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
},
"tool_calls": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"injected": true,
"input": "string",
"interception_id": "34d9b688-63ad-46f4-88b5-665c1e7f7824",
"metadata": {
"property1": null,
"property2": null
},
"provider_response_id": "string",
"server_url": "string",
"tool": "string"
}
]
}
],
"ended_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"model": "string",
"prompt": "string",
"provider": "string",
"started_at": "2019-08-24T14:15:22Z",
"token_usage": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
}
}
],
"token_usage_summary": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
}
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|-----------------------|----------------------------------------------------------------------------------------|----------|--------------|-------------|
| `client` | string | false | | |
| `ended_at` | string | false | | |
| `id` | string | false | | |
| `initiator` | [codersdk.MinimalUser](#codersdkminimaluser) | false | | |
| `metadata` | object | false | | |
| » `[any property]` | any | false | | |
| `models` | array of string | false | | |
| `page_ended_at` | string | false | | |
| `page_started_at` | string | false | | |
| `providers` | array of string | false | | |
| `started_at` | string | false | | |
| `threads` | array of [codersdk.AIBridgeThread](#codersdkaibridgethread) | false | | |
| `token_usage_summary` | [codersdk.AIBridgeSessionThreadsTokenUsage](#codersdkaibridgesessionthreadstokenusage) | false | | |
## codersdk.AIBridgeSessionThreadsTokenUsage
```json
{
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|--------------------|---------|----------|--------------|-------------|
| `input_tokens` | integer | false | | |
| `metadata` | object | false | | |
| » `[any property]` | any | false | | |
| `output_tokens` | integer | false | | |
## codersdk.AIBridgeSessionTokenUsageSummary
```json
@@ -761,6 +950,74 @@
| `input_tokens` | integer | false | | |
| `output_tokens` | integer | false | | |
## codersdk.AIBridgeThread
```json
{
"agentic_actions": [
{
"model": "string",
"thinking": [
{
"text": "string"
}
],
"token_usage": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
},
"tool_calls": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"injected": true,
"input": "string",
"interception_id": "34d9b688-63ad-46f4-88b5-665c1e7f7824",
"metadata": {
"property1": null,
"property2": null
},
"provider_response_id": "string",
"server_url": "string",
"tool": "string"
}
]
}
],
"ended_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"model": "string",
"prompt": "string",
"provider": "string",
"started_at": "2019-08-24T14:15:22Z",
"token_usage": {
"input_tokens": 0,
"metadata": {
"property1": null,
"property2": null
},
"output_tokens": 0
}
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------------|----------------------------------------------------------------------------------------|----------|--------------|-------------|
| `agentic_actions` | array of [codersdk.AIBridgeAgenticAction](#codersdkaibridgeagenticaction) | false | | |
| `ended_at` | string | false | | |
| `id` | string | false | | |
| `model` | string | false | | |
| `prompt` | string | false | | |
| `provider` | string | false | | |
| `started_at` | string | false | | |
| `token_usage` | [codersdk.AIBridgeSessionThreadsTokenUsage](#codersdkaibridgesessionthreadstokenusage) | false | | |
## codersdk.AIBridgeTokenUsage
```json
@@ -791,6 +1048,40 @@
| `output_tokens` | integer | false | | |
| `provider_response_id` | string | false | | |
## codersdk.AIBridgeToolCall
```json
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"injected": true,
"input": "string",
"interception_id": "34d9b688-63ad-46f4-88b5-665c1e7f7824",
"metadata": {
"property1": null,
"property2": null
},
"provider_response_id": "string",
"server_url": "string",
"tool": "string"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|------------------------|---------|----------|--------------|-------------|
| `created_at` | string | false | | |
| `id` | string | false | | |
| `injected` | boolean | false | | |
| `input` | string | false | | |
| `interception_id` | string | false | | |
| `metadata` | object | false | | |
| » `[any property]` | any | false | | |
| `provider_response_id` | string | false | | |
| `server_url` | string | false | | |
| `tool` | string | false | | |
## codersdk.AIBridgeToolUsage
```json