{c().error ?? "It did not work this time."}
+{c().error}
+{r.agent} wants to {r.label}.
+{r.detail}
Missing object
"; + const doc = this.wrap(this.c.board.object_html(bundle) ?? "Missing object
"); + this.srcCache.set(bundle, doc); + return doc; + } + + /** The iframe document for raw object HTML (an agent's live preview, a + * student's own layer): the same CSP and SDK as a placed object. */ + wrap(html: string): string { const lib = `${location.origin}/rupoklib/`; const body = html.replaceAll("rupoklib://", lib); const csp = [ @@ -133,7 +140,6 @@ export class ObjectHost { : /]*>/i.test(body) ? body.replace(/]*>/i, (m) => `${m}${head}`) : `${head}${body}`; - this.srcCache.set(bundle, doc); return doc; } diff --git a/apps/board/src/settings/defs/aiAction.tsx b/apps/board/src/settings/defs/aiAction.tsx new file mode 100644 index 0000000..f91b32d --- /dev/null +++ b/apps/board/src/settings/defs/aiAction.tsx @@ -0,0 +1,125 @@ +// Settings → AI & agents → AI in action: class mode, working cards, the +// landing sparkle and chime, live Solve this, students asking AI, and the +// "pre-approve Rupok tools" helper (aiAction/). + +import { For, createSignal } from "solid-js"; +import { aiPrefs } from "../../aiAction/state"; +import type { SettingProps } from "../registry"; +import { registerSettings } from "../registry"; + +const d = aiPrefs.defaults; +const GROUP = "AI in action"; +const DOCS = "https://github.com/shaitrish/rupok/blob/main/docs/ai-agents.md#make-ai-smoother-pre-approve-rupok-tools"; + +/** One-time setups that pre-approve Rupok's tools in each agent. */ +export const PREAPPROVE: { agent: string; file: string; snippet: string }[] = [ + { + agent: "Claude Code", + file: "~/.claude/settings.json (or .claude/settings.json in your lessons folder)", + snippet: `{ "permissions": { "allow": ["mcp__rupok__*"] } }`, + }, + { + agent: "Codex", + file: "~/.codex/config.toml", + snippet: `[mcp_servers.rupok]\ndefault_tools_approval_mode = "approve"`, + }, + { + agent: "OpenCode", + file: "opencode.json", + snippet: `{ "permission": { "rupok_*": "allow" } }`, + }, +]; + +function Preapprove(props: SettingProps) { + const [tab, setTab] = createSignal(0); + const [copied, setCopied] = createSignal(false); + const cur = () => PREAPPROVE[tab()]; + const copy = () => navigator.clipboard?.writeText(cur().snippet).then(() => { setCopied(true); setTimeout(() => setCopied(false), 1400); }, () => {}); + return ( +