- Notifications
You must be signed in to change notification settings - Fork1.1k
Commit3d1e298
feat: implement agent socket api, client and cli (#20758)
closes:#10352closes:coder/internal#1094closes:coder/internal#1095In this pull request, we enable a new set of experimental cli commandsgrouped under `coder exp sync`.These commands allow any process acting within a coder workspace toinform the coder agent of its requirements and execution progress. Thecoder agent will then relay this information to other processes thathave subscribed.These commands are:```# Check if this feature is enabled in your environment coder exp sync ping# express that your unit depends on anothercoder exp sync want <unit> <dependency_unit> # express that your unit intends to start a portion of the script that requires # other units to have completed first. This command blocks until all dependencies have been metcoder exp sync start <unit> # express that your unit has completes its work, allowing dependent units to begin their executioncoder exp sync complete <unit>```Example:In order to automatically run claude code in a new workspace, it mustfirst have a git repository cloned. The scripts responsible for cloningthe repository and for running claude code would coordinate in thefollowing way:```bash# Script A: Claude code# Inform the agent that the claude script wants the git script.# That is, the git script must have completed before the claude script can begin its executioncoder exp sync want claude git# Inform the agent that we would now like to begin execution of claude.# This command will block until the git script (and any other defined dependencies)# have completedcoder exp sync start claude# Now we run claude code and any other commands we needclaude ...# Once our script has completed, we inform the agent, so that any scripts that depend on this one# may begin their executioncoder exp sync complete claude``````bash# Script B: Git# Because the git script does not have any dependencies, we can simply inform the agent that we # intend to startcoder exp sync start gitgit clone ssh://git@github.com/coder/coder# Once the repository have been cloned, we inform the agent that this script is complete, so that# scripts that depend on it may begin their execution.coder exp sync complete git```Notes:* Unit names (ie. `claude` and `git`) given as input to the synccommands are arbitrary strings. You do not have to conform to specificidentifiers. We recommend naming your scripts descriptively, butsuccinctly.* Scripts unit names should be well documented. Other scripts will needto know the names you've chosen in order to depend on yours. Therefore,you---------Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>1 parentc87c33f commit3d1e298
File tree
37 files changed
+1313
-276
lines changed- agent
- agentsocket
- unit
- cli
- testdata
- TestSyncCommands_Golden
37 files changed
+1313
-276
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| |||
202 | 205 | | |
203 | 206 | | |
204 | 207 | | |
| 208 | + | |
| 209 | + | |
205 | 210 | | |
206 | 211 | | |
207 | 212 | | |
| |||
279 | 284 | | |
280 | 285 | | |
281 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
282 | 291 | | |
283 | 292 | | |
284 | 293 | | |
| |||
358 | 367 | | |
359 | 368 | | |
360 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
361 | 373 | | |
362 | 374 | | |
363 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
364 | 396 | | |
365 | 397 | | |
366 | 398 | | |
| |||
1928 | 1960 | | |
1929 | 1961 | | |
1930 | 1962 | | |
| 1963 | + | |
1931 | 1964 | | |
1932 | 1965 | | |
1933 | 1966 | | |
1934 | 1967 | | |
1935 | 1968 | | |
1936 | 1969 | | |
1937 | 1970 | | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
1938 | 1977 | | |
1939 | 1978 | | |
1940 | 1979 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
| |||
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | | - | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 68 | | |
73 | 69 | | |
74 | 70 | | |
| |||
91 | 87 | | |
92 | 88 | | |
93 | 89 | | |
| 90 | + | |
94 | 91 | | |
95 | 92 | | |
96 | 93 | | |
| |||
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 134 | + | |
182 | 135 | | |
183 | | - | |
| 136 | + | |
184 | 137 | | |
185 | 138 | | |
0 commit comments
Comments
(0)