Commit 3b41268
committed
feat(agent): runtime operations manager — idempotency-keyed switches, health, hot reload
New `packages/agent/src/runtime/operations/` module:
- `manager.ts` — RuntimeOperationManager, the single-flight gate for
provider switches, restarts, and reloads. Replaces the ad-hoc
`providerSwitchInProgress` boolean.
- `repository.ts` — operation-state store, surfaces pending/active/done.
- `classifier.ts` + `classifier.test.ts` — decides whether an inbound
request is a duplicate of an in-flight op via the idempotency key.
- `health.ts` + `health.test.ts` + `health-checks.ts` — runtime health
predicates used by the reload/cold strategies.
- `cold-strategy.ts`, `reload-hot.ts` — strategy implementations for
full restart vs hot reload.
- `index.ts` + `types.ts` — module barrel and shared types.
Wires the manager through:
- `api/provider-switch-routes.ts` — reads Idempotency-Key header,
routes through the manager rather than the legacy boolean gate.
- `api/server.ts`, `runtime/restart.ts` — refactored against the new
manager; the old single-flight scaffolding is gone.
- `app-core/scripts/dev-platform.mjs`, `app-core/src/api/client-base.ts`,
`client-types-core.ts`, `cli/run-main.ts`, `runtime/error-handlers.ts`,
`shared/scripts/generate-keywords.mjs` — companion changes the
manager required (dev-platform integration, error surfacing,
client-side typing for the new op-status responses).
WIP — preserving in a commit so it doesn't sit as uncommitted state on
the feature branch. Squash / split as needed in the PR.1 parent 665fa12 commit 3b41268
20 files changed
Lines changed: 2480 additions & 104 deletions
File tree
- packages
- agent/src
- api
- runtime
- operations
- app-core
- scripts
- src
- api
- cli
- runtime
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
30 | 39 | | |
31 | 40 | | |
32 | | - | |
| 41 | + | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
36 | 45 | | |
37 | 46 | | |
38 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
39 | 66 | | |
40 | 67 | | |
41 | 68 | | |
| |||
59 | 86 | | |
60 | 87 | | |
61 | 88 | | |
62 | | - | |
63 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
64 | 93 | | |
65 | 94 | | |
66 | | - | |
67 | 95 | | |
68 | 96 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | 97 | | |
78 | 98 | | |
79 | 99 | | |
| |||
97 | 117 | | |
98 | 118 | | |
99 | 119 | | |
100 | | - | |
| 120 | + | |
101 | 121 | | |
102 | 122 | | |
103 | 123 | | |
| |||
106 | 126 | | |
107 | 127 | | |
108 | 128 | | |
109 | | - | |
110 | | - | |
111 | 129 | | |
112 | 130 | | |
113 | 131 | | |
114 | | - | |
115 | 132 | | |
116 | 133 | | |
117 | 134 | | |
118 | 135 | | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 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 | + | |
128 | 170 | | |
129 | 171 | | |
130 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
131 | 186 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
137 | 197 | | |
138 | | - | |
139 | 198 | | |
140 | 199 | | |
141 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
208 | 222 | | |
209 | 223 | | |
210 | 224 | | |
| |||
1044 | 1058 | | |
1045 | 1059 | | |
1046 | 1060 | | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
1047 | 1101 | | |
1048 | 1102 | | |
1049 | 1103 | | |
| |||
1323 | 1377 | | |
1324 | 1378 | | |
1325 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
1326 | 1384 | | |
1327 | 1385 | | |
1328 | 1386 | | |
| |||
1339 | 1397 | | |
1340 | 1398 | | |
1341 | 1399 | | |
1342 | | - | |
| 1400 | + | |
1343 | 1401 | | |
1344 | 1402 | | |
1345 | 1403 | | |
| |||
0 commit comments