Skip to content

Add doctl agents configs commands (MARSOHS-741) - #1905

Open
nveerdixit wants to merge 48 commits into
digitalocean:mainfrom
nveerdixit:MARSOHS-741-agent-configs
Open

Add doctl agents configs commands (MARSOHS-741)#1905
nveerdixit wants to merge 48 commits into
digitalocean:mainfrom
nveerdixit:MARSOHS-741-agent-configs

Conversation

@nveerdixit

Copy link
Copy Markdown

Summary

Test plan

  • go test ./commands/ ./commands/displayers/ -count=1 -run 'Agents|ParseSecret|HostedAgent'
  • Local harness smoke against http://127.0.0.1:8080 (see MARSOHS-741)

Notes

  • Clone deferred (depends on harness PR 739)
  • List search deferred (MARSOHS-774)
  • Stacks on Hosted Agents session Origin doctl work (MARSOHS-551)

Made with Cursor

SSharma-10 and others added 30 commits May 28, 2026 23:40
doctl agent attach connected but printed nothing: the harness-api SSE
stream emits the SPI canonical event envelope (type/data/timestamp/
tenant_id, dot-separated event names) while vendored godo decoded
kind/payload/at/team_id, so every event fell through renderEvent.

- godo HostedAgentEvent: decode the SPI wire via UnmarshalJSON and switch
  the HostedAgentEventKind constants to the dot-separated SPI names.
- godo ErrorResponse: also read the nested {"error":{code,message}}
  envelope so failed calls show the server's reason, not a bare status.
- agents: align event payload structs/rendering and HITL tracking to the
  SPI data shapes, and acknowledge each submit with its run id so the
  agent's startup latency isn't mistaken for a hang (which caused
  duplicate submits).
- tests for the wire decode, rendering, nested-error surfacing, and ack.

The vendored godo edits mirror the fix being upstreamed to
digitalocean/godo and are in-tree until godo is re-vendored.

Co-authored-by: Cursor <cursoragent@cursor.com>
…igitalocean#1866)

* displayers: drop SandboxID column from hosted-agent session output

* add vendor files

---------

Co-authored-by: SSharma-10 <shivanisharma@digitalocean.com>
Vendors glamour and its transitive deps (chroma, goldmark, bluemonday,
etc.) and bumps lipgloss/termenv so `doctl agents` can render the
agent's markdown replies with syntax-highlighted code blocks. Also
re-syncs the pinned godo vendor tree (adds Session.SandboxID).

Co-authored-by: Cursor <cursoragent@cursor.com>
Buffer the agent's token stream and render each turn as markdown with
syntax-highlighted code blocks. Collapse HITL prompts to a compact,
color-coded approve/reject/defer menu that shows the command awaiting
approval, arrow-key selectable in a TTY. Correlate multiple pending
HITLs to their tool calls via a FIFO queue so no approval line is blank.

Co-authored-by: Cursor <cursoragent@cursor.com>
SSharma-10 and others added 17 commits July 6, 2026 16:50
…ean#1881)

* MARSOHS-340: fail agents attach fast on a terminal session

doctl agents attach fetched the session via GetSession but never checked
its status, so attaching to a destroyed/failed/destroying session printed
"Connected to ..." and only failed once the user typed something and
SendInput came back 404. This complements the harness-api server-side fix
(MARSOHS-340) which now rejects the stream subscribe itself, but the CLI
still showed a stale prompt instead of exiting.

Add a check right after GetSession succeeds: if the session is in a
terminal status (destroying/destroyed/failed), fail immediately with a
clear message instead of printing the banner and entering the interactive
loop. Reuses the existing isTerminalSessionStatus helper.

* MARSOHS-340: add test coverage for attach terminal-session rejection

Covers destroyed/destroying/failed statuses erroring immediately with
"cannot be attached" plus the humanized status, and pins the
SESSION_STATUS_ -> lowercase mapping in humanSessionStatus.
* m0 - first draft

* m2 + tests

* comment updated

* fix pr comments: update agentproxy to use new facade creation for connections and improve event loop handling
Bump godo via replace to the HostedAgents+Origin tip (includes NestedError
for harness-api envelopes). Document server-side sim/eval list omission;
add Origin column without client-side filters or --origin flags.
Wrap godo Agent Configs list/get/create/delete and list sessions-by-config. Vendors godo tip from nveerdixit/godo@cf5f607 until the upstream PR lands.

Co-authored-by: Cursor <cursoragent@cursor.com>
@nveerdixit

Copy link
Copy Markdown
Author

Local test evidence (MARSOHS-741)

Against local harness-api http://127.0.0.1:8080 with DIGITALOCEAN_ACCESS_TOKEN=do_dev_demo@acme.com.

Unit

$ go test ./commands/ ./commands/displayers/ -count=1 -run 'Agents|HostedAgent|ParseSecret'
ok  	github.com/digitalocean/doctl/commands	0.982s
ok  	github.com/digitalocean/doctl/commands/displayers	1.351s

CLI smoke (go build -o /tmp/doctl-741 ./cmd/doctl)

$ doctl --api-url http://127.0.0.1:8080 agents configs list --format ID,Name
ID                                      Name
019fea85-cafa-7965-9caf-a6daccbb5754    marsohs-741-test
...

$ doctl --api-url http://127.0.0.1:8080 agents configs create --name doctl741-1786346533 --spec /tmp/agent.yaml --format ID,Name
ID                                      Name
019fea8c-f64d-73df-ac37-7a3c726731c8    doctl741-1786346533

$ doctl --api-url http://127.0.0.1:8080 agents configs get 019fea8c-f64d-73df-ac37-7a3c726731c8 --format ID,Name
ID                                      Name
019fea8c-f64d-73df-ac37-7a3c726731c8    doctl741-1786346533

$ doctl --api-url http://127.0.0.1:8080 agents configs sessions 019fea8c-f64d-73df-ac37-7a3c726731c8
Session    Name    Agent    Status    Origin    Repo    Created

$ doctl --api-url http://127.0.0.1:8080 agents configs delete 019fea8c-f64d-73df-ac37-7a3c726731c8
Config deleted

$ doctl --api-url http://127.0.0.1:8080 agents configs get 019fea8c-f64d-73df-ac37-7a3c726731c8
Error: GET http://127.0.0.1:8080/v2/agents/configs/...: 404 ... agent config not found

Depends on godo PR: digitalocean/godo#1079

Slot list is name-only now that harness-api no longer returns configured.

Co-authored-by: Cursor <cursoragent@cursor.com>
@nveerdixit

Copy link
Copy Markdown
Author

Follow-up: credential display is slot names only (no configured/missing suffix), matching harness-api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants