feat(workbench): land M00–M06 runtime contracts and read-only view
Add capabilities/selection/usage/DocumentView/locator/RunContext with honest probes, LLM messages+cancel, sse-live cancel bridge, and CI workbench_contracts gate; record design evidence for verified slices. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
663a8ba2c0
commit
03396afd02
41 files changed
+2997
-68
No files matched your search
@@ -127,7 +127,11 @@ impl KnowledgePresentation {
|
||||
}
|
||||
}
|
||||
|
||||
/// V2: whether an SSE result packet may update the live document structure.
|
||||
/// Live View SSE: whether a result packet may update the document structure.
|
||||
///
|
||||
/// Legacy packets without a token are accepted so older live-view clients keep
|
||||
/// working. **Embedded DocumentView clients must use [`sse_accepts_packet_strict`]
|
||||
/// instead** — missing/empty tokens and mismatches are rejected there.
|
||||
pub fn sse_accepts_packet(page_token: &str, packet_token: Option<&str>) -> bool {
|
||||
match packet_token {
|
||||
None | Some("") => true, // legacy packets without token still apply
|
||||
@@ -136,6 +140,18 @@ pub fn sse_accepts_packet(page_token: &str, packet_token: Option<&str>) -> bool
|
||||
}
|
||||
}
|
||||
|
||||
/// Strict SSE / embed gate: reject missing, empty, or mismatched page tokens.
|
||||
///
|
||||
/// Use this for DocumentView / qdagent embed hosts. Do not inherit the live-view
|
||||
/// leniency of [`sse_accepts_packet`].
|
||||
pub fn sse_accepts_packet_strict(page_token: &str, packet_token: Option<&str>) -> bool {
|
||||
match packet_token {
|
||||
None | Some("") => false,
|
||||
Some(_tok) if page_token.is_empty() => false,
|
||||
Some(tok) => tok == page_token,
|
||||
}
|
||||
}
|
||||
|
||||
/// Stable page token from raw source bytes (used by SSE run path).
|
||||
pub fn page_token_from_source(rel: &str, source: &str) -> String {
|
||||
let mut h = Sha256::new();
|
||||
|
||||
Reference in new issue
Block a user