Spaces:
Sleeping
Sleeping
Commit ·
5bc8ca1
1
Parent(s): 9a30239
feat: rebuild Slipstream Lab as technical companion
Browse filesReplace the old landing-page-style demo with a CPU-first protocol lab focused on UCR exploration, conformance inspection, LangGraph snippets, and training guidance.
- README.md +32 -29
- app.py +431 -523
- app_logic.py +228 -0
- requirements.txt +1 -2
README.md
CHANGED
|
@@ -1,42 +1,45 @@
|
|
| 1 |
---
|
| 2 |
-
title: Slipstream
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 5.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
-
short_description: "
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# Slipstream
|
| 15 |
|
| 16 |
-
|
| 17 |
-
Force-Object wire message in real time. No API keys, no GPU.
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
-
|
| 22 |
-
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
## Resources
|
| 27 |
|
| 28 |
-
-
|
| 29 |
-
-
|
| 30 |
-
-
|
| 31 |
-
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
```bibtex
|
| 36 |
-
@misc{maio2025slipstream,
|
| 37 |
-
title={Slipstream: Semantic Quantization for Efficient Multi-Agent Coordination},
|
| 38 |
-
author={Maio, Anthony},
|
| 39 |
-
year={2025},
|
| 40 |
-
doi={10.5281/zenodo.18063451}
|
| 41 |
-
}
|
| 42 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Slipstream Lab
|
| 3 |
+
emoji: 🧭
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.5.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
+
short_description: "CPU-first technical companion for Slipstream 3.1.1"
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Slipstream Lab
|
| 15 |
|
| 16 |
+
Technical companion Space for Slipstream `3.1.1`.
|
|
|
|
| 17 |
|
| 18 |
+
This Space is intentionally different from [slipstream.making-minds.ai](https://slipstream.making-minds.ai):
|
| 19 |
|
| 20 |
+
- the website explains and promotes the release
|
| 21 |
+
- this Space helps engineers inspect the shipped protocol and adoption path
|
| 22 |
+
|
| 23 |
+
## Tabs
|
| 24 |
+
|
| 25 |
+
- `Overview`: release metrics and links
|
| 26 |
+
- `UCR Explorer`: browse the 45 core anchors
|
| 27 |
+
- `Conformance Lab`: validate and parse real `SLIP v3` wires
|
| 28 |
+
- `LangGraph Starter`: copy-paste integration snippets
|
| 29 |
+
- `Dataset / Model`: understand when training is optional and when it helps
|
| 30 |
+
|
| 31 |
+
## Runtime model
|
| 32 |
+
|
| 33 |
+
- CPU-first
|
| 34 |
+
- ZeroGPU-compatible
|
| 35 |
+
- no live model inference
|
| 36 |
+
- no training workflow
|
| 37 |
|
| 38 |
## Resources
|
| 39 |
|
| 40 |
+
- Website: [slipstream.making-minds.ai](https://slipstream.making-minds.ai)
|
| 41 |
+
- GitHub: [anthony-maio/slipcore](https://github.com/anthony-maio/slipcore)
|
| 42 |
+
- PyPI: [slipcore](https://pypi.org/project/slipcore/)
|
| 43 |
+
- Paper: [doi.org/10.5281/zenodo.18063451](https://doi.org/10.5281/zenodo.18063451)
|
| 44 |
+
- Dataset: [anthonym21/slipstream-tqt](https://huggingface.co/datasets/anthonym21/slipstream-tqt)
|
| 45 |
+
- Reference model: [anthonym21/slipstream-glm-z1-9b](https://huggingface.co/anthonym21/slipstream-glm-z1-9b)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -1,523 +1,431 @@
|
|
| 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 |
-
|
| 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 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
""
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
""
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
#
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 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 |
-
|
| 338 |
-
|
| 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 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
gr.Markdown(
|
| 391 |
-
gr.
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
dec_input = gr.Textbox(
|
| 434 |
-
label="SLIP v3 message",
|
| 435 |
-
value="SLIP v3 alice bob Request Review auth",
|
| 436 |
-
placeholder="SLIP v3 src dst Force Object payload...",
|
| 437 |
-
)
|
| 438 |
-
dec_btn = gr.Button("Decode", variant="primary")
|
| 439 |
-
dec_output = gr.Markdown()
|
| 440 |
-
|
| 441 |
-
dec_btn.click(decode_message, inputs=dec_input, outputs=dec_output)
|
| 442 |
-
|
| 443 |
-
# ---- UCR Explorer tab ----
|
| 444 |
-
with gr.TabItem("UCR Explorer", id="ucr"):
|
| 445 |
-
gr.Markdown("### Universal Concept Reference")
|
| 446 |
-
gr.Markdown("The 45 core anchors that form the shared semantic vocabulary.")
|
| 447 |
-
|
| 448 |
-
ucr_filter = gr.Dropdown(
|
| 449 |
-
choices=["All"] + FORCES,
|
| 450 |
-
value="All",
|
| 451 |
-
label="Filter by Force",
|
| 452 |
-
)
|
| 453 |
-
ucr_table = gr.Markdown(value=build_ucr_table("All"))
|
| 454 |
-
|
| 455 |
-
ucr_filter.change(build_ucr_table, inputs=ucr_filter, outputs=ucr_table)
|
| 456 |
-
|
| 457 |
-
# ---- About tab ----
|
| 458 |
-
with gr.TabItem("About", id="about"):
|
| 459 |
-
gr.Markdown(f"""
|
| 460 |
-
### What is Slipstream?
|
| 461 |
-
|
| 462 |
-
Slipstream is a protocol that performs **semantic quantization**: mapping free-form
|
| 463 |
-
messages onto a shared Universal Concept Reference (UCR) and transmitting factorized
|
| 464 |
-
intents (Force + Object) that identify structured actions.
|
| 465 |
-
|
| 466 |
-
Instead of sending `"Could you please take a look at my pull request for the authentication module changes?"` (17 tokens),
|
| 467 |
-
Slipstream transmits `SLIP v3 dev reviewer Request Review auth` (7 tokens).
|
| 468 |
-
|
| 469 |
-
**82% token reduction** while preserving semantic fidelity.
|
| 470 |
-
|
| 471 |
-
### How the quantizer works
|
| 472 |
-
|
| 473 |
-
The keyword quantizer runs in two stages:
|
| 474 |
-
|
| 475 |
-
1. **Force classification** -- match input against keyword patterns for each of the 12 Force tokens. Pick the highest-scoring Force.
|
| 476 |
-
2. **Object classification** -- match input against keyword patterns for each of the 31+ Object tokens. Pick the highest-scoring Object.
|
| 477 |
-
|
| 478 |
-
If no pattern matches above the confidence threshold, the message falls back to `Fallback Generic` with a pointer reference to the original text stored out-of-band.
|
| 479 |
-
|
| 480 |
-
For production use, swap in the embedding-based `SemanticQuantizer` from `slipcore_ml` (requires sentence-transformers).
|
| 481 |
-
|
| 482 |
-
---
|
| 483 |
-
|
| 484 |
-
### Resources
|
| 485 |
-
|
| 486 |
-
| Resource | Link |
|
| 487 |
-
|----------|------|
|
| 488 |
-
| GitHub | [github.com/anthony-maio/slipcore](https://github.com/anthony-maio/slipcore) |
|
| 489 |
-
| PyPI | `pip install slipcore` (v{__version__}) |
|
| 490 |
-
| Paper | [doi.org/10.5281/zenodo.18063451](https://doi.org/10.5281/zenodo.18063451) |
|
| 491 |
-
| SDK Guide | [docs/sdk-guide.md](https://github.com/anthony-maio/slipcore/blob/master/docs/sdk-guide.md) |
|
| 492 |
-
| Model (LoRA) | [anthonym21/slipstream-glm-z1-9b](https://huggingface.co/anthonym21/slipstream-glm-z1-9b) |
|
| 493 |
-
| Dataset | [anthonym21/slipstream-tqt](https://huggingface.co/datasets/anthonym21/slipstream-tqt) |
|
| 494 |
-
|
| 495 |
-
### Cost savings at scale
|
| 496 |
-
|
| 497 |
-
| Deployment | Agents | Annual JSON cost | Annual SLIP cost | Savings |
|
| 498 |
-
|------------|--------|------------------|------------------|---------|
|
| 499 |
-
| Startup | 10 | $3,600 | $650 | $2,950 |
|
| 500 |
-
| Scale-up | 50 | $180,000 | $32,400 | $147,600 |
|
| 501 |
-
| Enterprise | 1,000 | $2,500,000 | $450,000 | $2,050,000 |
|
| 502 |
-
|
| 503 |
-
---
|
| 504 |
-
|
| 505 |
-
**Citation:**
|
| 506 |
-
```bibtex
|
| 507 |
-
@misc{{maio2025slipstream,
|
| 508 |
-
title={{Slipstream: Semantic Quantization for Efficient Multi-Agent Coordination}},
|
| 509 |
-
author={{Maio, Anthony}},
|
| 510 |
-
year={{2025}},
|
| 511 |
-
doi={{10.5281/zenodo.18063451}}
|
| 512 |
-
}}
|
| 513 |
-
```
|
| 514 |
-
|
| 515 |
-
Apache 2.0 License | [Anthony Maio](https://github.com/anthony-maio)
|
| 516 |
-
""")
|
| 517 |
-
|
| 518 |
-
gr.Markdown(f"<center><sub>slipcore v{__version__} | keyword quantizer | "
|
| 519 |
-
f"[source](https://github.com/anthony-maio/slipcore/tree/master/hf-space)</sub></center>")
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
if __name__ == "__main__":
|
| 523 |
-
demo.launch()
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import Any
|
| 4 |
+
|
| 5 |
+
import gradio as gr
|
| 6 |
+
from app_logic import (
|
| 7 |
+
analyze_wire,
|
| 8 |
+
build_ucr_rows,
|
| 9 |
+
get_langgraph_snippet,
|
| 10 |
+
get_overview_metrics,
|
| 11 |
+
get_resource_rows,
|
| 12 |
+
get_training_guidance,
|
| 13 |
+
load_example_wires,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
TABLE_HEADERS = ["index", "force", "object", "canonical", "coords", "core", "state"]
|
| 17 |
+
SNIPPET_TOPICS = [
|
| 18 |
+
"Boundary Encode/Decode",
|
| 19 |
+
"Force:Object Router",
|
| 20 |
+
"Fallback-Aware Flow",
|
| 21 |
+
]
|
| 22 |
+
GUIDANCE_TOPICS = [
|
| 23 |
+
"When should I train?",
|
| 24 |
+
"What does the dataset look like?",
|
| 25 |
+
"What model artifacts exist?",
|
| 26 |
+
"How should I evaluate first?",
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
CUSTOM_CSS = """
|
| 30 |
+
:root {
|
| 31 |
+
--slip-bg: #111111;
|
| 32 |
+
--slip-surface: #1a1a1a;
|
| 33 |
+
--slip-line: rgba(255, 255, 255, 0.08);
|
| 34 |
+
--slip-text: #f4efe6;
|
| 35 |
+
--slip-muted: #c5b8a0;
|
| 36 |
+
--slip-accent: #d18d3b;
|
| 37 |
+
--slip-cool: #83c5be;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
body, .gradio-container {
|
| 41 |
+
background:
|
| 42 |
+
radial-gradient(circle at top left, rgba(209, 141, 59, 0.14), transparent 28%),
|
| 43 |
+
radial-gradient(circle at top right, rgba(131, 197, 190, 0.12), transparent 22%),
|
| 44 |
+
var(--slip-bg);
|
| 45 |
+
color: var(--slip-text);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.gradio-container {
|
| 49 |
+
max-width: 1320px !important;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.hero-shell {
|
| 53 |
+
border: 1px solid var(--slip-line);
|
| 54 |
+
border-radius: 28px;
|
| 55 |
+
padding: 28px;
|
| 56 |
+
background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
|
| 57 |
+
box-shadow: 0 24px 80px rgba(0,0,0,0.24);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.hero-grid {
|
| 61 |
+
display: grid;
|
| 62 |
+
grid-template-columns: 1.2fr 0.8fr;
|
| 63 |
+
gap: 20px;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.eyebrow {
|
| 67 |
+
color: var(--slip-accent);
|
| 68 |
+
text-transform: uppercase;
|
| 69 |
+
letter-spacing: 0.12em;
|
| 70 |
+
font-size: 12px;
|
| 71 |
+
margin-bottom: 14px;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
.hero-title {
|
| 75 |
+
font-size: 56px;
|
| 76 |
+
line-height: 0.95;
|
| 77 |
+
margin: 0 0 16px 0;
|
| 78 |
+
letter-spacing: -0.05em;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.hero-copy {
|
| 82 |
+
font-size: 17px;
|
| 83 |
+
line-height: 1.65;
|
| 84 |
+
color: var(--slip-muted);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.signal-card, .mini-card {
|
| 88 |
+
border: 1px solid var(--slip-line);
|
| 89 |
+
border-radius: 20px;
|
| 90 |
+
padding: 18px;
|
| 91 |
+
background: rgba(255,255,255,0.03);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
.signal-label {
|
| 95 |
+
color: var(--slip-cool);
|
| 96 |
+
text-transform: uppercase;
|
| 97 |
+
letter-spacing: 0.10em;
|
| 98 |
+
font-size: 12px;
|
| 99 |
+
margin-bottom: 10px;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.signal-code {
|
| 103 |
+
background: rgba(255,255,255,0.04);
|
| 104 |
+
border: 1px solid rgba(255,255,255,0.08);
|
| 105 |
+
border-radius: 16px;
|
| 106 |
+
padding: 14px;
|
| 107 |
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
| 108 |
+
font-size: 13px;
|
| 109 |
+
line-height: 1.65;
|
| 110 |
+
color: var(--slip-text);
|
| 111 |
+
white-space: pre-wrap;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.stats-grid {
|
| 115 |
+
display: grid;
|
| 116 |
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
| 117 |
+
gap: 14px;
|
| 118 |
+
margin-top: 18px;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.stat-value {
|
| 122 |
+
font-size: 28px;
|
| 123 |
+
font-weight: 700;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
.stat-label {
|
| 127 |
+
color: var(--slip-muted);
|
| 128 |
+
font-size: 13px;
|
| 129 |
+
margin-top: 6px;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.panel-copy {
|
| 133 |
+
color: var(--slip-muted);
|
| 134 |
+
line-height: 1.65;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
@media (max-width: 960px) {
|
| 138 |
+
.hero-grid,
|
| 139 |
+
.stats-grid {
|
| 140 |
+
grid-template-columns: 1fr;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.hero-title {
|
| 144 |
+
font-size: 42px;
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
"""
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
def _metrics_html() -> str:
|
| 151 |
+
cards = []
|
| 152 |
+
for item in get_overview_metrics():
|
| 153 |
+
cards.append(
|
| 154 |
+
f"""
|
| 155 |
+
<div class="mini-card">
|
| 156 |
+
<div class="stat-value">{item["value"]}</div>
|
| 157 |
+
<div class="stat-label">{item["metric"]}</div>
|
| 158 |
+
</div>
|
| 159 |
+
"""
|
| 160 |
+
)
|
| 161 |
+
return "<div class='stats-grid'>" + "".join(cards) + "</div>"
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def _resources_markdown() -> str:
|
| 165 |
+
rows = ["| Resource | Link |", "|---|---|"]
|
| 166 |
+
for item in get_resource_rows():
|
| 167 |
+
rows.append(f"| {item['resource']} | {item['link']} |")
|
| 168 |
+
return "\n".join(rows)
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def _render_ucr(force_filter: str, search: str) -> tuple[str, list[list[str]]]:
|
| 172 |
+
rows = build_ucr_rows(force_filter=force_filter, search=search)
|
| 173 |
+
summary = (
|
| 174 |
+
f"Showing **{len(rows)}** anchors"
|
| 175 |
+
if rows
|
| 176 |
+
else "No anchors matched the current filter."
|
| 177 |
+
)
|
| 178 |
+
data = [[row[header] for header in TABLE_HEADERS] for row in rows]
|
| 179 |
+
return summary, data
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
def _render_analysis(wire: str) -> tuple[str, str, dict[str, Any], str]:
|
| 183 |
+
result = analyze_wire(wire)
|
| 184 |
+
if result["status"] == "valid":
|
| 185 |
+
status = "### Valid wire\nThis message passes Slipstream v3 validation."
|
| 186 |
+
issues = "No issues."
|
| 187 |
+
else:
|
| 188 |
+
status = "### Invalid wire\nThis message violates one or more Slipstream v3 invariants."
|
| 189 |
+
issues = "\n".join(f"- {issue}" for issue in result["issues"])
|
| 190 |
+
return status, issues, result["fields"], result["human"]
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def _load_example(example_type: str, selected: str | None) -> str:
|
| 194 |
+
if selected:
|
| 195 |
+
return selected
|
| 196 |
+
examples = load_example_wires(example_type)
|
| 197 |
+
return examples[0] if examples else ""
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
def _example_choices(example_type: str) -> tuple[dict[str, Any], str]:
|
| 201 |
+
examples = load_example_wires(example_type)
|
| 202 |
+
value = examples[0] if examples else ""
|
| 203 |
+
return gr.update(choices=examples, value=value), value
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
def _render_snippet(topic: str) -> tuple[str, str]:
|
| 207 |
+
copy = {
|
| 208 |
+
"Boundary Encode/Decode": (
|
| 209 |
+
"Add Slipstream at the handoff boundary. "
|
| 210 |
+
"Keep your graph state and existing node logic intact."
|
| 211 |
+
),
|
| 212 |
+
"Force:Object Router": (
|
| 213 |
+
"Route on `Force:Object` once the message is decoded. "
|
| 214 |
+
"This is the smallest useful production pattern."
|
| 215 |
+
),
|
| 216 |
+
"Fallback-Aware Flow": (
|
| 217 |
+
"Let fallback handle the long tail first. "
|
| 218 |
+
"Only train later if the fallback rate is too high for your workload."
|
| 219 |
+
),
|
| 220 |
+
}[topic]
|
| 221 |
+
return copy, get_langgraph_snippet(topic)
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
with gr.Blocks(title="Slipstream Lab") as demo:
|
| 225 |
+
gr.HTML(
|
| 226 |
+
"""
|
| 227 |
+
<section class="hero-shell">
|
| 228 |
+
<div class="hero-grid">
|
| 229 |
+
<div>
|
| 230 |
+
<div class="eyebrow">Slipstream 3.1.1 · Hugging Face Technical Companion</div>
|
| 231 |
+
<h1 class="hero-title">Explore the protocol, not just the pitch.</h1>
|
| 232 |
+
<p class="hero-copy">
|
| 233 |
+
This Space is the technical counterpart to the static website.
|
| 234 |
+
It is designed for engineers evaluating Slipstream in real systems:
|
| 235 |
+
inspect UCR anchors, validate wire messages against the shipped invariants,
|
| 236 |
+
generate LangGraph integration snippets, and review the dataset/model path
|
| 237 |
+
without running live inference.
|
| 238 |
+
</p>
|
| 239 |
+
<p class="hero-copy">
|
| 240 |
+
It is CPU-first and ZeroGPU-compatible by design.
|
| 241 |
+
There is no mandatory GPU path and no large-model dependency in the app itself.
|
| 242 |
+
</p>
|
| 243 |
+
</div>
|
| 244 |
+
<div class="signal-card">
|
| 245 |
+
<div class="signal-label">Wire format</div>
|
| 246 |
+
<div class="signal-code">
|
| 247 |
+
SLIP v3 <src> <dst> <Force> <Object> [payload...]
|
| 248 |
+
</div>
|
| 249 |
+
<div class="signal-label" style="margin-top: 16px;">Example</div>
|
| 250 |
+
<div class="signal-code">SLIP v3 planner reviewer Request Review auth</div>
|
| 251 |
+
<div class="signal-label" style="margin-top: 16px;">Why it matters</div>
|
| 252 |
+
<div class="panel-copy">
|
| 253 |
+
Slipstream compresses routine coordination traffic into short, explicit
|
| 254 |
+
messages that are easier to route, validate, and reason about than
|
| 255 |
+
repeated JSON envelopes.
|
| 256 |
+
</div>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
</section>
|
| 260 |
+
"""
|
| 261 |
+
)
|
| 262 |
+
|
| 263 |
+
gr.HTML(_metrics_html())
|
| 264 |
+
|
| 265 |
+
with gr.Tabs():
|
| 266 |
+
with gr.TabItem("Overview"):
|
| 267 |
+
gr.Markdown(
|
| 268 |
+
"""
|
| 269 |
+
## What this Space is for
|
| 270 |
+
|
| 271 |
+
Use this Space when you want to inspect the released protocol,
|
| 272 |
+
validate concrete wire examples, or understand how Slipstream
|
| 273 |
+
fits into a LangGraph-style orchestration stack.
|
| 274 |
+
|
| 275 |
+
It does **not** try to be a second homepage and it does **not**
|
| 276 |
+
depend on live model inference.
|
| 277 |
+
"""
|
| 278 |
+
)
|
| 279 |
+
gr.Markdown(_resources_markdown())
|
| 280 |
+
|
| 281 |
+
with gr.TabItem("UCR Explorer"):
|
| 282 |
+
gr.Markdown(
|
| 283 |
+
"""
|
| 284 |
+
## Universal Concept Reference
|
| 285 |
+
|
| 286 |
+
Browse the 45 core anchors that define the released
|
| 287 |
+
Slipstream 3.1.1 semantic surface. Filter by Force or search
|
| 288 |
+
across object names, canonical text, and coordinates.
|
| 289 |
+
"""
|
| 290 |
+
)
|
| 291 |
+
with gr.Row():
|
| 292 |
+
force_filter = gr.Dropdown(
|
| 293 |
+
choices=["All"] + sorted({row["force"] for row in build_ucr_rows()}),
|
| 294 |
+
value="All",
|
| 295 |
+
label="Force filter",
|
| 296 |
+
)
|
| 297 |
+
search_box = gr.Textbox(
|
| 298 |
+
label="Search",
|
| 299 |
+
placeholder="review, timeout, handoff, 3 4 0 4",
|
| 300 |
+
)
|
| 301 |
+
ucr_summary = gr.Markdown()
|
| 302 |
+
ucr_table = gr.Dataframe(
|
| 303 |
+
headers=TABLE_HEADERS,
|
| 304 |
+
datatype=["str"] * len(TABLE_HEADERS),
|
| 305 |
+
interactive=False,
|
| 306 |
+
wrap=True,
|
| 307 |
+
)
|
| 308 |
+
for event in (force_filter.change, search_box.submit):
|
| 309 |
+
event(
|
| 310 |
+
_render_ucr,
|
| 311 |
+
inputs=[force_filter, search_box],
|
| 312 |
+
outputs=[ucr_summary, ucr_table],
|
| 313 |
+
)
|
| 314 |
+
demo.load(
|
| 315 |
+
_render_ucr,
|
| 316 |
+
inputs=[force_filter, search_box],
|
| 317 |
+
outputs=[ucr_summary, ucr_table],
|
| 318 |
+
)
|
| 319 |
+
|
| 320 |
+
with gr.TabItem("Conformance Lab"):
|
| 321 |
+
gr.Markdown(
|
| 322 |
+
"""
|
| 323 |
+
## Conformance Lab
|
| 324 |
+
|
| 325 |
+
Paste a `SLIP v3` wire message or load one of the shipped
|
| 326 |
+
conformance vectors. The validator below uses the library
|
| 327 |
+
implementation directly, so the results match the released
|
| 328 |
+
runtime behavior.
|
| 329 |
+
"""
|
| 330 |
+
)
|
| 331 |
+
with gr.Row():
|
| 332 |
+
example_type = gr.Radio(
|
| 333 |
+
choices=["Valid", "Invalid"],
|
| 334 |
+
value="Valid",
|
| 335 |
+
label="Example set",
|
| 336 |
+
)
|
| 337 |
+
example_wire = gr.Dropdown(
|
| 338 |
+
choices=load_example_wires("Valid"),
|
| 339 |
+
value=load_example_wires("Valid")[0],
|
| 340 |
+
label="Conformance example",
|
| 341 |
+
)
|
| 342 |
+
wire_input = gr.Textbox(
|
| 343 |
+
label="Wire message",
|
| 344 |
+
lines=4,
|
| 345 |
+
value=load_example_wires("Valid")[0],
|
| 346 |
+
)
|
| 347 |
+
analyze_btn = gr.Button("Validate and parse", variant="primary")
|
| 348 |
+
status_md = gr.Markdown()
|
| 349 |
+
issues_md = gr.Markdown(label="Issues")
|
| 350 |
+
fields_json = gr.JSON(label="Parsed fields")
|
| 351 |
+
human_md = gr.Markdown(label="Human render")
|
| 352 |
+
|
| 353 |
+
example_type.change(
|
| 354 |
+
_example_choices,
|
| 355 |
+
inputs=example_type,
|
| 356 |
+
outputs=[example_wire, wire_input],
|
| 357 |
+
)
|
| 358 |
+
example_wire.change(
|
| 359 |
+
_load_example,
|
| 360 |
+
inputs=[example_type, example_wire],
|
| 361 |
+
outputs=wire_input,
|
| 362 |
+
)
|
| 363 |
+
analyze_btn.click(
|
| 364 |
+
_render_analysis,
|
| 365 |
+
inputs=wire_input,
|
| 366 |
+
outputs=[status_md, issues_md, fields_json, human_md],
|
| 367 |
+
)
|
| 368 |
+
demo.load(
|
| 369 |
+
_render_analysis,
|
| 370 |
+
inputs=wire_input,
|
| 371 |
+
outputs=[status_md, issues_md, fields_json, human_md],
|
| 372 |
+
)
|
| 373 |
+
|
| 374 |
+
with gr.TabItem("LangGraph Starter"):
|
| 375 |
+
gr.Markdown(
|
| 376 |
+
"""
|
| 377 |
+
## LangGraph Starter
|
| 378 |
+
|
| 379 |
+
These snippets are meant to be copied into your graph layer.
|
| 380 |
+
Start with boundary encode/decode and route on `Force:Object`.
|
| 381 |
+
Training is optional and should come only after you have
|
| 382 |
+
measured real traffic.
|
| 383 |
+
"""
|
| 384 |
+
)
|
| 385 |
+
snippet_topic = gr.Dropdown(
|
| 386 |
+
choices=SNIPPET_TOPICS,
|
| 387 |
+
value=SNIPPET_TOPICS[0],
|
| 388 |
+
label="Pattern",
|
| 389 |
+
)
|
| 390 |
+
snippet_copy = gr.Markdown()
|
| 391 |
+
snippet_code = gr.Code(language="python", interactive=False)
|
| 392 |
+
snippet_topic.change(
|
| 393 |
+
_render_snippet,
|
| 394 |
+
inputs=snippet_topic,
|
| 395 |
+
outputs=[snippet_copy, snippet_code],
|
| 396 |
+
)
|
| 397 |
+
demo.load(
|
| 398 |
+
_render_snippet,
|
| 399 |
+
inputs=snippet_topic,
|
| 400 |
+
outputs=[snippet_copy, snippet_code],
|
| 401 |
+
)
|
| 402 |
+
|
| 403 |
+
with gr.TabItem("Dataset / Model"):
|
| 404 |
+
gr.Markdown(
|
| 405 |
+
"""
|
| 406 |
+
## Dataset and model path
|
| 407 |
+
|
| 408 |
+
Slipstream can be adopted without training. This tab is here to
|
| 409 |
+
clarify when training becomes useful, what the dataset contains,
|
| 410 |
+
and how to think about evaluation before you fine-tune anything.
|
| 411 |
+
"""
|
| 412 |
+
)
|
| 413 |
+
guidance_topic = gr.Dropdown(
|
| 414 |
+
choices=GUIDANCE_TOPICS,
|
| 415 |
+
value=GUIDANCE_TOPICS[0],
|
| 416 |
+
label="Question",
|
| 417 |
+
)
|
| 418 |
+
guidance_md = gr.Markdown()
|
| 419 |
+
guidance_topic.change(get_training_guidance, inputs=guidance_topic, outputs=guidance_md)
|
| 420 |
+
demo.load(get_training_guidance, inputs=guidance_topic, outputs=guidance_md)
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
if __name__ == "__main__":
|
| 424 |
+
demo.launch(
|
| 425 |
+
theme=gr.themes.Base(
|
| 426 |
+
primary_hue="amber",
|
| 427 |
+
secondary_hue="stone",
|
| 428 |
+
neutral_hue="zinc",
|
| 429 |
+
),
|
| 430 |
+
css=CUSTOM_CSS,
|
| 431 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app_logic.py
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
+
from functools import lru_cache
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
+
from slipcore import (
|
| 9 |
+
LangGraphSlipstreamAdapter,
|
| 10 |
+
create_base_ucr,
|
| 11 |
+
parse_slip,
|
| 12 |
+
render_human,
|
| 13 |
+
validate_wire,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 17 |
+
VALID_VECTORS = ROOT / "spec" / "conformance" / "valid.jsonl"
|
| 18 |
+
INVALID_VECTORS = ROOT / "spec" / "conformance" / "invalid.jsonl"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
@lru_cache(maxsize=1)
|
| 22 |
+
def _base_ucr():
|
| 23 |
+
return create_base_ucr()
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
@lru_cache(maxsize=1)
|
| 27 |
+
def _adapter() -> LangGraphSlipstreamAdapter:
|
| 28 |
+
return LangGraphSlipstreamAdapter()
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def build_ucr_rows(force_filter: str = "All", search: str = "") -> list[dict[str, str]]:
|
| 32 |
+
query = search.strip().lower()
|
| 33 |
+
rows: list[dict[str, str]] = []
|
| 34 |
+
|
| 35 |
+
for anchor in sorted(_base_ucr(), key=lambda item: item.index):
|
| 36 |
+
if force_filter != "All" and anchor.force != force_filter:
|
| 37 |
+
continue
|
| 38 |
+
|
| 39 |
+
haystack = " ".join(
|
| 40 |
+
[
|
| 41 |
+
anchor.force,
|
| 42 |
+
anchor.obj,
|
| 43 |
+
anchor.canonical,
|
| 44 |
+
" ".join(str(value) for value in anchor.coords),
|
| 45 |
+
]
|
| 46 |
+
).lower()
|
| 47 |
+
if query and query not in haystack:
|
| 48 |
+
continue
|
| 49 |
+
|
| 50 |
+
rows.append(
|
| 51 |
+
{
|
| 52 |
+
"index": f"0x{anchor.index:04x}",
|
| 53 |
+
"force": anchor.force,
|
| 54 |
+
"object": anchor.obj,
|
| 55 |
+
"canonical": anchor.canonical,
|
| 56 |
+
"coords": str(anchor.coords),
|
| 57 |
+
"core": "yes" if anchor.is_core else "no",
|
| 58 |
+
"state": anchor.state.value,
|
| 59 |
+
}
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
return rows
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def analyze_wire(wire: str) -> dict[str, Any]:
|
| 66 |
+
wire = wire.strip()
|
| 67 |
+
issues = validate_wire(wire)
|
| 68 |
+
if issues:
|
| 69 |
+
return {
|
| 70 |
+
"status": "invalid",
|
| 71 |
+
"issues": issues,
|
| 72 |
+
"human": "",
|
| 73 |
+
"fields": {},
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
message = parse_slip(wire)
|
| 77 |
+
fields = {
|
| 78 |
+
"version": message.version,
|
| 79 |
+
"src": message.src,
|
| 80 |
+
"dst": message.dst,
|
| 81 |
+
"force": message.force,
|
| 82 |
+
"object": message.obj,
|
| 83 |
+
"payload": " ".join(message.payload),
|
| 84 |
+
"fallback_ref": message.fallback_ref or "",
|
| 85 |
+
"token_count": str(message.token_count_estimate),
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
return {
|
| 89 |
+
"status": "valid",
|
| 90 |
+
"issues": [],
|
| 91 |
+
"human": render_human(message),
|
| 92 |
+
"fields": fields,
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def load_example_wires(kind: str) -> list[str]:
|
| 97 |
+
path = VALID_VECTORS if kind == "Valid" else INVALID_VECTORS
|
| 98 |
+
examples: list[str] = []
|
| 99 |
+
with path.open(encoding="utf-8") as handle:
|
| 100 |
+
for line in handle:
|
| 101 |
+
record = json.loads(line)
|
| 102 |
+
examples.append(record["wire"])
|
| 103 |
+
if len(examples) == 8:
|
| 104 |
+
break
|
| 105 |
+
return examples
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
LANGGRAPH_SNIPPETS = {
|
| 109 |
+
"Boundary Encode/Decode": """from typing import TypedDict
|
| 110 |
+
from langgraph.graph import StateGraph
|
| 111 |
+
|
| 112 |
+
from slipcore import (
|
| 113 |
+
LangGraphSlipstreamAdapter,
|
| 114 |
+
make_decode_node,
|
| 115 |
+
make_encode_node,
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class AgentState(TypedDict, total=False):
|
| 120 |
+
thought: str
|
| 121 |
+
src: str
|
| 122 |
+
dst: str
|
| 123 |
+
slip_wire: str
|
| 124 |
+
slip_force: str
|
| 125 |
+
slip_obj: str
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
adapter = LangGraphSlipstreamAdapter()
|
| 129 |
+
encode_node = make_encode_node(adapter)
|
| 130 |
+
decode_node = make_decode_node(adapter)
|
| 131 |
+
|
| 132 |
+
builder = StateGraph(AgentState)
|
| 133 |
+
builder.add_node("slip_encode", encode_node)
|
| 134 |
+
builder.add_node("slip_decode", decode_node)
|
| 135 |
+
""",
|
| 136 |
+
"Force:Object Router": """from slipcore import (
|
| 137 |
+
LangGraphSlipstreamAdapter,
|
| 138 |
+
make_force_object_router,
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
adapter = LangGraphSlipstreamAdapter()
|
| 142 |
+
route = make_force_object_router(adapter)
|
| 143 |
+
|
| 144 |
+
builder.add_conditional_edges(
|
| 145 |
+
"slip_decode",
|
| 146 |
+
route,
|
| 147 |
+
{
|
| 148 |
+
"Request:Review": "review_agent",
|
| 149 |
+
"Inform:Status": "status_agent",
|
| 150 |
+
"Fallback:Generic": "fallback_agent",
|
| 151 |
+
},
|
| 152 |
+
)
|
| 153 |
+
""",
|
| 154 |
+
"Fallback-Aware Flow": """from slipcore import LangGraphSlipstreamAdapter
|
| 155 |
+
|
| 156 |
+
adapter = LangGraphSlipstreamAdapter()
|
| 157 |
+
|
| 158 |
+
wire, result = adapter.encode_thought(
|
| 159 |
+
"Check kubernetes pod logs for OOMKilled events",
|
| 160 |
+
src="devops",
|
| 161 |
+
dst="sre",
|
| 162 |
+
)
|
| 163 |
+
|
| 164 |
+
decoded = adapter.decode_wire(wire)
|
| 165 |
+
print(decoded.message.force, decoded.message.obj)
|
| 166 |
+
print(decoded.fallback_text)
|
| 167 |
+
""",
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def get_langgraph_snippet(topic: str) -> str:
|
| 172 |
+
return LANGGRAPH_SNIPPETS[topic]
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
TRAINING_GUIDANCE = {
|
| 176 |
+
"When should I train?": (
|
| 177 |
+
"Training is optional. Start with the built-in keyword quantizer, "
|
| 178 |
+
"strict wire validation, and pointer-based fallback. Measure "
|
| 179 |
+
"fallback rate and routing correctness first. Train only if your "
|
| 180 |
+
"workload needs higher intent recall than the rules-based path provides."
|
| 181 |
+
),
|
| 182 |
+
"What does the dataset look like?": (
|
| 183 |
+
"The dataset is ShareGPT-style conversation data for Think -> "
|
| 184 |
+
"Quantize -> Transmit. Typical records include THOUGHT, QUANTIZE, "
|
| 185 |
+
"and SLIP lines so a model can learn the protocol without hiding "
|
| 186 |
+
"the reasoning step."
|
| 187 |
+
),
|
| 188 |
+
"What model artifacts exist?": (
|
| 189 |
+
"Reference artifacts live on Hugging Face under the anthonym21 "
|
| 190 |
+
"namespace: the dataset `slipstream-tqt`, the LoRA adapter "
|
| 191 |
+
"`slipstream-glm-z1-9b`, and companion merged and GGUF variants."
|
| 192 |
+
),
|
| 193 |
+
"How should I evaluate first?": (
|
| 194 |
+
"Build a small gold eval set from your own agent traffic. Track "
|
| 195 |
+
"Force accuracy, Object accuracy, fallback rate, and downstream "
|
| 196 |
+
"routing correctness before considering any fine-tuning pass."
|
| 197 |
+
),
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def get_training_guidance(topic: str) -> str:
|
| 202 |
+
return TRAINING_GUIDANCE[topic]
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def get_overview_metrics() -> list[dict[str, str]]:
|
| 206 |
+
return [
|
| 207 |
+
{"metric": "Current release", "value": "3.1.1"},
|
| 208 |
+
{"metric": "Core dependencies", "value": "0"},
|
| 209 |
+
{"metric": "Passing tests", "value": "583"},
|
| 210 |
+
{"metric": "Average token reduction", "value": "82%"},
|
| 211 |
+
]
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
def get_resource_rows() -> list[dict[str, str]]:
|
| 215 |
+
return [
|
| 216 |
+
{"resource": "Website", "link": "https://slipstream.making-minds.ai"},
|
| 217 |
+
{"resource": "GitHub", "link": "https://github.com/anthony-maio/slipcore"},
|
| 218 |
+
{"resource": "PyPI", "link": "https://pypi.org/project/slipcore/"},
|
| 219 |
+
{"resource": "Paper", "link": "https://doi.org/10.5281/zenodo.18063451"},
|
| 220 |
+
{
|
| 221 |
+
"resource": "Dataset",
|
| 222 |
+
"link": "https://huggingface.co/datasets/anthonym21/slipstream-tqt",
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"resource": "Reference model",
|
| 226 |
+
"link": "https://huggingface.co/anthonym21/slipstream-glm-z1-9b",
|
| 227 |
+
},
|
| 228 |
+
]
|
requirements.txt
CHANGED
|
@@ -1,2 +1 @@
|
|
| 1 |
-
|
| 2 |
-
slipcore>=3.0.1
|
|
|
|
| 1 |
+
slipcore>=3.1.1
|
|
|