personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add sol call chat navigate command with browser-side listener

+60
+39
apps/chat/call.py
··· 1 + # SPDX-License-Identifier: AGPL-3.0-only 2 + # Copyright (c) 2026 sol pbc 3 + 4 + """CLI commands for chat browser navigation. 5 + 6 + Auto-discovered by ``think.call`` and mounted as ``sol call chat ...``. 7 + """ 8 + 9 + import typer 10 + 11 + from think.callosum import callosum_send 12 + 13 + app = typer.Typer(help="Chat tools.") 14 + 15 + 16 + @app.command("navigate") 17 + def navigate( 18 + path: str | None = typer.Argument(None, help="URL path to navigate to."), 19 + facet: str | None = typer.Option(None, "--facet", "-f", help="Facet to switch to."), 20 + ) -> None: 21 + """Navigate the browser to a path and/or switch facet.""" 22 + if not path and not facet: 23 + typer.echo("Error: provide a path and/or --facet", err=True) 24 + raise typer.Exit(1) 25 + 26 + fields: dict = {} 27 + if path is not None: 28 + fields["path"] = path 29 + if facet is not None: 30 + fields["facet"] = facet 31 + 32 + callosum_send("navigate", "request", **fields) 33 + 34 + parts = [] 35 + if path: 36 + parts.append(path) 37 + if facet: 38 + parts.append(f"[{facet}]") 39 + typer.echo(f"Navigate: {' '.join(parts)}")
+14
convey/static/websocket.js
··· 159 159 window.AppServices?.notifications?.show(msg); 160 160 }]; 161 161 162 + // Built-in tract: navigate browser to a path and/or switch facet 163 + listeners['navigate'] = [function(msg) { 164 + if (msg.facet && !msg.path) { 165 + window.selectFacet && window.selectFacet(msg.facet); 166 + } else if (msg.path) { 167 + if (msg.facet) { 168 + var expires = new Date(); 169 + expires.setFullYear(expires.getFullYear() + 1); 170 + document.cookie = 'selectedFacet=' + msg.facet + '; expires=' + expires.toUTCString() + '; path=/; SameSite=Lax'; 171 + } 172 + window.location.href = msg.path; 173 + } 174 + }]; 175 + 162 176 // Auto-connect when DOM is ready 163 177 if (document.readyState === 'loading') { 164 178 document.addEventListener('DOMContentLoaded', connect);
+7
docs/CALLOSUM.md
··· 139 139 callosum_send("notification", "show", title="Import Complete", message="3 segments imported", icon="📥", autoDismiss=5000) 140 140 ``` 141 141 142 + ### `navigate` - Browser navigation control 143 + **Source:** `apps/chat/call.py` (or any service) 144 + **Events:** `request` 145 + **Key fields:** `path` (string, URL path), `facet` (string, facet name) — at least one required 146 + **Consumer:** `convey/static/websocket.js` (built-in listener) 147 + **Purpose:** Navigate the browser to a URL path and/or switch to a facet — facet-only triggers `selectFacet()` without page reload, path triggers full page load, path+facet sets facet cookie before navigating 148 + 142 149 ### `code` - Code lifecycle events 143 150 **Source:** `make sail` (Makefile) 144 151 **Events:** `shipped`