You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d2df489
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/SPEC.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -206,7 +206,12 @@ fail, then implement.
206
206
(`src/commonMain/python/python_multiplatform_devagent.py`, generated into Kotlin by `generateDevAgentSource`)
207
207
as the module `python_multiplatform_devagent` and it listens on 127.0.0.1 only. The marker is the build-time
208
208
switch: this library is one artifact for debug and release, so the app's build decides, and toolchain stages
209
-
the marker into debug variants only. Without it the variable is ignored with a warning and no port opens. The
209
+
the marker into debug variants only. Without it the variable is ignored with a warning and no port opens. When
210
+
the variable is unset, the marker's content is the request, in the same grammar and with the same token check,
211
+
because an installed Android or iOS app is given no environment variable (toolchain #154, its Decision 15 (a),
212
+
toolchain team report 2026-11-25 relayed by the leader; #543). The variable wins when set, and an empty marker
213
+
means no agent. The default overlay is `tempfile.mkdtemp()`, which is writable on Android because
214
+
`PythonBootstrap` sets `TMPDIR` to the app's `cacheDir` (`PythonBootstrapTest.initializeLeavesTempfileUsable`). The
210
215
token must be at least 43 characters (`secrets.token_urlsafe(32)`), or the agent refuses to start. The listening
211
216
socket cannot be bound by another socket while it listens: `SO_EXCLUSIVEADDRUSE` on Windows; on POSIX,
212
217
`SO_REUSEADDR` only so that a restarted app can rebind the launcher's port past TIME_WAIT. A connection's first
@@ -218,12 +223,14 @@ fail, then implement.
218
223
and does not stop the app. `Status: partial`: desktop
219
224
(`PM/desktopTest/.../env/PythonDevAgentTest.kt`: the embedded agent answers over loopback; a child JVM with the
220
225
marker and the variable has an agent on that port, one without the variable has none, one without the marker
221
-
(a release build) opens no port with the variable set, and a short token opens no port; the protocol, token
226
+
(a release build) opens no port with the variable set, and a short token opens no port; with the variable unset,
227
+
one whose marker holds the request has an agent on that port, the variable wins over the marker, and a marker
228
+
with a short token opens no port; the protocol, token
222
229
length, port takeover and restart: `python-multiplatform/src/test/python/test_devagent.py`, CI `Dev agent
223
230
protocol tests` on macOS and the `dev-agent` job on ubuntu and windows (#238; with `SO_EXCLUSIVEADDRUSE`
224
231
removed, the Windows takeover test fails, checked once); toolchain stages the marker for `enableHotReload`
225
-
builds and passes the variable to the desktop run tasks (toolchain#105), but nothing sets the variable on
226
-
Android or iOS yet (toolchain's M2, M3); no interrupt; `execute` runs on the agent's thread (no main-thread dispatch yet).
232
+
builds and passes the variable to the desktop run tasks (toolchain#105), but nothing writes the
233
+
request into an Android or iOS marker in develop yet (toolchain#154, M2; M3); no interrupt; `execute` runs on the agent's thread (no main-thread dispatch yet).
Copy file name to clipboardExpand all lines: python-multiplatform/src/commonMain/python/python_multiplatform_devagent.py
+24-4Lines changed: 24 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@
5
5
The runtime starts it from `Python3.initialize()` only when the launcher sets the environment variable
6
6
`PYTHON_MULTIPLATFORM_DEV_AGENT` to `port=<n>;token=<t>[;overlay=<dir>]` (a debug launch does; a release
7
7
build never does), and only in a build that staged the enabling marker (the runtime checks that; see
8
-
`PythonDevAgent.kt`). It listens on 127.0.0.1 only. The token must be at least `MIN_TOKEN_LENGTH` characters
8
+
`PythonDevAgent.kt`). When the variable is unset, the marker's content is the request, in the same grammar
9
+
(an installed Android or iOS app gets no environment variable); an empty marker means no agent. It listens on 127.0.0.1 only. The token must be at least `MIN_TOKEN_LENGTH` characters
9
10
(`secrets.token_urlsafe(32)`), or the agent refuses to start. A connection's first message must be `hello`
10
11
with the token; anything else closes the connection.
0 commit comments