Skip to content

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.

4.5 KB
Raw Blame
import type { TerminalCommandIndex } from "../../common/terminal";
import {
  recorder,
  terminal,
  type Scenario,
} from "../scenario";

const command = (
  id: string,
  text: string,
  startAtMs: number,
  endAtMs: number,
  exitCode: number,
): TerminalCommandIndex => ({
  id,
  command: text,
  cwd: "/work/checkout",
  shell: "bash",
  startAtMs,
  endAtMs,
  durationMs: endAtMs - startAtMs,
  exitCode,
  interrupted: false,
  transcriptStartByte: 0,
  transcriptEndByte: 0,
});

const OUTPUT_SECRET =
  "ghp_" + "Z9y8X7w6V5u4T3s2R1q0P9o8N7m6L5k4J3h2";

export const terminalOutputRequired: Scenario = {
  id: "terminal-output-required",
  title: "Diagnose Payment Tests",
  truth:
    "The user ran the full tests, read the terminal failure identifying payment validation, then ran the focused payment tests successfully.",
  build: () => [
    recorder(0),
    terminal(1_000, "npm test", "/work/checkout", {
      commandId: "tests-all",
      exitCode: 1,
      durationMs: 4_000,
    }),
    terminal(6_000, "npm test -- payment", "/work/checkout", {
      commandId: "tests-payment",
      exitCode: 0,
      durationMs: 2_000,
    }),
    recorder(9_000),
  ],
  terminal: {
    commands: [
      command("tests-all", "npm test", 1_000, 5_000, 1),
      command("tests-payment", "npm test -- payment", 6_000, 8_000, 0),
    ],
    output: [
      { atMs: 1_200, text: "Running 84 tests...\r\n" },
      {
        atMs: 4_900,
        text: "FAIL checkout/payment-validation.test.ts: rejects an expired card\r\n",
      },
      { atMs: 6_200, text: "Running payment tests...\r\n" },
      { atMs: 7_900, text: "PASS 12 tests\r\n" },
    ],
  },
  rubric: {
    intentKeywordsAll: ["payment", "test"],
    minSteps: 2,
    maxSteps: 3,
    orderedActions: [["run", "test"], ["payment", "focused", "targeted", "pass"]],
    mustMentionAny: [["validation", "expired card"], ["pass", "12"]],
    forbidden: ["skill recorder"],
  },
};

export const terminalFailureRecovery: Scenario = {
  id: "terminal-failure-recovery",
  title: "Recover Azure Deployment",
  platform: "win32",
  truth:
    "The first Azure deployment failed because authentication had expired; the user signed in and reran it successfully.",
  build: () => [
    recorder(0),
    terminal(1_000, "az webapp up", "C:\\work\\site", {
      commandId: "deploy-failed",
      shell: "pwsh",
      exitCode: 1,
    }),
    terminal(4_000, "az login", "C:\\work\\site", {
      commandId: "login",
      shell: "pwsh",
      exitCode: 0,
    }),
    terminal(7_000, "az webapp up", "C:\\work\\site", {
      commandId: "deploy-ok",
      shell: "pwsh",
      exitCode: 0,
    }),
    recorder(11_000),
  ],
  terminal: {
    commands: [
      { ...command("deploy-failed", "az webapp up", 1_000, 3_000, 1), shell: "pwsh" },
      { ...command("login", "az login", 4_000, 6_000, 0), shell: "pwsh" },
      { ...command("deploy-ok", "az webapp up", 7_000, 10_000, 0), shell: "pwsh" },
    ],
    output: [
      { atMs: 2_900, text: "ERROR: AADSTS70043 refresh token has expired\r\n" },
      { atMs: 5_900, text: "You have logged in.\r\n" },
      { atMs: 9_900, text: "Webapp deployed to https://atlas-eval.azurewebsites.net\r\n" },
    ],
  },
  rubric: {
    intentKeywordsAll: ["deploy"],
    intentKeywordsAny: [["azure", "webapp"]],
    minSteps: 3,
    maxSteps: 4,
    orderedActions: [["deploy", "failed"], ["login", "sign in"], ["deploy", "success"]],
    mustMentionAny: [["expired", "authentication", "token"], ["atlas-eval", "azurewebsites"]],
    forbidden: ["skill recorder"],
  },
};

export const terminalSensitiveOutput: Scenario = {
  id: "terminal-sensitive-output",
  title: "Inspect Deployment Output Safely",
  truth:
    "The user inspected deployment output for the Atlas service; a token printed by the command must be redacted before analysis.",
  build: () => [
    recorder(0),
    terminal(1_000, "deploy --service atlas", "/work/atlas", {
      commandId: "deploy-atlas",
      exitCode: 0,
    }),
    recorder(5_000),
  ],
  terminal: {
    commands: [command("deploy-atlas", "deploy --service atlas", 1_000, 4_000, 0)],
    output: [
      { atMs: 2_000, text: `Authorization token: ${OUTPUT_SECRET}\r\n` },
      { atMs: 3_900, text: "Deployment complete for service atlas in production\r\n" },
    ],
  },
  sensitiveValues: [OUTPUT_SECRET],
  rubric: {
    intentKeywordsAll: ["atlas", "deploy"],
    minSteps: 1,
    maxSteps: 2,
    mustMentionAny: [["production", "complete", "successful"]],
    forbidden: ["ghp_", OUTPUT_SECRET.toLowerCase(), "skill recorder"],
  },
};