Files
Shadowbroker/frontend/src/mesh/dmConnectDelivery.ts
T
BigBodyCobainandCursor 89d6bb8fb9 Ship DM connect delivery, fleet pubkey lookup, OpenClaw Infonet agent, and relay auto-wormhole.
Auto-relay connect DMs with End Contact severing, signed fleet prekey lookup,
OpenClaw private Infonet channel intents, headless relay Tor bootstrap on redeploy,
and swarm/DM live verification scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 02:15:56 -06:00

41 lines
1.3 KiB
TypeScript

import type { Contact } from '@/mesh/meshIdentity';
import type { DmSendResponse } from '@/mesh/meshDmClient';
import { updatePrivateDeliveryAction } from '@/mesh/wormholeClient';
export type DmConnectIntent =
| 'invite_short_address'
| 'invite_import'
| 'contact_request'
| 'contact_accept'
| 'contact_offer';
export function connectDeliveryMeta(options: {
intent: DmConnectIntent;
lookupPeerUrl?: string;
contact?: Partial<Contact> | null;
}): { connectIntent: DmConnectIntent; lookupPeerUrl?: string } {
const lookupPeerUrl = String(
options.lookupPeerUrl || options.contact?.invitePinnedLookupPeerUrl || '',
)
.trim()
.replace(/\/$/, '');
return {
connectIntent: options.intent,
...(lookupPeerUrl ? { lookupPeerUrl } : {}),
};
}
/** Fallback when the server queued connect traffic but UI still shows a manual relay step. */
export async function ensureDmOutboxReleased(sent: DmSendResponse): Promise<DmSendResponse> {
if (!sent.ok) return sent;
const outboxId = String(sent.outbox_id || '').trim();
if (!outboxId) return sent;
if (!sent.queued && !sent.private_transport_pending) return sent;
try {
await updatePrivateDeliveryAction(outboxId, 'relay');
} catch {
// Backend auto-release may have already approved this outbox item.
}
return sent;
}