-
Notifications
You must be signed in to change notification settings - Fork 525
feat(agent-server): conversation-scoped runtime APIs and clients #4966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
20b83ba
feat: add conversation-scoped runtime APIs and clients
openhands-agent f638e0e
fix(ci): recognize upstream approved LLM.modify_params removal
openhands-agent 954892d
refactor(client): bind runtime services to explicit conversation owne…
openhands-agent 29184d8
fix(client): keep runtime URL parameters within public type budget
openhands-agent c12cf0a
Merge main into conversation runtime API foundation
openhands-agent 584aa4a
feat: expose runtime lifecycle contracts independently of Docker
openhands-agent f64e34f
chore: keep runtime lifecycle tests focused
openhands-agent ae05f6e
Merge branch 'factory/restack-lifecycle' into factory/ready-sdk-4966
openhands-agent ad08608
style: format extracted runtime lifecycle model
openhands-agent b8e0d3c
ci: use the native stack base instead of temporary branch filters
openhands-agent c3d8db9
Merge remote-tracking branch 'origin/main' into factory/ready-sdk-4966
openhands-agent d5719d4
docs: capture live Canvas evidence for #4966
openhands-agent 86695aa
chore: Remove PR-only artifacts [automated]
2805ce4
refactor(agent-server): keep runtime contracts independent of Docker
openhands-agent 3808768
Merge remote-tracking branch 'origin/main' into factory/ready-sdk-4966
openhands-agent 4244f91
refactor(client): scope existing clients without runtime facades
openhands-agent 3600b6d
fix(api): type download schemas on their owning routes
openhands-agent cd064c0
fix(runtime): limit process cleanup to scoped services
openhands-agent 65911c8
docs: add live narrowed-client evidence
openhands-agent 97e664a
refactor(runtime): keep route reuse compatibility explicit
openhands-agent 9fd0983
refactor(runtime): remove unused scoped contracts
openhands-agent 8152c39
refactor(client): rely on the compiled client contract
openhands-agent 4b75798
docs: align runtime evidence with narrowed scope
openhands-agent 72a74b3
docs(client): explain optional conversation ownership
openhands-agent c39586e
fix(runtime): keep host bash teardown unchanged
openhands-agent 8182852
refactor(runtime): name conversation ownership explicitly
openhands-agent 01398e7
refactor(runtime): make bash lifecycle intrinsic
openhands-agent 1e1a610
chore: Remove PR-only artifacts [automated]
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
clients/typescript/src/__tests__/conversation-scope.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { createServer, Server } from 'node:http'; | ||
| import { AddressInfo } from 'node:net'; | ||
| import { ServerClient } from '../client/server-client'; | ||
| import { HttpClient } from '../client/http-client'; | ||
| import { RemoteWorkspace } from '../workspace/remote-workspace'; | ||
|
|
||
| describe('conversation-scoped requests', () => { | ||
| let server: Server; | ||
| let host: string; | ||
| const urls: string[] = []; | ||
| let scoped = false; | ||
| beforeAll(async () => { | ||
| server = createServer((req, res) => { | ||
| urls.push(req.url!); | ||
|
Check warning on line 14 in clients/typescript/src/__tests__/conversation-scope.test.ts
|
||
| if (req.url === '/server_info') { | ||
| res.setHeader('content-type', 'application/json'); | ||
| res.end(JSON.stringify({ capabilities: scoped ? ['conversation_runtime_routes_v1'] : [] })); | ||
| return; | ||
| } | ||
| res.setHeader('content-type', 'application/json'); | ||
| res.end(JSON.stringify({ exit_code: 0, stdout: 'ok', stderr: '' })); | ||
| }); | ||
| await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve)); | ||
| host = `http://127.0.0.1:${(server.address() as AddressInfo).port}`; | ||
| }); | ||
| afterAll(async () => { | ||
| server.closeAllConnections(); | ||
| await new Promise<void>((resolve) => server.close(() => resolve())); | ||
| }); | ||
| it('advertises client-side runtime routing support', () => { | ||
| expect(ServerClient.supportsConversationRuntimeRoutes).toBe(true); | ||
| }); | ||
| it('scopes workspace commands to their conversation', async () => { | ||
| const workspace = new RemoteWorkspace({ | ||
| host, | ||
| workingDir: '/workspace', | ||
| conversationId: 'demo-cid', | ||
| }); | ||
| const result = await workspace.executeCommand('pwd'); | ||
| expect(result.stdout).toBe('ok'); | ||
| expect(urls.pop()).toBe('/api/bash/execute_bash_command?cid=demo-cid'); | ||
| }); | ||
| it('uses canonical routes and preserves explicit context on capable servers', async () => { | ||
| scoped = true; | ||
| try { | ||
| const client = new HttpClient({ baseUrl: host, conversationId: 'default' }); | ||
| await client.get('/api/file/download', { params: { cid: 'explicit', path: '/workspace/a' } }); | ||
| expect(urls.pop()).toBe('/api/conversations/explicit/file/download?path=%2Fworkspace%2Fa'); | ||
| await client.post('/api/bash/execute_bash_command', { command: 'pwd' }); | ||
| expect(urls.pop()).toBe('/api/conversations/default/bash/execute_bash_command'); | ||
| await client.get('/api/tools/'); | ||
| expect(urls.pop()).toBe('/api/tools/'); | ||
| await client.get('/api/file/home'); | ||
| expect(urls.pop()).toBe('/api/file/home'); | ||
| await client.post('/api/mcp/test', { server: {} }); | ||
| expect(urls.pop()).toBe('/api/conversations/default/mcp/test'); | ||
| await client.get('/api/mcp/oauth/status/job'); | ||
| expect(urls.pop()).toBe('/api/mcp/oauth/status/job'); | ||
| } finally { | ||
| scoped = false; | ||
| } | ||
| }); | ||
| it('preserves unscoped behavior and explicit query context', async () => { | ||
| await new HttpClient({ baseUrl: host }).get('/api/file/home'); | ||
| expect(urls.pop()).toBe('/api/file/home'); | ||
| await new HttpClient({ baseUrl: host, conversationId: 'default' }).get('/api/file/download', { | ||
| params: { cid: 'explicit' }, | ||
| }); | ||
| expect(urls.pop()).toBe('/api/file/download?cid=explicit'); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.