Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.
TypeScript agent-skillsai-agentsautomationcopilotcopilot-clicopilot-coworkcopilot-studioelectronmicrosoft-scoutscreen-recording
Add Skill Builder UI to the sessions library
adilei3df2e3ed558e
diff --git a/src/App.css b/src/App.cssindex ea808be..a1c0599 100644--- a/src/App.css+++ b/src/App.css@@ -1182,3 +1182,288 @@ button:focus-visible,animation: none;}}++/* ── Skill builder ───────────────────────────────────────────────────────+ Reuses ws / ws-head / ws-foot / status-line / record-cta. The two signature+ moments are the input-source badges and the action → native-tool rows, so+ those carry the only colour; everything else stays quiet sand + neutral. */+.sb-arch {+ display: flex;+ flex-direction: column;+ gap: 16px;+ max-width: 640px;+ margin: 0 auto;+ width: 100%;+}++.sb-lead {+ margin: 0;+ font-size: 15px;+ color: var(--text);+}++.arch-grid {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));+ gap: 10px;+}++.arch-card {+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ gap: 4px;+ text-align: left;+ background: var(--surface);+ border: 1px solid var(--line);+ border-radius: 11px;+ padding: 13px 14px;+}++.arch-card:not(:disabled):hover {+ border-color: var(--line-strong);+}++.arch-card.on {+ border-color: var(--signal);+ box-shadow: 0 2px 14px -6px rgba(var(--brand-rgb), 0.45);+}++.arch-card:disabled {+ opacity: 0.55;+ cursor: default;+}++.arch-name {+ font-size: 13.5px;+ font-weight: 600;+ color: var(--text);+}++.arch-note {+ font-size: 11.5px;+ color: var(--muted);+}++.sb-arch .record-cta {+ align-self: flex-start;+}++/* Plan view */+.sb-plan {+ display: flex;+ flex-direction: column;+ gap: 18px;+ max-width: 660px;+ margin: 0 auto;+ width: 100%;+}++.sb-planhead {+ display: flex;+ align-items: baseline;+ gap: 10px;+ flex-wrap: wrap;+}++.sb-title {+ margin: 0;+ font-size: 20px;+ font-weight: 650;+ letter-spacing: -0.01em;+ color: var(--text);+}++.sb-slug {+ font-family: var(--mono);+ font-size: 12px;+ color: var(--brand-ink);+ background: var(--signal-dim);+ border-radius: 6px;+ padding: 2px 7px;+}++.sb-desc {+ margin: 0;+ font-size: 14px;+ line-height: 1.55;+ color: var(--text);+}++.sb-sec {+ display: flex;+ flex-direction: column;+ gap: 8px;+}++.sb-sec > p {+ margin: 0;+ font-size: 13.5px;+ line-height: 1.5;+ color: var(--text);+}++.sb-muted {+ color: var(--muted) !important;+}++/* Inputs — each with a source badge (the "how it gets this" signal) */+.sb-inputs {+ list-style: none;+ margin: 0;+ padding: 0;+ display: flex;+ flex-direction: column;+ gap: 8px;+}++.input-row {+ display: flex;+ flex-direction: column;+ gap: 3px;+ background: var(--surface);+ border: 1px solid var(--line);+ border-radius: 9px;+ padding: 10px 12px;+}++.input-main {+ display: flex;+ align-items: center;+ gap: 9px;+}++.input-name {+ font-size: 13.5px;+ font-weight: 600;+ color: var(--text);+}++.src-badge {+ font-family: var(--mono);+ font-size: 10px;+ text-transform: uppercase;+ letter-spacing: 0.05em;+ border-radius: 20px;+ padding: 2px 9px;+ white-space: nowrap;+}++.src-ask {+ color: var(--brand-ink);+ background: var(--signal-dim);+}++.src-discover {+ color: var(--go);+ background: rgba(var(--go-rgb), 0.12);+}++.src-constant {+ color: var(--muted);+ background: var(--surface-2);+}++.input-detail {+ font-size: 12.5px;+ line-height: 1.45;+ color: var(--muted);+}++/* Steps */+.sb-steps {+ margin: 0;+ padding-left: 20px;+ display: flex;+ flex-direction: column;+ gap: 6px;+}++.sb-steps li {+ font-size: 13.5px;+ line-height: 1.5;+ color: var(--text);+}++/* Action → native tool mapping */+.sb-map {+ list-style: none;+ margin: 0;+ padding: 0;+ display: flex;+ flex-direction: column;+ gap: 6px;+}++.map-row {+ display: flex;+ align-items: center;+ gap: 10px;+ font-size: 13px;+}++.map-action {+ color: var(--text);+ flex: 1 1 auto;+ min-width: 0;+}++.map-arrow {+ color: var(--faint);+ flex: none;+}++.map-tool {+ font-family: var(--mono);+ font-size: 12px;+ color: var(--text);+ background: var(--surface-2);+ border-radius: 6px;+ padding: 2px 8px;+ flex: none;+}++.sb-refine {+ padding-top: 2px;+}++/* Done */+.sb-done {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 10px;+ text-align: center;+ max-width: 520px;+ margin: 32px auto 0;+ width: 100%;+}++.sb-check {+ width: 44px;+ height: 44px;+ border-radius: 50%;+ display: grid;+ place-items: center;+ background: rgba(var(--go-rgb), 0.14);+ color: var(--go);+ font-size: 22px;+ font-weight: 700;+}++.sb-done p {+ margin: 0;+ font-size: 14px;+ color: var(--text);+}++.sb-path {+ font-family: var(--mono);+ font-size: 12px;+ color: var(--muted) !important;+ word-break: break-all;+ background: var(--surface);+ border: 1px solid var(--line);+ border-radius: 8px;+ padding: 8px 11px;+}diff --git a/src/Library.tsx b/src/Library.tsxindex 09cc7d5..3d1f2dc 100644--- a/src/Library.tsx+++ b/src/Library.tsx@@ -1,7 +1,9 @@import { useCallback, useEffect, useRef, useState } from "react";import type { Analysis } from "../common/analysis";-import type { AnalyzeProgress, SessionSummary } from "../common/ipc";+import type { AnalyzeProgress, SessionSummary, SkillBuildProgress } from "../common/ipc";+import type { BuiltSkill, SkillArchitecture, SkillPlan } from "../common/skill";+import { ARCHITECTURES } from "../common/skill";import { formatDur, formatMs, formatWhen, shortLabel } from "./format";export function Library() {@@ -206,6 +208,7 @@ function AnalysisWorkspace({const [editing, setEditing] = useState(false);const [draftTitle, setDraftTitle] = useState("");const [draftIntent, setDraftIntent] = useState("");+ const [building, setBuilding] = useState(false);// Set while the user is deliberately canceling, so the aborted run's rejection// doesn't surface as an error toast.const canceled = useRef(false);@@ -313,6 +316,19 @@ function AnalysisWorkspace({const approved = analysis?.approved ?? false;+ if (building && analysis) {+ return (+ <SkillBuilderView+ sessionId={sessionId}+ startedAt={summary.startedAt}+ onClose={() => {+ setBuilding(false);+ void onChanged();+ }}+ />+ );+ }+return (<section className="ws"><div className="ws-head">@@ -456,7 +472,11 @@ function AnalysisWorkspace({</button>)}{approved ? (- <button className="record-cta" disabled title="Skill generation is the next milestone">+ <button+ className="record-cta"+ onClick={() => setBuilding(true)}+ title="Turn this recording into a reusable skill"+ >Create skill →</button>) : (@@ -476,6 +496,280 @@ function AnalysisWorkspace({);}+/* --- Skill builder ------------------------------------------------------- */++type BuildPhase = "arch" | "planning" | "plan" | "creating" | "done";++const SOURCE_LABEL: Record<SkillPlan["inputs"][number]["source"], string> = {+ ask: "You provide it",+ discover: "Found on this device",+ constant: "Fixed value",+};++function SkillBuilderView({+ sessionId,+ startedAt,+ onClose,+}: {+ sessionId: string;+ startedAt: number | null;+ onClose: () => void;+}) {+ const [phase, setPhase] = useState<BuildPhase>("arch");+ const [architecture, setArchitecture] = useState<SkillArchitecture>("scout");+ const [plan, setPlan] = useState<SkillPlan | null>(null);+ const [statusLine, setStatusLine] = useState("");+ const [feedback, setFeedback] = useState("");+ const [error, setError] = useState<string | null>(null);+ const [exportedPath, setExportedPath] = useState("");+ const [builtName, setBuiltName] = useState("");+ const canceled = useRef(false);++ // Reopen straight to the exported state if this recording already has a skill.+ useEffect(() => {+ let live = true;+ void window.skillRecorder.getSkill(sessionId).then((s: BuiltSkill | null) => {+ if (live && s?.exportedPath) {+ setBuiltName(s.name);+ setExportedPath(s.exportedPath);+ if (s.plan) setPlan(s.plan);+ setPhase("done");+ }+ });+ return () => {+ live = false;+ };+ }, [sessionId]);++ useEffect(() => {+ return window.skillRecorder.onSkillProgress((p: SkillBuildProgress) => {+ if (p.sessionId === sessionId) setStatusLine(p.message);+ });+ }, [sessionId]);++ const runPlan = useCallback(+ async (note?: string) => {+ canceled.current = false;+ setError(null);+ setStatusLine(note ? "Refining the plan…" : "Planning the skill…");+ setPhase("planning");+ const res = await window.skillRecorder.buildSkill({ sessionId, architecture, feedback: note });+ if (res.ok && res.plan) {+ setPlan(res.plan);+ setFeedback("");+ setPhase("plan");+ } else if (!canceled.current) {+ setError(res.error ?? "Planning failed");+ setPhase(note ? "plan" : "arch");+ }+ },+ [sessionId, architecture],+ );++ const create = useCallback(async () => {+ canceled.current = false;+ setError(null);+ setStatusLine("Writing the skill…");+ setPhase("creating");+ const res = await window.skillRecorder.createSkill(sessionId);+ if (res.ok && res.skill) {+ setBuiltName(res.skill.name);+ setExportedPath(res.path ?? res.skill.exportedPath ?? "");+ setPhase("done");+ } else if (!canceled.current) {+ setError(res.error ?? "Could not create the skill");+ setPhase("plan");+ }+ }, [sessionId]);++ const cancelRun = useCallback(async () => {+ canceled.current = true;+ setStatusLine("Stopping…");+ await window.skillRecorder.cancelSkill(sessionId);+ setPhase(plan ? "plan" : "arch");+ }, [sessionId, plan]);++ const busy = phase === "planning" || phase === "creating";++ return (+ <section className="ws">+ <div className="ws-head">+ <div className="ws-titles">+ <span className="eyebrow">Create skill</span>+ <span className="ws-when">{formatWhen(startedAt)}</span>+ </div>+ <button className="ghost" onClick={onClose} disabled={busy} title="Back to the analysis">+ Close+ </button>+ </div>++ <div className="ws-body">+ {error && <div className="analysis-error">{error}</div>}++ {phase === "arch" && (+ <div className="sb-arch">+ <p className="sb-lead">Which agent should run this skill?</p>+ <div className="arch-grid">+ {ARCHITECTURES.map((a) => (+ <button+ key={a.id}+ className={`arch-card ${architecture === a.id ? "on" : ""}`}+ disabled={!a.enabled}+ onClick={() => a.enabled && setArchitecture(a.id)}+ >+ <span className="arch-name">{a.label}</span>+ <span className="arch-note">{a.enabled ? a.note : "Coming soon"}</span>+ </button>+ ))}+ </div>+ <button className="record-cta" onClick={() => void runPlan()}>+ Plan the skill →+ </button>+ </div>+ )}++ {busy && (+ <div className="status-line">+ <span className="spinner" />+ <span className="status-text">{statusLine || "Working…"}</span>+ <button className="linky status-cancel" onClick={cancelRun}>+ Cancel+ </button>+ </div>+ )}++ {phase === "plan" && plan && (+ <div className="sb-plan">+ <div className="sb-planhead">+ <h2 className="sb-title">{plan.title}</h2>+ <code className="sb-slug">{plan.name}</code>+ </div>+ <p className="sb-desc">{plan.description}</p>++ {(plan.summary || plan.generalization) && (+ <div className="sb-sec">+ <span className="eyebrow">How it generalizes</span>+ {plan.summary && <p>{plan.summary}</p>}+ {plan.generalization && <p className="sb-muted">{plan.generalization}</p>}+ </div>+ )}++ {plan.inputs.length > 0 && (+ <div className="sb-sec">+ <span className="eyebrow">Inputs</span>+ <ul className="sb-inputs">+ {plan.inputs.map((inp, i) => (+ <li key={i} className="input-row">+ <div className="input-main">+ <span className="input-name">{inp.name}</span>+ <span className={`src-badge src-${inp.source}`}>{SOURCE_LABEL[inp.source]}</span>+ </div>+ {(inp.detail || inp.description) && (+ <span className="input-detail">{inp.detail || inp.description}</span>+ )}+ </li>+ ))}+ </ul>+ </div>+ )}++ {plan.steps.length > 0 && (+ <div className="sb-sec">+ <span className="eyebrow">What the skill will do</span>+ <ol className="sb-steps">+ {plan.steps.map((s, i) => (+ <li key={i}>{s}</li>+ ))}+ </ol>+ </div>+ )}++ {plan.toolMapping.length > 0 && (+ <div className="sb-sec">+ <span className="eyebrow">Native tools it will use</span>+ <ul className="sb-map">+ {plan.toolMapping.map((m, i) => (+ <li key={i} className="map-row">+ <span className="map-action">{m.action}</span>+ <span className="map-arrow" aria-hidden>+ →+ </span>+ <code className="map-tool">{m.tool}</code>+ </li>+ ))}+ </ul>+ </div>+ )}++ <div className="sb-refine">+ <textarea+ className="overall-fb"+ placeholder="Adjust anything in plain language, e.g. 'read the file from Downloads instead of asking'…"+ value={feedback}+ onChange={(e) => setFeedback(e.target.value)}+ />+ </div>+ </div>+ )}++ {phase === "done" && (+ <div className="sb-done">+ <div className="sb-check" aria-hidden>+ ✓+ </div>+ <h2 className="sb-title">Skill exported</h2>+ <p>+ <code className="sb-slug">{builtName}</code> is ready for {archLabel(architecture)}.+ </p>+ {exportedPath && <p className="sb-path">{exportedPath}</p>}+ </div>+ )}+ </div>++ {phase === "plan" && plan && (+ <div className="ws-foot">+ <span className="foot-status" />+ <div className="ws-foot-actions">+ {feedback.trim() && (+ <button className="secondary" onClick={() => void runPlan(feedback.trim())}>+ Refine plan+ </button>+ )}+ <button+ className="record-cta"+ onClick={() => void create()}+ disabled={feedback.trim().length > 0}+ title={feedback.trim() ? "Refine or clear your notes first" : "Create and export the skill"}+ >+ Create & export skill+ </button>+ </div>+ </div>+ )}++ {phase === "done" && (+ <div className="ws-foot">+ <span className="foot-status">Saved</span>+ <div className="ws-foot-actions">+ {exportedPath && (+ <button className="secondary" onClick={() => void window.skillRecorder.revealSkill(exportedPath)}>+ Reveal file+ </button>+ )}+ <button className="record-cta" onClick={onClose}>+ Done+ </button>+ </div>+ </div>+ )}+ </section>+ );+}++function archLabel(id: SkillArchitecture): string {+ return ARCHITECTURES.find((a) => a.id === id)?.label ?? id;+}+/* --- One step, told as plain language ------------------------------------- */function StepCard({