replicas-engine 0.1.679 → 0.1.681

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.
@@ -366,7 +366,9 @@ var FALLBACK_AGENT_MODEL = {
366
366
  relay: DEFAULT_CLAUDE_MODEL
367
367
  };
368
368
  function getDefaultAgentModel(provider, overrides) {
369
- return overrides?.[provider]?.[0] ?? FALLBACK_AGENT_MODEL[provider];
369
+ const fallback = FALLBACK_AGENT_MODEL[provider];
370
+ const options = getAgentModelOptions(provider, overrides);
371
+ return options.includes(fallback) ? fallback : options[0];
370
372
  }
371
373
  function normalizeClaudeModel(model) {
372
374
  if (model === "opus" || model === CLAUDE_OPUS_1M_MODEL || model === LEGACY_CLAUDE_OPUS_1M_MODEL) {
@@ -454,6 +456,10 @@ var AGENT_MODELS = {
454
456
  pi: [...OPENROUTER_MODELS, ...ASTER_MODELS],
455
457
  relay: [CLAUDE_FABLE_5_MODEL, CLAUDE_OPUS_5_MODEL, CLAUDE_OPUS_4_8_MODEL, CLAUDE_SONNET_5_MODEL]
456
458
  };
459
+ function getAgentModelOptions(provider, overrides) {
460
+ const override = overrides?.[provider];
461
+ return override?.length ? override : AGENT_MODELS[provider];
462
+ }
457
463
  var MODEL_LABELS = {
458
464
  fable: "Fable 5",
459
465
  [CLAUDE_FABLE_5_MODEL]: "Fable 5",
@@ -1621,6 +1627,8 @@ replicas computer record stop
1621
1627
  replicas media upload /tmp/demo.mp4 --name "Demo recording"
1622
1628
  \`\`\`
1623
1629
 
1630
+ For any external destination, continue with the required delivery flow in \`MEDIA.md\`.
1631
+
1624
1632
  ## Command reference
1625
1633
 
1626
1634
  ### \`replicas computer info\`
@@ -1755,7 +1763,7 @@ replicas computer record start /tmp/walkthrough.mp4
1755
1763
  replicas computer record stop
1756
1764
  replicas media upload /tmp/walkthrough.mp4 --name "Walkthrough recording"
1757
1765
  \`\`\`
1758
- Then embed the printed \`![\u2026](\u2026)\` line in your chat reply. See \`MEDIA.md\`.
1766
+ Then embed the printed \`![\u2026](\u2026)\` line in your chat reply and follow \`MEDIA.md\` for any external destination.
1759
1767
 
1760
1768
  ## Failure modes
1761
1769
 
@@ -1955,16 +1963,9 @@ gh pr review 123 --approve
1955
1963
  gh pr review 123 --request-changes --body "Changes needed"
1956
1964
  \`\`\`
1957
1965
 
1958
- ## Image Uploads in PRs
1966
+ ## Media in GitHub workflows
1959
1967
 
1960
- GitHub does NOT have a public API for uploading images to PRs/issues. When you need to include images:
1961
- - Do NOT use placeholder image URLs
1962
- - Do NOT commit screenshots as files to the repository
1963
- - Run \`replicas media upload <image> --name "<display name>" --share\` and put the printed \`Forge embed\` Markdown in the PR body or comment
1964
- - For a self-contained HTML report, run \`replicas media upload <page.html> --name "<display name>" --access organization\` and put the printed \`Forge link\` Markdown in the PR body or comment. Organization members who are already signed in open it directly; others sign in and return to the page
1965
- - For video, embed a shared poster image linked to the recording's **View in Replicas** URL; GitHub does not reliably render externally hosted video inline
1966
- - Treat the public URL as an opt-in bearer capability; revoke it with \`replicas media revoke <media-id>\` only when the user asks or the media should stop rendering \u2014 revoking breaks embeds already posted on the PR
1967
- - If you were triggered from Slack, also upload the image to the Slack thread so the user can see it directly
1968
+ 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 Replicas upload, GitHub's inline fallback, and the required **View in Replicas** link.
1968
1969
  `;
1969
1970
  var GITHUB_ABILITY = {
1970
1971
  label: "GitHub",
@@ -2026,7 +2027,7 @@ await replicas.gitlab.request('/projects/group%2Frepo/pipelines', {
2026
2027
 
2027
2028
  ## Descriptions and media
2028
2029
 
2029
- API updates replace the entire merge request description, so always preserve the required Replicas footer and co-author trailers. For media, first run \`replicas media upload\` as documented in \`MEDIA.md\`; use GitLab's project uploads endpoint only when a native repository-protected embed is required.
2030
+ API updates replace the entire merge request description, so always preserve the required Replicas footer and co-author trailers. Media delivery is owned by \`references/MEDIA.md\`; read its GitLab section before adding media so the original bytes are uploaded to Replicas and GitLab and the dashboard link remains secondary.
2030
2031
  `;
2031
2032
  var GITLAB_ABILITY = {
2032
2033
  label: "GitLab",
@@ -2091,6 +2092,8 @@ await replicas.linear.graphql({
2091
2092
  \`\`\`
2092
2093
 
2093
2094
  Search with \`containsIgnoreCase: $query\` filters, for example on both \`title\` and \`description\`. Batch independent queries with \`Promise.all\` to save round trips.
2095
+
2096
+ For screenshots, recordings, diagrams, or other media, read \`references/MEDIA.md\` before adding it to an issue or comment. It is the single source of truth for uploading the Replicas copy and the raw file to Linear; a dashboard link alone is not an inline attachment.
2094
2097
  `;
2095
2098
  var LINEAR_ABILITY = {
2096
2099
  label: "Linear",
@@ -2102,18 +2105,19 @@ var LINEAR_ABILITY = {
2102
2105
 
2103
2106
  // ../shared/src/default-skills/replicas-agent/abilities/media.ts
2104
2107
  var SECTION6 = `### Media
2105
- Share screenshots, screen recordings, generated diagrams, audio clips, and self-contained HTML pages through Replicas and external messages.
2108
+ 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.
2106
2109
 
2107
2110
  **Reference:** \`references/MEDIA.md\`
2108
2111
 
2109
2112
  Use this when:
2113
+ - You are about to run \`replicas media upload\`; this reference owns the complete Replicas-first, destination-second workflow
2110
2114
  - You produce a screenshot, recording, generated image, or audio clip the user should see
2111
2115
  - You produce a self-contained HTML report that should be linked from a pull request
2112
2116
  - You record video output (browser automation, screen capture) \u2014 including the recommended aspect ratio and FPS
2113
- - You need to embed media in a Slack/Linear/GitHub message AND keep a referenceable copy in the Replicas dashboard`;
2117
+ - You need to embed media in a Slack/Linear/GitHub/GitLab message AND keep a referenceable copy in the Replicas dashboard`;
2114
2118
  var REFERENCE6 = `# Media (Screenshots, Recordings, Audio, HTML)
2115
2119
 
2116
- This guide covers how to share screenshots, screen recordings, generated diagrams, audio clips, and self-contained HTML pages through Replicas and external surfaces (Slack, Linear, GitHub).
2120
+ 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).
2117
2121
 
2118
2122
  ## Prerequisites
2119
2123
 
@@ -2123,12 +2127,32 @@ The \`replicas\` CLI is pre-installed and authenticated in your workspace. No ad
2123
2127
 
2124
2128
  Upload to Replicas in these cases \u2014 and **only** these cases:
2125
2129
 
2126
- 1. **Media you produce.** Any screenshot, screen recording, generated diagram, or audio clip you create that the user might want to see. Upload before doing anything else with the file (analyzing, deleting, sending elsewhere). This applies even when you're also sending the file to Slack, Linear, GitHub, etc.
2130
+ 1. **Media you produce.** Any screenshot, screen recording, generated diagram, audio clip, or HTML page you create that the user might want to see. Upload before doing anything else with the file (analyzing, deleting, sending elsewhere). This applies even when you're also sending the file to Slack, Linear, GitHub, or GitLab.
2127
2131
  2. **Files the user explicitly asks you to upload.** If the user sends or points at a file (image, video, audio, HTML) and asks you to upload it, run \`replicas media upload\`. Otherwise leave it alone \u2014 files in the workspace the user did not ask about should not be auto-uploaded as media.
2128
- 3. **Anything you plan to share externally (Slack, Linear, GitHub, etc.).** Upload to Replicas *in addition to* the platform's native upload. Never as a replacement.
2132
+ 3. **Anything you plan to share externally (Slack, Linear, GitHub, GitLab, etc.).** Upload to Replicas *in addition to* the platform's destination upload. Never as a replacement.
2129
2133
 
2130
2134
  If none of these apply, don't upload.
2131
2135
 
2136
+ ## Required delivery contract
2137
+
2138
+ \`replicas media upload\` is always the first delivery action. When the current task has an external destination, every other delivery step follows only after that command succeeds. For every file:
2139
+
2140
+ 1. First, run \`replicas media upload\` with the original file. Do not begin any destination upload until the command succeeds. This creates the canonical dashboard copy and prints the authenticated chat embed plus a per-file dashboard link.
2141
+ 2. Include the printed embed line in the Replicas chat reply, followed by the matching **View in Replicas** link. HTML uses its printed page link instead of an image embed.
2142
+ 3. Identify every destination in the task and attempt to upload the same original bytes there. Use the destination's inline representation from the table below; do not replace the file with a Replicas link.
2143
+ 4. Put the **View in Replicas** dashboard link next to the destination embed as a secondary link.
2144
+ 5. Check each destination response. If a native upload is unavailable or fails, say so explicitly and keep the dashboard link; never claim that a link is an inline upload.
2145
+
2146
+ | Destination | Required file delivery | Inline result |
2147
+ |---|---|---|
2148
+ | Replicas dashboard/chat | \`replicas media upload\` | Printed \`![\u2026](\u2026)\` line in chat |
2149
+ | Slack | \`files.getUploadURLExternal\` \u2192 raw-byte POST \u2192 \`files.completeUploadExternal\` | Uploaded file in the channel or thread |
2150
+ | Linear | \`fileUpload\` mutation \u2192 presigned upload \u2192 issue/comment mutation | Returned \`assetUrl\` in Markdown |
2151
+ | GitLab | Project \`/uploads\` endpoint with the original bytes | Returned GitLab Markdown |
2152
+ | GitHub | No supported attachment API; use a Replicas public forge share for the inline image or video poster | Printed Forge embed, linked to the recording when needed |
2153
+
2154
+ The dashboard link is the subtitle and jump-back path. It is never a substitute for the destination upload.
2155
+
2132
2156
  ## Uploading to Replicas
2133
2157
 
2134
2158
  \`\`\`bash
@@ -2185,7 +2209,7 @@ replicas media upload screenshot.png --name "Login page" --access public
2185
2209
  | \`https://api.tryreplicas.com/v1/media/<id>\` (inside \`![\u2026](\u2026)\`) | Authenticated API redirect to a presigned blob \u2014 requires the Replicas chat session | **Only** in the Replicas chat reply. Nowhere else. |
2186
2210
  | \`https://tryreplicas.com/organizations/<organization-id>/media/<media-id>\` | Organization-only page printed by \`--access organization\` | Pull requests and other places where every viewer belongs to the Replicas organization. |
2187
2211
  | \`https://api.tryreplicas.com/v1/media/public/<id>/<token>\` | Opt-in public bearer URL printed by \`--access public\` or \`--share\` | GitHub embeds for image, video, or audio media. |
2188
- | \`https://tryreplicas.com/workspaces/<workspace-id>?media=<media-id>\` | Authenticated dashboard deep link that opens the media file in the workspace | Everywhere external \u2014 Slack, GitHub, Linear, PR bodies, comments, emails. |
2212
+ | \`https://tryreplicas.com/workspaces/<workspace-id>?media=<media-id>\` | Authenticated dashboard deep link that opens the media file in the workspace | Everywhere external: Slack, GitHub, GitLab, Linear, PR bodies, comments, emails. |
2189
2213
 
2190
2214
  ### NEVER link the API redirect URL outside the Replicas chat reply
2191
2215
 
@@ -2195,6 +2219,7 @@ This rule has no exceptions:
2195
2219
  - \u274C Never paste it in a Slack message \u2014 upload the actual bytes via the 3-step \`files.getUploadURLExternal\` \u2192 POST bytes \u2192 \`files.completeUploadExternal\` flow instead (see below).
2196
2220
  - \u274C Never paste it in a GitHub PR description, issue body, review comment, or commit message.
2197
2221
  - \u274C Never paste it in a Linear issue body or comment \u2014 upload via Linear's \`fileUpload\` mutation instead (see below).
2222
+ - \u274C Never paste it in a GitLab merge request or issue; upload the original bytes through GitLab's project upload endpoint instead (see below).
2198
2223
  - \u274C Never link to it from any external doc, email, or external chat.
2199
2224
  - \u274C Never include it as a "backup link" in case the dashboard link breaks \u2014 it will always break externally.
2200
2225
 
@@ -2218,16 +2243,16 @@ Include each markdown embed line **verbatim** where you want that file to render
2218
2243
 
2219
2244
  After (or alongside) the embeds, include a \`[View in Replicas](<deep-link>)\` hyperlink for each file using the per-file dashboard URL from the CLI. This lets the user open the specific item in the workspace.
2220
2245
 
2221
- ## On external platforms \u2014 upload natively AND link the dashboard
2246
+ ## On external platforms: embed the file AND link the dashboard
2222
2247
 
2223
- Sharing media externally is a **two-step requirement** for every file:
2248
+ After \`replicas media upload\` succeeds, external delivery has two required follow-up steps for every file:
2224
2249
 
2225
- 1. **Upload the raw bytes natively to that platform** so the recipient sees the media embedded inline in the message itself.
2250
+ 1. **Upload the raw bytes through that platform's supported inline path** so the recipient sees the media embedded in the message itself.
2226
2251
  2. **Link the Replicas dashboard deep link** (\`?media=<id>\` form) so the user can jump straight to the file in the workspace.
2227
2252
 
2228
- A link alone is not enough. A native upload alone is not enough. Do both.
2253
+ A link alone is not enough. An upload without the dashboard link is not enough. Do both.
2229
2254
 
2230
- GitHub has no native upload API, so use an explicit Replicas public share for screenshots and recording previews. GitLab has a native upload API and should receive the original bytes.
2255
+ Slack, Linear, and GitLab receive the original bytes through their native upload APIs. GitHub has no supported attachment API, so use an explicit Replicas public share for screenshots and recording previews.
2231
2256
 
2232
2257
  ### Slack \u2014 embed natively via the 3-step external file upload flow
2233
2258
 
@@ -2358,7 +2383,7 @@ GitHub does not reliably render arbitrary external videos as inline players. For
2358
2383
  [![Demo recording](<public-poster-url>)](<recording-dashboard-url>)
2359
2384
  \`\`\`
2360
2385
 
2361
- Public forge shares are bearer capabilities. For private repositories, create one only when the user asked for inline PR media. Revoke with \`replicas media revoke <media-id>\` **only** when the user asks or the media should intentionally stop rendering \u2014 never as routine post-task cleanup, since revoking breaks every embed already posted on the PR.
2386
+ Public forge shares are unauthenticated bearer capabilities. For private repositories, create one only when the user explicitly asked for inline PR media. Without that consent, keep the media private in Replicas and report that GitHub has no supported attachment API; do not publish a bearer share or pretend the dashboard link is an embed. 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.
2362
2387
 
2363
2388
  For a self-contained HTML report, upload it with \`--access organization\` and put the printed \`Forge link\` Markdown in the PR body or comment. GitHub cannot render the page inline, so use the normal link rather than image syntax. HTML pages cannot be shared publicly.
2364
2389
 
@@ -2366,7 +2391,7 @@ Do **not** commit screenshots to the repo, use placeholder URLs, expose the auth
2366
2391
 
2367
2392
  ### GitLab: native inline screenshots and videos
2368
2393
 
2369
- GitLab supports native project Markdown uploads. Always upload the media to Replicas first, then POST the same original file to the repository's \`/projects/:id/uploads\` API using the workspace GitLab credential. Insert the returned \`markdown\` value into the merge request body or comment and include the Replicas dashboard link. Image uploads render inline; MP4, MOV, and WebM uploads render as inline video players.
2394
+ GitLab supports native project Markdown uploads. For a GitLab destination, always upload the media to Replicas first, then POST the same original file to the repository's \`/projects/:id/uploads\` API using the workspace GitLab credential. Insert the returned \`markdown\` value into the merge request body or comment and include the Replicas dashboard link. Image uploads render inline; MP4, MOV, and WebM uploads render as inline video players.
2370
2395
 
2371
2396
  Do not use a Replicas public forge share for GitLab when the native project upload succeeds; native uploads preserve project access controls.
2372
2397
 
@@ -2415,7 +2440,7 @@ replicas media upload chart-a.svg chart-b.svg --name "Latency chart" --name "Err
2415
2440
  `;
2416
2441
  var MEDIA_ABILITY = {
2417
2442
  label: "Media",
2418
- description: "Share screenshots, recordings, generated images, audio clips, and HTML pages.",
2443
+ description: "Deliver media to Replicas and destination workflows with inline uploads.",
2419
2444
  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",
2420
2445
  section: SECTION6,
2421
2446
  referenceFile: { name: "MEDIA.md", content: REFERENCE6 }
@@ -2697,7 +2722,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
2697
2722
  | \`replicas automation ...\` | Manage automations (cron + GitHub/GitLab event triggers) |
2698
2723
  | \`replicas preview ...\` | Register / list preview URLs (covered in \`PREVIEWS.md\`) |
2699
2724
  | \`replicas service ...\` | Run long-lived services detached so they survive workspace sleep/wake (see below) |
2700
- | \`replicas media ...\` | Upload screenshots, videos, audio (covered in \`MEDIA.md\`) |
2725
+ | \`replicas media ...\` | Upload media to the dashboard and follow \`MEDIA.md\` for destination embedding |
2701
2726
  | \`replicas slack thread ...\` | Attach or switch Slack thread routing (covered in \`SLACK.md\`) |
2702
2727
 
2703
2728
  \`replicas <command> --help\` is always the source of truth for flags.
@@ -2991,6 +3016,8 @@ await replicas.slack.call('chat.postMessage', {
2991
3016
 
2992
3017
  Only the announcing message gets the button \u2014 follow-ups about a pull request already linked in the thread keep the link in the text and drop the \`blocks\`. Use "View MR" for GitLab. With several links, give each button a unique \`action_id\` and name its repository in the label ("View PR \xB7 web").
2993
3018
 
3019
+ For screenshots, recordings, diagrams, or other media, read \`references/MEDIA.md\` before posting. It is the single source of truth for uploading the Replicas copy and the raw file to Slack; a dashboard link in \`text\` is not an inline attachment.
3020
+
2994
3021
  Attach every new top-level conversation so future replies route to this workspace. For a reply in another thread, attach its root \`thread_ts\`, not the reply timestamp. Do not attach the originating thread again.
2995
3022
 
2996
3023
  ## Search and batch
@@ -6677,7 +6704,7 @@ var DEFAULT_CODEX_ARGS = [
6677
6704
  var MIN_CODEX_CLI_VERSION = "0.144.6";
6678
6705
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
6679
6706
  var codexCliVersionEnsured = null;
6680
- var ENGINE_PACKAGE_VERSION = "0.1.679";
6707
+ var ENGINE_PACKAGE_VERSION = "0.1.681";
6681
6708
  var INITIALIZE_METHOD = "initialize";
6682
6709
  var INITIALIZED_NOTIFICATION = "initialized";
6683
6710
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -7,7 +7,7 @@ import {
7
7
  headlessAgentRequestSchema,
8
8
  putPresignedFile,
9
9
  recoverCompletedTurn
10
- } from "./chunk-6VS3OIXH.js";
10
+ } from "./chunk-HWSR36NN.js";
11
11
 
12
12
  // src/headless-agent.ts
13
13
  import { createHash } from "crypto";
package/dist/src/index.js CHANGED
@@ -190,7 +190,7 @@ import {
190
190
  serializeCanvasContentResponse,
191
191
  shellQuotePosix,
192
192
  stripAgentDiagnosticErrors
193
- } from "./chunk-6VS3OIXH.js";
193
+ } from "./chunk-HWSR36NN.js";
194
194
 
195
195
  // src/index.ts
196
196
  import { serve } from "@hono/node-server";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.679",
3
+ "version": "0.1.681",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",