replicas-engine 0.1.1117 → 0.1.1119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1554,8 +1554,7 @@ var sendChatMessageRequestSchema = z4.object({
1554
1554
  senderDisplayName: z4.string().optional(),
1555
1555
  senderAvatarUrl: z4.string().optional(),
1556
1556
  errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
1557
- errorNotificationTargets: z4.array(integrationErrorNotificationTargetSchema).optional(),
1558
- streamSlackActivity: z4.boolean().optional()
1557
+ errorNotificationTargets: z4.array(integrationErrorNotificationTargetSchema).optional()
1559
1558
  }).passthrough();
1560
1559
  function isChatMessageSender(value) {
1561
1560
  return isRecord(value) && (value.messageId === void 0 || typeof value.messageId === "string") && typeof value.senderUserId === "string" && typeof value.senderEmail === "string" && typeof value.recordedAt === "string";
@@ -1803,12 +1802,6 @@ var SUBAGENT_MCP_TOOLS = {
1803
1802
  deleteAgent: "delete_agent"
1804
1803
  };
1805
1804
  var SUBAGENT_MCP_TOOL_NAMES = Object.values(SUBAGENT_MCP_TOOLS);
1806
- function isSubagentMcpToolName(tool) {
1807
- return SUBAGENT_MCP_TOOL_NAMES.some((name) => name === tool);
1808
- }
1809
- function isSubagentMcpServerName(server) {
1810
- return server === SUBAGENT_MCP_SERVER_NAME;
1811
- }
1812
1805
 
1813
1806
  // ../shared/src/workspace-identity.ts
1814
1807
  import { z as z5 } from "zod";
@@ -2773,16 +2766,6 @@ function planItemsFromMessage(message2) {
2773
2766
  return [{ text: text3, status: status === "completed" || status === "in_progress" ? status : "pending" }];
2774
2767
  });
2775
2768
  }
2776
- function getDisplayMessageStatus(message2) {
2777
- if (message2.type === "error" || message2.type === "quota_status") return "failed";
2778
- if (message2.type === "auth_fallback") return message2.status === "switched" ? "completed" : "failed";
2779
- if (message2.type === "interruption" || message2.type === "multitask_event") return "completed";
2780
- if (message2.type === "background_task") return message2.status === "stopped" ? "completed" : message2.status;
2781
- if (message2.type === "command" || message2.type === "patch") {
2782
- return message2.status ?? (message2.exitCode === void 0 ? "in_progress" : message2.exitCode === 0 ? "completed" : "failed");
2783
- }
2784
- return "status" in message2 ? message2.status : void 0;
2785
- }
2786
2769
  function todoItemStatus(item) {
2787
2770
  return item.itemStatus ?? (item.completed ? "completed" : "pending");
2788
2771
  }
@@ -2816,17 +2799,6 @@ ${operation.diff}` : ""}`).join("\n\n");
2816
2799
  if (message2.type === "multitask_event") return { kind: "task", title: "Subagent update", summary: message2.events.map((event) => `${event.agentName}: ${event.summary}`).join(" \xB7 "), content: "" };
2817
2800
  return { kind: "error", title: "Agent error", summary: "", content: message2.message };
2818
2801
  }
2819
- function lineCountFromOutput(output) {
2820
- if (!output) return null;
2821
- let end = output.length;
2822
- while (end > 0 && output[end - 1] === "\n") end--;
2823
- if (end === 0) return null;
2824
- let lines = 1;
2825
- for (let i = 0; i < end; i++) {
2826
- if (output[i] === "\n") lines++;
2827
- }
2828
- return lines;
2829
- }
2830
2802
  function fileContentDiff(path, content, action) {
2831
2803
  const lines = content.replace(/\n$/, "").split("\n");
2832
2804
  return [
@@ -2836,39 +2808,7 @@ function fileContentDiff(path, content, action) {
2836
2808
  ...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
2837
2809
  ].join("\n");
2838
2810
  }
2839
- var READ_COMMANDS = /* @__PURE__ */ new Set([
2840
- "cat",
2841
- "find",
2842
- "grep",
2843
- "head",
2844
- "ls",
2845
- "nl",
2846
- "pwd",
2847
- "rg",
2848
- "sed",
2849
- "tail",
2850
- "tree",
2851
- "wc"
2852
- ]);
2853
2811
  var SEARCH_COMMANDS = /* @__PURE__ */ new Set(["grep", "rg"]);
2854
- var PIPE_FILTERS = /* @__PURE__ */ new Set(["awk", "cat", "column", "cut", "grep", "head", "jq", "nl", "rg", "sed", "sort", "tail", "tr", "uniq", "wc"]);
2855
- var NEUTRAL_COMMANDS = /* @__PURE__ */ new Set(["cd", "echo", "printf", "true"]);
2856
- var GIT_READ_COMMANDS = /* @__PURE__ */ new Set([
2857
- "branch",
2858
- "diff",
2859
- "grep",
2860
- "log",
2861
- "ls-files",
2862
- "show",
2863
- "status"
2864
- ]);
2865
- var GH_READ_COMMANDS = /* @__PURE__ */ new Set([
2866
- "api",
2867
- "issue",
2868
- "pr",
2869
- "repo",
2870
- "run"
2871
- ]);
2872
2812
  var OPTION_VALUE_FLAGS = /* @__PURE__ */ new Set([
2873
2813
  "-A",
2874
2814
  "-B",
@@ -2891,26 +2831,9 @@ var LINE_COUNT_VALUE_FLAGS = /* @__PURE__ */ new Set([
2891
2831
  var SCRIPT_ROOT = "/";
2892
2832
  var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
2893
2833
  var fileWrites = ({ writes }) => writes.filter(({ path }) => path !== "/dev/null");
2894
- function displayPath(dir, path) {
2895
- if (path.startsWith("~")) return path;
2896
- const resolved = resolveShellPath(dir, path);
2897
- if (resolved === null) return null;
2898
- if (resolved === SCRIPT_ROOT) return ".";
2899
- if (resolved.startsWith(`${SCRIPT_ROOT}/`)) return resolved.slice(SCRIPT_ROOT.length + 1);
2900
- return path.startsWith("/") ? resolved : null;
2901
- }
2902
2834
  function shellCommands(command) {
2903
2835
  return parseShellScript(command, SCRIPT_ROOT).filter(({ wrapper }) => !wrapper);
2904
2836
  }
2905
- function simpleCommands(command) {
2906
- const commands = shellCommands(command);
2907
- const hasRedirectOrSubshell = commands.some((shellCommand) => shellCommand.subshell || shellCommand.stdinFile !== null || !shellCommand.piped && shellCommand.stdin !== void 0 || fileWrites(shellCommand).length > 0);
2908
- if (commands.length === 0 || hasRedirectOrSubshell) return null;
2909
- return commands.map((shellCommand) => {
2910
- const argv = shellCommand.argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026"));
2911
- return { ...shellCommand, argv, name: commandName(argv) };
2912
- });
2913
- }
2914
2837
  var SKILL_READ_COMMANDS = /* @__PURE__ */ new Set(["awk", "bat", "cat", "head", "less", "more", "nl", "sed", "tail"]);
2915
2838
  function skillNamesFromCommand(command) {
2916
2839
  return Array.from(new Set(shellCommands(command).flatMap((shellCommand) => {
@@ -2971,72 +2894,10 @@ function readCommandPaths(command, words) {
2971
2894
  }
2972
2895
  return pathArgs(words.slice(1), command === "head" || command === "tail" ? LINE_COUNT_VALUE_FLAGS : void 0);
2973
2896
  }
2974
- function readTitle(search, output, paths) {
2975
- const lines = lineCountFromOutput(output);
2976
- if (lines) return `Read ${lines} line${lines === 1 ? "" : "s"}${paths.length > 1 ? ` from ${paths.length} files` : ""}`;
2977
- return search ? "Search" : paths.length > 1 ? `Read ${paths.length} files` : "Read";
2978
- }
2979
- function writtenFile(command) {
2980
- const [write, ...rest] = shellCommands(command).filter(({ argv }) => !["cd", "mkdir"].includes(commandName(argv)));
2981
- if (!write || rest.length > 0 || write.piped || write.subshell || write.stdinFile !== null) return null;
2982
- if (!["cat", "echo", "printf"].includes(commandName(write.argv))) return null;
2983
- const writes = fileWrites(write);
2984
- return writes.length === 1 && writes[0].path ? displayPath(write.dir, writes[0].target) : null;
2985
- }
2986
2897
  function writesFiles(name, argv) {
2987
2898
  if (name === "sed") return argv.some((word) => /^(-[a-zA-Z]*i|--in-place)/.test(word));
2988
2899
  return name === "find" && argv.some((word) => /^-(exec|ok|delete|fprint|fls)/.test(word));
2989
2900
  }
2990
- function commandDisplayFromCommand(command, output) {
2991
- const written = writtenFile(command);
2992
- if (written) return { title: "Write", paths: [written] };
2993
- const commands = simpleCommands(command);
2994
- if (!commands || commands.some(({ name, argv, piped }) => writesFiles(name, argv) || piped && !PIPE_FILTERS.has(name))) return null;
2995
- const mainCommands = commands.filter(({ name, piped }) => !piped && !NEUTRAL_COMMANDS.has(name));
2996
- if (mainCommands.length === 0) return null;
2997
- if (mainCommands.length === 1) {
2998
- const [{ name, argv: words }] = mainCommands;
2999
- if (name === "git" && words[1] && GIT_READ_COMMANDS.has(words[1])) {
3000
- return { title: `Git ${words[1]}`, paths: [] };
3001
- }
3002
- if (name === "gh" && words[1] && GH_READ_COMMANDS.has(words[1])) {
3003
- return { title: words[1] === "pr" && words[2] ? `GitHub PR ${words[2]}` : "GitHub", paths: [] };
3004
- }
3005
- }
3006
- if (!mainCommands.every(({ name }) => READ_COMMANDS.has(name))) return null;
3007
- const paths = /* @__PURE__ */ new Set();
3008
- for (const { name, argv, dir } of mainCommands) {
3009
- for (const path of readCommandPaths(name, argv)) {
3010
- const shown = displayPath(dir, path);
3011
- if (shown === null) return null;
3012
- paths.add(shown);
3013
- }
3014
- }
3015
- const search = mainCommands.every(({ name }) => SEARCH_COMMANDS.has(name));
3016
- return { title: readTitle(search, output, [...paths]), paths: [...paths] };
3017
- }
3018
-
3019
- // ../shared/src/display-message/tool-call.ts
3020
- function parseToolCallInput(inputValue) {
3021
- const input = typeof inputValue === "string" ? inputValue : inputValue ? JSON.stringify(inputValue, null, 2) : "";
3022
- let inputObject = null;
3023
- if (inputValue && typeof inputValue !== "string") inputObject = inputValue;
3024
- else if (input)
3025
- try {
3026
- const parsed = JSON.parse(input);
3027
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
3028
- inputObject = Object.fromEntries(Object.entries(parsed));
3029
- } catch {
3030
- }
3031
- const filePath = inputObject ? [inputObject.file_path, inputObject.filePath, inputObject.path, inputObject.filename, inputObject.file].find(
3032
- (value) => typeof value === "string" && value.trim().length > 0
3033
- ) : void 0;
3034
- return {
3035
- input,
3036
- inputObject,
3037
- filePath: filePath ?? input.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m)?.[1]
3038
- };
3039
- }
3040
2901
 
3041
2902
  // ../shared/src/display-message/parsers/mcp.ts
3042
2903
  function parseMcpToolName(name) {
@@ -3051,28 +2912,6 @@ function parseMcpToolName(name) {
3051
2912
  return { server, tool };
3052
2913
  }
3053
2914
 
3054
- // ../shared/src/display-message/subagent-tools.ts
3055
- function chatIdFrom(input) {
3056
- const value = parseToolCallInput(input).inputObject;
3057
- if (!value) return null;
3058
- if ("chatId" in value && typeof value.chatId === "string") return value.chatId;
3059
- return "chat_id" in value && typeof value.chat_id === "string" ? value.chat_id : null;
3060
- }
3061
- function subagentToolName(message2) {
3062
- const mcp = parseMcpToolName(message2.tool);
3063
- const server = mcp?.server ?? message2.server;
3064
- const tool = mcp?.tool ?? message2.tool;
3065
- return isSubagentMcpServerName(server) ? tool : null;
3066
- }
3067
- function subagentChatId(message2) {
3068
- const tool = subagentToolName(message2);
3069
- if (!tool || tool === SUBAGENT_MCP_TOOLS.getProviders || !isSubagentMcpToolName(tool)) return null;
3070
- const inputId = chatIdFrom(message2.input);
3071
- if (inputId) return inputId;
3072
- if (tool !== SUBAGENT_MCP_TOOLS.spawnAgent || !message2.output) return null;
3073
- return chatIdFrom(message2.output);
3074
- }
3075
-
3076
2915
  // ../shared/src/mothership-events.ts
3077
2916
  import { z as z16 } from "zod";
3078
2917
 
@@ -3166,7 +3005,6 @@ var terminalSocketServerMessageSchema = z13.discriminatedUnion("type", [
3166
3005
  var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
3167
3006
 
3168
3007
  // ../shared/src/replicas-mcp.ts
3169
- var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
3170
3008
  var REPLICAS_MCP_TOOLS = {
3171
3009
  listEnvironments: "list_environments",
3172
3010
  createAutomation: "create_automation",
@@ -3378,7 +3216,7 @@ Starts an ffmpeg screen recorder and returns only after ffmpeg has written the f
3378
3216
  Only one recording at a time. Re-running \`start\` while one is active fails - call \`stop\` first.
3379
3217
 
3380
3218
  ### \`replicas computer record stop\`
3381
- SIGINTs ffmpeg, verifies that the process has finalized the MP4, then prints the output path. A finalization timeout preserves the recording state so \`stop\` can be retried safely. Upload it with \`replicas media upload <path> --name "<name>"\` to share it.
3219
+ SIGINTs ffmpeg, verifies that the process has finalized the MP4, then prints the output path. A finalization timeout preserves the recording state so \`stop\` can be retried safely. To show the interaction in a PR or message, turn it into a short looping GIF with \`replicas media gif <path>\`, then upload with \`replicas media upload <path> --name "<name>"\`.
3382
3220
 
3383
3221
  ## Patterns
3384
3222
 
@@ -3423,9 +3261,10 @@ For tasks the user wants proof of:
3423
3261
  replicas computer record start /tmp/walkthrough.mp4
3424
3262
  # ... your work ...
3425
3263
  replicas computer record stop
3426
- replicas media upload /tmp/walkthrough.mp4 --name "Walkthrough recording"
3264
+ replicas media gif /tmp/walkthrough.mp4 --duration 8
3265
+ replicas media upload /tmp/walkthrough.gif /tmp/walkthrough.mp4 --name "Walkthrough" --name "Walkthrough recording"
3427
3266
  \`\`\`
3428
- Then embed the printed \`![\u2026](\u2026)\` line in your chat reply and follow \`MEDIA.md\` for any external destination.
3267
+ Then embed the printed \`![\u2026](\u2026)\` lines in your chat reply and follow \`MEDIA.md\` for any external destination: the GIF goes inline in PRs, and a grid of extracted frames never does.
3429
3268
 
3430
3269
  ## Failure modes
3431
3270
 
@@ -4062,7 +3901,7 @@ gh pr review 123 --request-changes --body "Changes needed"
4062
3901
 
4063
3902
  ## Media in GitHub workflows
4064
3903
 
4065
- Media delivery is owned by \`references/MEDIA.md\`. Read its GitHub section before adding screenshots, recordings, diagrams, or HTML reports to a pull request, issue, review comment, or commit; it covers the public links every image upload prints, recording previews, organization-only HTML links, and the required **View in Replicas** link.
3904
+ Media delivery is owned by \`references/MEDIA.md\`. Read it before adding screenshots, GIFs, recordings, diagrams, or HTML reports to a pull request, issue, review comment, or commit; it covers when to use a GIF instead of screenshots, the public links every image upload prints, recording previews, organization-only HTML links, and the required **View in Replicas** link.
4066
3905
  `;
4067
3906
  var GITHUB_ABILITY = {
4068
3907
  label: "GitHub",
@@ -4245,24 +4084,74 @@ var LINEAR_ABILITY = {
4245
4084
 
4246
4085
  // ../shared/src/default-skills/replicas-agent/abilities/media.ts
4247
4086
  var SECTION7 = `### Media
4248
- Deliver screenshots, screen recordings, generated diagrams, audio clips, and self-contained HTML pages to the Replicas dashboard and, when applicable, inline in the destination workflow.
4087
+ Deliver screenshots, GIFs, screen recordings, generated diagrams, audio clips, and self-contained HTML pages to the Replicas dashboard and, when applicable, inline in the destination workflow.
4249
4088
 
4250
4089
  **Reference:** \`references/MEDIA.md\`
4251
4090
 
4252
4091
  Use this when:
4253
4092
  - You are about to run \`replicas media upload\`; this reference owns the complete Replicas-first, destination-second workflow
4254
4093
  - You produce a screenshot, recording, generated image, or audio clip the user should see
4094
+ - You need to show motion or an interaction (an animation, a popup that moves, a flow) in a PR or message: make a short looping GIF with \`replicas media gif\`, never a grid of frames
4255
4095
  - You produce a self-contained HTML report that should be linked from a pull request
4256
4096
  - You record video output (browser automation, screen capture) \u2014 including the recommended aspect ratio and FPS
4257
4097
  - You need to embed media in a Slack/Linear/GitHub/GitLab message AND keep a referenceable copy in the Replicas dashboard`;
4258
- var REFERENCE7 = `# Media (Screenshots, Recordings, Audio, HTML)
4098
+ var REFERENCE7 = `# Media (Screenshots, GIFs, Recordings, Audio, HTML)
4259
4099
 
4260
- This is the single source of truth for delivering screenshots, screen recordings, generated diagrams, audio clips, and self-contained HTML pages through Replicas and external surfaces (Slack, Linear, GitHub, GitLab).
4100
+ This is the single source of truth for delivering screenshots, GIFs, screen recordings, generated diagrams, audio clips, and self-contained HTML pages through Replicas and external surfaces (Slack, Linear, GitHub, GitLab).
4261
4101
 
4262
4102
  ## Prerequisites
4263
4103
 
4264
4104
  The \`replicas\` CLI is pre-installed and authenticated in your workspace. No additional setup is needed.
4265
4105
 
4106
+ ## Screenshot, GIF, or recording
4107
+
4108
+ Pick the format from what the reader has to see:
4109
+
4110
+ - **Static UI** (a layout, a new button, an error message): still screenshots.
4111
+ - **Motion or an interaction** (an animation, a popup that moves or flickers, a drag, a short multi-step flow): a short looping GIF. It plays inline in GitHub, Slack, Linear, GitLab, and Replicas chat, with no click and no sign-in.
4112
+ - **A long walkthrough, or anything with sound**: the MP4 recording, shown as a GIF or poster that links to it (see GitHub below).
4113
+
4114
+ Never paste a contact sheet or grid of frames extracted from a recording, and never paste a run of separate frame screenshots. At PR width each frame is a thumbnail, and the reader can't tell what moved. Make a GIF instead.
4115
+
4116
+ ### Make a GIF from a recording
4117
+
4118
+ \`\`\`bash
4119
+ replicas computer record start /tmp/after.mp4 --fps 30
4120
+ # ... perform only the interaction ...
4121
+ replicas computer record stop
4122
+ replicas media gif /tmp/after.mp4 --start 1 --duration 6
4123
+ replicas media upload /tmp/after.gif --name "Language menu after fix"
4124
+ \`\`\`
4125
+
4126
+ \`replicas media gif <recording>\` takes any MP4, WebM, or MOV (desktop, Playwright, CDP screencast, or simulator recordings) and writes a looping GIF next to it (\`-o\` to choose the path). It starts at 12 fps and 960 px wide and lowers both until the file is under 5 MiB. GitHub's image proxy returns 404 for larger images, so a bigger GIF shows as a broken image in the PR.
4127
+
4128
+ - Keep it to the interaction, usually 3\u201310 seconds: \`--start\` and \`--duration\` (default 10, max 30).
4129
+ - When the change is small on a large screen, \`--crop w:h:x:y\` (recording pixels) to the area that changes so text stays readable. Use the same crop for the before and after GIFs.
4130
+ - If it reports the GIF is still too large, show less: a shorter \`--duration\` or a tighter \`--crop\`.
4131
+ - Upload the GIF like any image. Its printed \`![\u2026](\u2026)\` line is public and renders inline everywhere.
4132
+ - Older workspaces may not have \`replicas media gif\` yet (\`replicas media gif --help\` fails). Use the same ffmpeg settings directly; keep \`-ss\` and \`-t\` before \`-i\` (palettegen waits for its input to end, so trimming after \`-i\` never finishes), and if the file is over 5 MiB, lower \`fps\` and the width and run it again:
4133
+
4134
+ \`\`\`bash
4135
+ ffmpeg -v error -y -ss 1 -t 6 -i /tmp/after.mp4 \\
4136
+ -vf "fps=12,scale='min(960,iw)':-1:flags=lanczos,split[a][b];[a]palettegen=stats_mode=diff[p];[b][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" \\
4137
+ -loop 0 /tmp/after.gif
4138
+ \`\`\`
4139
+
4140
+ ffmpeg is baked into the workspace image. If it's missing, install it with \`sudo apt-get install -y ffmpeg\`.
4141
+
4142
+ ### Before and after
4143
+
4144
+ Record both with the same steps, window size, and crop. Say in one line what to watch for, then put the GIFs side by side in a table, or in labeled sections when they are wide:
4145
+
4146
+ \`\`\`markdown
4147
+ The menu should open on its trigger. Before, it jumps about 95px up in half the openings.
4148
+
4149
+ | Before | After |
4150
+ | --- | --- |
4151
+ | ![Language menu before fix](<before-gif-url>) | ![Language menu after fix](<after-gif-url>) |
4152
+ | [View in Replicas](<before-dashboard-url>) | [View in Replicas](<after-dashboard-url>) |
4153
+ \`\`\`
4154
+
4266
4155
  ## When to upload
4267
4156
 
4268
4157
  Upload to Replicas in these cases \u2014 and **only** these cases:
@@ -4289,7 +4178,7 @@ If none of these apply, don't upload.
4289
4178
  | Slack | \`files.getUploadURLExternal\` \u2192 raw-byte POST \u2192 \`files.completeUploadExternal\` | Uploaded file in the channel or thread |
4290
4179
  | Linear | \`fileUpload\` mutation \u2192 presigned upload \u2192 issue/comment mutation | Returned \`assetUrl\` in Markdown |
4291
4180
  | GitLab | Project \`/uploads\` endpoint with the original bytes | Returned GitLab Markdown |
4292
- | GitHub | Printed public embed for an image or recording poster | Printed embed, linked to the recording when needed |
4181
+ | GitHub | Printed public embed for an image, GIF, or recording poster | Printed embed, linked to the recording when needed |
4293
4182
 
4294
4183
  The dashboard link is the subtitle and jump-back path. It is never a substitute for the destination embed.
4295
4184
 
@@ -4494,7 +4383,7 @@ jq -n \\
4494
4383
  }' | linear_graphql
4495
4384
  \`\`\`
4496
4385
 
4497
- For a recording, upload the MP4 with its own MIME type, then upload a poster frame (\`ffmpeg -i /tmp/demo.mp4 -frames:v 1 /tmp/demo-poster.png\`) the same way as \`image/png\` and link it: \`[![Demo recording](<poster-asset-url>)](<recording-asset-url>)\`.
4386
+ To show motion, upload the GIF from \`replicas media gif\` this way as \`image/gif\` and embed its \`assetUrl\` like a screenshot. For a full recording, upload the MP4 with its own MIME type, then upload a poster frame (\`ffmpeg -i /tmp/demo.mp4 -frames:v 1 /tmp/demo-poster.png\`) the same way as \`image/png\` and link it: \`[![Demo recording](<poster-asset-url>)](<recording-asset-url>)\`.
4498
4387
 
4499
4388
  The same flow works for issue bodies (use \`issueCreate\` / \`issueUpdate\` with the same markdown body).
4500
4389
 
@@ -4519,10 +4408,10 @@ gh pr edit 456 --body-file /tmp/pr-body.md
4519
4408
  gh pr comment 456 --body-file /tmp/comment.md
4520
4409
  \`\`\`
4521
4410
 
4522
- Videos stay private, and GitHub does not play external videos inline. Upload the MP4 normally, generate a poster with \`ffmpeg -i /tmp/demo.mp4 -frames:v 1 /tmp/demo-poster.png\`, upload the poster like any image, and link its printed embed to the recording's **View in Replicas** URL:
4411
+ GitHub does not play external videos inline, so show motion with a GIF (see *Make a GIF from a recording* above); its printed embed animates inline like any image. Videos stay private. When the full recording is also worth watching, upload the MP4 too and link the GIF to the recording's **View in Replicas** URL. When a still is enough, use a poster instead (\`ffmpeg -i /tmp/demo.mp4 -frames:v 1 /tmp/demo-poster.png\`), uploaded like any image:
4523
4412
 
4524
4413
  \`\`\`markdown
4525
- [![Demo recording](<public-poster-url>)](<recording-dashboard-url>)
4414
+ [![Checkout flow](<public-gif-or-poster-url>)](<recording-dashboard-url>)
4526
4415
  \`\`\`
4527
4416
 
4528
4417
  Public links are unauthenticated bearer capabilities. Revoke with \`replicas media revoke <media-id>\` **only** when the user asks or the media should intentionally stop rendering; never as routine post-task cleanup, since revoking breaks every embed already posted on the PR.
@@ -4554,13 +4443,15 @@ const context = await browser.newContext({
4554
4443
 
4555
4444
  For \`ffmpeg\` screen captures, pass \`-r 30\` (or \`-r 60\`) to set the frame rate.
4556
4445
 
4446
+ Start recording just before the interaction and stop right after it, so the GIF made from it stays short.
4447
+
4557
4448
  ## Supported formats
4558
4449
 
4559
4450
  Auto-detected from the filename extension:
4560
4451
 
4561
4452
  | Extension | Kind |
4562
4453
  |---|---|
4563
- | \`png\`, \`jpg\`, \`jpeg\`, \`webp\` | image |
4454
+ | \`png\`, \`jpg\`, \`jpeg\`, \`webp\`, \`gif\` | image |
4564
4455
  | \`mp4\`, \`webm\` | video |
4565
4456
  | \`mp3\`, \`wav\` | audio |
4566
4457
  | \`html\`, \`htm\` | html |
@@ -4583,7 +4474,7 @@ replicas media upload chart-a.svg chart-b.svg --name "Latency chart" --name "Err
4583
4474
  var MEDIA_ABILITY = {
4584
4475
  label: "Media",
4585
4476
  description: "Deliver media to Replicas and destination workflows with inline uploads.",
4586
- bullet: "- Producing or showing the user any media \u2014 screenshots, screen recordings, generated images or diagrams, audio clips, or HTML recap pages \u2014 including in your Replicas chat reply, PR descriptions/comments, and other external platforms. Paste the printed `![\u2026](\u2026)` embeds in your chat reply, never only dashboard links, and upload the file itself to Slack, Linear, or GitLab",
4477
+ bullet: "- Producing or showing the user any media \u2014 screenshots, screen recordings, generated images or diagrams, audio clips, or HTML recap pages \u2014 including in your Replicas chat reply, PR descriptions/comments, and other external platforms. Paste the printed `![\u2026](\u2026)` embeds in your chat reply, never only dashboard links, and upload the file itself to Slack, Linear, or GitLab. To show motion, turn the recording into a short GIF with `replicas media gif` instead of a grid of frames",
4587
4478
  section: SECTION7,
4588
4479
  referenceFile: { name: "MEDIA.md", content: REFERENCE7 }
4589
4480
  };
@@ -5566,138 +5457,7 @@ function areUserMessagesWithinMatchWindow(a, b) {
5566
5457
  return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
5567
5458
  }
5568
5459
 
5569
- // ../shared/src/display-message/turns.ts
5570
- function isCompaction(message2) {
5571
- return message2.type === "reasoning" && message2.content === COMPACTION_CONTENT;
5572
- }
5573
- function isGoalUpdate(message2) {
5574
- return message2.type === "tool_call" && message2.server === "claude" && message2.tool === GOAL_TOOL_NAME;
5575
- }
5576
-
5577
5460
  // ../shared/src/display-message/steps.ts
5578
- function inputString(input, ...keys) {
5579
- for (const key of keys) {
5580
- const value = input?.[key];
5581
- if (typeof value === "string" && value.trim()) return value;
5582
- }
5583
- return void 0;
5584
- }
5585
- var COMMAND_PARSE_LIMIT = 4096;
5586
- function shellPayload(command) {
5587
- const [first] = parseShellScript(command, null);
5588
- const flag = first?.wrapper ? first.argv.findIndex((arg, index) => index > 0 && /^-[A-Za-z]*c[A-Za-z]*$/.test(arg)) : -1;
5589
- return (flag > 0 ? first.argv[flag + 1] : void 0)?.replaceAll(SHELL_OPAQUE, "\u2026") ?? command.trim();
5590
- }
5591
- function commandLabel(command) {
5592
- const lines = shellPayload(command.slice(0, COMMAND_PARSE_LIMIT)).replace(/^cd\s+\S+\s*&&\s*/, "").split("\n").filter((line) => line.trim());
5593
- const shown = lines.length > 1 && /(["']|<<-?\s*['"]?\w+['"]?)\s*$/.test(lines[0]) ? 2 : 1;
5594
- const label = lines.slice(0, shown).map((line) => line.trim()).join(" ");
5595
- return lines.length > shown ? `${label} \u2026` : label;
5596
- }
5597
- var BACKGROUND_META = {
5598
- in_progress: "Running in background",
5599
- completed: "Done in background",
5600
- failed: "Failed in background",
5601
- stopped: "Stopped in background"
5602
- };
5603
- var OPERATION_VERBS = {
5604
- add: ["Creating", "Created", "file-plus"],
5605
- delete: ["Deleting", "Deleted", "file-x"],
5606
- update: ["Editing", "Edited", "file-pen"]
5607
- };
5608
- function describeMessageSteps(message2, durationMs, background) {
5609
- const status = getDisplayMessageStatus(message2);
5610
- const base = {
5611
- message: message2,
5612
- running: status === "in_progress",
5613
- failed: status === "failed",
5614
- durationMs
5615
- };
5616
- switch (message2.type) {
5617
- case "reasoning":
5618
- if (isCompaction(message2)) {
5619
- return [{ ...base, key: message2.id, category: "compact", icon: "fold", live: "Compacting context", done: base.failed ? "Context compaction" : "Compacted context" }];
5620
- }
5621
- if (!message2.content.trim()) return [];
5622
- return [{ ...base, key: message2.id, category: "think", icon: "brain", live: "Thinking", done: "Thought", failed: false, detail: "reasoning" }];
5623
- case "command": {
5624
- const policyBlocked = message2.status === "failed" && message2.exitCode == null && Boolean(message2.output?.toLowerCase().includes("blocked by organization policy"));
5625
- const display = policyBlocked || message2.command.length > COMMAND_PARSE_LIMIT ? null : commandDisplayFromCommand(message2.command);
5626
- const failed = policyBlocked || base.failed || message2.exitCode != null && message2.exitCode !== 0 || background?.status === "failed";
5627
- const running = background ? background.status === "in_progress" : base.running;
5628
- const meta = policyBlocked ? "Blocked by policy" : background ? BACKGROUND_META[background.status] : failed && message2.exitCode != null ? `Exit code ${message2.exitCode}` : void 0;
5629
- if (display?.title.startsWith("Read") && display.paths.length > 0) {
5630
- return display.paths.map((path, index) => ({ ...base, key: index ? `${message2.id}-${index}` : message2.id, category: "read", icon: "book", live: "Reading", done: "Read", target: { text: path, path }, meta, running, failed, detail: "shell", background }));
5631
- }
5632
- if (display?.title === "Write") {
5633
- return [{ ...base, key: message2.id, category: "edit", icon: "file-pen", live: "Writing", done: "Wrote", target: { text: display.paths[0], path: display.paths[0] }, meta, running, failed, detail: "shell", background }];
5634
- }
5635
- return [{
5636
- ...base,
5637
- key: message2.id,
5638
- category: display?.title === "Search" ? "search" : "command",
5639
- icon: "terminal",
5640
- live: "Running",
5641
- done: "Ran",
5642
- target: { text: commandLabel(message2.command) },
5643
- meta,
5644
- running,
5645
- failed,
5646
- detail: "shell",
5647
- background
5648
- }];
5649
- }
5650
- case "patch":
5651
- return message2.operations.map((operation, index) => {
5652
- const [live, done, icon] = OPERATION_VERBS[operation.action] ?? OPERATION_VERBS.update;
5653
- return {
5654
- ...base,
5655
- key: `${message2.id}-${index}`,
5656
- category: "edit",
5657
- icon,
5658
- live,
5659
- done,
5660
- target: { text: operation.moveTo ?? operation.path, path: operation.moveTo ?? operation.path },
5661
- detail: operation.diff ? "diff" : void 0,
5662
- operation
5663
- };
5664
- });
5665
- case "file_change":
5666
- return message2.changes.map((change, index) => {
5667
- const [live, done, icon] = OPERATION_VERBS[change.kind] ?? OPERATION_VERBS.update;
5668
- return { ...base, key: `${message2.id}-${index}`, category: "edit", icon, live, done, target: { text: change.path, path: change.path } };
5669
- });
5670
- case "web_search":
5671
- return [{ ...base, key: message2.id, category: "web", icon: "globe", live: "Searching the web for", done: "Searched the web for", target: { text: message2.query } }];
5672
- case "skill": {
5673
- if (message2.skillName.startsWith(LEARNED_SKILL_DIR_PREFIX)) {
5674
- return [{ ...base, key: message2.id, category: "tool", icon: "lightbulb", live: "Using learning", done: "Used learning", target: { text: message2.skillName.slice(LEARNED_SKILL_DIR_PREFIX.length) } }];
5675
- }
5676
- return [{ ...base, key: message2.id, category: "tool", icon: "zap", live: "Using skill", done: "Used skill", target: { text: message2.skillName } }];
5677
- }
5678
- case "subagent":
5679
- return [{
5680
- ...base,
5681
- ...background && { running: background.status === "in_progress", failed: background.status === "failed" },
5682
- key: message2.id,
5683
- category: "agent",
5684
- icon: "bot",
5685
- live: "Running",
5686
- done: "Ran",
5687
- target: { text: message2.description, plain: true },
5688
- background
5689
- }];
5690
- case "background_task":
5691
- if (message2.toolUseId) return [];
5692
- return [{ ...base, key: message2.id, category: "task", icon: "bell", live: "Running", done: "Ran", target: { text: message2.description ?? message2.summary ?? "background task", plain: true } }];
5693
- case "tool_call": {
5694
- const step = describeToolCall(message2, base);
5695
- return step ? [step] : [];
5696
- }
5697
- default:
5698
- return [];
5699
- }
5700
- }
5701
5461
  var SUBAGENT_STEPS = {
5702
5462
  [SUBAGENT_MCP_TOOLS.messageAgent]: { icon: "message", live: "Messaging", done: "Messaged" },
5703
5463
  [SUBAGENT_MCP_TOOLS.waitAgent]: { icon: "clock", live: "Waiting for", done: "Waited for" },
@@ -5713,90 +5473,6 @@ var MOTHERSHIP_TOOL_ACTIONS = {
5713
5473
  [REPLICAS_MCP_TOOLS.archiveSubagent]: "archive",
5714
5474
  [REPLICAS_MCP_TOOLS.waitForSubagents]: "wait"
5715
5475
  };
5716
- var INTERNAL_TOOLS = /* @__PURE__ */ new Set(["ToolSearch", "ListMcpResourcesTool", "ReadMcpResourceTool", "TaskOutput", "BashOutput"]);
5717
- function describeToolCall(message2, base) {
5718
- const { inputObject: input, filePath } = parseToolCallInput(message2.input);
5719
- const tool = message2.tool;
5720
- const key = message2.id;
5721
- if (INTERNAL_TOOLS.has(tool)) return null;
5722
- if (isGoalUpdate(message2)) {
5723
- const objective = inputString(input, "objective");
5724
- return objective ? { ...base, key, category: "tool", icon: "target", live: "Setting goal", done: "Set goal", target: { text: objective, plain: true } } : { ...base, key, category: "tool", icon: "target", live: "Clearing goal", done: "Cleared goal" };
5725
- }
5726
- const subagentTool = subagentToolName(message2);
5727
- if (subagentTool && isSubagentMcpToolName(subagentTool)) {
5728
- const failed = base.failed || typeof parseToolCallInput(message2.output).inputObject?.error === "string";
5729
- if (subagentTool === SUBAGENT_MCP_TOOLS.spawnAgent) {
5730
- return { ...base, key, category: "agent", icon: "bot", live: "Running", done: "Started", failed, target: { text: inputString(input, "title", "prompt") ?? "subagent", plain: true } };
5731
- }
5732
- const chatId = subagentChatId(message2);
5733
- const provider2 = typeof input?.provider === "string" && isValidAgentProvider(input.provider) ? input.provider : null;
5734
- const agent = inputString(input, "title") ?? chatId?.slice(0, 8) ?? (provider2 ? getProviderDisplayName(provider2) : void 0);
5735
- return { ...base, key, category: "tool", ...SUBAGENT_STEPS[subagentTool], failed, target: agent ? { text: agent, plain: true } : void 0, detail: "subagent" };
5736
- }
5737
- const mcp = parseMcpToolName(tool);
5738
- const mothershipAction = (mcp?.server ?? message2.server) === REPLICAS_MCP_SERVER_NAME ? MOTHERSHIP_TOOL_ACTIONS[mcp?.tool ?? tool] : void 0;
5739
- if (mothershipAction) {
5740
- const step = {
5741
- ...base,
5742
- key,
5743
- failed: base.failed || Boolean(message2.output?.startsWith("Error:")),
5744
- mothership: { action: mothershipAction, name: inputString(input, "name"), agentId: inputString(input, "agent_id"), chatId: inputString(input, "chat_id"), text: inputString(input, "prompt", "message") }
5745
- };
5746
- if (mothershipAction === "spawn") return { ...step, category: "agent", icon: "network", live: "Spawning", done: "Spawned", detail: "mothership" };
5747
- if (mothershipAction === "send") return { ...step, category: "agent", icon: "message", live: "Messaging", done: "Messaged", detail: "mothership" };
5748
- if (mothershipAction === "wait") {
5749
- return { ...step, category: "agent", icon: "clock", live: "Waiting for subagents", done: "Waited for subagents", detail: "mothership", mothership: { ...step.mothership, events: extractMothershipEvents(message2.output ?? "") } };
5750
- }
5751
- if (mothershipAction === "archive") return { ...step, category: "tool", icon: "archive", live: "Archiving subagent", done: "Archived subagent", detail: "io" };
5752
- return mothershipAction === "list" ? { ...step, category: "tool", icon: "network", live: "Listing subagents", done: "Listed subagents", detail: "io" } : { ...step, category: "tool", icon: "network", live: "Reading subagent response", done: "Read subagent response", detail: "io" };
5753
- }
5754
- const shellCommand = /^(bash|shell|run_shell_command)$/i.test(tool) ? inputString(input, "command", "cmd") : void 0;
5755
- if (shellCommand) {
5756
- return { ...base, key, category: "command", icon: "terminal", live: "Running", done: "Ran", target: { text: commandLabel(shellCommand) }, detail: "io" };
5757
- }
5758
- if (/^(read|read_file|view)$/i.test(tool) && filePath) {
5759
- return { ...base, key, category: "read", icon: "book", live: "Reading", done: "Read", target: { text: filePath, path: filePath }, detail: "io" };
5760
- }
5761
- if (/^(grep|glob|search|find|codebase_search|file_search)$/i.test(tool)) {
5762
- const scope = inputString(input, "path", "glob", "include", "target_directories");
5763
- return {
5764
- ...base,
5765
- key,
5766
- category: "search",
5767
- icon: "search",
5768
- live: "Searching for",
5769
- done: "Searched for",
5770
- target: { text: inputString(input, "pattern", "query", "glob_pattern", "globPattern") ?? tool },
5771
- scope,
5772
- detail: message2.output ? "results" : void 0
5773
- };
5774
- }
5775
- if (/^(ls|list_dir|list_directory)$/i.test(tool)) {
5776
- const path = inputString(input, "path", "relative_workspace_path") ?? ".";
5777
- return { ...base, key, category: "read", icon: "folder", live: "Listing", done: "Listed", target: { text: path, path }, detail: "io" };
5778
- }
5779
- if (/^(webfetch|web_fetch|fetch)$/i.test(tool)) {
5780
- return { ...base, key, category: "web", icon: "globe", live: "Fetching", done: "Fetched", target: { text: inputString(input, "url") ?? tool }, detail: "io" };
5781
- }
5782
- if (/^(websearch|web_search)$/i.test(tool)) {
5783
- return { ...base, key, category: "web", icon: "globe", live: "Searching the web for", done: "Searched the web for", target: { text: inputString(input, "query") ?? tool } };
5784
- }
5785
- if (/^(edit|write|multiedit|notebookedit|apply_patch|str_replace)/i.test(tool) && filePath) {
5786
- return { ...base, key, category: "edit", icon: "file-pen", live: "Editing", done: "Edited", target: { text: filePath, path: filePath }, detail: "io" };
5787
- }
5788
- return {
5789
- ...base,
5790
- key,
5791
- category: "tool",
5792
- icon: "wrench",
5793
- live: "Calling",
5794
- done: "Called",
5795
- target: { text: mcp?.tool ?? tool },
5796
- scope: mcp?.server ?? (message2.server && message2.server !== "claude" ? message2.server : void 0),
5797
- detail: message2.input || message2.output ? "io" : void 0
5798
- };
5799
- }
5800
5476
 
5801
5477
  // ../shared/src/user-message-attachments.ts
5802
5478
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
@@ -10052,7 +9728,6 @@ export {
10052
9728
  chatHistoryPageParamsFromQuery,
10053
9729
  paginateChatHistory,
10054
9730
  coerceBackgroundTaskPayload,
10055
- planItemsFromMessage,
10056
9731
  fileContentDiff,
10057
9732
  skillNamesFromCommand,
10058
9733
  SUBAGENT_MCP_SERVER_NAME,
@@ -10083,7 +9758,6 @@ export {
10083
9758
  learnedSkillsManifestSchema,
10084
9759
  learnedSkillFormatInstruction,
10085
9760
  areUserMessagesWithinMatchWindow,
10086
- describeMessageSteps,
10087
9761
  extractErrorText,
10088
9762
  isTransientErrorText,
10089
9763
  extractToolResultText,
@@ -5,14 +5,14 @@ import {
5
5
  getOriginDefaultBranch,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-YOPLBPQ5.js";
8
+ } from "./chunk-AG62XLHV.js";
9
9
  import {
10
10
  extractCommandProtectionCommandText,
11
11
  findCommandProtectionGitLookups,
12
12
  findGitCommitSignals,
13
13
  findPrMergeSignals,
14
14
  parseCommandProtectionRequest
15
- } from "./chunk-PM24TJJL.js";
15
+ } from "./chunk-DW4DQJGC.js";
16
16
 
17
17
  // src/services/command-protection-service.ts
18
18
  import { readFile, stat } from "fs/promises";