replicas-engine 0.1.1567 → 0.1.1569

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.
@@ -8,12 +8,12 @@ import {
8
8
  listCodexModelsForDetails,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-FJ4W42RK.js";
12
- import "./chunk-74EBBT75.js";
13
- import "./chunk-YSTJHVJC.js";
14
- import "./chunk-RZ3COCB2.js";
11
+ } from "./chunk-GXZYWFGM.js";
12
+ import "./chunk-53WPGYHP.js";
13
+ import "./chunk-4BS46JRE.js";
14
+ import "./chunk-Q6HPHSHB.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-TNFYQ7EM.js";
16
+ import "./chunk-BSQPKFWX.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-YSTJHVJC.js";
6
+ } from "./chunk-4BS46JRE.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -15,7 +15,7 @@ import {
15
15
  isRecord,
16
16
  readOllamaAuthEnv,
17
17
  readOpenAICompatibleAuthEnv
18
- } from "./chunk-TNFYQ7EM.js";
18
+ } from "./chunk-BSQPKFWX.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-RZ3COCB2.js";
6
+ } from "./chunk-Q6HPHSHB.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-TNFYQ7EM.js";
9
+ } from "./chunk-BSQPKFWX.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1567";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1569";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-RZ3COCB2.js";
7
+ } from "./chunk-Q6HPHSHB.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -21,7 +21,7 @@ import {
21
21
  provisionedDeviceSchema,
22
22
  readReplicasRuntimeEnv,
23
23
  serializePosixEnvFile
24
- } from "./chunk-TNFYQ7EM.js";
24
+ } from "./chunk-BSQPKFWX.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -20156,7 +20156,7 @@ var VOICE_WAVEFORM = {
20156
20156
  };
20157
20157
 
20158
20158
  // ../shared/src/e2b.ts
20159
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-14-v22";
20159
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-14-v24";
20160
20160
 
20161
20161
  // ../shared/src/e2b-retry.ts
20162
20162
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-TNFYQ7EM.js";
8
+ } from "./chunk-BSQPKFWX.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -8,18 +8,19 @@ import {
8
8
  getOriginDefaultBranch,
9
9
  monolithRequest,
10
10
  readRepoHeadBranches,
11
+ readRuntimeEnvFile,
11
12
  resolveDiffBase,
12
13
  runGitCommand,
13
14
  setAgentCredentialSnapshot
14
- } from "./chunk-74EBBT75.js";
15
+ } from "./chunk-53WPGYHP.js";
15
16
  import {
16
17
  AppServerProcess,
17
18
  buildCodexAgentEnv
18
- } from "./chunk-YSTJHVJC.js";
19
+ } from "./chunk-4BS46JRE.js";
19
20
  import {
20
21
  SUBPROCESS_MAX_BUFFER,
21
22
  execFileAsync
22
- } from "./chunk-RZ3COCB2.js";
23
+ } from "./chunk-Q6HPHSHB.js";
23
24
  import {
24
25
  isRecord
25
26
  } from "./chunk-UZSNFLDQ.js";
@@ -57,7 +58,7 @@ import {
57
58
  resolveOpenAICompatibleModelsUrl,
58
59
  splitMothershipInstructions,
59
60
  withTimeout
60
- } from "./chunk-TNFYQ7EM.js";
61
+ } from "./chunk-BSQPKFWX.js";
61
62
 
62
63
  // src/managers/codex-token-manager.ts
63
64
  import { promises as fs } from "fs";
@@ -299,6 +300,139 @@ var BaseRefreshManager = class {
299
300
  }
300
301
  };
301
302
 
303
+ // src/utils/transcript-secrets.ts
304
+ var BACKSLASH = 92;
305
+ var FILLER = 42;
306
+ var SECRET_NAME = /KEY|TOKEN|SECRET|PASSWORD|PASSWD|PASSCODE|CREDENTIAL|PRIVATE|DSN|TOTP|COOKIE/i;
307
+ var PASSWORD_NAME = /SECRET|PASSWORD|PASSWD|PASSCODE/i;
308
+ var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
309
+ var WHOLE_WORD_BELOW = 16;
310
+ var KEPT_REPLACEMENTS = 8;
311
+ var REPLACED_KEPT_MS = 24 * 60 * 60 * 1e3;
312
+ var currentBySource = /* @__PURE__ */ new Map();
313
+ var replacedBySource = /* @__PURE__ */ new Map();
314
+ var found = /* @__PURE__ */ new Set();
315
+ var variablesVersion = 0;
316
+ function remember(source, values) {
317
+ const previous = currentBySource.get(source) ?? [];
318
+ if (previous.join("\n") === values.join("\n")) return;
319
+ if (!source.startsWith("credential:")) variablesVersion++;
320
+ currentBySource.set(source, values);
321
+ if (previous.length > 0) replacedBySource.set(source, [{ values: previous, at: Date.now() }, ...replacedBySource.get(source) ?? []]);
322
+ }
323
+ function looksLikeCredential(value) {
324
+ return value.length >= 16 && /[A-Za-z]/.test(value) && /\d/.test(value) && (/[A-Z_]/.test(value) || value.length >= 32) && !value.startsWith("/") && !value.includes("://") && !UUID.test(value) && !/^[0-9a-f]{40}$/.test(value) && !/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(value);
325
+ }
326
+ function isNamedSecret(value, password = false) {
327
+ return value.length >= 8 && !/^(true|false|yes|no|on|off|\d+)$/i.test(value) && !value.startsWith("/") && (/[^A-Za-z]/.test(value) || value.length >= (password ? 12 : 16));
328
+ }
329
+ function credentialTokens(text) {
330
+ return text.split(/[^A-Za-z0-9._~+/=-]+/).filter(looksLikeCredential);
331
+ }
332
+ function urlCredentials(value) {
333
+ if (!/^[a-z][a-z0-9+.-]*:\/\/\S+$/i.test(value)) return null;
334
+ try {
335
+ const url = new URL(value);
336
+ const query = [...url.searchParams].flatMap(([name, part]) => SECRET_NAME.test(name) && isNamedSecret(part) ? [part, encodeURIComponent(part)] : []);
337
+ if (url.password) return [...query, ...[url.password, decodeURIComponent(url.password)].filter((part) => isNamedSecret(part, true))];
338
+ return [...query, ...[url.username, decodeURIComponent(url.username)].filter(looksLikeCredential)];
339
+ } catch {
340
+ return null;
341
+ }
342
+ }
343
+ function variableSecrets(key, value) {
344
+ if (!value) return [];
345
+ const fromUrl = urlCredentials(value);
346
+ if (fromUrl) return fromUrl;
347
+ if (SECRET_NAME.test(key)) return value.includes("\n") ? credentialTokens(value) : isNamedSecret(value, PASSWORD_NAME.test(key)) ? [value] : [];
348
+ return !key.startsWith("REPLICAS_") && !/\s/.test(value) && looksLikeCredential(value) ? [value] : [];
349
+ }
350
+ function rememberCredentials(source, text) {
351
+ remember(`credential:${source}`, credentialTokens(text));
352
+ }
353
+ function rememberSecret(source, value) {
354
+ remember(`credential:${source}`, value.length >= 8 ? [value] : []);
355
+ }
356
+ function transcriptSecrets() {
357
+ for (const [key, value] of Object.entries(process.env)) remember(`env:${key}`, variableSecrets(key, value));
358
+ for (const [key, value] of Object.entries(readRuntimeEnvFile()?.values ?? {})) remember(`runtime:${key}`, variableSecrets(key, value));
359
+ for (const [source, replaced2] of replacedBySource) {
360
+ replacedBySource.set(source, replaced2.filter(({ at }, index) => index < KEPT_REPLACEMENTS || Date.now() - at <= REPLACED_KEPT_MS));
361
+ }
362
+ const replaced = [...replacedBySource.values()].flatMap((entries) => entries.flatMap(({ values }) => values));
363
+ return { secrets: [.../* @__PURE__ */ new Set([...[...currentBySource.values()].flat(), ...replaced, ...found])], variablesVersion };
364
+ }
365
+ function needlesFor(secrets) {
366
+ const escape = (value) => JSON.stringify(value).slice(1, -1);
367
+ const bySecretForm = new Map(secrets.flatMap((secret) => [[escape(secret), secret], [escape(escape(secret)), secret]]));
368
+ return [...bySecretForm].map(([form, secret]) => ({ needle: Buffer.from(form), secret })).sort((a, b) => b.needle.length - a.needle.length);
369
+ }
370
+ function wordAt(buffer, at) {
371
+ return buffer[at] | buffer[at + 1] << 8 | buffer[at + 2] << 16 | buffer[at + 3] << 24;
372
+ }
373
+ function prefixSlot(prefix) {
374
+ return Math.imul(prefix, 2654435761) >>> 16;
375
+ }
376
+ function isWordByte(byte) {
377
+ return byte !== void 0 && (byte >= 48 && byte <= 57 || (byte | 32) >= 97 && (byte | 32) <= 122);
378
+ }
379
+ async function* scrubSecrets(chunks, secrets) {
380
+ const needles = needlesFor(secrets);
381
+ if (needles.length === 0) {
382
+ yield* chunks;
383
+ return;
384
+ }
385
+ let tail = Buffer.alloc(0);
386
+ let carriedBackslashes = 0;
387
+ const byteAt = (buffer, index) => index >= 0 ? buffer[index] : tail[tail.length + index];
388
+ const backslashesBefore = (buffer, position) => {
389
+ let start = position;
390
+ while (start > 0 && buffer[start - 1] === BACKSLASH) start--;
391
+ return position - start + (start === 0 ? carriedBackslashes : 0);
392
+ };
393
+ const standsAlone = (buffer, at, needle) => {
394
+ if (backslashesBefore(buffer, at) % 2 === 1) return false;
395
+ if (needle.length >= WHOLE_WORD_BELOW) return true;
396
+ const joinsWordBefore = isWordByte(byteAt(buffer, at - 1)) && byteAt(buffer, at - 2) !== BACKSLASH;
397
+ return !joinsWordBefore && !isWordByte(buffer[at + needle.length]);
398
+ };
399
+ const byPrefix = /* @__PURE__ */ new Map();
400
+ const prefixes = new Uint8Array(1 << 16);
401
+ for (const entry of needles) {
402
+ const prefix = wordAt(entry.needle, 0);
403
+ byPrefix.set(prefix, [...byPrefix.get(prefix) ?? [], entry]);
404
+ prefixes[prefixSlot(prefix)] = 1;
405
+ }
406
+ const scrub = (buffer, end) => {
407
+ const parts = [];
408
+ let at = 0;
409
+ for (let index = 0; index < end && index + 4 <= buffer.length; index++) {
410
+ const prefix = wordAt(buffer, index);
411
+ if (prefixes[prefixSlot(prefix)] === 0) continue;
412
+ const match = byPrefix.get(prefix)?.find(({ needle }) => index + needle.length <= buffer.length && buffer.compare(needle, 0, needle.length, index, index + needle.length) === 0 && standsAlone(buffer, index, needle));
413
+ if (!match) continue;
414
+ found.add(match.secret);
415
+ parts.push(buffer.subarray(at, index), Buffer.alloc(match.needle.length, FILLER));
416
+ at = index + match.needle.length;
417
+ index = at - 1;
418
+ }
419
+ const stop = Math.max(at, end);
420
+ parts.push(buffer.subarray(at, stop));
421
+ carriedBackslashes = backslashesBefore(buffer, stop);
422
+ tail = stop >= 2 ? Buffer.from(buffer.subarray(stop - 2, stop)) : Buffer.concat([tail, buffer.subarray(0, stop)]).subarray(-2);
423
+ return { scrubbed: Buffer.concat(parts), rest: buffer.subarray(stop) };
424
+ };
425
+ let rest = Buffer.alloc(0);
426
+ for await (const chunk of chunks) {
427
+ const buffer = rest.length > 0 ? Buffer.concat([rest, chunk]) : chunk;
428
+ const result = scrub(buffer, buffer.length - needles[0].needle.length);
429
+ rest = result.rest;
430
+ if (result.scrubbed.length > 0) yield result.scrubbed;
431
+ }
432
+ const last = scrub(rest, rest.length);
433
+ if (last.scrubbed.length > 0) yield last.scrubbed;
434
+ }
435
+
302
436
  // src/managers/codex-token-manager.ts
303
437
  var CodexAspAuthMethodChangedError = class extends Error {
304
438
  name = "CodexAspAuthMethodChangedError";
@@ -320,7 +454,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
320
454
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
321
455
  await this.applyCredentialsResponse(data);
322
456
  setAgentCredentialSnapshot("codex", data);
323
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-KATBKCJV.js");
457
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-CLZIVMP3.js");
324
458
  await restartCodexAspHostIfRunning2();
325
459
  });
326
460
  await this.start(true);
@@ -342,7 +476,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
342
476
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
343
477
  await this.applyCredentialsResponse(data);
344
478
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
345
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-KATBKCJV.js");
479
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-CLZIVMP3.js");
346
480
  await restartCodexAspHostIfRunning2();
347
481
  }
348
482
  setAgentCredentialSnapshot("codex", data);
@@ -433,6 +567,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
433
567
  }
434
568
  buildAspOauthLogin(response) {
435
569
  const credential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex;
570
+ rememberSecret("codex", response.accessToken);
436
571
  return {
437
572
  tokens: {
438
573
  accessToken: response.accessToken,
@@ -519,6 +654,7 @@ async function writeSecureCredentialFile(filePath, content, options) {
519
654
  if (options?.ensureParentDir) {
520
655
  await mkdir(dirname(filePath), { recursive: true, mode: 448 });
521
656
  }
657
+ rememberCredentials(filePath, content);
522
658
  await atomicWriteFile(filePath, content, { mode: 384 });
523
659
  }
524
660
  async function configureManagedGitCredentialHelper(homeDir) {
@@ -2116,6 +2252,9 @@ export {
2116
2252
  refreshDelayMs,
2117
2253
  BaseRefreshManager,
2118
2254
  AsyncLock,
2255
+ rememberSecret,
2256
+ transcriptSecrets,
2257
+ scrubSecrets,
2119
2258
  atomicWriteFile,
2120
2259
  writeSecureCredentialFile,
2121
2260
  configureManagedGitCredentialHelper,
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-TNFYQ7EM.js";
6
+ } from "./chunk-BSQPKFWX.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -6,7 +6,7 @@ import {
6
6
  getOriginDefaultBranch,
7
7
  monolithRequest,
8
8
  runGitCommand
9
- } from "./chunk-74EBBT75.js";
9
+ } from "./chunk-53WPGYHP.js";
10
10
  import {
11
11
  extractCommandProtectionCommandText,
12
12
  findCommandProtectionGitLookups,
@@ -15,7 +15,7 @@ import {
15
15
  findScoutRepoWriteSignals,
16
16
  parseCommandProtectionRequest,
17
17
  withE2BRetry
18
- } from "./chunk-TNFYQ7EM.js";
18
+ } from "./chunk-BSQPKFWX.js";
19
19
 
20
20
  // src/services/command-protection-service.ts
21
21
  import { readFile, stat } from "fs/promises";
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-MOCSFEKX.js";
7
- import "./chunk-74EBBT75.js";
8
- import "./chunk-RZ3COCB2.js";
6
+ } from "./chunk-YLPKKLUA.js";
7
+ import "./chunk-53WPGYHP.js";
8
+ import "./chunk-Q6HPHSHB.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-TNFYQ7EM.js";
12
+ import "./chunk-BSQPKFWX.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -14,12 +14,12 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-4LDNAMIY.js";
17
+ } from "./chunk-2KLOIH2V.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-YSTJHVJC.js";
22
- import "./chunk-RZ3COCB2.js";
21
+ } from "./chunk-4BS46JRE.js";
22
+ import "./chunk-Q6HPHSHB.js";
23
23
  import {
24
24
  AGENT,
25
25
  OPENCODE_GO_PROVIDER,
@@ -29,7 +29,7 @@ import {
29
29
  headlessAgentUsagePath,
30
30
  isRecord,
31
31
  withTimeout
32
- } from "./chunk-TNFYQ7EM.js";
32
+ } from "./chunk-BSQPKFWX.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // 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-MOCSFEKX.js";
30
+ } from "./chunk-YLPKKLUA.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -65,10 +65,10 @@ import {
65
65
  spawnMuseMsp,
66
66
  startMuseSession,
67
67
  uuidV7
68
- } from "./chunk-4LDNAMIY.js";
68
+ } from "./chunk-2KLOIH2V.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
- } from "./chunk-ZK3F4Q56.js";
71
+ } from "./chunk-D3QWARLZ.js";
72
72
  import {
73
73
  ACCOUNT_RATE_LIMITS_READ_METHOD,
74
74
  AsyncLock,
@@ -132,18 +132,21 @@ import {
132
132
  recordExhaustedCredential,
133
133
  recordFallbackModel,
134
134
  refreshDelayMs,
135
+ rememberSecret,
135
136
  removeCredentialFileLines,
136
137
  removeTempImageFiles,
137
138
  restartCodexAspHost,
138
139
  routineRefreshRequest,
139
140
  saveRepoState,
141
+ scrubSecrets,
140
142
  subagentMcpProcessConfig,
141
143
  threadToAspTranscript,
142
144
  timestampFromMilliseconds,
143
145
  timestampFromSeconds,
146
+ transcriptSecrets,
144
147
  upsertCredentialFileLines,
145
148
  writeSecureCredentialFile
146
- } from "./chunk-FJ4W42RK.js";
149
+ } from "./chunk-GXZYWFGM.js";
147
150
  import {
148
151
  ENGINE_ENV,
149
152
  UNQUOTED_PATHS_CONFIG,
@@ -154,15 +157,15 @@ import {
154
157
  resolveDiffBase,
155
158
  setAgentCredentialSnapshot,
156
159
  setLinearSessionId
157
- } from "./chunk-74EBBT75.js";
160
+ } from "./chunk-53WPGYHP.js";
158
161
  import {
159
162
  getCodexModelProvider
160
- } from "./chunk-YSTJHVJC.js";
163
+ } from "./chunk-4BS46JRE.js";
161
164
  import {
162
165
  SUBPROCESS_MAX_BUFFER,
163
166
  execAsync,
164
167
  execFileAsync
165
- } from "./chunk-RZ3COCB2.js";
168
+ } from "./chunk-Q6HPHSHB.js";
166
169
  import {
167
170
  isRecord as isRecord2
168
171
  } from "./chunk-UZSNFLDQ.js";
@@ -443,7 +446,7 @@ import {
443
446
  workspaceTokenRequestSchema,
444
447
  workspaceTokenResponseSchema,
445
448
  wrapInTag
446
- } from "./chunk-TNFYQ7EM.js";
449
+ } from "./chunk-BSQPKFWX.js";
447
450
  import {
448
451
  cloneMcpConfig,
449
452
  ensureCompatibilityImports,
@@ -9503,6 +9506,7 @@ var WorkspaceIdentityTokens = class {
9503
9506
  return createErrorResult({ message: "AWS source identity is unavailable from this Replicas version", code: 503 });
9504
9507
  }
9505
9508
  }
9509
+ rememberSecret(`identity:${audience}:${awsSourceIdentity}`, token.token);
9506
9510
  return createSuccessResult({ token, refreshAt: Date.parse(token.expires_at) - MIN_REMAINING_MS });
9507
9511
  }
9508
9512
  };
@@ -9683,6 +9687,7 @@ var McpOAuthTokens = class {
9683
9687
  const message = isRecord(data) && typeof data.error === "string" ? data.error : `MCP OAuth token request failed: ${response.status}`;
9684
9688
  return createErrorResult({ message, code: response.ok ? 502 : response.status });
9685
9689
  }
9690
+ rememberSecret(`mcp:${environmentMcpId}`, parsed.data.access_token);
9686
9691
  const remaining = parsed.data.expires_at ? Date.parse(parsed.data.expires_at) - Date.now() : Infinity;
9687
9692
  return createSuccessResult({
9688
9693
  token: parsed.data,
@@ -61035,14 +61040,16 @@ async function uploadOpenedTranscript(chatId, opened, historyVersion, chat, capt
61035
61040
  };
61036
61041
  const settled = Date.now() - mtimeMs > 1e3;
61037
61042
  const target = `${chatId}:${capture ? "capture" : "canonical"}`;
61038
- const fingerprint = JSON.stringify({ size, mtimeMs, metadata });
61043
+ const { secrets, variablesVersion } = transcriptSecrets();
61044
+ const fingerprint = JSON.stringify({ size, mtimeMs, metadata, variablesVersion });
61039
61045
  const last = lastUploadByTarget.get(target);
61040
61046
  if (last?.fingerprint === fingerprint) {
61041
61047
  return capture ? { ...last.artifact, metadata: { ...last.artifact.metadata, captureId: capture.captureId } } : null;
61042
61048
  }
61049
+ const scrubbedBytes = () => scrubSecrets(logBytes(opened), secrets);
61043
61050
  if (capture) {
61044
61051
  const hash = createHash8("sha256");
61045
- for await (const chunk of logBytes(opened)) hash.update(chunk);
61052
+ for await (const chunk of scrubbedBytes()) hash.update(chunk);
61046
61053
  metadata.captureId = capture.captureId;
61047
61054
  metadata.captureReason = capture.reason;
61048
61055
  metadata.sha256 = hash.digest("hex");
@@ -61059,7 +61066,7 @@ async function uploadOpenedTranscript(chatId, opened, historyVersion, chat, capt
61059
61066
  throw new Error("prepare failed: invalid response");
61060
61067
  }
61061
61068
  if (prepareBody.uploadUrl === null) return null;
61062
- await putPresignedFile(prepareBody.uploadUrl, Readable.from(logBytes(opened)), size, "application/x-ndjson");
61069
+ await putPresignedFile(prepareBody.uploadUrl, Readable.from(scrubbedBytes()), size, "application/x-ndjson");
61063
61070
  const finalizeResponse = await monolithRequest("/v1/engine/chat-transcripts/finalize", {
61064
61071
  body: uploadRequest
61065
61072
  });
@@ -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-ZK3F4Q56.js";
6
+ } from "./chunk-D3QWARLZ.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-TNFYQ7EM.js";
12
+ } from "./chunk-BSQPKFWX.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
  spawnSubagentRequestSchema,
12
12
  subagentResponseSchema,
13
13
  waitSubagentRequestSchema
14
- } from "./chunk-TNFYQ7EM.js";
14
+ } from "./chunk-BSQPKFWX.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1567",
3
+ "version": "0.1.1569",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",