@phnx-labs/artifacts-cli 0.18.3 → 0.18.5

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.
@@ -233,6 +233,8 @@ export default {
233
233
  return json({ ticket: ticket }, 200);
234
234
  }
235
235
 
236
+ if (request.method === 'POST' && path === '__registry-backfill') return backfillRegistry(request, env, url);
237
+
236
238
  const multipartAction = url.searchParams.get('multipart');
237
239
  if (multipartAction) {
238
240
  const uploaded = await handleMultipartUpload(request, env, url, path, multipartAction);
@@ -241,6 +243,13 @@ export default {
241
243
  if (multipartAction === 'complete' && uploaded.status === 200 && ctx && typeof ctx.waitUntil === 'function') {
242
244
  ctx.waitUntil(startMediaAfterUpload(env, url.origin, path));
243
245
  }
246
+ const multipartCollab = collabConfig(env);
247
+ if (multipartAction === 'complete' && uploaded.status === 200 && multipartCollab) {
248
+ const stored = await env.BUCKET.head(path);
249
+ if (stored && isListedFile(path, stored)) {
250
+ return withCollabStatus(uploaded, await registerShare(env, multipartCollab, url, path, stored.customMetadata || {}, fileOf(stored), undefined, fileSearchFields(null, stored.customMetadata || {}, contentTypeOf(stored))));
251
+ }
252
+ }
244
253
  return uploaded;
245
254
  }
246
255
 
@@ -359,7 +368,8 @@ export default {
359
368
  if (attempt === 0 && segments.length === 2) await clearStalePeople(env, path, existing);
360
369
  if (auth.kind === 'phoenix') {
361
370
  const existingSize = existing && typeof existing.size === 'number' ? existing.size : 0;
362
- const newCanonical = !existing;
371
+ // A <page>.png cover is part of its page, never a page of its own.
372
+ const newCanonical = !existing && !path.endsWith('.png');
363
373
  // Keeping a revision retains the old canonical bytes AND adds the new
364
374
  // ones, so storage grows by the full new size. A no-revision or first
365
375
  // publish grows by new minus the bytes it replaces (may be negative on a
@@ -435,24 +445,25 @@ export default {
435
445
  // its generated sibling so the next crawler receives a fresh card; BYO
436
446
  // publishes send no OG metadata and keep their explicitly uploaded cover.
437
447
  if (customMetadata['og-title']) await env.BUCKET.delete(path + '.png');
438
- // Register only a page comments can anchor to. A failed registration
439
- // never fails the publish: the page is stored, and the caller is told.
440
- // Threads carry over only from a live registered page at this address.
441
- // Anything else (a free slug, an expired page nobody read since) clears
442
- // whatever Rush still holds there first, so a new page never inherits
443
- // another page's comments. A non-HTML file that replaces a registered
444
- // page closes its threads, and the caller hears why.
448
+ // Register every published file, so Rush's artifact list holds what /__mine does. A failed
449
+ // registration never fails the publish: the file is stored, and the caller is told. Threads
450
+ // carry over only from a live registered page at this address, and a file republished over a
451
+ // live file keeps its registration (and its stars); anything else clears what Rush still holds there.
445
452
  const replacedMeta = (replaced && replaced.customMetadata) || {};
446
453
  const replacedRevision = replacedMeta['body-revision'] || '';
447
454
  const replacedExpiry = replacedMeta['expires-at'];
448
- const continuesThreads = !!replacedRevision && !(replacedExpiry && Date.now() > Date.parse(replacedExpiry));
455
+ const replacedLive = !!replaced && isListedFile(path, replaced) && !(replacedExpiry && Date.now() > Date.parse(replacedExpiry));
456
+ // A page stored before revisions were stamped counts as registered once Rush holds it (the marker).
457
+ const replacedPage = replacedLive && contentTypeOf(replaced).toLowerCase().indexOf('text/html') !== -1;
458
+ const replacedRegistered = !!replacedRevision || (replacedPage && !!(await env.BUCKET.head(REGISTERED_PREFIX + path)));
459
+ const continuesThreads = replacedLive && (isHtmlPage ? replacedRegistered : true);
449
460
  let registration = null;
450
- if (collab && customMetadata['body-revision']) {
461
+ if (collab && isListedFile(path, { customMetadata })) {
462
+ const file = { contentType, etag: putResult.etag, uploaded: putResult.uploaded || new Date() };
463
+ const fields = fileSearchFields(isHtmlPage ? putBody : null, customMetadata, contentType);
451
464
  registration = continuesThreads
452
- ? await registerShare(env, collab, url, path, customMetadata, undefined, searchFieldsOrNone(putBody, customMetadata))
453
- : await registerFreshShare(env, collab, url, path, customMetadata, searchFieldsOrNone(putBody, customMetadata));
454
- } else if (collab && continuesThreads) {
455
- registration = { registered: false, error: 'the new file is not an HTML page, so its review threads are closed' };
465
+ ? await registerShare(env, collab, url, path, customMetadata, file, undefined, fields)
466
+ : await registerFreshShare(env, collab, url, path, customMetadata, file, fields);
456
467
  }
457
468
  return withCollabStatus(
458
469
  json({ ok: true, url: url.origin + '/' + path, expiresAt: expiresAt || null, unlisted: visibility === 'unlisted', visibility }, 200),
@@ -593,9 +604,16 @@ export default {
593
604
  // Rush keys anchor checks and comment gating off its registry, so a
594
605
  // visibility or policy change re-registers the share.
595
606
  const collab = collabConfig(env);
596
- const registration = collab && metadata['body-revision'] && (visibilityChanged || policyChanged)
597
- ? await registerShare(env, collab, url, path, metadata)
598
- : null;
607
+ const relabelled = (metadata.label || '') !== ((existing.customMetadata || {}).label || '');
608
+ let registration = null;
609
+ if (collab && isListedFile(path, existing) && (visibilityChanged || policyChanged || relabelled)) {
610
+ const file = { contentType: contentTypeOf(existing), etag: putResult.etag, uploaded: putResult.uploaded || existing.uploaded };
611
+ // A page stored before publishes stamped a revision keeps the one its comments anchor to.
612
+ const page = !metadata['body-revision'] && file.contentType.toLowerCase().indexOf('text/html') !== -1
613
+ ? await storedPageRevision(env, path, putResult, null)
614
+ : null;
615
+ registration = await registerShare(env, collab, url, path, page ? { ...metadata, 'body-revision': page.revision } : metadata, file);
616
+ }
599
617
  return withCollabStatus(
600
618
  json({ ok: true, url: url.origin + '/' + path, label: metadata.label || null, meta: extraMetaOf(metadata), visibility: metadata.visibility || 'public', previousVisibility: previousVisibility, comments: commentPolicyOf(metadata) }, 200),
601
619
  registration,
@@ -676,6 +694,29 @@ export default {
676
694
  // generated marker and continue through the ordinary object route below.
677
695
  if (segments.length === 2 && path.endsWith('.png')) {
678
696
  let existingCover = await env.BUCKET.get(path);
697
+ // A video's cover is the frame artifacts share uploaded. Whoever may
698
+ // watch the video may see it, under the video's current visibility; a
699
+ // video with no frame has no cover, never a card drawn from its bytes.
700
+ const coveredPage = await env.BUCKET.head(path.slice(0, -4));
701
+ if (isVideoObject(coveredPage)) {
702
+ const viewer = await resolveViewer(request, env, url);
703
+ if (viewer.redirect) return viewer.redirect;
704
+ const pageVisibility = (coveredPage.customMetadata && coveredPage.customMetadata.visibility) || 'public';
705
+ const denied = await gateVisibility(url, env, coveredPage, viewer.identity || null);
706
+ if (denied) return isIdentityGated(pageVisibility) && denied.status !== 503 ? sealedCover(request, url, coveredPage, segments[0], path.slice(0, -4)) : denied;
707
+ const tokenDenied = await gateTokenRead(request, url, coveredPage, viewer.identity || null);
708
+ if (tokenDenied) return tokenDenied;
709
+ const videoExpiry = coveredPage.customMetadata && coveredPage.customMetadata['expires-at'];
710
+ if (videoExpiry && Date.now() > Date.parse(videoExpiry)) {
711
+ return new Response('gone — this link has expired', { status: 410, headers: { 'content-type': 'text/plain; charset=utf-8', 'cache-control': 'no-store' } });
712
+ }
713
+ existingCover = videoFrame(existingCover);
714
+ if (!existingCover) return new Response('not found', { status: 404, headers: { 'content-type': 'text/plain' } });
715
+ const frameHeaders = managedCoverHeaders(pageVisibility);
716
+ frameHeaders.set('content-type', (existingCover.httpMetadata && existingCover.httpMetadata.contentType) || 'image/png');
717
+ if (!isIdentityGated(pageVisibility) && pageVisibility !== 'private') frameHeaders.set('cache-control', 'public, max-age=300');
718
+ return new Response(request.method === 'HEAD' ? null : existingCover.body, { status: 200, headers: frameHeaders });
719
+ }
679
720
  if (!existingCover || (existingCover.customMetadata && existingCover.customMetadata['og-generated'] === 'true')) {
680
721
  const pagePath = path.slice(0, -4);
681
722
  const viewer = await resolveViewer(request, env, url);
@@ -812,8 +853,9 @@ export default {
812
853
  // best-effort: serving the expiry 410 must never depend on the refund
813
854
  }
814
855
  }
815
- // An expired video's derived files go with it (best-effort, after the refund).
856
+ // An expired video's derived files and frame go with it (best-effort, after the refund).
816
857
  if (path.split('/').filter(Boolean).length === 2) await deleteMediaDerived(env, path);
858
+ if (isVideoObject(current) && path.split('/').filter(Boolean).length === 2) await deleteVideoFrame(env, path);
817
859
  // So do its people list and inbox entries. Best-effort: a list left
818
860
  // behind grants nothing, since the next page here clears it first.
819
861
  if (path.split('/').filter(Boolean).length === 2) {
@@ -822,7 +864,7 @@ export default {
822
864
  // An expired slug is reusable, so its threads go with it, off the
823
865
  // response path like the view counter.
824
866
  const expiredCollab = collabConfig(env);
825
- if (expiredCollab && current.customMetadata && current.customMetadata['body-revision'] && path.split('/').filter(Boolean).length === 2 && ctx && typeof ctx.waitUntil === 'function') {
867
+ if (expiredCollab && isListedFile(path, current) && ctx && typeof ctx.waitUntil === 'function') {
826
868
  ctx.waitUntil(purgeShare(expiredCollab, url, path));
827
869
  }
828
870
  return new Response('gone — this link has expired', { status: 410, headers: expiredHeaders(false) });
@@ -925,17 +967,34 @@ export default {
925
967
  headers.set('cache-control', 'public, max-age=60');
926
968
  if (visibility === 'unlisted') headers.set('X-Robots-Tag', 'noindex');
927
969
  }
928
- if (request.method === 'HEAD') return new Response(null, { status: 200, headers });
929
970
  const ctype = headers.get('content-type') || '';
930
971
  const wantsRaw = url.searchParams.get('raw') != null;
931
972
  const kind = viewableAssetKind(ctype);
932
973
  // Navigation to a media viewer needs metadata, not the media bytes. Return
933
- // it before the R2 body read just like an authorization denial does.
934
- if (!range && ctype.indexOf('text/html') === -1 && !wantsRaw && kind && acceptsHtml(request) && visibility !== 'private') {
974
+ // it before the R2 body read just like an authorization denial does. A
975
+ // preview bot gets a video's page, never an image's: Slack and Discord
976
+ // fetch a linked image itself as the picture.
977
+ if (kind) headers.set('Vary', kind === 'video' ? 'Accept, User-Agent' : 'Accept');
978
+ const servesViewer = !range && ctype.indexOf('text/html') === -1 && !wantsRaw && kind && (acceptsHtml(request) || (kind === 'video' && wantsPage(request))) && visibility !== 'private';
979
+ // A link checker that sends HEAD first must see what its GET will get: the
980
+ // viewer page, not an 86 MB video/mp4.
981
+ if (request.method === 'HEAD') {
982
+ if (!servesViewer) return new Response(null, { status: 200, headers });
983
+ const hheaders = new Headers(headers);
984
+ hheaders.set('content-type', 'text/html; charset=utf-8');
985
+ hheaders.delete('etag');
986
+ hheaders.delete('content-length');
987
+ return new Response(null, { status: 200, headers: hheaders });
988
+ }
989
+ if (servesViewer) {
990
+ const cover = kind === 'video' ? videoFrame(await env.BUCKET.head(path + '.png')) : null;
935
991
  const viewerPage = renderAssetViewer(url.pathname, kind, gateObj.customMetadata || {}, firstSeg, {
936
992
  isOwner,
937
993
  ownerDomain,
938
994
  link: shareLink(url),
995
+ pageUrl: url.origin + url.pathname,
996
+ contentType: ctype,
997
+ coverUrl: cover ? url.origin + url.pathname + '.png' : '',
939
998
  media: kind === 'video' ? await mediaViewData(env, ctx, gateObj, path, isOwner) : null,
940
999
  canRetry: isOwner && !!mediaConfig(env),
941
1000
  });
@@ -1040,26 +1099,27 @@ export default {
1040
1099
  let doomed = null;
1041
1100
  const isCover = path.endsWith('.png');
1042
1101
  const collab = collabConfig(env);
1043
- if ((auth.kind === 'phoenix' || collab) && !isCover && !firstSeg.startsWith('__')) {
1102
+ if (!firstSeg.startsWith('__')) {
1044
1103
  doomed = typeof env.BUCKET.head === 'function' ? await env.BUCKET.head(path) : await env.BUCKET.get(path);
1045
1104
  }
1046
1105
  if (!(await pathMutationLockOwned(env.BUCKET, path, mutationHolder))) {
1047
1106
  return json({ error: 'delete conflict: path lock changed', key: path }, 409);
1048
1107
  }
1049
1108
  await env.BUCKET.delete(path);
1050
- // Derived transcript files were never charged, so deleting one directly
1051
- // refunds nothing.
1052
- if (doomed && auth.kind === 'phoenix' && !isMediaDerived(doomed)) {
1109
+ // Derived transcript files and a generated cover were never charged, so
1110
+ // deleting one directly refunds nothing; an uploaded frame refunds its bytes.
1111
+ if (doomed && auth.kind === 'phoenix' && !isMediaDerived(doomed) && (!isCover || videoFrame(doomed))) {
1053
1112
  const delSegs = path.split('/').filter(Boolean);
1054
1113
  await refundShareWrite(env, auth.owner, {
1055
1114
  refund: typeof doomed.size === 'number' ? doomed.size : 0,
1056
- freeCanonical: delSegs.length === 2,
1115
+ freeCanonical: delSegs.length === 2 && !isCover,
1057
1116
  });
1058
1117
  }
1059
- // A video takes its derived files with it (best-effort, after the refund).
1118
+ // A video takes its derived files and its frame with it (best-effort, after the refund).
1060
1119
  if (!isMediaDerived(doomed) && path.split('/').filter(Boolean).length === 2) await deleteMediaDerived(env, path);
1120
+ if (isVideoObject(doomed) && path.split('/').filter(Boolean).length === 2) await deleteVideoFrame(env, path);
1061
1121
  if (!isMediaDerived(doomed) && !isCover && path.split('/').filter(Boolean).length === 2) await clearPeople(env, path);
1062
- const purge = collab && doomed && doomed.customMetadata && doomed.customMetadata['body-revision'] && path.split('/').filter(Boolean).length === 2
1122
+ const purge = collab && doomed && isListedFile(path, doomed)
1063
1123
  ? await purgeShare(collab, url, path)
1064
1124
  : null;
1065
1125
  const deleted = json({ ok: true, deleted: path }, 200);
@@ -1873,16 +1933,21 @@ function renderAssetViewer(pathname, kind, meta, handle, opts) {
1873
1933
  try { name = decodeURIComponent(pathname.split('/').pop() || 'file'); } catch (e) { name = pathname.split('/').pop() || 'file'; }
1874
1934
  var o = opts || {};
1875
1935
  var media = kind === 'video' ? o.media : null;
1876
- var summaryTitle = media && media.summary && media.summary.title ? media.summary.title : '';
1936
+ // A silent recording's summary only repeats the file name and says nothing was
1937
+ // said, so the share's label and og-description describe it instead.
1938
+ var spoken = media && media.summary && media.transcript && media.transcript.length ? media.summary : null;
1939
+ var summaryTitle = spoken && spoken.title ? spoken.title : '';
1877
1940
  var bar = renderAttributionBar(meta, handle, Object.assign({}, o, {
1878
1941
  title: summaryTitle || (meta && meta.label) || name,
1879
1942
  media: media,
1880
1943
  }));
1944
+ var description = (spoken && spoken.summary) || (meta && meta['og-description']) || '';
1945
+ var og = assetOgTags(kind, summaryTitle || (meta && meta.label) || name, description, o);
1881
1946
  if (media) {
1882
- var title = summaryTitle || name;
1947
+ var title = summaryTitle || (meta && meta.label) || name;
1883
1948
  return '<!doctype html><html><head><meta charset="utf-8">' +
1884
1949
  '<meta name="viewport" content="width=device-width,initial-scale=1">' +
1885
- '<title>' + escapeHtml(title) + '</title>' +
1950
+ '<title>' + escapeHtml(title) + '</title>' + og +
1886
1951
  '<style>' + MEDIA_VIEWER_CSS + '</style></head><body>' + bar +
1887
1952
  renderMediaPanels(pathname, opts.media, { canRetry: !!opts.canRetry }) + '</body></html>';
1888
1953
  }
@@ -1893,7 +1958,7 @@ function renderAssetViewer(pathname, kind, meta, handle, opts) {
1893
1958
  else if (kind === 'pdf') asset = '<iframe src="' + rawUrl + '" title="' + escapeHtml(name) + '"></iframe>';
1894
1959
  return '<!doctype html><html><head><meta charset="utf-8">' +
1895
1960
  '<meta name="viewport" content="width=device-width,initial-scale=1">' +
1896
- '<title>' + escapeHtml(name) + '</title>' +
1961
+ '<title>' + escapeHtml(name) + '</title>' + og +
1897
1962
  '<style>html,body{margin:0;background:#09090b}' +
1898
1963
  'body{min-height:calc(100vh - 46px);display:flex;align-items:center;justify-content:center;padding:16px;box-sizing:border-box}' +
1899
1964
  '.ashv{max-width:100%;max-height:calc(100vh - 90px);display:flex;align-items:center;justify-content:center}' +
@@ -1903,6 +1968,26 @@ function renderAssetViewer(pathname, kind, meta, handle, opts) {
1903
1968
  '</style></head><body>' + bar + '<div class="ashv">' + asset + '</div></body></html>';
1904
1969
  }
1905
1970
 
1971
+ // The link preview for an asset's viewer page. A video's image is its cover
1972
+ // frame (<page>.png, uploaded by artifacts share), present or not at all:
1973
+ // a card drawn from an mp4 would be a title on a blank card.
1974
+ function assetOgTags(kind, title, description, o) {
1975
+ var page = o.pageUrl || '';
1976
+ var image = kind === 'image' ? page + '?raw=1' : (o.coverUrl || '');
1977
+ var tag = function (attr, key, value) { return '<meta ' + attr + '="' + key + '" content="' + escapeHtml(value) + '">'; };
1978
+ var out = tag('property', 'og:type', kind === 'video' ? 'video.other' : 'website') +
1979
+ tag('property', 'og:title', title) + tag('name', 'twitter:title', title);
1980
+ if (page) out += tag('property', 'og:url', page);
1981
+ if (description) out += tag('name', 'description', description) + tag('property', 'og:description', description) + tag('name', 'twitter:description', description);
1982
+ if (image) out += tag('property', 'og:image', image) + tag('name', 'twitter:image', image);
1983
+ out += tag('name', 'twitter:card', image ? 'summary_large_image' : 'summary');
1984
+ if (kind === 'video' && page) {
1985
+ out += tag('property', 'og:video', page + '?raw=1') + tag('property', 'og:video:secure_url', page + '?raw=1');
1986
+ if (o.contentType) out += tag('property', 'og:video:type', o.contentType);
1987
+ }
1988
+ return out;
1989
+ }
1990
+
1906
1991
  // --- The sealed page (me/org) ----------------------------------------------
1907
1992
  // A browser or link-preview bot that may not read a me/org page gets this page
1908
1993
  // instead of a bare login redirect or a text 404, so a link pasted in Slack
@@ -1915,9 +2000,15 @@ function renderAssetViewer(pathname, kind, meta, handle, opts) {
1915
2000
  var PREVIEW_BOT = /Slackbot|facebookexternalhit|Twitterbot|LinkedInBot|Discordbot|WhatsApp|TelegramBot|Applebot|redditbot|Embedly|SkypeUriPreview|Iframely|Mastodon|vkShare|Pinterest/i;
1916
2001
  var AGENT_NAMES = { claude: 'Claude Code', codex: 'Codex', opencode: 'OpenCode', gemini: 'Gemini', cursor: 'Cursor', droid: 'Droid', grok: 'Grok', kimi: 'Kimi', antigravity: 'Antigravity' };
1917
2002
 
2003
+ // A browser, or a link-preview bot: WhatsApp, X and Facebook read a page's
2004
+ // meta tags but send no text/html in Accept.
2005
+ function wantsPage(request) {
2006
+ return acceptsHtml(request) || PREVIEW_BOT.test(request.headers.get('user-agent') || '');
2007
+ }
2008
+
1918
2009
  function wantsSealedPage(request) {
1919
2010
  if (request.method !== 'GET' && request.method !== 'HEAD') return false;
1920
- return acceptsHtml(request) || PREVIEW_BOT.test(request.headers.get('user-agent') || '');
2011
+ return wantsPage(request);
1921
2012
  }
1922
2013
 
1923
2014
  function shortDate(value) {
@@ -2406,16 +2497,38 @@ function searchFieldsOrNone(bytes, meta) {
2406
2497
  try { return pageSearchFields(bytes, meta); } catch (err) { return undefined; }
2407
2498
  }
2408
2499
 
2409
- async function registerShare(env, collab, url, key, meta, idempotencyKey, page) {
2500
+ // What a stored file is, as Rush's artifact list shows it: its type, its R2 version and when it landed.
2501
+ function fileOf(obj) {
2502
+ return { contentType: contentTypeOf(obj), etag: obj.etag, uploaded: obj.uploaded };
2503
+ }
2504
+
2505
+ function contentTypeOf(obj) {
2506
+ return (obj && obj.httpMetadata && obj.httpMetadata.contentType) || '';
2507
+ }
2508
+
2509
+ // A page is searched by its description and visible text; any other file by its description alone.
2510
+ function fileSearchFields(bytes, meta, contentType) {
2511
+ if (bytes && String(contentType).toLowerCase().indexOf('text/html') !== -1) return searchFieldsOrNone(bytes, meta);
2512
+ const description = String(meta['og-description'] || '').split(String.fromCharCode(0)).join('').slice(0, 300);
2513
+ return { description: description || null, body_text: null };
2514
+ }
2515
+
2516
+ async function registerShare(env, collab, url, key, meta, file, idempotencyKey, page) {
2410
2517
  const shareId = collabShareId(url, key);
2518
+ const uploaded = file.uploaded ? new Date(file.uploaded).toISOString() : null;
2411
2519
  const result = await collabRegistryCall(collab, 'PUT', '/shares', shareId, {
2412
2520
  share_id: shareId,
2413
2521
  owner_actor_id: meta.owner || '',
2414
2522
  org_domain: meta.org_domain || null,
2415
2523
  visibility: meta.visibility || 'public',
2416
2524
  comment_policy: commentPolicyOf(meta),
2417
- current_revision: meta['body-revision'],
2418
- title: meta.label || meta['og-title'] || null,
2525
+ // Only a page has anchors; any other file is versioned by its R2 etag.
2526
+ current_revision: meta['body-revision'] || 'etag:' + file.etag,
2527
+ title: meta.label || meta['og-title'] || key.split('/').pop(),
2528
+ content_type: file.contentType || null,
2529
+ published_at: meta['published-at'] || uploaded,
2530
+ // Sent as null for a file that never expires, so a republish clears an earlier expiry.
2531
+ expires_at: meta['expires-at'] || null,
2419
2532
  producer: {
2420
2533
  agent: meta.agent || null,
2421
2534
  session: meta.session || null,
@@ -2424,7 +2537,66 @@ async function registerShare(env, collab, url, key, meta, idempotencyKey, page)
2424
2537
  },
2425
2538
  ...(page || {}),
2426
2539
  }, idempotencyKey);
2427
- return result.error ? { registered: false, error: result.error } : { registered: true };
2540
+ // A failed registration drops the marker, so the backfill repairs this file on its next pass.
2541
+ if (result.error) {
2542
+ await env.BUCKET.delete(REGISTERED_PREFIX + key);
2543
+ return { registered: false, error: result.error };
2544
+ }
2545
+ if (file.etag) await env.BUCKET.put(REGISTERED_PREFIX + key, file.etag, { httpMetadata: { contentType: 'text/plain' } });
2546
+ return { registered: true };
2547
+ }
2548
+
2549
+ // The etag of the version of each file Rush last registered, so the backfill knows what is current.
2550
+ var REGISTERED_PREFIX = '__registered/';
2551
+ var BACKFILL_BATCH = 50;
2552
+
2553
+ // POST /__registry-backfill?cursor=&dry=1 — the endpoint owner (WRITE_TOKEN) registers every live
2554
+ // file Rush does not hold at its current version, one bounded batch per call. It never purges,
2555
+ // never rewrites a file, and a replay of the same version sends the same Idempotency-Key.
2556
+ async function backfillRegistry(request, env, url) {
2557
+ const auth = await authorizeWrite(request, env);
2558
+ if (auth.error) return auth.error;
2559
+ if (auth.kind !== 'byo') return json({ error: 'the registry backfill needs the endpoint write token' }, 403);
2560
+ const collab = collabConfig(env);
2561
+ if (!collab) return json({ error: 'collaboration is not configured' }, 501);
2562
+ const dry = url.searchParams.get('dry') === '1';
2563
+ const listing = await env.BUCKET.list({ cursor: url.searchParams.get('cursor') || undefined, limit: BACKFILL_BATCH, include: ['httpMetadata', 'customMetadata'] });
2564
+ const report = { dry: dry, files: 0, expired: 0, current: 0, pending: 0, registered: 0, skipped: {}, failed: [], handles: {}, kinds: {} };
2565
+ const skip = function (reason) { report.skipped[reason] = (report.skipped[reason] || 0) + 1; };
2566
+ for (const o of listing.objects || []) {
2567
+ if (!isListedFile(o.key, o)) continue;
2568
+ const meta = o.customMetadata || {};
2569
+ // An expired file Rush still lists is registered with its expiry, so the list leaves it out.
2570
+ if (isExpiredObject(o)) report.expired++;
2571
+ if (!meta.owner) { skip('no_owner'); continue; }
2572
+ report.files++;
2573
+ const handle = o.key.split('/')[0];
2574
+ report.handles[handle] = (report.handles[handle] || 0) + 1;
2575
+ const kind = pageKind(contentTypeOf(o));
2576
+ report.kinds[kind] = (report.kinds[kind] || 0) + 1;
2577
+ const marker = await env.BUCKET.get(REGISTERED_PREFIX + o.key);
2578
+ if (marker && (await marker.text()) === o.etag) { report.current++; continue; }
2579
+ report.pending++;
2580
+ if (dry) continue;
2581
+ let fileMeta = meta;
2582
+ let fields = fileSearchFields(null, meta, contentTypeOf(o));
2583
+ if (kind === 'page') {
2584
+ const full = await env.BUCKET.get(o.key);
2585
+ if (!full) { skip('gone'); continue; }
2586
+ const bytes = new Uint8Array(await full.arrayBuffer());
2587
+ fields = fileSearchFields(bytes, meta, contentTypeOf(o));
2588
+ if (!meta['body-revision']) {
2589
+ const record = await storedPageRevision(env, o.key, o, bytes);
2590
+ if (record) fileMeta = { ...meta, 'body-revision': record.revision };
2591
+ }
2592
+ }
2593
+ const idempotencyKey = 'backfill:' + (await bytesRevision(new TextEncoder().encode(collabShareId(url, o.key) + '|' + o.etag))).slice(7);
2594
+ const registration = await registerShare(env, collab, url, o.key, fileMeta, fileOf(o), idempotencyKey, fields);
2595
+ if (registration.registered) report.registered++;
2596
+ else report.failed.push({ key: o.key, error: registration.error });
2597
+ }
2598
+ report.next_cursor = listing.truncated ? listing.cursor : null;
2599
+ return json(report, 200);
2428
2600
  }
2429
2601
 
2430
2602
  // A share Rush never heard of has nothing to purge.
@@ -2434,10 +2606,13 @@ async function purgeShare(collab, url, key) {
2434
2606
  return result.error && result.status !== 404 ? { purged: false, error: result.error } : { purged: true };
2435
2607
  }
2436
2608
 
2437
- async function registerFreshShare(env, collab, url, key, meta, page) {
2609
+ async function registerFreshShare(env, collab, url, key, meta, file, page) {
2438
2610
  const purge = await purgeShare(collab, url, key);
2439
- if (!purge.purged) return { registered: false, error: 'could not clear review threads left at this address: ' + purge.error };
2440
- return registerShare(env, collab, url, key, meta, undefined, page);
2611
+ if (!purge.purged) {
2612
+ await env.BUCKET.delete(REGISTERED_PREFIX + key);
2613
+ return { registered: false, error: 'could not clear review threads left at this address: ' + purge.error };
2614
+ }
2615
+ return registerShare(env, collab, url, key, meta, file, undefined, page);
2441
2616
  }
2442
2617
 
2443
2618
  // Browser route -> Rush route, and the capability a write needs.
@@ -2558,7 +2733,7 @@ async function handleCollab(request, env, url, path) {
2558
2733
  revision = record.revision;
2559
2734
  if (!record.registered) {
2560
2735
  const idempotencyKey = 'register:' + (await bytesRevision(new TextEncoder().encode(collabShareId(url, key) + '|' + revision))).slice(7);
2561
- const registration = await registerShare(env, collab, url, key, { ...meta, 'body-revision': revision }, idempotencyKey);
2736
+ const registration = await registerShare(env, collab, url, key, { ...meta, 'body-revision': revision }, fileOf(obj), idempotencyKey);
2562
2737
  if (registration.registered) await env.BUCKET.put('__revisions/' + key, JSON.stringify({ ...record, registered: true }), { httpMetadata: { contentType: 'application/json' } });
2563
2738
  else unavailable = registration.error;
2564
2739
  }
@@ -1 +1 @@
1
- {"version":3,"file":"worker-template.js","sourceRoot":"","sources":["../../../src/lib/share/worker-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEtD,yDAAyD;AACzD,EAAE;AACF,mCAAmC;AACnC,gFAAgF;AAChF,uEAAuE;AACv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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAk1B3B,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/artifacts-cli",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "description": "Your coding agent writes Markdown; artifacts turns it into one polished HTML page you can read, mark up and share as a link.",
5
5
  "homepage": "https://artifacts-cli.sh",
6
6
  "repository": {