Commit 1bd20e7
authored
Expose SDK bridge connectivity check (#25)
## Summary
- add `isConnected()` to `@agent-cdp/sdk` so app code can cheaply detect
whether the agent-cdp runtime bridge is attached before starting a
profiling or capture workflow
- reuse a shared binding lookup inside `AgentRuntimeClient` and cover
the new connectivity check with SDK tests
- document the new SDK call in `docs/SDK.md`
## Backward-compatibility analysis
- existing SDK APIs remain unchanged; this only adds a new optional
helper
- daemon commands, CLI commands, output formats, saved artifacts, and
daemon lifecycle behavior are unchanged
- the change does not alter defaults or bridge timing; it only exposes
the current bridge-installed state as a boolean
## Risks
- `isConnected()` reports bridge presence, so it reflects whether the
runtime bridge is installed in the app context rather than proving a
future command cannot race with a disconnect
- consumers may treat the boolean as a stronger guarantee than it is if
they do not account for target reconnects between the check and a later
SDK call
- documentation now needs to keep the distinction clear between bridge
presence and successful execution of a later profiling command
## Manual testing
- in an app wired with `@agent-cdp/sdk`, start the daemon and select the
target with `agent-cdp target select <target-id>`
- call `isConnected()` before target selection and verify it returns
`false`
- select the target, call `isConnected()` again, and verify it returns
`true`
- run `pnpm --filter @agent-cdp/protocol build`, `pnpm --filter
@agent-cdp/sdk test`, and `pnpm --filter @agent-cdp/sdk typecheck`1 parent 35b22f1 commit 1bd20e7
3 files changed
Lines changed: 36 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
49 | | - | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
35 | 51 | | |
36 | 52 | | |
37 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| |||
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
189 | | - | |
190 | | - | |
191 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
192 | 196 | | |
193 | 197 | | |
194 | 198 | | |
| |||
203 | 207 | | |
204 | 208 | | |
205 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
206 | 215 | | |
207 | 216 | | |
208 | 217 | | |
| |||
228 | 237 | | |
229 | 238 | | |
230 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
231 | 244 | | |
232 | 245 | | |
233 | 246 | | |
| |||
0 commit comments