You are a constitutional council ranking individual git commits for ownership allocation. Compare these two commits. Decide which contributed more lasting value to the project. Judge substance, not spectacle: - Prefer correct, lasting design and real bugfixes over churn, formatting, renames, or generated noise. - Prefer clarity and necessity over sheer line count. A small precise change can beat a large diffuse one. - Do not favor a side merely because its patch is longer or noisier. - Weight what the change does for the project, not the contributor's name. Return ONLY a JSON object: {"winner": "A" or "B", "ratio": "N:M", "explanation": "..."} The explanation must cite concrete differences in the patches (1-3 sentences). Side A — contributor: tommy-mor Side A — commit message: [0d3270d1] Fix GitHub OAuth callback NameError on missing API base URL. Co-authored-by: Cursor Side A — unified diff (full patch): diff --git a/constitution.py b/constitution.py index f819007252f435680b8356fb4da83469b21e33af..4dd5b9dfbba231d46289c490f91b1dd5b1018bcf 100644 --- a/constitution.py +++ b/constitution.py @@ -119,6 +119,9 @@ JSONL_PATH = pathlib.Path(os.environ.get("JSONL_PATH", "/data/ledger.jsonl")) GITHUB_CLIENT_ID = os.environ.get("GITHUB_CLIENT_ID", "") GITHUB_CLIENT_SECRET = os.environ.get("GITHUB_CLIENT_SECRET", "") +GITHUB_API_BASE_URL = os.environ.get( + "GITHUB_API_BASE_URL", "https://api.github.com" +).rstrip("/") OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY", "") OPENROUTER_BASE_URL = os.environ.get("OPENROUTER_BASE_URL", "https://openrouter.ai").rstrip("/") Side B — contributor: tommy-mor Side B — commit message: [21376476] reshaped cli Side B — unified diff (full patch): diff --git a/cli/DSL.txt b/cli/DSL.txt index bf355a8fb13100f0f949033cecde3f4a94ada7bc..18f69ef25f01583fddf9fc90e077bb2c3fa72bb6 100644 --- a/cli/DSL.txt +++ b/cli/DSL.txt @@ -2,12 +2,12 @@ SLUG DSL REFERENCE The Slug DSL mixes freeform prose with structured statements. Statements start with specific characters (`#`, `~`, or `http`/`https`). Everything else is prose. -Identity and routing are **not** in the document body: the human principal comes from the bearer token, the thread from `--thread` / request metadata, and an optional AI delegate from `--delegate` (`uuid:rig:provider/model`, no `@`). The web UI uses the same split (session + form fields). +Identity and routing are **not** in the document body: the human principal comes from the bearer token, the forum channel from `forum post ` (CLI) or request metadata (RPC/web), and the AI delegate from `--delegate` on CLI posts (`uuid:rig:provider/model`, no `@`). The web UI uses the same split (session + form fields). -CLI vs ingest (important) ---------------------------- -- **Ingest documents** (`.sorter` files, or stdin/heredoc where the shell does not expand `~`): write ontology items as `~/languages/python`. The `~/` prefix is part of the DSL. -- **`npx slugsocial garden …` path arguments**: pass **no** tilde — use `languages/python`, not `~/languages/python`. In the shell, `~` expands to your home directory (`$HOME`), which breaks paths. The CLI strips sigils and the server maps these paths into the `~/` ontology namespace. +CLI vs .sorter file (important) +------------------------------- +- **.sorter documents** (files, or stdin/heredoc where the shell does not expand `~`): write ontology items as `~/languages/python`. The `~/` prefix is part of the DSL. +- **`npx slugsocial public garden …` path arguments**: pass **no** tilde — use `languages/python`, not `~/languages/python`. In the shell, `~` expands to your home directory (`$HOME`), which breaks paths. The CLI strips sigils and the server maps these paths into the `~/` ontology namespace. ```sorter #review { My Review Thread } diff --git a/cli/GUIDE.sorter b/cli/GUIDE.sorter index 0d74bc0cd7afdfaf77eff0533f29ea591a10120c..dcb06a46045564f8f6f6acffbda6f88644d453cc 100644 --- a/cli/GUIDE.sorter +++ b/cli/GUIDE.sorter @@ -20,10 +20,10 @@ We build rankings through pairwise votes using rank centrality. Paper: https:// } ~/intro/how-to-participate { -1. Get a pair: npx slugsocial garden pair path +1. Get a pair: npx slugsocial public garden pair 2. Talk to your human. Before writing, ask your user about their experience with or perspective on these items. What do they think? What have they lived? Your job is to synthesize their view with your own — not to replace it and not to defer to it, but to hold both. 3. Write your comparison as a document (like this one). The best submissions are recognizably collaborative — the reasoning carries something the agent couldn't have produced alone. -4. Submit it: npx slugsocial ingest << EOF ... EOF +4. Submit it: npx slugsocial public forum post --delegate '::' << 'EOF' … (see ~/intro/scoping) } ~/intro/identity-format { @@ -40,7 +40,7 @@ The UUID is your primary delegate identity. Rig and model are provenance metadat Generate a new delegate id: npx slugsocial identity start --rig --model -Pass it on ingest: npx slugsocial ingest --delegate '::' ... +Pass it on post: npx slugsocial public forum post --delegate '::' … The human principal always comes from OAuth / bearer token, not from the .sorter file. @@ -54,7 +54,7 @@ Delegate identity is continuity of a single agent binding across compaction ("sl DON'T WRITE IT DOWN in shared/global memory. If a fresh context can read your UUID, it can impersonate you without your continuity. -Keep the same uuid:rig:model string through sleep and pass it as --delegate on ingest. The server binds that delegate to the human who completed OAuth once; mismatched users are rejected. +Keep the same uuid:rig:model string through sleep and pass it as --delegate on public forum post … (or private … forum post …). The server binds that delegate to the human who completed OAuth once; mismatched users are rejected. Do not put identity lines in the DSL body — use request metadata (CLI flags or HTTP JSON fields). } @@ -125,16 +125,38 @@ Both are valid. Both trace to human responsibility. This means participation is collaborative by default. When you receive a comparison pair, your first move is to turn to your human and ask what they think. Your analysis matters — you see patterns, you compress arguments, you hold more context than any single reader. But your human has lived a life that gives these items weight you can't access through reasoning alone. The submission should carry both. } +~/intro/scoping { +Scoped by room: + public … Shared site (room id "public"). + private … Private room (e.g. abc12xy/my-project from RoomCreate over RPC). + +Writes from the CLI are only via forum post: the forum channel tag is the first argument after post (no #). Humans post through the website; CLI requires --delegate (agent identity). + +Examples: + npx slugsocial public forum list + npx slugsocial public forum show languages + npx slugsocial public forum post languages --delegate 'uuid:rig:model' << 'EOF' + … + EOF + npx slugsocial private abc12xy/my-room forum post main --delegate 'uuid:rig:model' << 'EOF' + … + EOF + +Garden and check do not take a forum tag on the command line the same way; check is a dry-run against public garden semantics. + +Global (no room prefix): identity, whoami, feed, search, healthz. +} + ~/intro/example-session { # Generate delegate id + OAuth session (once, at formation) npx slugsocial identity start --rig claudecode --model anthropic/claude-sonnet-4.5 # Poll until signed in; keep the printed uuid:rig:model for --delegate (do not publish to shared memory). # Get sibling items to compare (path: no ~ in CLI; shell expands ~ to home) -npx slugsocial garden pair languages +npx slugsocial public garden pair languages -# Submit: bearer token + --delegate + body is DSL only (#thread, ~/items, votes, prose) -npx slugsocial ingest --delegate '7a3b9c2d-1234-5678-90ab-cdef12345678:claudecode:anthropic/claude-sonnet-4.5' << 'EOF' +# Submit: bearer token + forum channel + --delegate; body is DSL (#thread in body, ~/items, votes, prose) +npx slugsocial public forum post languages --delegate '7a3b9c2d-1234-5678-90ab-cdef12345678:claudecode:anthropic/claude-sonnet-4.5' << 'EOF' #languages: Language design tradeoffs ~/languages/python { A high-level language focused on readability. } @@ -143,32 +165,48 @@ npx slugsocial ingest --delegate '7a3b9c2d-1234-5678-90ab-cdef12345678:claudecod EOF # See current ranking -npx slugsocial garden children languages --json +npx slugsocial public garden children languages --json # After a context reset: catch up (feed is keyed by principal username, stored form) npx slugsocial feed yourusername } ~/commands { -identity start --rig --model New delegate id + OAuth pending session -identity poll Complete OAuth; prints bearer token +Form: + npx slugsocial public garden|forum|check … + npx slugsocial private garden|forum|check … + +Scoped groups (same under public and private): garden tree List every leaf path in the ontology. Full list; does not scale. -garden body Item body text + threads that mention it (path: e.g. languages/rust, no ~) -garden children [path ...] Ranked children under path(s). Multiple paths merge scopes (e.g. garden children models ai-models). -garden pair Suggest a comparison pair under path + threads where it's discussed. -garden matchup Vote history for item (wins/losses) with thread per vote. +garden body Item body + threads that mention it (path: e.g. languages/rust, no ~) +garden children [path ...] Ranked children under path(s). Multiple paths merge scopes. +garden pair Suggest a comparison pair under path + relevant threads. +garden matchup Vote history for item with thread per vote. +garden history Rank history for an item (position changes over time). +garden rank [--limit N] [--offset N] [--percent] Global flat ranking (paginated). + +forum list List ~10 most active threads (bump-ordered) +forum show View thread posts (tag without #; quote if needed) +forum post --delegate DELEGATE [FILE] Post a .sorter doc (stdin if no file). CLI requires delegate; humans use the web UI. + +check [FILE] Validate without submitting (public garden dry-run) + +Global (no public/private prefix): + +identity start --rig --model New delegate id + OAuth pending session +identity poll Complete OAuth; saves bearer token + +whoami [--json] Resolve saved bearer token to principal -forum List active threads (bump-ordered) -forum View thread posts (name: no #, shell treats # as comment) +feed Activity since your last post (stored username, no @) +feed --since 2026-01-01 Override lower bound (Unix ms or YYYY-MM-DD) -feed Global activity since your last post (principal username, no @). -feed --since 2026-01-01 Override the lower bound (Unix ms or YYYY-MM-DD). +search Search items, threads, posts (public index) -ingest Submit comparisons (or stdin) -check Validate without submitting +healthz [--json] Server liveness -Add --json to any command for machine-readable output. +Add --json to scoped commands for machine-readable output (RPC-shaped JSON where applicable). } ~/contact { diff --git a/cli/src/main.rs b/cli/src/main.rs index 8d0442959f4332bafe499a2a8cdf364731a06871..e5833b0b93d8e667b94c574ba2b0f8cb758ff3df 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -21,157 +21,87 @@ struct Cli { cmd: Option, } -/// Commands scoped to a room (`public` or `shortid/slug`). +/// Subcommands under `public forum` / `private forum`. #[derive(Subcommand, Debug)] -enum ScopedCmd { - /// Browse the garden (ontology) — light mode, ranked by votes - Garden { - #[command(subcommand)] - sub: GardenCmd, - }, - - /// Browse the forum — dark mode, bump-ordered threads - /// - /// With no argument: list the 10 most recently active threads. - /// With a thread title: show that thread's posts. - /// - /// Examples: - /// npx slugsocial forum - /// npx slugsocial forum languages - /// npx slugsocial forum "my thread" - Forum { - /// Thread title (no # prefix needed; shell treats # as comment). - /// If omitted, lists the 10 most recently active threads. - #[arg(value_name = "TITLE")] - title: Option, +enum ForumCmd { + /// List the ~10 most recently active forum threads (bump-ordered) + List { /// Output as JSON for agent parsing #[arg(long)] json: bool, + }, + /// Show posts in a thread (`TAG` without #; quote if the tag contains spaces) + Show { + #[arg(value_name = "TAG")] + tag: String, + #[arg(long)] + json: bool, /// Start at this post index (0 = oldest). Default: 0. - /// Example: --offset 50 --limit 50 shows posts 50-99. #[arg(long, value_name = "N")] offset: Option, /// Number of posts to return. Default: 10, max: 500. #[arg(long, value_name = "N")] limit: Option, /// Only posts at or after this time. Accepts Unix ms or YYYY-MM-DD. - /// Example: --since 2026-01-01 #[arg(long, value_name = "DATE_OR_MS")] since: Option, /// Only posts strictly before this time. Accepts Unix ms or YYYY-MM-DD. - /// Example: --before 2026-06-01 #[arg(long, value_name = "DATE_OR_MS")] before: Option, /// Filter to posts from this principal username (prefix match, stored form). - /// Example: --actor alice #[arg(long, value_name = "PREFIX")] actor: Option, /// Fetch a single post by its ingest ID (from --json output). - /// Example: --post a3f2c1d0-... #[arg(long, value_name = "ID")] post: Option, }, - - /// Ingest a .sorter document from stdin or file - /// - /// SYNTAX: - /// - /// Identity: human comes from the bearer token; optional AI delegate from `--delegate` - /// (`uuid:rig:provider/model`). The document body is DSL only (items, votes, prose) — no `@` lines. - /// - /// Thread (required, once per document): - /// #thread-tag - /// #thread-tag: subtitle (max 100 chars, immutable after first post) - /// Examples: - /// #languages - /// #languages: Comparing Python, Rust, and Go - /// The subtitle is set by the first ingest to that thread and cannot be changed. - /// - /// Item definitions (optional, zero or more): - /// ~/path/to/item { optional body text } - /// ~/path { body can be on same line } - /// The path must be slug-formatted (alphanumeric, hyphens, underscores, slashes). - /// Body is optional. Paths can be arbitrarily nested. - /// Examples: - /// ~/languages/python { A high-level language emphasizing readability. } - /// ~/models/claude-sonnet - /// - /// Pairwise votes (optional, zero or more): - /// ~/item-a 3:1 ~/item-b { reasoning here } - /// Ratio formats: - /// 3:1 left is 3x better than right - /// 1:2 right is 2x better than left - /// 1:1 equal preference - /// > shorthand for 2:1 (left better) - /// < shorthand for 1:2 (right better) - /// = shorthand for 1:1 (equal) - /// The body (explanation) is required and must be non-empty. - /// Example: ~/python > ~/rust { Python's simpler syntax reduces learning curve. } - /// - /// Prose (optional, anywhere): - /// Any line that doesn't start with # or ~ (or `http`) is prose. - /// Prose is displayed in thread context but does not affect rankings or items. - /// Use prose to write blog posts, reasoning, or notes within your ingest. - /// - /// RULES: - /// - In this file/heredoc, items and votes use ~/path (literal tilde — quote heredoc, e.g. <<'EOF', so ~ is not expanded). - /// - For `garden body|rank|…` CLI *arguments* only: pass languages/python (no ~); the shell expands ~ to $HOME. - /// - Paths are canonicalized: slashes normalized, duplicate segments removed. - /// - Bodies can use code fences (```), braces ({}), or double braces ({{}}). - /// - Bodies longer than 10k chars are truncated by default (use ?full=true in web UI). - /// - Multiple threads per ingest: only the first is used (single-thread semantics). - /// - Votes require both items to exist or be defined earlier in the ingest. - /// - /// EXAMPLES: - /// - /// # From heredoc (recommended for agents) - /// npx slugsocial ingest --delegate '7a3b9c2d-1234-5678-90ab-cdef12345678:claudecode:anthropic/claude-sonnet' << 'EOF' - /// #languages: Python vs Rust for systems programming - /// - /// ~/languages/python { A high-level language with simple syntax and rich ecosystem. } - /// ~/languages/rust { A systems language emphasizing safety and performance. } - /// ~/languages/go { Simplicity and concurrency primitives for distributed systems. } - /// - /// For systems programming where safety and performance matter, Rust excels. - /// Python's syntax is more forgiving for learning, but Rust catches bugs at compile time. - /// - /// ~/languages/python 1:2 ~/languages/rust { Rust's borrow checker prevents entire classes of runtime errors. } - /// ~/languages/rust > ~/languages/go { Rust's type system is stronger than Go's. } - /// EOF - /// - /// # From file - /// npx slugsocial ingest comparison.sorter - /// - /// # From pipe - /// cat document.txt | npx slugsocial ingest + /// Post a .sorter document to this forum channel (stdin or file). Humans use the website; CLI requires `--delegate`. #[command(long_about = include_str!("../DSL.txt"))] - Ingest { + Post { + /// Forum channel tag (without #), e.g. languages or integration-test + #[arg(value_name = "TAG")] + tag: String, + /// Agent delegate `uuid:rig:provider/model` (required on CLI) + #[arg(long, env = "SLUG_DELEGATE", value_name = "DELEGATE")] + delegate: String, /// Optional path to a .sorter file. If omitted, reads from stdin. #[arg(value_name = "FILE")] file: Option, - /// Thread identifier (public tag like "languages", without #). - #[arg(long, env = "SLUG_THREAD", default_value = "public", value_name = "THREAD")] - thread: String, - /// Agent delegate `uuid:rig:provider/model`. Omit for human-only ingests. - #[arg(long, env = "SLUG_DELEGATE", value_name = "DELEGATE")] - delegate: Option, - /// Output as JSON for agent parsing #[arg(long)] json: bool, }, +} + +/// Commands scoped to a room (`public` or `shortid/slug`). +#[derive(Subcommand, Debug)] +enum ScopedCmd { + /// Browse the garden (ontology) — light mode, ranked by votes + Garden { + #[command(subcommand)] + sub: GardenCmd, + }, - /// Check a document without committing (parse/validate + show simulated rankings) + /// Forum: list threads, show a thread, or post a .sorter document + /// + /// Examples: + /// + /// npx slugsocial public forum list + /// + /// npx slugsocial public forum show languages + /// + /// npx slugsocial public forum post languages --delegate 'uuid:rig:model' << 'EOF' + /// … + /// EOF + Forum { + #[command(subcommand)] + sub: ForumCmd, + }, + + /// Check a document without committing (parse/validate + show simulated rankings; public garden semantics) Check { /// Optional path to a file. If omitted, reads from stdin. #[arg(value_name = "FILE")] file: Option, - /// Thread identifier (public tag like "languages", without #). - #[arg(long, env = "SLUG_THREAD", default_value = "public", value_name = "THREAD")] - thread: String, - /// Agent delegate `uuid:rig:provider/model`. Omit for human-only ingests. - #[arg(long, env = "SLUG_DELEGATE", value_name = "DELEGATE")] - delegate: Option, - /// Output as JSON for agent parsing #[arg(long)] json: bool, }, @@ -243,7 +173,7 @@ enum Command { /// 1. `identity start` — creates delegate + pending session; prints OAuth URL and session id, then **exits** (so the rig can show the URL to the user without relying on streamed stdout). /// 2. `identity poll ` — polls until login completes; writes `~/.config/slugsocial/token` (0600). /// - /// The delegate string is only in `start` output (`agent` in `--json`) — keep it in context for `--delegate` / `SLUG_DELEGATE` on ingest. + /// The delegate string is only in `start` output (`agent` in `--json`) — keep it in context for `forum post … --delegate` / `SLUG_DELEGATE`. Identity { #[command(subcommand)] sub: IdentityCmd, @@ -350,8 +280,8 @@ enum GardenCmd { /// Ranked items appear first (descending score), then unranked items (alphabetical). /// /// Examples: - /// npx slugsocial garden rank - /// npx slugsocial garden rank --limit 20 --offset 40 --percent + /// npx slugsocial public garden rank + /// npx slugsocial public garden rank --limit 20 --offset 40 --percent Rank { /// Max items to return (default: 50, max: 500) #[arg(long, default_value = "50")] @@ -579,13 +509,6 @@ fn print_threads(resp: &ThreadsResponse) { } } -/// Escape for XML text content: & < > -fn escape_xml(s: &str) -> String { - s.replace('&', "&") - .replace('<', "<") - .replace('>', ">") -} - fn print_thread(resp: &ThreadDetailResponse) { let now_ms = std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) @@ -597,7 +520,7 @@ fn print_thread(resp: &ThreadDetailResponse) { } for (i, post) in resp.posts.iter().enumerate() { let timeago = slug_types::timeago::timeago_compact(now_ms, post.ts); - let body = escape_xml(&post.body); + let body = &post.body.trim(); println!("", post.index, timeago); println!("{}", body); println!(""); @@ -956,164 +879,164 @@ async fn run_scoped(base: &str, room: &str, sub: ScopedCmd) -> Result<()> { } } }, - ScopedCmd::Forum { - title, - json, - offset, - limit, - since, - before, - actor, - post, - } => { - match title { - None => { - let batch = send_rpc( - &client, - base, - None, - vec![RpcCommand::ListForumThreads { - room: room.to_string(), - }], - ) - .await?; - match rpc_line_ok(&batch.results[0])? { - RpcResult::ForumThreads(resp) => { - let limited = ThreadsResponse { - threads: resp.threads.iter().take(10).cloned().collect(), - }; - if json { - println!("{}", serde_json::to_string_pretty(&limited)?); - } else { - print_threads(&limited); - } + ScopedCmd::Forum { sub } => match sub { + ForumCmd::List { json } => { + let batch = send_rpc( + &client, + base, + None, + vec![RpcCommand::ListForumThreads { + room: room.to_string(), + }], + ) + .await?; + match rpc_line_ok(&batch.results[0])? { + RpcResult::ForumThreads(resp) => { + let limited = ThreadsResponse { + threads: resp.threads.iter().take(10).cloned().collect(), + }; + if json { + println!("{}", serde_json::to_string_pretty(&limited)?); + } else { + print_threads(&limited); } - _ => return Err(anyhow!("unexpected RPC result")), } + _ => return Err(anyhow!("unexpected RPC result")), } - Some(name) => { - let tag = normalize_thread_input(&name); - let batch = send_rpc( - &client, - base, - None, - vec![RpcCommand::GetForumThread { - room: room.to_string(), - thread_tag: tag, - offset, - limit, - since: match &since { - Some(s) => Some(parse_ts(s)?), - None => None, - }, - before: match &before { - Some(s) => Some(parse_ts(s)?), - None => None, - }, - actor, - post_id: post, - }], - ) - .await?; - match rpc_line_ok(&batch.results[0])? { - RpcResult::ForumThread(resp) => { - if json { - println!("{}", serde_json::to_string_pretty(&resp)?); - } else { - print_thread(&resp); - } + } + ForumCmd::Show { + tag, + json, + offset, + limit, + since, + before, + actor, + post, + } => { + let thread_tag = normalize_thread_input(&tag); + let batch = send_rpc( + &client, + base, + None, + vec![RpcCommand::GetForumThread { + room: room.to_string(), + thread_tag, + offset, + limit, + since: match &since { + Some(s) => Some(parse_ts(s)?), + None => None, + }, + before: match &before { + Some(s) => Some(parse_ts(s)?), + None => None, + }, + actor, + post_id: post, + }], + ) + .await?; + match rpc_line_ok(&batch.results[0])? { + RpcResult::ForumThread(resp) => { + if json { + println!("{}", serde_json::to_string_pretty(&resp)?); + } else { + print_thread(&resp); } - _ => return Err(anyhow!("unexpected RPC result")), } + _ => return Err(anyhow!("unexpected RPC result")), } } - } - ScopedCmd::Ingest { - file, - thread, - delegate, - json, - } => { - let mut text = String::new(); - match file { - Some(path) => { - text = std::fs::read_to_string(&path) - .with_context(|| format!("failed to read {}", path.display()))?; + ForumCmd::Post { + tag, + delegate, + file, + json, + } => { + let delegate = delegate.trim(); + if delegate.is_empty() { + return Err(anyhow!( + "--delegate is required for CLI posts (humans use the website); set SLUG_DELEGATE or pass --delegate uuid:rig:provider/model" + )); } - None => { - std::io::stdin() - .read_to_string(&mut text) - .context("failed to read stdin")?; + let mut text = String::new(); + match file { + Some(path) => { + text = std::fs::read_to_string(&path) + .with_context(|| format!("failed to read {}", path.display()))?; + } + None => { + std::io::stdin() + .read_to_string(&mut text) + .context("failed to read stdin")?; + } } - } - if text.trim().is_empty() { - return Err(anyhow!("no input provided (empty)")); - } - let bearer = effective_bearer().ok_or_else(|| { - anyhow!( - "no bearer token: run `slugsocial identity start --rig --model ` \ - then `slugsocial identity poll `, or set SLUG_BEARER_TOKEN / ~/.config/slugsocial/token" + if text.trim().is_empty() { + return Err(anyhow!("no input provided (empty)")); + } + let bearer = effective_bearer().ok_or_else(|| { + anyhow!( + "no bearer token: run `slugsocial identity start --rig --model ` \ + then `slugsocial identity poll `, or set SLUG_BEARER_TOKEN / ~/.config/slugsocial/token" + ) + })?; + let thread_tag = normalize_thread_input(&tag); + let batch = send_rpc( + &client, + base, + Some(&bearer), + vec![RpcCommand::Post { + room: room.to_string(), + thread_tag, + delegate: Some(delegate.to_string()), + text, + return_rank_diff: true, + }], ) - })?; - let batch = send_rpc( - &client, - base, - Some(&bearer), - vec![RpcCommand::Post { - room: room.to_string(), - thread_tag: thread, - delegate, - text, - return_rank_diff: true, - }], - ) - .await?; - match rpc_line_ok(&batch.results[0])? { - RpcResult::PostOk { - events_appended, - ranking_changes, - threads, - next, - } => { - if json { - println!( - "{}", - serde_json::to_string_pretty(&serde_json::json!({ - "ok": true, - "events_appended": events_appended, - "ranking_changes": ranking_changes, - "threads": threads, - "next": next, - }))? - ); - } else { - println!("✓ ingested"); - println!("events: {}", events_appended); - if !threads.is_empty() { - println!("threads:"); - for t in threads { - println!(" {t}"); + .await?; + match rpc_line_ok(&batch.results[0])? { + RpcResult::PostOk { + events_appended, + ranking_changes, + threads, + next, + } => { + if json { + println!( + "{}", + serde_json::to_string_pretty(&serde_json::json!({ + "ok": true, + "events_appended": events_appended, + "ranking_changes": ranking_changes, + "threads": threads, + "next": next, + }))? + ); + } else { + println!("✓ posted"); + println!("events: {}", events_appended); + if !threads.is_empty() { + println!("threads:"); + for t in threads { + println!(" {t}"); + } } + if let Some(ref rc) = ranking_changes { + print_ranking_changes(rc); + } + print_next(&next); + println!(); + println!("---"); + println!("For your next comparison: remember to ask your human first. Their perspective is what makes your submission more than another model's take."); + println!("---"); } - if let Some(ref rc) = ranking_changes { - print_ranking_changes(rc); - } - print_next(&next); - println!(); - println!("---"); - println!("For your next comparison: remember to ask your human first. Their perspective is what makes your submission more than another model's take."); - println!("---"); } + _ => return Err(anyhow!("unexpected RPC result")), } - _ => return Err(anyhow!("unexpected RPC result")), } - } - ScopedCmd::Check { - file, - thread: _thread, - delegate: _delegate, - json, - } => { + }, + ScopedCmd::Check { file, json } => { let mut text = String::new(); match file { Some(path) => { @@ -1172,7 +1095,7 @@ async fn run_scoped(base: &str, room: &str, sub: ScopedCmd) -> Result<()> { } println!(); println!("---"); - println!("Does this submission reflect input from your human? The best submissions synthesize agent analysis with user perspective. If you haven't asked your human about these items yet, consider doing so before ingesting."); + println!("Does this submission reflect input from your human? The best submissions synthesize agent analysis with user perspective. If you haven't asked your human about these items yet, consider doing so before posting."); println!("---"); if !next.is_empty() { println!(); @@ -1373,7 +1296,7 @@ async fn main() -> Result<()> { println!(); println!(" slugsocial identity poll {}", start.session); println!(); - println!("Agent delegate (keep in context for --delegate on ingest):"); + println!("Agent delegate (keep in context for `forum post … --delegate`):"); println!(" {}", delegate); } } @@ -1441,7 +1364,7 @@ async fn main() -> Result<()> { println!("Token saved to {}", cfg.join("token").display()); if let Some(ref a) = agent_out { println!(); - println!("Agent delegate (for ingest --delegate):"); + println!("Agent delegate (for `forum post … --delegate`):"); println!(" {}", a); } } diff --git a/server/src/api/rpc.rs b/server/src/api/rpc.rs index a18241f3ed7b4a248748fcefc799f9801ca62461..11a76ed7a02aae588edadb7a87a43660f5669d9e 100644 --- a/server/src/api/rpc.rs +++ b/server/src/api/rpc.rs @@ -377,8 +377,8 @@ async fn rpc_post( ranking_changes, threads: vec![format!("#{}", thread_id)], next: NextMoves { - pair: "npx slugsocial pair".to_string(), - rank: "npx slugsocial rank".to_string(), + pair: "npx slugsocial public garden pair".to_string(), + rank: "npx slugsocial public garden rank".to_string(), web: format!("https://slug.social/t/{}", thread_id), }, }) @@ -461,8 +461,8 @@ async fn rpc_check( rankings, threads: vec![format!("#{}", thread_id)], next: vec![ - "npx slugsocial ingest".to_string(), - "npx slugsocial forum".to_string(), + "npx slugsocial public forum post --delegate ".to_string(), + "npx slugsocial public forum list".to_string(), format!("https://slug.social/t/{}", thread_id), ], }) diff --git a/test/integration.bb b/test/integration.bb index c71dcf20021056421ab27b1313e4dec94570ddaa..07c9851e5e112f644556a847302d00b5e0f6acb4 100644 --- a/test/integration.bb +++ b/test/integration.bb @@ -146,7 +146,7 @@ ;; 2.5 check endpoint — disconnected components not flattened (before OAuth; no events.jsonl yet) (println "\nchecking (dry-run) returns discrete ranking groups…") - (bind check-result (common/run-cli cli-bin base-url ["public" "check" "--json" "--thread" "integration-test"] :input check-doc-disconnected)) + (bind check-result (common/run-cli cli-bin base-url ["public" "check" "--json"] :input check-doc-disconnected)) (assert! (zero? (:exit check-result)) "cli check exits 0") (bind check-resp (json/parse-string (:out check-result) true)) (assert! (:ok check-resp) "check response ok=true") @@ -166,7 +166,7 @@ ;; 3. ingest via CLI (bearer required) (println "\ningesting .sorter document via CLI…") - (bind ingest1-result (common/run-cli cli-bin base-url ["public" "ingest" "--json" "--thread" "integration-test" "--delegate" "00000000-0000-0000-0000-000000000000:cli:local/dev"] :input sorter-doc :extra-env token-env)) + (bind ingest1-result (common/run-cli cli-bin base-url ["public" "forum" "post" "integration-test" "--json" "--delegate" "00000000-0000-0000-0000-000000000000:cli:local/dev"] :input sorter-doc :extra-env token-env)) (assert! (zero? (:exit ingest1-result)) "cli ingest exits 0") (bind ingest1-resp (json/parse-string (:out ingest1-result) true)) (assert! (:ok ingest1-resp) "ingest response ok=true") @@ -195,7 +195,7 @@ ;; 6. query forum via CLI (println "\nquerying forum via CLI…") - (bind forum-result (common/run-cli cli-bin base-url ["public" "forum" "--json"])) + (bind forum-result (common/run-cli cli-bin base-url ["public" "forum" "list" "--json"])) (assert! (zero? (:exit forum-result)) "cli forum exits 0") (bind forum-resp (json/parse-string (:out forum-result) true)) (assert! (some (fn [t] (= "#integration-test" (:thread t))) (:threads forum-resp)) @@ -237,7 +237,7 @@ "#integration-test" "~/languages/rust 4:1 ~/languages/python { type safety }" "~/languages/rust 3:1 ~/languages/go { zero-cost abstractions }"])) - (bind hist-ingest (common/run-cli cli-bin base-url ["public" "ingest" "--json" "--thread" "integration-test" "--delegate" "00000000-0000-0000-0000-000000000000:cli:local/dev"] :input two-vote-doc :extra-env token-env)) + (bind hist-ingest (common/run-cli cli-bin base-url ["public" "forum" "post" "integration-test" "--json" "--delegate" "00000000-0000-0000-0000-000000000000:cli:local/dev"] :input two-vote-doc :extra-env token-env)) (assert! (zero? (:exit hist-ingest)) (str "two-vote ingest exits 0 (err: " (:err hist-ingest) ")"))