replicas-engine 0.1.909 → 0.1.910

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.
@@ -5,11 +5,11 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-SJSIX3BZ.js";
9
- import "./chunk-7KUALGJK.js";
10
- import "./chunk-AIMXTL65.js";
8
+ } from "./chunk-5CL42RWH.js";
9
+ import "./chunk-PRJY4Y7V.js";
10
+ import "./chunk-EE6PRRN4.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-NJY73FDM.js";
12
+ import "./chunk-PZHMAH33.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
  export {
15
15
  getCodexAspHost,
@@ -5,13 +5,13 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-7KUALGJK.js";
8
+ } from "./chunk-PRJY4Y7V.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  SUBPROCESS_MAX_BUFFER,
12
12
  buildCodexAgentEnv,
13
13
  execFileAsync
14
- } from "./chunk-AIMXTL65.js";
14
+ } from "./chunk-EE6PRRN4.js";
15
15
  import {
16
16
  isRecord
17
17
  } from "./chunk-UZSNFLDQ.js";
@@ -25,7 +25,7 @@ import {
25
25
  listOpenAICompatibleModels,
26
26
  readOllamaAuthEnv,
27
27
  resolveOpenAICompatibleModelsUrl
28
- } from "./chunk-NJY73FDM.js";
28
+ } from "./chunk-PZHMAH33.js";
29
29
 
30
30
  // src/managers/codex-token-manager.ts
31
31
  import { promises as fs } from "fs";
@@ -254,8 +254,8 @@ var CodexTokenManager = class extends BaseRefreshManager {
254
254
  async switchCredentials(data) {
255
255
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
256
256
  await this.applyCredentialsResponse(data);
257
- if (data.scope) setAgentCredentialSnapshot("codex", { method: data.type, scope: data.scope, revision: data.revision });
258
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-VBFVCBG5.js");
257
+ setAgentCredentialSnapshot("codex", data);
258
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-7J3NRDPV.js");
259
259
  await restartCodexAspHostIfRunning2();
260
260
  });
261
261
  await this.start(true);
@@ -275,16 +275,10 @@ var CodexTokenManager = class extends BaseRefreshManager {
275
275
  await this.applyCredentialUpdate(generation, async () => {
276
276
  await this.applyCredentialsResponse(data);
277
277
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
278
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-VBFVCBG5.js");
278
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-7J3NRDPV.js");
279
279
  await restartCodexAspHostIfRunning2();
280
280
  }
281
- if (data.scope) {
282
- setAgentCredentialSnapshot("codex", {
283
- method: data.type,
284
- scope: data.scope,
285
- ...data.revision ? { revision: data.revision } : {}
286
- });
287
- }
281
+ setAgentCredentialSnapshot("codex", data);
288
282
  });
289
283
  console.log(`[CodexTokenManager] Credentials refreshed (method=${data.type})`);
290
284
  return data;
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES,
6
6
  isVersionBelow
7
- } from "./chunk-NJY73FDM.js";
7
+ } from "./chunk-PZHMAH33.js";
8
8
 
9
9
  // src/utils/codex-agent-env.ts
10
10
  function buildCodexAgentEnv(source = process.env) {
@@ -245,7 +245,7 @@ function getCodexModelProvider(method) {
245
245
  if (method === "foundry") return "azure";
246
246
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
247
247
  }
248
- var ENGINE_PACKAGE_VERSION = "0.1.909";
248
+ var ENGINE_PACKAGE_VERSION = "0.1.910";
249
249
  var INITIALIZE_METHOD = "initialize";
250
250
  var INITIALIZED_NOTIFICATION = "initialized";
251
251
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  monolithRequest
6
- } from "./chunk-7KUALGJK.js";
6
+ } from "./chunk-PRJY4Y7V.js";
7
7
  import {
8
8
  extractCommandProtectionCommandText,
9
9
  findGitCommitSignals,
10
10
  findPrMergeSignals
11
- } from "./chunk-NJY73FDM.js";
11
+ } from "./chunk-PZHMAH33.js";
12
12
 
13
13
  // src/services/command-protection-service.ts
14
14
  var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
@@ -15,7 +15,7 @@ import {
15
15
  isValidRelayBaseProvider,
16
16
  parsePosixEnvFile,
17
17
  readReplicasRuntimeEnv
18
- } from "./chunk-NJY73FDM.js";
18
+ } from "./chunk-PZHMAH33.js";
19
19
 
20
20
  // src/engine-env.ts
21
21
  import { readFileSync as readFileSync2 } from "fs";
@@ -161,10 +161,11 @@ function loadEngineEnv() {
161
161
  return env;
162
162
  }
163
163
  var ENGINE_ENV = loadEngineEnv();
164
- function setAgentCredentialSnapshot(provider, snapshot) {
164
+ function setAgentCredentialSnapshot(provider, { type, scope, revision, account }) {
165
+ if (!scope) return;
165
166
  ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS = {
166
167
  ...ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS,
167
- [provider]: snapshot
168
+ [provider]: { method: type, scope, ...revision ? { revision } : {}, ...account ? { account } : {} }
168
169
  };
169
170
  process.env.REPLICAS_AGENT_CREDENTIALS = JSON.stringify(ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS);
170
171
  }
@@ -958,10 +958,15 @@ function hasAgentChatActivityFields(value) {
958
958
  function isAgentChatActivityRecord(value) {
959
959
  return hasAgentChatActivityFields(value) && typeof value.provider === "string" && isValidAgentProvider(value.provider);
960
960
  }
961
+ var credentialAccountSchema = z2.object({
962
+ ownerName: z2.string().optional(),
963
+ email: z2.string().optional()
964
+ });
961
965
  var agentCredentialSnapshotSchema = z2.object({
962
966
  method: z2.enum(CREDENTIAL_METHOD),
963
967
  scope: z2.enum(CREDENTIAL_SCOPE),
964
- revision: z2.string().optional()
968
+ revision: z2.string().optional(),
969
+ account: credentialAccountSchema.optional()
965
970
  });
966
971
  function isAuthMethod(value) {
967
972
  return typeof value === "string" && Object.values(CREDENTIAL_METHOD).some((method) => method === value);
@@ -1043,6 +1048,8 @@ var CURSOR_CONNECTION_STATUS_EVENT_TYPE = "cursor-connection-status";
1043
1048
  var AUTH_FALLBACK_EVENT_TYPE = "auth-fallback";
1044
1049
  function coerceAuthFallbackPayload(payload) {
1045
1050
  const { provider, reason, exhaustedMethod, exhaustedScope, candidateMethod, candidateScope, status, detail } = payload;
1051
+ const exhaustedAccount = credentialAccountSchema.safeParse(payload.exhaustedAccount).data;
1052
+ const candidateAccount = credentialAccountSchema.safeParse(payload.candidateAccount).data;
1046
1053
  if (typeof provider !== "string" || !isValidCodingAgentProvider(provider) || reason !== "rate_limit" && reason !== "out_of_credits" || !isAuthMethod(exhaustedMethod) || !isAuthMethod(candidateMethod) || !isCredentialScope(candidateScope) || status !== "switched" && status !== "failed") {
1047
1054
  return null;
1048
1055
  }
@@ -1051,8 +1058,10 @@ function coerceAuthFallbackPayload(payload) {
1051
1058
  reason,
1052
1059
  exhaustedMethod,
1053
1060
  ...isCredentialScope(exhaustedScope) ? { exhaustedScope } : {},
1061
+ ...exhaustedAccount ? { exhaustedAccount } : {},
1054
1062
  candidateMethod,
1055
1063
  candidateScope,
1064
+ ...candidateAccount ? { candidateAccount } : {},
1056
1065
  status,
1057
1066
  ...typeof detail === "string" && detail ? { detail } : {}
1058
1067
  };
@@ -1886,19 +1895,27 @@ function detectAgentQuotaLimit(text) {
1886
1895
  }
1887
1896
 
1888
1897
  // ../shared/src/auth-fallback.ts
1889
- function credentialLabel(payload, method, scope) {
1890
- const label = getCredentialMethodLabel(payload.provider, method);
1891
- if (scope === CREDENTIAL_SCOPE.USER) return `your ${label}`;
1892
- if (scope === CREDENTIAL_SCOPE.ORG) return `the organization ${label}`;
1893
- return `the ${label}`;
1898
+ function describeCredential(provider, credential) {
1899
+ const label = getCredentialMethodLabel(provider, credential.method);
1900
+ const { ownerName, email } = credential.account ?? {};
1901
+ const owner = credential.scope === CREDENTIAL_SCOPE.USER ? ownerName ? `${ownerName}'s personal ${label}` : `your ${label}` : credential.scope === CREDENTIAL_SCOPE.ORG ? `the organization's ${label}` : `the ${label}`;
1902
+ return email ? `${owner} (${email})` : owner;
1894
1903
  }
1895
1904
  function describeAuthFallback(payload) {
1896
1905
  const agent = getProviderDisplayName(payload.provider);
1897
- const exhausted = credentialLabel(payload, payload.exhaustedMethod, payload.exhaustedScope);
1906
+ const exhausted = describeCredential(payload.provider, {
1907
+ method: payload.exhaustedMethod,
1908
+ scope: payload.exhaustedScope,
1909
+ account: payload.exhaustedAccount
1910
+ });
1898
1911
  const switched = payload.status === "switched";
1899
1912
  return {
1900
1913
  headline: payload.reason === "out_of_credits" ? `${agent} is out of credits on ${exhausted}` : `${agent} hit its usage limit on ${exhausted}`,
1901
- outcomeClause: switched ? `switched to ${credentialLabel(payload, payload.candidateMethod, payload.candidateScope)}` : "could not use the configured fallback credential"
1914
+ outcomeClause: switched ? `switched to ${describeCredential(payload.provider, {
1915
+ method: payload.candidateMethod,
1916
+ scope: payload.candidateScope,
1917
+ account: payload.candidateAccount
1918
+ })}` : "could not use the configured fallback credential"
1902
1919
  };
1903
1920
  }
1904
1921
 
@@ -1906,7 +1923,7 @@ function describeAuthFallback(payload) {
1906
1923
  import { z as z6 } from "zod";
1907
1924
  var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
1908
1925
  var workspaceCredentialProviderSchema = z6.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
1909
- var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true });
1926
+ var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true });
1910
1927
  var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
1911
1928
  provider: z6.enum(VALID_CODING_AGENT_PROVIDERS)
1912
1929
  }).refine(({ provider, method }) => agentCredentialMethods(provider).includes(method), {
@@ -2781,7 +2798,7 @@ gh pr review 123 --request-changes --body "Changes needed"
2781
2798
 
2782
2799
  ## Media in GitHub workflows
2783
2800
 
2784
- 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 public Forge embeds for images and recording previews, organization-only HTML links, and the required **View in Replicas** link.
2801
+ 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.
2785
2802
  `;
2786
2803
  var GITHUB_ABILITY = {
2787
2804
  label: "GitHub",
@@ -2992,11 +3009,11 @@ If none of these apply, don't upload.
2992
3009
 
2993
3010
  \`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:
2994
3011
 
2995
- 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 a chat embed plus a per-file dashboard link. With public access, the printed Forge embed is the chat embed and is also safe to use on GitHub.
3012
+ 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 an embed plus a per-file dashboard link. Every image gets a public link, so its printed embed works in chat and on GitHub.
2996
3013
  2. Include the printed embed line in the Replicas chat reply, followed by **View in Canvas** using the matching per-file dashboard URL. HTML uses its printed page link instead of an image embed.
2997
- 3. Identify every destination in the task and use its inline representation from the table below. Slack, Linear, and GitLab require an upload of the same original bytes; GitHub uses the public Forge embed.
3014
+ 3. Identify every destination in the task and use its inline representation from the table below. Slack, Linear, and GitLab require an upload of the same original bytes; GitHub uses the image's printed public embed.
2998
3015
  4. Put the **View in Replicas** dashboard link next to the destination embed as a secondary link.
2999
- 5. Check each destination response. If its upload or Forge share fails, say so explicitly and keep the dashboard link; never claim that a dashboard link is an inline embed.
3016
+ 5. Check each destination response. If its upload or public link fails, say so explicitly and keep the dashboard link; never claim that a dashboard link is an inline embed.
3000
3017
 
3001
3018
  | Destination | Required file delivery | Inline result |
3002
3019
  |---|---|---|
@@ -3004,7 +3021,7 @@ If none of these apply, don't upload.
3004
3021
  | Slack | \`files.getUploadURLExternal\` \u2192 raw-byte POST \u2192 \`files.completeUploadExternal\` | Uploaded file in the channel or thread |
3005
3022
  | Linear | \`fileUpload\` mutation \u2192 presigned upload \u2192 issue/comment mutation | Returned \`assetUrl\` in Markdown |
3006
3023
  | GitLab | Project \`/uploads\` endpoint with the original bytes | Returned GitLab Markdown |
3007
- | GitHub | Replicas public Forge share for an image or recording poster | Printed Forge embed, linked to the recording when needed |
3024
+ | GitHub | Printed public embed for an image or recording poster | Printed embed, linked to the recording when needed |
3008
3025
 
3009
3026
  The dashboard link is the subtitle and jump-back path. It is never a substitute for the destination embed.
3010
3027
 
@@ -3034,8 +3051,8 @@ Names are normalized to hyphen-case (spaces become hyphens, e.g. \`Login page\`
3034
3051
 
3035
3052
  For each media file, the CLI prints an embed line and a dashboard link:
3036
3053
 
3037
- 1. Default and organization access print \`Replicas chat embed: ![filename](<api-url>)\`; this authenticated URL renders inline in Replicas chat **only** \u2014 see below.
3038
- 2. Public access (\`--access public\` or \`--share\`) prints \`![filename](<public-url>)\` as the Forge embed instead. This is the public, stable bearer URL to paste into GitHub when sharing is authorized.
3054
+ 1. Images always print \`![filename](<public-url>)\`. This public, stable link works in Replicas chat, GitHub, and anywhere else Markdown images render. No flag is needed.
3055
+ 2. Video and audio print \`Replicas chat embed: ![filename](<api-url>)\` by default; this authenticated URL renders inline in Replicas chat **only** \u2014 see below. \`--access public\` prints a public embed instead.
3039
3056
  3. \`View in Replicas: <deep-link>\` is a per-file dashboard URL of the form \`https://app.replicas.dev/workspaces/<workspace-id>?media=<media-id>\` that opens directly to that specific file.
3040
3057
 
3041
3058
  Match each "View in Replicas" line to the embed line directly above it \u2014 that's the deep link for that file.
@@ -3050,13 +3067,13 @@ replicas media upload recap.html --name "Visual recap" --access organization
3050
3067
 
3051
3068
  The printed \`Forge link (organization only)\` opens a dedicated page. Signed-in organization members go straight to it; signed-out members sign in and return to the page.
3052
3069
 
3053
- Use public access only when the media must render without Replicas authentication:
3070
+ Video and audio stay private unless they must play without Replicas sign-in; then pass \`--access public\` (alias \`--share\`):
3054
3071
 
3055
3072
  \`\`\`bash
3056
- replicas media upload screenshot.png --name "Login page" --access public
3073
+ replicas media upload demo.mp4 --name "Checkout demo" --access public
3057
3074
  \`\`\`
3058
3075
 
3059
- \`--share\` remains an alias for \`--access public\`. Public access prints the raw \`Forge embed\` Markdown instead of the authenticated chat-only embed for image, video, or audio media, backed by an opt-in bearer URL. Anyone with that unguessable URL can view the asset until it is rotated or revoked. HTML pages only support organization access. Use \`replicas media share <media-id>\` to rotate a public media URL and \`replicas media revoke <media-id>\` to revoke it.
3076
+ Public links are unguessable bearer URLs: anyone with the link can view the file until it is rotated or revoked. HTML pages only support organization access. Reuse the link printed at upload. \`replicas media share <media-id>\` issues a new link and breaks the old one everywhere it is embedded, and \`replicas media revoke <media-id>\` removes public access.
3060
3077
 
3061
3078
  Permanently delete an upload with \`replicas media delete <media-id>\`. The backend only permits deletion when the media belongs to the current workspace; media from another workspace returns not found.
3062
3079
 
@@ -3064,14 +3081,14 @@ Permanently delete an upload with \`replicas media delete <media-id>\`. The back
3064
3081
 
3065
3082
  | URL | What it is | Where it's allowed |
3066
3083
  |---|---|---|
3067
- | \`https://api.replicas.dev/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. |
3084
+ | \`https://api.replicas.dev/v1/media/<id>\` (inside \`![\u2026](\u2026)\`) | Authenticated API redirect printed for private video, audio, and HTML \u2014 requires the Replicas chat session | **Only** in the Replicas chat reply. Nowhere else. |
3068
3085
  | \`https://replicas.dev/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. |
3069
- | \`https://api.replicas.dev/v1/media/public/<id>/<token>\` | Opt-in public bearer URL printed by \`--access public\` or \`--share\` | The Replicas chat reply and GitHub embeds, for image, video, or audio media. |
3086
+ | \`https://api.replicas.dev/v1/media/public/<id>/<token>\` | Public bearer URL printed for every image, and for video or audio with \`--access public\` | The Replicas chat reply and GitHub embeds. |
3070
3087
  | \`https://app.replicas.dev/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. |
3071
3088
 
3072
3089
  ### NEVER link the API redirect URL outside the Replicas chat reply
3073
3090
 
3074
- The \`api.replicas.dev/v1/media/<id>\` URL is **not public**. It's an authenticated redirect that only resolves to a presigned download when the Replicas chat session token is present. Anywhere else (Slack, Linear, GitHub, a browser tab the user opens directly, a customer copy-pasting from chat) it returns \`{"error":"Missing authorization token"}\` and renders as a broken image.
3091
+ The \`api.replicas.dev/v1/media/<id>\` URL is **not public**. Image uploads never print it; if you have one for an image from an older upload, run \`replicas media share <media-id>\` to get a public link. It's an authenticated redirect that only resolves to a presigned download when the Replicas chat session token is present. Anywhere else (Slack, Linear, GitHub, a browser tab the user opens directly, a customer copy-pasting from chat) it returns \`{"error":"Missing authorization token"}\` and renders as a broken image.
3075
3092
 
3076
3093
  This rule has no exceptions:
3077
3094
  - \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).
@@ -3105,12 +3122,12 @@ After (or alongside) the embeds, include a \`[View in Canvas](<deep-link>)\` hyp
3105
3122
 
3106
3123
  After \`replicas media upload\` succeeds, external delivery has two required follow-up steps for every file:
3107
3124
 
3108
- 1. **Use the destination's inline representation:** upload the raw bytes to Slack, Linear, or GitLab; embed a public Forge share on GitHub.
3125
+ 1. **Use the destination's inline representation:** upload the raw bytes to Slack, Linear, or GitLab; embed the image's printed public link on GitHub.
3109
3126
  2. **Link the Replicas dashboard deep link** (\`?media=<id>\` form) so the user can jump straight to the file in the workspace.
3110
3127
 
3111
3128
  A dashboard link alone is not enough. An embed without the dashboard link is not enough. Do both.
3112
3129
 
3113
- Slack, Linear, and GitLab receive the original bytes through their native upload APIs. GitHub uses a Replicas public Forge share for screenshots and recording previews.
3130
+ Slack, Linear, and GitLab receive the original bytes through their native upload APIs. GitHub uses the printed public link for screenshots and recording previews.
3114
3131
 
3115
3132
  ### Slack \u2014 embed natively via the 3-step external file upload flow
3116
3133
 
@@ -3211,19 +3228,17 @@ The same flow works for issue bodies (use \`issueCreate\` / \`issueUpdate\` with
3211
3228
 
3212
3229
  Never paste the \`api.replicas.dev/v1/media/<id>\` URL into a Linear body or comment \u2014 it will render as a broken image to anyone outside your Replicas chat.
3213
3230
 
3214
- ### GitHub: inline images and recording previews via Forge
3215
-
3216
- Replicas authenticates GitHub with GitHub App tokens, which native GitHub CLI attachment uploads do not support. Do not use \`gh --attach\` for media. Use a public Forge share for images in PR descriptions, issues, and comments.
3231
+ ### GitHub: inline images and recording previews
3217
3232
 
3218
- Create a public share only for a public repository or after explicit consent to publish media from a private repository. If sharing is not authorized, keep the media private and include its **View in Replicas** link, explaining that inline GitHub images require a public share.
3233
+ Replicas authenticates GitHub with GitHub App tokens, which GitHub's attachment upload rejects, so \`gh --attach\` does not work. Use the public link every image upload prints, in public and private repositories alike, for PR descriptions, issues, and comments.
3219
3234
 
3220
- 1. Upload the image with public access. This creates both the Replicas dashboard copy and the Forge share:
3235
+ 1. Upload the image:
3221
3236
 
3222
3237
  \`\`\`bash
3223
- replicas media upload /tmp/screenshot.png --name "PR screenshot" --access public
3238
+ replicas media upload /tmp/screenshot.png --name "PR screenshot"
3224
3239
  \`\`\`
3225
3240
 
3226
- 2. Copy the printed \`![filename](<public-url>)\` Forge embed into the body file, followed by the matching **View in Replicas** link. Use the printed public URL verbatim; never use a local file path, the authenticated API URL, or an expiring storage URL.
3241
+ 2. Copy the printed \`![filename](<public-url>)\` line verbatim into the body file, followed by the matching **View in Replicas** link. Never use a local file path, a \`/v1/media/<id>\` URL, a Linear \`assetUrl\`, or an expiring storage URL.
3227
3242
  3. Create or update the PR using the body file:
3228
3243
 
3229
3244
  \`\`\`bash
@@ -3232,13 +3247,13 @@ gh pr edit 456 --body-file /tmp/pr-body.md
3232
3247
  gh pr comment 456 --body-file /tmp/comment.md
3233
3248
  \`\`\`
3234
3249
 
3235
- GitHub does not reliably render external videos as inline players. For a recording preview, upload the MP4 normally, generate a poster with \`ffmpeg -i /tmp/demo.mp4 -frames:v 1 /tmp/demo-poster.png\`, upload the poster with \`--access public\`, and link its Forge embed to the recording's **View in Replicas** URL:
3250
+ 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:
3236
3251
 
3237
3252
  \`\`\`markdown
3238
3253
  [![Demo recording](<public-poster-url>)](<recording-dashboard-url>)
3239
3254
  \`\`\`
3240
3255
 
3241
- Public forge shares 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.
3256
+ 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.
3242
3257
 
3243
3258
  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.
3244
3259
 
@@ -3248,7 +3263,7 @@ Do **not** commit screenshots to the repo, use placeholder URLs, expose the auth
3248
3263
 
3249
3264
  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.
3250
3265
 
3251
- Do not use a Replicas public forge share for GitLab when the native project upload succeeds; native uploads preserve project access controls.
3266
+ Do not use a Replicas public link for GitLab when the native project upload succeeds; native uploads preserve project access controls.
3252
3267
 
3253
3268
  ## Recording defaults
3254
3269
 
@@ -3290,7 +3305,7 @@ replicas media upload chart-a.svg chart-b.svg --name "Latency chart" --name "Err
3290
3305
  - \`--kind <image|video|audio|html>\` \u2014 override auto-detection
3291
3306
  - \`--name <name>\`: required display name shown in the dashboard, one per file in order
3292
3307
  - \`--session-id <id>\` \u2014 associate the upload with a specific session
3293
- - \`--access organization|public\`: create an organization-only link, or a public bearer URL for non-HTML media
3308
+ - \`--access organization|public\`: for video, audio, and HTML, create an organization-only link or a public bearer URL (video and audio only). Images are always public
3294
3309
  - \`--share\`: alias for \`--access public\`; not supported for HTML
3295
3310
  `;
3296
3311
  var MEDIA_ABILITY = {
@@ -8028,6 +8043,7 @@ export {
8028
8043
  listOllamaModels,
8029
8044
  CREDENTIAL_METHOD,
8030
8045
  AGENT_CREDENTIAL_METHODS_IN_ORDER,
8046
+ describeCredential,
8031
8047
  agentCredentialSnapshotSchema,
8032
8048
  isAgentChatTurnActivityRecord,
8033
8049
  isAgentChatSkillActivityRecord,
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-NJY73FDM.js";
8
+ } from "./chunk-PZHMAH33.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-P57WPSR3.js";
7
- import "./chunk-7KUALGJK.js";
6
+ } from "./chunk-K7TEHLJA.js";
7
+ import "./chunk-PRJY4Y7V.js";
8
8
  import {
9
9
  isRecord
10
10
  } from "./chunk-UZSNFLDQ.js";
11
- import "./chunk-NJY73FDM.js";
11
+ import "./chunk-PZHMAH33.js";
12
12
  import "./chunk-VEQXQN22.js";
13
13
 
14
14
  // src/command-protection-hook.ts
@@ -8,12 +8,12 @@ import {
8
8
  import {
9
9
  AppServerProcess,
10
10
  buildCodexAgentEnv
11
- } from "./chunk-AIMXTL65.js";
11
+ } from "./chunk-EE6PRRN4.js";
12
12
  import {
13
13
  AGENT,
14
14
  getMemoryOutputSafetyViolation,
15
15
  headlessAgentRequestSchema
16
- } from "./chunk-NJY73FDM.js";
16
+ } from "./chunk-PZHMAH33.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
 
19
19
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  evaluateCommandProtection,
28
28
  extractToolCommand,
29
29
  reportCommandProtectionBlock
30
- } from "./chunk-P57WPSR3.js";
30
+ } from "./chunk-K7TEHLJA.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -52,7 +52,7 @@ import {
52
52
  } from "./chunk-FLDA7BX3.js";
53
53
  import {
54
54
  publishedPullRequestUrls
55
- } from "./chunk-NAPCNWTB.js";
55
+ } from "./chunk-ZQQZKUCT.js";
56
56
  import {
57
57
  RELAY_MCP_TOOLS,
58
58
  RELAY_MCP_TOOL_NAMES,
@@ -73,21 +73,21 @@ import {
73
73
  refreshDelayMs,
74
74
  restartCodexAspHost,
75
75
  routineRefreshExclusions
76
- } from "./chunk-SJSIX3BZ.js";
76
+ } from "./chunk-5CL42RWH.js";
77
77
  import {
78
78
  ENGINE_ENV,
79
79
  IS_WARMING_MODE,
80
80
  monolithRequest,
81
81
  monolithService,
82
82
  setAgentCredentialSnapshot
83
- } from "./chunk-7KUALGJK.js";
83
+ } from "./chunk-PRJY4Y7V.js";
84
84
  import {
85
85
  AspClient,
86
86
  SUBPROCESS_MAX_BUFFER,
87
87
  execAsync,
88
88
  execFileAsync,
89
89
  getCodexModelProvider
90
- } from "./chunk-AIMXTL65.js";
90
+ } from "./chunk-EE6PRRN4.js";
91
91
  import {
92
92
  isRecord as isRecord2
93
93
  } from "./chunk-UZSNFLDQ.js";
@@ -215,6 +215,7 @@ import {
215
215
  createUuidFromHex,
216
216
  decodePathSegments,
217
217
  defaultForkChatTitle,
218
+ describeCredential,
218
219
  describeQuotaLimit,
219
220
  detectAgentQuotaLimit,
220
221
  detectLanguageByPath,
@@ -312,7 +313,7 @@ import {
312
313
  workspaceCredentialProviderSchema,
313
314
  workspaceTokenRequestSchema,
314
315
  workspaceTokenResponseSchema
315
- } from "./chunk-NJY73FDM.js";
316
+ } from "./chunk-PZHMAH33.js";
316
317
  import {
317
318
  cloneMcpConfig,
318
319
  ensureCompatibilityImports,
@@ -9531,13 +9532,7 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
9531
9532
  newEnvVars: envVars,
9532
9533
  envs: [ENGINE_ENV, process.env]
9533
9534
  });
9534
- if (response.scope) {
9535
- setAgentCredentialSnapshot("claude", {
9536
- method: response.type,
9537
- scope: response.scope,
9538
- ...response.revision ? { revision: response.revision } : {}
9539
- });
9540
- }
9535
+ setAgentCredentialSnapshot("claude", response);
9541
9536
  }
9542
9537
  async writeOauthCredentialsFile(credentials) {
9543
9538
  const credentialsPath = path3.join(ENGINE_ENV.HOME_DIR, ".claude", ".credentials.json");
@@ -11568,13 +11563,7 @@ var MuseTokenManager = class extends BaseRefreshManager {
11568
11563
  }
11569
11564
  const data = await response.json();
11570
11565
  await writeSecureCredentialFile(MUSE_AUTH_PATH, serializeMuseAuthFile(data), { ensureParentDir: true });
11571
- if (data.scope) {
11572
- setAgentCredentialSnapshot("muse", {
11573
- method: data.type,
11574
- scope: data.scope,
11575
- ...data.revision ? { revision: data.revision } : {}
11576
- });
11577
- }
11566
+ setAgentCredentialSnapshot("muse", data);
11578
11567
  },
11579
11568
  isOauthNow: () => false
11580
11569
  });
@@ -11588,6 +11577,18 @@ var SWAPPABLE_AGENTS = {
11588
11577
  codex: codexTokenManager,
11589
11578
  muse: museTokenManager
11590
11579
  };
11580
+ var QUOTA_STOP_NEXT_STEP = {
11581
+ failed: "The next credential in the fallback chain could not be used. Check it in Settings \u2192 Fallbacks and try again.",
11582
+ not_configured: "Nothing further is configured in the fallback chain. Add a credential or harness in Settings \u2192 Fallbacks, or try again once the limit resets.",
11583
+ unavailable: "No other credential is available for this workspace. Check Settings \u2192 Fallbacks, or try again once the limit resets."
11584
+ };
11585
+ function describeQuotaExhaustion(provider, reason, credential, fallback) {
11586
+ const agent = getProviderDisplayName(provider);
11587
+ const account = credential ? describeCredential(provider, credential) : "the credential this workspace is using";
11588
+ const limit = reason === "out_of_credits" ? `${agent} ran out of credits on ${account}.` : `${agent} hit the usage limit on ${account}.`;
11589
+ const next = fallback.outcome === "fork" ? `Forking this chat to ${getProviderDisplayName(fallback.target.provider, "long")}.` : QUOTA_STOP_NEXT_STEP[fallback.outcome];
11590
+ return `${limit} ${next}`;
11591
+ }
11591
11592
  var AuthFallbackCoordinator = class {
11592
11593
  constructor(provider, record3, context) {
11593
11594
  this.provider = provider;
@@ -11649,8 +11650,10 @@ var AuthFallbackCoordinator = class {
11649
11650
  reason,
11650
11651
  exhaustedMethod: exhausted.method,
11651
11652
  exhaustedScope: exhausted.scope,
11653
+ ...exhausted.account ? { exhaustedAccount: exhausted.account } : {},
11652
11654
  candidateMethod: applied.method,
11653
11655
  candidateScope: applied.scope,
11656
+ ...applied.account ? { candidateAccount: applied.account } : {},
11654
11657
  status,
11655
11658
  detail
11656
11659
  };
@@ -13457,7 +13460,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13457
13460
  attempt++;
13458
13461
  continue;
13459
13462
  }
13460
- await this.emitQuotaExhaustedEvent(quotaKind, fallback, detail);
13463
+ await this.emitQuotaExhaustedEvent(quotaKind, fallback, detail, attemptedCredential);
13461
13464
  return;
13462
13465
  }
13463
13466
  if (_ClaudeManager.isAuthError(error)) {
@@ -13568,10 +13571,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13568
13571
  return "Claude authentication failed after multiple attempts. Check your Claude, Anthropic API key, or Bedrock credentials in Settings \u2192 Agents and try again.";
13569
13572
  }
13570
13573
  }
13571
- async emitQuotaExhaustedEvent(kind, fallback, detail) {
13572
- const limit = kind === "out_of_credits" ? "Claude ran out of credits on the credential this workspace is using." : "Claude hit the usage limit on the credential this workspace is using.";
13573
- const next = fallback.outcome === "fork" ? `Forking this chat to ${getProviderDisplayName(fallback.target.provider, "long")}.` : fallback.outcome === "failed" ? "The next credential in the fallback chain could not be used. Check it in Settings \u2192 Fallbacks and try again." : fallback.outcome === "not_configured" ? "Nothing further is configured in the fallback chain. Add a credential or harness in Settings \u2192 Fallbacks, or try again once the limit resets." : "No other credential is available for this workspace. Check Settings \u2192 Fallbacks, or try again once the limit resets.";
13574
- await this.emitTerminalErrorResult(detail, [`${limit} ${next}`]);
13574
+ async emitQuotaExhaustedEvent(kind, fallback, detail, credential) {
13575
+ await this.emitTerminalErrorResult(detail, [describeQuotaExhaustion("claude", kind, credential, fallback)]);
13575
13576
  this.emitQuotaExhausted({
13576
13577
  provider: "claude",
13577
13578
  reason: kind,
@@ -15355,14 +15356,18 @@ var CodexAspManager = class extends CodingAgentManager {
15355
15356
  if (!retryFailure) return;
15356
15357
  terminalError = retryFailure.error;
15357
15358
  } else {
15358
- const outOfCredits = await this.confirmOutOfCredits(await getCodexAspHost());
15359
+ const reason = await this.confirmOutOfCredits(await getCodexAspHost()) ? "out_of_credits" : detectAgentQuotaLimit(terminalError.message) ?? "rate_limit";
15359
15360
  this.emitQuotaExhausted({
15360
15361
  provider: "codex",
15361
- reason: outOfCredits ? "out_of_credits" : detectAgentQuotaLimit(terminalError.message) ?? "rate_limit",
15362
+ reason,
15362
15363
  detail: terminalError.message,
15363
15364
  ...fallback.outcome === "fork" ? { forkTo: fallback.target } : {}
15364
15365
  });
15365
- if (outOfCredits) return;
15366
+ this.onEvent(this.recordCodexHistoryEvent("codex-asp-error", {
15367
+ message: describeQuotaExhaustion("codex", reason, attemptedCredential, fallback)
15368
+ }));
15369
+ if (reason === "out_of_credits") return;
15370
+ throw terminalError;
15366
15371
  }
15367
15372
  }
15368
15373
  if (terminalError instanceof CodexAspAuthMethodChangedError) {
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-NAPCNWTB.js";
6
+ } from "./chunk-ZQQZKUCT.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-NJY73FDM.js";
12
+ } from "./chunk-PZHMAH33.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -11,7 +11,7 @@ import {
11
11
  relaySubagentResponseSchema,
12
12
  spawnRelaySubagentRequestSchema,
13
13
  waitRelaySubagentRequestSchema
14
- } from "./chunk-NJY73FDM.js";
14
+ } from "./chunk-PZHMAH33.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/relay-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.909",
3
+ "version": "0.1.910",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",