Skip to content

Commit a909887

Browse files
vanpeltClaudeclaude
authored
Feature/pre release (#205)
Lot's of bug fixes and little improvements. --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent a17e19e commit a909887

28 files changed

+1028
-808
lines changed

container/docs/docs.go

Lines changed: 90 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,17 +1545,17 @@ const docTemplate = `{
15451545
}
15461546
}
15471547
},
1548-
"/v1/pty/sse": {
1549-
"get": {
1550-
"description": "Establishes a Server-Sent Events connection for terminal streaming",
1548+
"/v1/pty/prompt": {
1549+
"post": {
1550+
"description": "Sends prompt to PTY session, waits for readiness",
15511551
"tags": [
15521552
"pty"
15531553
],
1554-
"summary": "Create PTY SSE connection",
1554+
"summary": "Send prompt to PTY",
15551555
"parameters": [
15561556
{
15571557
"type": "string",
1558-
"description": "Session ID",
1558+
"description": "Session ID (workspace name)",
15591559
"name": "session",
15601560
"in": "query",
15611561
"required": true
@@ -1567,15 +1567,97 @@ const docTemplate = `{
15671567
"in": "query"
15681568
},
15691569
{
1570-
"type": "string",
1571-
"description": "Prompt to send to PTY session",
1570+
"description": "Prompt text to send",
15721571
"name": "prompt",
1572+
"in": "body",
1573+
"required": true,
1574+
"schema": {
1575+
"type": "string"
1576+
}
1577+
}
1578+
],
1579+
"responses": {
1580+
"200": {
1581+
"description": "Prompt sent successfully",
1582+
"schema": {
1583+
"type": "object",
1584+
"additionalProperties": true
1585+
}
1586+
},
1587+
"400": {
1588+
"description": "Invalid parameters",
1589+
"schema": {
1590+
"type": "object",
1591+
"additionalProperties": true
1592+
}
1593+
},
1594+
"404": {
1595+
"description": "Session not found",
1596+
"schema": {
1597+
"type": "object",
1598+
"additionalProperties": true
1599+
}
1600+
},
1601+
"408": {
1602+
"description": "PTY not ready within timeout",
1603+
"schema": {
1604+
"type": "object",
1605+
"additionalProperties": true
1606+
}
1607+
},
1608+
"500": {
1609+
"description": "Failed to send prompt",
1610+
"schema": {
1611+
"type": "object",
1612+
"additionalProperties": true
1613+
}
1614+
}
1615+
}
1616+
}
1617+
},
1618+
"/v1/pty/start": {
1619+
"post": {
1620+
"description": "Creates PTY session for workspace if not exists, returns immediately",
1621+
"tags": [
1622+
"pty"
1623+
],
1624+
"summary": "Start PTY session",
1625+
"parameters": [
1626+
{
1627+
"type": "string",
1628+
"description": "Session ID (workspace name)",
1629+
"name": "session",
1630+
"in": "query",
1631+
"required": true
1632+
},
1633+
{
1634+
"type": "string",
1635+
"description": "Agent type (claude, bash, etc)",
1636+
"name": "agent",
15731637
"in": "query"
15741638
}
15751639
],
15761640
"responses": {
15771641
"200": {
1578-
"description": "Stream of terminal events"
1642+
"description": "Session started or already exists",
1643+
"schema": {
1644+
"type": "object",
1645+
"additionalProperties": true
1646+
}
1647+
},
1648+
"400": {
1649+
"description": "Invalid parameters",
1650+
"schema": {
1651+
"type": "object",
1652+
"additionalProperties": true
1653+
}
1654+
},
1655+
"500": {
1656+
"description": "Failed to create session",
1657+
"schema": {
1658+
"type": "object",
1659+
"additionalProperties": true
1660+
}
15791661
}
15801662
}
15811663
}

container/docs/swagger.json

Lines changed: 90 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,17 +1542,17 @@
15421542
}
15431543
}
15441544
},
1545-
"/v1/pty/sse": {
1546-
"get": {
1547-
"description": "Establishes a Server-Sent Events connection for terminal streaming",
1545+
"/v1/pty/prompt": {
1546+
"post": {
1547+
"description": "Sends prompt to PTY session, waits for readiness",
15481548
"tags": [
15491549
"pty"
15501550
],
1551-
"summary": "Create PTY SSE connection",
1551+
"summary": "Send prompt to PTY",
15521552
"parameters": [
15531553
{
15541554
"type": "string",
1555-
"description": "Session ID",
1555+
"description": "Session ID (workspace name)",
15561556
"name": "session",
15571557
"in": "query",
15581558
"required": true
@@ -1564,15 +1564,97 @@
15641564
"in": "query"
15651565
},
15661566
{
1567-
"type": "string",
1568-
"description": "Prompt to send to PTY session",
1567+
"description": "Prompt text to send",
15691568
"name": "prompt",
1569+
"in": "body",
1570+
"required": true,
1571+
"schema": {
1572+
"type": "string"
1573+
}
1574+
}
1575+
],
1576+
"responses": {
1577+
"200": {
1578+
"description": "Prompt sent successfully",
1579+
"schema": {
1580+
"type": "object",
1581+
"additionalProperties": true
1582+
}
1583+
},
1584+
"400": {
1585+
"description": "Invalid parameters",
1586+
"schema": {
1587+
"type": "object",
1588+
"additionalProperties": true
1589+
}
1590+
},
1591+
"404": {
1592+
"description": "Session not found",
1593+
"schema": {
1594+
"type": "object",
1595+
"additionalProperties": true
1596+
}
1597+
},
1598+
"408": {
1599+
"description": "PTY not ready within timeout",
1600+
"schema": {
1601+
"type": "object",
1602+
"additionalProperties": true
1603+
}
1604+
},
1605+
"500": {
1606+
"description": "Failed to send prompt",
1607+
"schema": {
1608+
"type": "object",
1609+
"additionalProperties": true
1610+
}
1611+
}
1612+
}
1613+
}
1614+
},
1615+
"/v1/pty/start": {
1616+
"post": {
1617+
"description": "Creates PTY session for workspace if not exists, returns immediately",
1618+
"tags": [
1619+
"pty"
1620+
],
1621+
"summary": "Start PTY session",
1622+
"parameters": [
1623+
{
1624+
"type": "string",
1625+
"description": "Session ID (workspace name)",
1626+
"name": "session",
1627+
"in": "query",
1628+
"required": true
1629+
},
1630+
{
1631+
"type": "string",
1632+
"description": "Agent type (claude, bash, etc)",
1633+
"name": "agent",
15701634
"in": "query"
15711635
}
15721636
],
15731637
"responses": {
15741638
"200": {
1575-
"description": "Stream of terminal events"
1639+
"description": "Session started or already exists",
1640+
"schema": {
1641+
"type": "object",
1642+
"additionalProperties": true
1643+
}
1644+
},
1645+
"400": {
1646+
"description": "Invalid parameters",
1647+
"schema": {
1648+
"type": "object",
1649+
"additionalProperties": true
1650+
}
1651+
},
1652+
"500": {
1653+
"description": "Failed to create session",
1654+
"schema": {
1655+
"type": "object",
1656+
"additionalProperties": true
1657+
}
15761658
}
15771659
}
15781660
}

container/docs/swagger.yaml

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,11 +2171,11 @@ paths:
21712171
summary: Create PTY WebSocket connection
21722172
tags:
21732173
- pty
2174-
/v1/pty/sse:
2175-
get:
2176-
description: Establishes a Server-Sent Events connection for terminal streaming
2174+
/v1/pty/prompt:
2175+
post:
2176+
description: Sends prompt to PTY session, waits for readiness
21772177
parameters:
2178-
- description: Session ID
2178+
- description: Session ID (workspace name)
21792179
in: query
21802180
name: session
21812181
required: true
@@ -2184,14 +2184,71 @@ paths:
21842184
in: query
21852185
name: agent
21862186
type: string
2187-
- description: Prompt to send to PTY session
2188-
in: query
2187+
- description: Prompt text to send
2188+
in: body
21892189
name: prompt
2190+
required: true
2191+
schema:
2192+
type: string
2193+
responses:
2194+
"200":
2195+
description: Prompt sent successfully
2196+
schema:
2197+
additionalProperties: true
2198+
type: object
2199+
"400":
2200+
description: Invalid parameters
2201+
schema:
2202+
additionalProperties: true
2203+
type: object
2204+
"404":
2205+
description: Session not found
2206+
schema:
2207+
additionalProperties: true
2208+
type: object
2209+
"408":
2210+
description: PTY not ready within timeout
2211+
schema:
2212+
additionalProperties: true
2213+
type: object
2214+
"500":
2215+
description: Failed to send prompt
2216+
schema:
2217+
additionalProperties: true
2218+
type: object
2219+
summary: Send prompt to PTY
2220+
tags:
2221+
- pty
2222+
/v1/pty/start:
2223+
post:
2224+
description: Creates PTY session for workspace if not exists, returns immediately
2225+
parameters:
2226+
- description: Session ID (workspace name)
2227+
in: query
2228+
name: session
2229+
required: true
2230+
type: string
2231+
- description: Agent type (claude, bash, etc)
2232+
in: query
2233+
name: agent
21902234
type: string
21912235
responses:
21922236
"200":
2193-
description: Stream of terminal events
2194-
summary: Create PTY SSE connection
2237+
description: Session started or already exists
2238+
schema:
2239+
additionalProperties: true
2240+
type: object
2241+
"400":
2242+
description: Invalid parameters
2243+
schema:
2244+
additionalProperties: true
2245+
type: object
2246+
"500":
2247+
description: Failed to create session
2248+
schema:
2249+
additionalProperties: true
2250+
type: object
2251+
summary: Start PTY session
21952252
tags:
21962253
- pty
21972254
/v1/sessions:

container/internal/cmd/serve.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ func startServer(cmd *cobra.Command) {
153153
claudeService := services.NewClaudeService()
154154
sessionService := services.NewSessionService()
155155

156+
// Wire up SessionService to ClaudeService for best session file selection
157+
claudeService.SetSessionService(sessionService)
158+
156159
// Initialize and start Claude monitor service
157160
claudeMonitor := services.NewClaudeMonitorService(gitService, sessionService, claudeService, gitService.GetStateManager())
158161

@@ -223,7 +226,8 @@ func startServer(cmd *cobra.Command) {
223226

224227
// Register routes
225228
v1.Get("/pty", ptyHandler.HandleWebSocket)
226-
v1.Get("/pty/sse", ptyHandler.HandleSSEConnection)
229+
v1.Post("/pty/start", ptyHandler.HandlePTYStart)
230+
v1.Post("/pty/prompt", ptyHandler.HandlePTYPrompt)
227231

228232
// Auth routes
229233
v1.Post("/auth/github/start", authHandler.StartGitHubAuth)

0 commit comments

Comments
 (0)