replicas-cli 0.3.410 → 0.3.413

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.
Files changed (2) hide show
  1. package/dist/index.cjs +396 -5
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -24772,7 +24772,7 @@ ssh mac 'xcodebuild -version; xcrun simctl list runtimes; xcrun simctl list devi
24772
24772
  ## When it fails
24773
24773
 
24774
24774
  - \`ssh\` closes straight away, such as "Connection closed by UNKNOWN port 65535": through the desktop app, the app isn't running there or the user turned this workspace's access off: run \`replicas local-control request\` to ask the user in the chat. Over the tailnet it can also mean this workspace hasn't joined it (\`tailscale status\`): use a desktop app host for that computer if there is one before asking the user to fix the tailnet.
24775
- - "Operation not permitted" on the user's files: macOS is blocking the app. Ask the user to allow Replicas under System Settings \u2192 Privacy & Security \u2192 Full Disk Access.
24775
+ - "Operation not permitted" or "authorization denied" on the user's files: macOS is blocking the app. Through the desktop app, a line saying so means the user has already been asked to turn on Full Disk Access: tell them why, and that it works once they restart Replicas. Otherwise ask them to allow it under System Settings \u2192 Privacy & Security \u2192 Full Disk Access.
24776
24776
  `;
24777
24777
  LOCAL_COMPUTER_ABILITY = {
24778
24778
  label: "User's computer",
@@ -34820,7 +34820,7 @@ var init_mothership_board = __esm({
34820
34820
  text3 = (max) => external_exports.string().trim().min(1).max(max, tooLong(max));
34821
34821
  clearable = (schema) => external_exports.union([schema, external_exports.literal("")]).optional();
34822
34822
  httpsUrl = external_exports.url({ protocol: /^https$/, error: "Must be an https URL" });
34823
- inlineMarkdown = "Markdown: **bold**, *italics*, `code`, [links](https://...)";
34823
+ inlineMarkdown = "Markdown: **bold**, *italics*, `code`, [links](https://... or an absolute file path)";
34824
34824
  markdown = `${inlineMarkdown} and line breaks.`;
34825
34825
  linearIdentifier = external_exports.string().regex(/^[A-Za-z][A-Za-z0-9]{0,9}-\d{1,7}$/, "Use a Linear identifier such as REP-123");
34826
34826
  mediaSchema = external_exports.object({
@@ -35101,6 +35101,386 @@ var init_user_message_attachments = __esm({
35101
35101
  }
35102
35102
  });
35103
35103
 
35104
+ // ../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js
35105
+ function isBytes(a) {
35106
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
35107
+ }
35108
+ function abytes(value, length, title2 = "") {
35109
+ const bytes = isBytes(value);
35110
+ const len = value?.length;
35111
+ const needsLen = length !== void 0;
35112
+ if (!bytes || needsLen && len !== length) {
35113
+ const prefix = title2 && `"${title2}" `;
35114
+ const ofLen = needsLen ? ` of length ${length}` : "";
35115
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
35116
+ const message2 = prefix + "expected Uint8Array" + ofLen + ", got " + got;
35117
+ if (!bytes)
35118
+ throw new TypeError(message2);
35119
+ throw new RangeError(message2);
35120
+ }
35121
+ return value;
35122
+ }
35123
+ function aexists(instance, checkFinished = true) {
35124
+ if (instance.destroyed)
35125
+ throw new Error("Hash instance has been destroyed");
35126
+ if (checkFinished && instance.finished)
35127
+ throw new Error("Hash#digest() has already been called");
35128
+ }
35129
+ function aoutput(out, instance) {
35130
+ abytes(out, void 0, "digestInto() output");
35131
+ const min = instance.outputLen;
35132
+ if (out.length < min) {
35133
+ throw new RangeError('"digestInto() output" expected to be of length >=' + min);
35134
+ }
35135
+ }
35136
+ function clean(...arrays) {
35137
+ for (let i = 0; i < arrays.length; i++) {
35138
+ arrays[i].fill(0);
35139
+ }
35140
+ }
35141
+ function createView(arr) {
35142
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
35143
+ }
35144
+ function rotr(word, shift) {
35145
+ return word << 32 - shift | word >>> shift;
35146
+ }
35147
+ function bytesToHex(bytes) {
35148
+ abytes(bytes);
35149
+ if (hasHexBuiltin)
35150
+ return bytes.toHex();
35151
+ let hex3 = "";
35152
+ for (let i = 0; i < bytes.length; i++) {
35153
+ hex3 += hexes[bytes[i]];
35154
+ }
35155
+ return hex3;
35156
+ }
35157
+ function createHasher(hashCons, info = {}) {
35158
+ const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
35159
+ const tmp = hashCons(void 0);
35160
+ hashC.outputLen = tmp.outputLen;
35161
+ hashC.blockLen = tmp.blockLen;
35162
+ hashC.canXOF = tmp.canXOF;
35163
+ hashC.create = (opts) => hashCons(opts);
35164
+ Object.assign(hashC, info);
35165
+ return Object.freeze(hashC);
35166
+ }
35167
+ var hasHexBuiltin, hexes, oidNist;
35168
+ var init_utils2 = __esm({
35169
+ "../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js"() {
35170
+ "use strict";
35171
+ hasHexBuiltin = /* @__PURE__ */ (() => (
35172
+ // @ts-ignore
35173
+ typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
35174
+ ))();
35175
+ hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
35176
+ oidNist = (suffix) => ({
35177
+ // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet.
35178
+ // Larger suffix values would need base-128 OID encoding and a different length byte.
35179
+ oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
35180
+ });
35181
+ }
35182
+ });
35183
+
35184
+ // ../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/_md.js
35185
+ function Chi(a, b, c) {
35186
+ return a & b ^ ~a & c;
35187
+ }
35188
+ function Maj(a, b, c) {
35189
+ return a & b ^ a & c ^ b & c;
35190
+ }
35191
+ var HashMD, SHA256_IV;
35192
+ var init_md = __esm({
35193
+ "../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/_md.js"() {
35194
+ "use strict";
35195
+ init_utils2();
35196
+ HashMD = class {
35197
+ constructor(blockLen, outputLen, padOffset, isLE) {
35198
+ __publicField(this, "blockLen");
35199
+ __publicField(this, "outputLen");
35200
+ __publicField(this, "canXOF", false);
35201
+ __publicField(this, "padOffset");
35202
+ __publicField(this, "isLE");
35203
+ // For partial updates less than block size
35204
+ __publicField(this, "buffer");
35205
+ __publicField(this, "view");
35206
+ __publicField(this, "finished", false);
35207
+ __publicField(this, "length", 0);
35208
+ __publicField(this, "pos", 0);
35209
+ __publicField(this, "destroyed", false);
35210
+ this.blockLen = blockLen;
35211
+ this.outputLen = outputLen;
35212
+ this.padOffset = padOffset;
35213
+ this.isLE = isLE;
35214
+ this.buffer = new Uint8Array(blockLen);
35215
+ this.view = createView(this.buffer);
35216
+ }
35217
+ update(data) {
35218
+ aexists(this);
35219
+ abytes(data);
35220
+ const { view, buffer, blockLen } = this;
35221
+ const len = data.length;
35222
+ for (let pos = 0; pos < len; ) {
35223
+ const take = Math.min(blockLen - this.pos, len - pos);
35224
+ if (take === blockLen) {
35225
+ const dataView = createView(data);
35226
+ for (; blockLen <= len - pos; pos += blockLen)
35227
+ this.process(dataView, pos);
35228
+ continue;
35229
+ }
35230
+ buffer.set(data.subarray(pos, pos + take), this.pos);
35231
+ this.pos += take;
35232
+ pos += take;
35233
+ if (this.pos === blockLen) {
35234
+ this.process(view, 0);
35235
+ this.pos = 0;
35236
+ }
35237
+ }
35238
+ this.length += data.length;
35239
+ this.roundClean();
35240
+ return this;
35241
+ }
35242
+ digestInto(out) {
35243
+ aexists(this);
35244
+ aoutput(out, this);
35245
+ this.finished = true;
35246
+ const { buffer, view, blockLen, isLE } = this;
35247
+ let { pos } = this;
35248
+ buffer[pos++] = 128;
35249
+ clean(this.buffer.subarray(pos));
35250
+ if (this.padOffset > blockLen - pos) {
35251
+ this.process(view, 0);
35252
+ pos = 0;
35253
+ }
35254
+ for (let i = pos; i < blockLen; i++)
35255
+ buffer[i] = 0;
35256
+ view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
35257
+ this.process(view, 0);
35258
+ const oview = createView(out);
35259
+ const len = this.outputLen;
35260
+ if (len % 4)
35261
+ throw new Error("_sha2: outputLen must be aligned to 32bit");
35262
+ const outLen = len / 4;
35263
+ const state = this.get();
35264
+ if (outLen > state.length)
35265
+ throw new Error("_sha2: outputLen bigger than state");
35266
+ for (let i = 0; i < outLen; i++)
35267
+ oview.setUint32(4 * i, state[i], isLE);
35268
+ }
35269
+ digest() {
35270
+ const { buffer, outputLen } = this;
35271
+ this.digestInto(buffer);
35272
+ const res = buffer.slice(0, outputLen);
35273
+ this.destroy();
35274
+ return res;
35275
+ }
35276
+ _cloneInto(to) {
35277
+ to || (to = new this.constructor());
35278
+ to.set(...this.get());
35279
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
35280
+ to.destroyed = destroyed;
35281
+ to.finished = finished;
35282
+ to.length = length;
35283
+ to.pos = pos;
35284
+ if (length % blockLen)
35285
+ to.buffer.set(buffer);
35286
+ return to;
35287
+ }
35288
+ clone() {
35289
+ return this._cloneInto();
35290
+ }
35291
+ };
35292
+ SHA256_IV = /* @__PURE__ */ Uint32Array.from([
35293
+ 1779033703,
35294
+ 3144134277,
35295
+ 1013904242,
35296
+ 2773480762,
35297
+ 1359893119,
35298
+ 2600822924,
35299
+ 528734635,
35300
+ 1541459225
35301
+ ]);
35302
+ }
35303
+ });
35304
+
35305
+ // ../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha2.js
35306
+ var SHA256_K, SHA256_W, SHA2_32B, _SHA256, sha256;
35307
+ var init_sha2 = __esm({
35308
+ "../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha2.js"() {
35309
+ "use strict";
35310
+ init_md();
35311
+ init_utils2();
35312
+ SHA256_K = /* @__PURE__ */ Uint32Array.from([
35313
+ 1116352408,
35314
+ 1899447441,
35315
+ 3049323471,
35316
+ 3921009573,
35317
+ 961987163,
35318
+ 1508970993,
35319
+ 2453635748,
35320
+ 2870763221,
35321
+ 3624381080,
35322
+ 310598401,
35323
+ 607225278,
35324
+ 1426881987,
35325
+ 1925078388,
35326
+ 2162078206,
35327
+ 2614888103,
35328
+ 3248222580,
35329
+ 3835390401,
35330
+ 4022224774,
35331
+ 264347078,
35332
+ 604807628,
35333
+ 770255983,
35334
+ 1249150122,
35335
+ 1555081692,
35336
+ 1996064986,
35337
+ 2554220882,
35338
+ 2821834349,
35339
+ 2952996808,
35340
+ 3210313671,
35341
+ 3336571891,
35342
+ 3584528711,
35343
+ 113926993,
35344
+ 338241895,
35345
+ 666307205,
35346
+ 773529912,
35347
+ 1294757372,
35348
+ 1396182291,
35349
+ 1695183700,
35350
+ 1986661051,
35351
+ 2177026350,
35352
+ 2456956037,
35353
+ 2730485921,
35354
+ 2820302411,
35355
+ 3259730800,
35356
+ 3345764771,
35357
+ 3516065817,
35358
+ 3600352804,
35359
+ 4094571909,
35360
+ 275423344,
35361
+ 430227734,
35362
+ 506948616,
35363
+ 659060556,
35364
+ 883997877,
35365
+ 958139571,
35366
+ 1322822218,
35367
+ 1537002063,
35368
+ 1747873779,
35369
+ 1955562222,
35370
+ 2024104815,
35371
+ 2227730452,
35372
+ 2361852424,
35373
+ 2428436474,
35374
+ 2756734187,
35375
+ 3204031479,
35376
+ 3329325298
35377
+ ]);
35378
+ SHA256_W = /* @__PURE__ */ new Uint32Array(64);
35379
+ SHA2_32B = class extends HashMD {
35380
+ constructor(outputLen) {
35381
+ super(64, outputLen, 8, false);
35382
+ }
35383
+ get() {
35384
+ const { A, B, C, D, E, F, G, H } = this;
35385
+ return [A, B, C, D, E, F, G, H];
35386
+ }
35387
+ // prettier-ignore
35388
+ set(A, B, C, D, E, F, G, H) {
35389
+ this.A = A | 0;
35390
+ this.B = B | 0;
35391
+ this.C = C | 0;
35392
+ this.D = D | 0;
35393
+ this.E = E | 0;
35394
+ this.F = F | 0;
35395
+ this.G = G | 0;
35396
+ this.H = H | 0;
35397
+ }
35398
+ process(view, offset) {
35399
+ for (let i = 0; i < 16; i++, offset += 4)
35400
+ SHA256_W[i] = view.getUint32(offset, false);
35401
+ for (let i = 16; i < 64; i++) {
35402
+ const W15 = SHA256_W[i - 15];
35403
+ const W2 = SHA256_W[i - 2];
35404
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
35405
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
35406
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
35407
+ }
35408
+ let { A, B, C, D, E, F, G, H } = this;
35409
+ for (let i = 0; i < 64; i++) {
35410
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
35411
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
35412
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
35413
+ const T2 = sigma0 + Maj(A, B, C) | 0;
35414
+ H = G;
35415
+ G = F;
35416
+ F = E;
35417
+ E = D + T1 | 0;
35418
+ D = C;
35419
+ C = B;
35420
+ B = A;
35421
+ A = T1 + T2 | 0;
35422
+ }
35423
+ A = A + this.A | 0;
35424
+ B = B + this.B | 0;
35425
+ C = C + this.C | 0;
35426
+ D = D + this.D | 0;
35427
+ E = E + this.E | 0;
35428
+ F = F + this.F | 0;
35429
+ G = G + this.G | 0;
35430
+ H = H + this.H | 0;
35431
+ this.set(A, B, C, D, E, F, G, H);
35432
+ }
35433
+ roundClean() {
35434
+ clean(SHA256_W);
35435
+ }
35436
+ destroy() {
35437
+ this.destroyed = true;
35438
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
35439
+ clean(this.buffer);
35440
+ }
35441
+ };
35442
+ _SHA256 = class extends SHA2_32B {
35443
+ constructor() {
35444
+ super(32);
35445
+ // We cannot use array here since array allows indexing by variable
35446
+ // which means optimizer/compiler cannot use registers.
35447
+ __publicField(this, "A", SHA256_IV[0] | 0);
35448
+ __publicField(this, "B", SHA256_IV[1] | 0);
35449
+ __publicField(this, "C", SHA256_IV[2] | 0);
35450
+ __publicField(this, "D", SHA256_IV[3] | 0);
35451
+ __publicField(this, "E", SHA256_IV[4] | 0);
35452
+ __publicField(this, "F", SHA256_IV[5] | 0);
35453
+ __publicField(this, "G", SHA256_IV[6] | 0);
35454
+ __publicField(this, "H", SHA256_IV[7] | 0);
35455
+ }
35456
+ };
35457
+ sha256 = /* @__PURE__ */ createHasher(
35458
+ () => new _SHA256(),
35459
+ /* @__PURE__ */ oidNist(1)
35460
+ );
35461
+ }
35462
+ });
35463
+
35464
+ // ../shared/src/user-message-images.ts
35465
+ function userMessageImageHash(image, cacheKey = image) {
35466
+ if (!image.data) return image.dataHash;
35467
+ let hash2 = hashes.get(cacheKey);
35468
+ if (hash2 === void 0) {
35469
+ hash2 = bytesToHex(sha256(new TextEncoder().encode(image.data)));
35470
+ hashes.set(cacheKey, hash2);
35471
+ }
35472
+ return hash2;
35473
+ }
35474
+ var hashes;
35475
+ var init_user_message_images = __esm({
35476
+ "../shared/src/user-message-images.ts"() {
35477
+ "use strict";
35478
+ init_sha2();
35479
+ init_utils2();
35480
+ hashes = /* @__PURE__ */ new WeakMap();
35481
+ }
35482
+ });
35483
+
35104
35484
  // ../shared/src/display-message/parsers/codex-asp-parser.ts
35105
35485
  function collectCodexTurns(events) {
35106
35486
  const turns = /* @__PURE__ */ new Map();
@@ -35409,7 +35789,13 @@ function takeRecordedPrompt(prompts3, echo, turnIndex) {
35409
35789
  { content: stripReplicasInstructionBlock(echo.content), timestamp: timestampMs }
35410
35790
  )) continue;
35411
35791
  const images = candidate.message.images;
35412
- if (images && echo.images && (images.length !== echo.images.length || images.some((image, index) => image.mediaType !== echo.images?.[index].mediaType || image.data !== echo.images?.[index].data))) continue;
35792
+ if (images && echo.images && (images.length !== echo.images.length || images.some((image, index) => {
35793
+ const other = echo.images?.[index];
35794
+ if (!other || image.mediaType !== other.mediaType) return true;
35795
+ if (image.data && other.data) return image.data !== other.data;
35796
+ const hash2 = userMessageImageHash(image);
35797
+ return hash2 === void 0 || hash2 !== userMessageImageHash(other);
35798
+ }))) continue;
35413
35799
  closestIndex = i;
35414
35800
  closestDistance = distance;
35415
35801
  }
@@ -35654,7 +36040,10 @@ function parseCodexEvents(events) {
35654
36040
  const prompts3 = recordedPrompts.get(stripReplicasInstructionBlock(message2.content));
35655
36041
  const recorded = prompts3 && takeRecordedPrompt(prompts3, message2, index);
35656
36042
  if (recorded) claimedPrompts.add(recorded);
35657
- const prompt = recorded ? { ...recorded, images: recorded.images ?? message2.images } : message2;
36043
+ const prompt = recorded ? {
36044
+ ...recorded,
36045
+ images: recorded.images?.map((image, index2) => image.data ? image : message2.images?.[index2]?.data ? message2.images[index2] : image) ?? message2.images
36046
+ } : message2;
35658
36047
  if (!opened) promptTurnIds.set(prompt, turnId);
35659
36048
  opened = true;
35660
36049
  kept.push(prompt);
@@ -35672,6 +36061,7 @@ var init_codex_parser = __esm({
35672
36061
  init_json();
35673
36062
  init_user_message_matching();
35674
36063
  init_prompts();
36064
+ init_user_message_images();
35675
36065
  init_utils();
35676
36066
  init_format2();
35677
36067
  init_codex_asp_parser();
@@ -37401,6 +37791,7 @@ var init_codex_history = __esm({
37401
37791
  init_chat_transcript_pages();
37402
37792
  init_display_message();
37403
37793
  init_type_guards();
37794
+ init_user_message_images();
37404
37795
  COMPACT_BODY_MAX_BYTES = 2 * 1024;
37405
37796
  }
37406
37797
  });
@@ -37959,7 +38350,7 @@ var CLI_VERSION;
37959
38350
  var init_cli_version = __esm({
37960
38351
  "../shared/src/cli-version.ts"() {
37961
38352
  "use strict";
37962
- CLI_VERSION = "0.3.410";
38353
+ CLI_VERSION = "0.3.413";
37963
38354
  }
37964
38355
  });
37965
38356
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.410",
3
+ "version": "0.3.413",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {