Commit 0ce90f5
refactor: intent layers gate via intent context, not enable/disable (#427)
* feat!: intent layers gate via intent context, not enable/disable
Redesign IntentLayers so a layer maps to an intent-context token instead
of mutating the global enabled/disabled intent set.
- activate_layer -> skill.set_context(<layer token>)
- deactivate_layer -> skill.remove_context(<layer token>)
- reset() (kept aliased as disable()) removes every active layer context
`@layer_intent` now injects the layer context token as a `.require()` on
the IntentBuilder, so the intent only validates while its layer is active.
Intents stay registered for the skill lifetime; gating is per-session via
adapt context, with no detach/attach churn.
resets_layers() now calls reset(); the enable_intent/disable_intent paths
are gone from the layer machinery.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat: game skills converse via context-gated layers + skill_will_match probe
Make ConversationalGameSkill work with the new context-gated layers:
- OVOSGameSkill now also inherits ConversationalSkill so the converse
ping/request bus handlers are actually wired for game skills (they were
not, so converse never ran for games).
- Add OVOSSkill.skill_will_match(): a read-only probe over
intent.service.intent.get that reports whether one of THIS skill's
intents would match an utterance under the current session context.
Supports exclude_pipeline so a conversing skill can skip the converse
stage and avoid re-entrancy.
- ConversationalGameSkill.can_converse() returns True only while playing
AND no context-gated layer intent would match (so layer intents are
handled by adapt, not swallowed by converse). converse() uses the same
probe. calc_intent() now ignores non-intent-parser pipeline results.
- on_play_game restart semantics doc fix in the game base.
Add a 4-layer demo skill e2e (ovoscope MiniCroft / FakeBus) proving the
layer mechanism: utterances advance layer0->layer3, only the active
layer's intent matches at each step (others are gated off via missing
context), always-on intents match throughout, and reset removes the
context so layer intents stop matching.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat: session-aware playback + per-session layer gating (OCP is session aware)
OCP tracks player state per session, so game/playback skills must too.
- OVOSCommonPlaybackSkill: _playing/_paused Events -> per-session sets
(_playing_sessions/_paused_sessions) keyed by SessionManager.get(msg)
.session_id. New get_session_id(), is_playing_in/is_paused_in,
playing_sessions; is_playing/is_paused properties now resolve the current
session. OCP play/pause/resume/stop handlers key state by session and reply
with message.reply so the session round-trips.
- OVOSGameSkill.stop_game is per-session; on_pause_game/on_resume_game no
longer mutate paused state (the framework does, per session);
on_game_command(self, utterance, lang, message=None) - the message (and thus
session) is now passed so games can key per-session state.
- IntentLayers.is_active(layer, session=None) reads the layer's context token
from the session (the per-session source of truth), falling back to the
skill-level active_layers when no session is resolvable. This makes layer
gating correct under concurrent multi-session play.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test: adapt layer tests to context gating
- common_play: assert per-session playback state (no playing/paused
sessions on init) instead of the removed _playing/_paused Event objects
- intent_layers_e2e: restore the global SessionManager.bus in tearDownClass
so the stopped MiniCroft bus does not leak into get_response/killable
intent tests sharing the class-level SessionManager
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: add ovos-adapt-parser to test deps for layer e2e pipeline
The intent-layers e2e test drives a live ADAPT pipeline via MiniCroft; CI
installs only the declared test extras, where ovos-adapt-parser (which
provides the ovos-adapt-pipeline-plugin matcher) was missing, so the
pipeline matched nothing ('Unknown pipeline matcher'). Add it to both the
[test] extra and requirements/test.txt.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: bump ovos-adapt-parser test dep to >=1.3.1a1 for workshop 8.x
Stable ovos-adapt-parser 1.0.9 caps ovos-workshop<8.0.0, which conflicts
with this branch (8.3.0a1) and made the install unresolvable in CI.
1.3.1a1 relaxes the cap to <9.0.0; pin it as the floor (prerelease floor
pin) so pip resolves it without --pre.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor: keep #427 to IntentLayers only; game-skill + OCP playback move to a stacked PR
IntentLayers stays standalone and backwards-compatible for decorator consumers
(disable() aliases reset(); all decorators + methods preserved). The session-aware
game-skill + OCPCommonPlayback changes move to feat/gameskill-and-ocp-deprecation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat: skill_will_match accepts a Session to probe under that session's context
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 9234a41 commit 0ce90f5
6 files changed
Lines changed: 517 additions & 49 deletions
File tree
- ovos_workshop
- decorators
- skills
- requirements
- test/unittests
- skills
| 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 | + | |
1 | 18 | | |
2 | 19 | | |
3 | 20 | | |
| |||
6 | 23 | | |
7 | 24 | | |
8 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
9 | 37 | | |
10 | 38 | | |
11 | 39 | | |
| |||
30 | 58 | | |
31 | 59 | | |
32 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
33 | 66 | | |
34 | 67 | | |
35 | | - | |
36 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
37 | 71 | | |
38 | 72 | | |
39 | 73 | | |
40 | 74 | | |
41 | 75 | | |
42 | | - | |
43 | | - | |
| 76 | + | |
44 | 77 | | |
45 | | - | |
| 78 | + | |
46 | 79 | | |
47 | 80 | | |
48 | 81 | | |
| |||
51 | 84 | | |
52 | 85 | | |
53 | 86 | | |
54 | | - | |
55 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
56 | 90 | | |
57 | 91 | | |
58 | 92 | | |
59 | 93 | | |
60 | 94 | | |
61 | | - | |
62 | | - | |
| 95 | + | |
63 | 96 | | |
64 | | - | |
| 97 | + | |
65 | 98 | | |
66 | 99 | | |
67 | 100 | | |
| |||
78 | 111 | | |
79 | 112 | | |
80 | 113 | | |
81 | | - | |
82 | | - | |
| 114 | + | |
83 | 115 | | |
84 | | - | |
| 116 | + | |
85 | 117 | | |
86 | 118 | | |
87 | 119 | | |
| |||
90 | 122 | | |
91 | 123 | | |
92 | 124 | | |
93 | | - | |
| 125 | + | |
| 126 | + | |
94 | 127 | | |
95 | 128 | | |
96 | 129 | | |
97 | 130 | | |
98 | 131 | | |
99 | 132 | | |
100 | | - | |
101 | | - | |
| 133 | + | |
102 | 134 | | |
103 | | - | |
| 135 | + | |
104 | 136 | | |
105 | 137 | | |
106 | 138 | | |
| |||
109 | 141 | | |
110 | 142 | | |
111 | 143 | | |
112 | | - | |
| 144 | + | |
113 | 145 | | |
114 | 146 | | |
115 | 147 | | |
116 | 148 | | |
117 | 149 | | |
118 | | - | |
119 | | - | |
| 150 | + | |
120 | 151 | | |
121 | | - | |
| 152 | + | |
122 | 153 | | |
123 | 154 | | |
124 | 155 | | |
| |||
129 | 160 | | |
130 | 161 | | |
131 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
132 | 169 | | |
133 | 170 | | |
134 | 171 | | |
135 | 172 | | |
136 | 173 | | |
| 174 | + | |
137 | 175 | | |
138 | 176 | | |
139 | 177 | | |
140 | 178 | | |
141 | 179 | | |
142 | 180 | | |
143 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
144 | 189 | | |
145 | 190 | | |
146 | 191 | | |
| |||
153 | 198 | | |
154 | 199 | | |
155 | 200 | | |
156 | | - | |
| 201 | + | |
157 | 202 | | |
158 | 203 | | |
159 | 204 | | |
160 | 205 | | |
161 | 206 | | |
162 | 207 | | |
163 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
164 | 216 | | |
165 | 217 | | |
| 218 | + | |
166 | 219 | | |
167 | 220 | | |
168 | 221 | | |
| |||
187 | 240 | | |
188 | 241 | | |
189 | 242 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
195 | 251 | | |
196 | 252 | | |
197 | 253 | | |
198 | | - | |
199 | | - | |
| 254 | + | |
| 255 | + | |
200 | 256 | | |
201 | 257 | | |
202 | 258 | | |
203 | | - | |
| 259 | + | |
204 | 260 | | |
205 | 261 | | |
206 | 262 | | |
207 | | - | |
208 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
209 | 269 | | |
210 | 270 | | |
211 | 271 | | |
212 | 272 | | |
213 | | - | |
214 | | - | |
215 | | - | |
| 273 | + | |
216 | 274 | | |
217 | 275 | | |
218 | 276 | | |
219 | 277 | | |
220 | | - | |
221 | | - | |
| 278 | + | |
| 279 | + | |
222 | 280 | | |
223 | 281 | | |
224 | 282 | | |
225 | 283 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 284 | + | |
229 | 285 | | |
230 | 286 | | |
231 | 287 | | |
232 | 288 | | |
233 | | - | |
234 | | - | |
| 289 | + | |
| 290 | + | |
235 | 291 | | |
236 | 292 | | |
237 | 293 | | |
| |||
241 | 297 | | |
242 | 298 | | |
243 | 299 | | |
244 | | - | |
245 | | - | |
| 300 | + | |
| 301 | + | |
246 | 302 | | |
247 | 303 | | |
248 | 304 | | |
249 | 305 | | |
250 | 306 | | |
251 | 307 | | |
252 | | - | |
253 | | - | |
254 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
255 | 338 | | |
256 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
0 commit comments