@semiont/http-transport 0.5.6
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.
- package/README.md +74 -0
- package/dist/index.d.ts +233 -0
- package/dist/index.js +948 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transport/actor-state-unit.ts","../src/transport/http-transport.ts","../src/transport/http-content-transport.ts"],"names":["Subject","BehaviorSubject","busLog","withSpan","SpanKind","Observable","getActiveTraceparent","body","err"],"mappings":";;;;;;;AAiCO,IAAM,qBAAA,GAAwB;AAarC,IAAM,mBAAA,GAA+E;AAAA,EACnF,OAAA,EAAc,CAAC,YAAA,EAAc,QAAQ,CAAA;AAAA,EACrC,UAAA,EAAc,CAAC,MAAA,EAAQ,cAAA,EAAgB,QAAQ,CAAA;AAAA,EAC/C,IAAA,EAAc,CAAC,cAAA,EAAgB,QAAQ,CAAA;AAAA,EACvC,YAAA,EAAc,CAAC,YAAA,EAAc,UAAA,EAAY,QAAQ,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjD,QAAA,EAAc,CAAC,YAAA,EAAc,cAAA,EAAgB,QAAQ,CAAA;AAAA,EACrD,QAAc;AAChB,CAAA;AAEO,SAAS,qBAAqB,OAAA,EAAgD;AACnF,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,aAAA,EAAe,QAAA,EAAU,iBAAiB,KAAA,EAAO,YAAA,EAAc,WAAA,GAAc,GAAA,EAAM,GAAI,OAAA;AAC/G,EAAA,MAAM,QAAA,GAAW,OAAO,aAAA,KAAkB,UAAA,GAAa,gBAAgB,MAAM,aAAA;AAE7E,EAAA,MAAM,cAAA,GAAiB,IAAI,GAAA,CAAI,eAAe,CAAA;AAC9C,EAAA,MAAM,cAAA,uBAAqB,GAAA,EAAY;AACvC,EAAA,IAAI,WAAA,GAAc,YAAA;AAElB,EAAA,MAAM,OAAA,GAAU,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B,GAAG,eAAe,CAAA;AAC1E,MAAA,UAAA,CAAW,GAAG,CAAA;AACd,MAAA,MAAA,CAAO,GAAG,CAAA;AAAA,IACZ,CAAA;AAEA,IAAA,GAAA,CAAI,YAAY,MAAM;AACpB,MAAA,MAAM,GAAA,GAAM,IAAI,QAAA,CAAS,kBAAA,EAAoB,GAAG,SAAS,CAAA;AACzD,MAAA,UAAA,CAAW,GAAG,CAAA;AACd,MAAA,MAAA,CAAO,GAAG,CAAA;AAAA,IACZ,CAAA;AAEA,IAAA,GAAA,CAAI,UAAU,MAAM;AAIlB,MAAA,MAAM,GAAA,GAAM,IAAI,QAAA,CAAS,gBAAA,EAAkB,GAAG,SAAS,CAAA;AACvD,MAAA,UAAA,CAAW,GAAG,CAAA;AACd,MAAA,MAAA,CAAO,GAAG,CAAA;AAAA,IACZ,CAAA;AAEA,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,MAAM,OAAA,GAAU,MAAM,GAAA,CAAI,KAAA,EAAM;AAChC,MAAA,MAAA,CAAO,iBAAiB,OAAA,EAAS,OAAA,EAAS,EAAE,IAAA,EAAM,MAAM,CAAA;AAAA,IAG1D;AAEA,IAAA,GAAA,CAAI,KAAK,QAAQ,CAAA;AAAA,EACnB,CAAC,CAAA;AACH","file":"index.js","sourcesContent":["import { BehaviorSubject, Observable, Subject } from 'rxjs';\nimport { filter, map, share } from 'rxjs/operators';\nimport { busLog, type ConnectionState } from '@semiont/core';\nimport {\n SpanKind,\n extractTraceparent,\n getActiveTraceparent,\n withSpan,\n withTraceparent,\n} from '@semiont/observability';\n\n/** Minimal StateUnit surface — anything with a `dispose()` method. */\ninterface StateUnit {\n dispose(): void;\n}\n\nexport type { ConnectionState };\n\nexport interface BusEvent {\n channel: string;\n payload: Record<string, unknown>;\n scope?: string;\n}\n\nexport interface ActorStateUnitOptions {\n baseUrl: string;\n token: string | (() => string);\n channels: string[];\n scope?: string;\n reconnectMs?: number;\n}\n\n/** Time in the `reconnecting` state before transitioning to `degraded`. */\nexport const DEGRADED_THRESHOLD_MS = 3_000;\n\nexport interface ActorStateUnit extends StateUnit {\n on$<T = Record<string, unknown>>(channel: string): Observable<T>;\n emit(channel: string, payload: Record<string, unknown>, emitScope?: string): Promise<void>;\n state$: Observable<ConnectionState>;\n addChannels(channels: string[], scope?: string): void;\n removeChannels(channels: string[]): void;\n start(): void;\n stop(): void;\n}\n\n/** Allowed transitions in the connection state machine. */\nconst ALLOWED_TRANSITIONS: Record<ConnectionState, ReadonlyArray<ConnectionState>> = {\n initial: ['connecting', 'closed'],\n connecting: ['open', 'reconnecting', 'closed'],\n open: ['reconnecting', 'closed'],\n reconnecting: ['connecting', 'degraded', 'closed'],\n // `degraded → reconnecting` is a legitimate recovery edge: a channel-set\n // change (`addChannels`/`removeChannels`) schedules a reconnect that can\n // fire while the connection is degraded. Omitting it made `reconnect()`\n // throw a fatal, uncaught exception from the reconnect timer (#844).\n degraded: ['connecting', 'reconnecting', 'closed'],\n closed: [],\n};\n\nexport function createActorStateUnit(options: ActorStateUnitOptions): ActorStateUnit {\n const { baseUrl, token: tokenOrGetter, channels: initialChannels, scope: initialScope, reconnectMs = 5_000 } = options;\n const getToken = typeof tokenOrGetter === 'function' ? tokenOrGetter : () => tokenOrGetter;\n\n const globalChannels = new Set(initialChannels);\n const scopedChannels = new Set<string>();\n let activeScope = initialScope;\n\n const events$ = new Subject<BusEvent>();\n const state$ = new BehaviorSubject<ConnectionState>('initial');\n let currentState: ConnectionState = 'initial';\n let degradedTimer: ReturnType<typeof setTimeout> | null = null;\n\n /**\n * Move the state machine to `next`. An unexpected edge is logged and\n * ignored — NOT thrown. `transition()` runs inside timer callbacks (the\n * reconnect and degraded timers), so a throw here is an uncaught exception\n * that takes down the host process (#844). A bad edge means a bug in the\n * reconnect loop, but degrading gracefully (keep the current state, warn)\n * is strictly better than killing a long-running job. The permitted edges\n * — including the `degraded → reconnecting` recovery edge — are in\n * `ALLOWED_TRANSITIONS`.\n *\n * Side effect: manages the `degraded` timer. Enters on\n * `reconnecting`, cleared on exit.\n */\n const transition = (next: ConnectionState): void => {\n if (currentState === next) return;\n const allowed = ALLOWED_TRANSITIONS[currentState];\n if (!allowed.includes(next)) {\n console.warn(`[actor] ignoring invalid connection state transition: ${currentState} → ${next}`);\n return;\n }\n const prev = currentState;\n currentState = next;\n\n if (next === 'reconnecting' && prev !== 'reconnecting') {\n // Starting a reconnect cycle — arm the degraded-threshold timer.\n if (degradedTimer) clearTimeout(degradedTimer);\n degradedTimer = setTimeout(() => {\n if (currentState === 'reconnecting') transition('degraded');\n }, DEGRADED_THRESHOLD_MS);\n }\n if (prev === 'reconnecting' && next !== 'reconnecting') {\n // Leaving reconnecting (to connecting, degraded, or closed) —\n // the timer is either no longer relevant or has just fired.\n if (degradedTimer) { clearTimeout(degradedTimer); degradedTimer = null; }\n }\n\n state$.next(next);\n };\n\n let running = false;\n /**\n * All in-flight SSE fetch controllers. Tracked as a Set because\n * connect() may race with itself under mount-churn or rapid channel-\n * set changes — whenever a new connect() starts we abort ALL previous\n * in-flight fetches rather than only the last-tracked one. A previous\n * single-slot implementation leaked orphaned streams (diagnosed by\n * observing 3 concurrent SSE subscribes in the /bus/subscribe network\n * log, each delivering duplicate RECV frames). Using a Set guarantees\n * at most one live stream post-reconnect regardless of race order.\n */\n const inflightControllers = new Set<AbortController>();\n let reconnectTimer: ReturnType<typeof setTimeout> | null = null;\n\n /**\n * `Last-Event-ID` of the most recently delivered SSE event from the\n * server. Sent as a request header on each connect so the server can\n * replay persisted events missed during the disconnect (see\n * `apps/backend/src/routes/bus.ts` subscribe handler). Initialised\n * `null` — fresh connections send no header.\n *\n * We track both persisted (`p-*`) and ephemeral (`e-*`) ids. The server\n * treats ephemeral ids as \"no resumption context\" and responds live-\n * only; persisted ids drive replay.\n */\n let lastEventId: string | null = null;\n\n /**\n * Recently-delivered event ids, to dedup the make-before-break overlap: the\n * brief window where the old and new connection both deliver the same live\n * event during a scope-change handoff. Persisted ids (`p-<scope>-<seq>`) are\n * stable across connections, so this collapses such an overlap to a single\n * emission. Ephemeral ids (`e-<connectionId>-<counter>`) are per-connection,\n * so a cross-connection ephemeral duplicate is NOT caught here — its\n * consumers tolerate the rare double (a correlation reply is taken with\n * `take(1)`; cache invalidations and job-completion are idempotent/terminal).\n * Bounded FIFO (insertion-ordered Set) to cap memory.\n *\n * Cost note: this is *always-on* — every delivered event does a has/add here\n * — yet a duplicate is only possible during a handoff overlap; in steady\n * state there's a single connection and nothing can collide. So every\n * consumer of this transport carries a small standing structure for a path\n * that fires only on (now-rare) scope changes. It's left unconditional\n * because the per-event cost is negligible next to the JSON.parse + trace\n * span already on this path. If that ever stops being true, scope it to the\n * overlap (build on handoff start, drop once the old read loop exits) or\n * track a high-water `Map<scope, maxSeq>` instead of every id.\n */\n const seenEventIds = new Set<string>();\n const SEEN_EVENT_IDS_MAX = 512;\n const rememberEventId = (id: string): void => {\n seenEventIds.add(id);\n if (seenEventIds.size > SEEN_EVENT_IDS_MAX) {\n const oldest = seenEventIds.values().next().value;\n if (oldest !== undefined) seenEventIds.delete(oldest);\n }\n };\n\n const shared$ = events$.pipe(share());\n\n const disconnect = () => {\n for (const c of inflightControllers) {\n try { c.abort(); } catch { /* noop */ }\n }\n inflightControllers.clear();\n if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }\n };\n\n const connect = async (keepPrevious = false) => {\n // Transition to `connecting` from whichever reconnect-ish state\n // we're currently in (`initial`, `reconnecting`, `degraded`).\n transition('connecting');\n\n // Snapshot the connections this connect() supersedes.\n // - keepPrevious=false (initial connect / drop-recovery): there is no\n // live connection worth preserving, so abort up front — this closes\n // the orphan-stream leak described above.\n // - keepPrevious=true (scope-change reconnect): MAKE-BEFORE-BREAK. Keep\n // the previous connection(s) ALIVE until the new one is `open`, then\n // abort them (below, after the fetch resolves), so an in-flight\n // ephemeral result isn't dropped in a reconnect gap (#847). The brief\n // window where old and new both deliver is deduped by event id.\n const previous = [...inflightControllers];\n if (!keepPrevious) {\n for (const c of previous) {\n try { c.abort(); } catch { /* noop */ }\n }\n inflightControllers.clear();\n }\n\n const params = new URLSearchParams();\n for (const ch of globalChannels) {\n params.append('channel', ch);\n }\n if (activeScope && scopedChannels.size > 0) {\n params.append('scope', activeScope);\n for (const ch of scopedChannels) {\n params.append('scoped', ch);\n }\n }\n const url = `${baseUrl}/bus/subscribe?${params.toString()}`;\n\n const controller = new AbortController();\n inflightControllers.add(controller);\n\n try {\n const headers: Record<string, string> = { Authorization: `Bearer ${getToken()}` };\n if (lastEventId) headers['Last-Event-ID'] = lastEventId;\n const response = await fetch(url, { headers, signal: controller.signal });\n\n if (!response.ok || !response.body) {\n throw new Error(`SSE connect failed: ${response.status}`);\n }\n\n // Stopped/disposed while the fetch was in flight — don't proceed to open\n // (and retire the old connection on) a stream we've been told to tear\n // down. `stop()`/`dispose()` already aborted this controller.\n if (!running) return;\n\n // Make-before-break handoff: the new connection is established (the\n // backend has subscribed it and any `Last-Event-ID` replay is flowing),\n // so NOW retire the previous connection(s). Aborting only after the new\n // fetch resolves is what closes the reconnect gap — an event in flight\n // on the old connection during a scope change is delivered, not dropped\n // (#847). A live event delivered by both during the overlap is deduped\n // by id in the read loop below. Had the fetch failed, we'd have thrown\n // above and never reached here, leaving the old connection live (no gap).\n if (keepPrevious) {\n for (const c of previous) {\n try { c.abort(); } catch { /* noop */ }\n inflightControllers.delete(c);\n }\n }\n\n transition('open');\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n // SSE parse state is declared OUTSIDE the read loop: a single\n // event can span many `reader.read()` chunks when the payload is\n // large (a full resource-result with annotations can easily exceed\n // one TCP segment). Resetting these on every read would silently\n // drop any event whose `event:`/`id:` headers land in one chunk\n // and whose terminating blank line lands in the next.\n let currentEvent = '';\n let currentData = '';\n let currentId: string | undefined;\n\n while (running && inflightControllers.has(controller)) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('event: ')) {\n currentEvent = line.slice(7);\n } else if (line.startsWith('data: ')) {\n currentData = line.slice(6);\n } else if (line.startsWith('id: ')) {\n currentId = line.slice(4);\n } else if (line === '') {\n // Skip an overlap duplicate — the same stable-id event delivered\n // by both the old and new connection during a make-before-break\n // handoff (#847). Ephemeral ids are unique per connection, so this\n // never spuriously drops a distinct event.\n const isDuplicate = currentId !== undefined && seenEventIds.has(currentId);\n if (currentEvent === 'bus-event' && currentData && !isDuplicate) {\n if (currentId !== undefined) {\n lastEventId = currentId;\n rememberEventId(currentId);\n }\n const parsed = JSON.parse(currentData) as BusEvent;\n busLog('RECV', parsed.channel, parsed.payload, parsed.scope);\n // Tier 2: lift trace context off the SSE payload (the\n // backend's writeBusEvent puts it there). The synchronous\n // fan-out to subscribers happens inside the bus.recv span,\n // so handlers see the parent trace.\n const carrier = extractTraceparent(\n parsed.payload as Record<string, unknown>,\n );\n await withTraceparent(carrier, () =>\n withSpan(\n `bus.recv:${parsed.channel}`,\n () => { events$.next(parsed); },\n {\n kind: SpanKind.CONSUMER,\n attrs: {\n 'bus.channel': parsed.channel,\n ...(parsed.scope ? { 'bus.scope': parsed.scope } : {}),\n },\n },\n ),\n );\n }\n currentEvent = '';\n currentData = '';\n currentId = undefined;\n }\n }\n }\n } catch (err) {\n if ((err as Error).name === 'AbortError') return;\n // Any non-abort error falls through to the reconnect-retry block.\n } finally {\n inflightControllers.delete(controller);\n }\n\n // If we reached here without an AbortError, the connection dropped\n // or the fetch failed. Transition to reconnecting and schedule a\n // retry after `reconnectMs`.\n if (running) {\n transition('reconnecting');\n reconnectTimer = setTimeout(() => {\n if (running) connect();\n }, reconnectMs);\n }\n };\n\n const reconnect = () => {\n if (!running) return;\n // Transition to `reconnecting` BEFORE aborting the current\n // connection. This matches the pre-state-machine contract where\n // gap-detection relied on seeing a \"dropped\" signal before a\n // subsequent \"connected\" signal; with the state machine, the\n // transition sequence `open → reconnecting → connecting → open`\n // is what BrowseNamespace's gap-detection (pre-BUS-RESUMPTION\n // code path) watches for.\n if (currentState === 'open' || currentState === 'connecting' || currentState === 'degraded') {\n transition('reconnecting');\n }\n // Make-before-break: do NOT abort the live connection here. Cancel only a\n // pending drop-recovery retry, then connect — `connect(keepPrevious=true)`\n // retires the old connection after the new one is open (no gap).\n if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }\n connect(true);\n };\n\n // Debounce channel-set-change reconnects. React StrictMode in dev\n // produces mount → cleanup → mount synchronously, which previously\n // translated into three back-to-back reconnects — enough to tear down\n // in-flight responses, fire gap detection, refetch, tear that down\n // again, and leave the page stuck in \"Loading...\" while caches\n // thrashed. With a short debounce the whole sequence collapses into\n // one reconnect after the final channel-set is stable.\n let reconnectTimer2: ReturnType<typeof setTimeout> | null = null;\n const RECONNECT_DEBOUNCE_MS = 100;\n const scheduleReconnect = () => {\n if (reconnectTimer2) clearTimeout(reconnectTimer2);\n reconnectTimer2 = setTimeout(() => {\n reconnectTimer2 = null;\n reconnect();\n }, RECONNECT_DEBOUNCE_MS);\n };\n\n return {\n on$<T = Record<string, unknown>>(channel: string): Observable<T> {\n return shared$.pipe(\n filter((e) => e.channel === channel),\n map((e) => e.payload as T),\n );\n },\n\n emit: async (channel: string, payload: Record<string, unknown>, emitScope?: string): Promise<void> => {\n // EMIT logging + bus.emit span live at the transport contract layer\n // (`HttpTransport.emit`). ActorStateUnit is plumbing. We do propagate the\n // active span's W3C traceparent on the outbound POST so the backend\n // can stitch the bus.dispatch server span as a child.\n const body: Record<string, unknown> = { channel, payload };\n if (emitScope) body.scope = emitScope;\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${getToken()}`,\n };\n const trace = getActiveTraceparent();\n if (trace) {\n headers['traceparent'] = trace.traceparent;\n if (trace.tracestate) headers['tracestate'] = trace.tracestate;\n }\n await fetch(`${baseUrl}/bus/emit`, {\n method: 'POST',\n headers,\n body: JSON.stringify(body),\n });\n },\n\n state$: state$.asObservable(),\n\n addChannels: (channels: string[], scope?: string) => {\n let changed = false;\n if (scope !== undefined) {\n for (const ch of channels) {\n if (!scopedChannels.has(ch)) { scopedChannels.add(ch); changed = true; }\n }\n if (scope !== activeScope) { activeScope = scope; changed = true; }\n } else {\n for (const ch of channels) {\n if (!globalChannels.has(ch)) { globalChannels.add(ch); changed = true; }\n }\n }\n if (changed) scheduleReconnect();\n },\n\n removeChannels: (channels: string[]) => {\n let changed = false;\n for (const ch of channels) {\n if (scopedChannels.delete(ch)) changed = true;\n if (globalChannels.delete(ch)) changed = true;\n }\n if (scopedChannels.size === 0) activeScope = undefined;\n if (changed) scheduleReconnect();\n },\n\n start: () => {\n if (running) return;\n running = true;\n connect();\n },\n\n stop: () => {\n running = false;\n if (currentState !== 'closed') transition('closed');\n if (reconnectTimer2) { clearTimeout(reconnectTimer2); reconnectTimer2 = null; }\n if (degradedTimer) { clearTimeout(degradedTimer); degradedTimer = null; }\n disconnect();\n },\n\n dispose: () => {\n running = false;\n if (currentState !== 'closed') transition('closed');\n if (reconnectTimer2) { clearTimeout(reconnectTimer2); reconnectTimer2 = null; }\n if (degradedTimer) { clearTimeout(degradedTimer); degradedTimer = null; }\n disconnect();\n events$.complete();\n state$.complete();\n },\n };\n}\n","/**\n * HttpTransport — the HTTP/SSE implementation of ITransport.\n *\n * Phase 1 of TRANSPORT-ABSTRACTION. Owns everything that crosses the wire\n * in remote mode: the bus actor (SSE + POST /bus/emit), auth/admin/exchange/\n * system HTTP endpoints, and connection-state plumbing.\n *\n * Does NOT own the local coordination bus — that lives on `SemiontClient`.\n * `bridgeInto(bus)` wires SSE-received events into the caller-supplied bus\n * once at construction.\n */\n\nimport ky, { HTTPError, type KyInstance } from 'ky';\nimport { BehaviorSubject, Observable, Subject, type Subscription } from 'rxjs';\nimport type {\n AccessToken,\n BaseUrl,\n Email,\n EventBus,\n EventMap,\n GoogleCredential,\n Logger,\n RefreshToken,\n ResourceId,\n UserDID,\n components,\n} from '@semiont/core';\nimport {\n PERSISTED_EVENT_TYPES,\n RESOURCE_BROADCAST_TYPES,\n SemiontError,\n busLog,\n} from '@semiont/core';\nimport type { TransportErrorCode } from '@semiont/core';\nimport { SpanKind, recordBusEmit, withSpan } from '@semiont/observability';\nimport { createActorStateUnit, type ActorStateUnit } from './actor-state-unit';\nimport type {\n BackendDownload,\n ConnectionState,\n IBackendOperations,\n ITransport,\n HealthCheckResponse,\n StatusResponse,\n UserResponse,\n UpdateUserRequest,\n UpdateUserResponse,\n ListUsersResponse,\n ProgressEvent,\n} from '@semiont/core';\nimport { BRIDGED_CHANNELS } from '@semiont/core';\n\ntype AuthResponse = components['schemas']['AuthResponse'];\ntype TokenRefreshResponse = components['schemas']['TokenRefreshResponse'];\ntype AdminUserStatsResponse = components['schemas']['AdminUserStatsResponse'];\ntype OAuthConfigResponse = components['schemas']['OAuthConfigResponse'];\n\n// ── Channel constants (mirror client.ts) ────────────────────────────────\n\nconst RESOURCE_SCOPED_CHANNELS = [\n ...PERSISTED_EVENT_TYPES.filter((t) => t !== 'frame:entity-type-added'),\n ...RESOURCE_BROADCAST_TYPES,\n];\n\n/**\n * Convert a fetch `Response` to the transport-neutral `BackendDownload`\n * shape. ky throws on non-OK by default, so callers can rely on the\n * response being healthy by the time it gets here. `response.body`\n * is non-null for successful responses with content.\n */\nfunction responseToDownload(response: Response): BackendDownload {\n const contentType = response.headers.get('Content-Type') ?? 'application/octet-stream';\n const contentDisposition = response.headers.get('Content-Disposition');\n const filename = contentDisposition?.match(/filename=\"(.+?)\"/)?.[1];\n return {\n stream: response.body!,\n contentType,\n ...(filename ? { filename } : {}),\n };\n}\n\nfunction classifyApiCode(status: number): TransportErrorCode {\n if (status === 400) return 'bad-request';\n if (status === 401) return 'unauthorized';\n if (status === 403) return 'forbidden';\n if (status === 404) return 'not-found';\n if (status === 409) return 'conflict';\n if (status >= 500) return 'unavailable';\n return 'error';\n}\n\nexport class APIError extends SemiontError {\n declare code: TransportErrorCode;\n readonly status: number;\n readonly statusText: string;\n\n constructor(message: string, status: number, statusText: string, body?: unknown) {\n super(message, classifyApiCode(status), { status, statusText, body });\n this.name = 'APIError';\n this.status = status;\n this.statusText = statusText;\n }\n}\n\nexport type TokenRefresher = () => Promise<string | null>;\n\nexport interface HttpTransportConfig {\n baseUrl: BaseUrl;\n /** Observable token source; headers read the current value. */\n token$?: BehaviorSubject<AccessToken | null>;\n timeout?: number;\n retry?: number;\n logger?: Logger;\n /** Optional 401-recovery hook. See {@link TokenRefresher}. */\n tokenRefresher?: TokenRefresher;\n}\n\nexport class HttpTransport implements ITransport, IBackendOperations {\n readonly baseUrl: BaseUrl;\n private readonly http: KyInstance;\n private readonly token$: BehaviorSubject<AccessToken | null>;\n private readonly logger?: Logger;\n private readonly errorsSubject: Subject<SemiontError> = new Subject<SemiontError>();\n /**\n * Stream of `APIError` instances surfaced from any HTTP request just\n * before the transport throws to the caller. Satisfies the `ITransport`\n * `errors$` contract — see `@semiont/core/transport.ts`.\n */\n readonly errors$: Observable<SemiontError> = this.errorsSubject.asObservable();\n\n private _actor: ActorStateUnit | null = null;\n private _actorStarted = false;\n private disposed = false;\n\n private activeResource: {\n resourceId: ResourceId;\n refCount: number;\n bridgeSubs: Subscription[];\n } | null = null;\n\n /** Buses we've been asked to bridge wire events into. */\n private readonly bridges: EventBus[] = [];\n\n constructor(config: HttpTransportConfig) {\n const { baseUrl, timeout = 30000, retry = 2, logger, tokenRefresher } = config;\n\n this.baseUrl = (baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl) as BaseUrl;\n this.token$ = config.token$ ?? new BehaviorSubject<AccessToken | null>(null);\n this.logger = logger;\n\n // Retry policy: when a refresher is configured, expand retry to also\n // cover 401 (one attempt). Otherwise use the plain `retry` number.\n const retryConfig = tokenRefresher\n ? {\n limit: 1,\n methods: ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'],\n statusCodes: [401, 408, 413, 429, 500, 502, 503, 504],\n }\n : retry;\n\n this.http = ky.create({\n timeout,\n retry: retryConfig,\n credentials: 'include',\n hooks: {\n beforeRequest: [\n ({ request }) => {\n if (this.logger) {\n this.logger.debug('HTTP Request', {\n type: 'http_request',\n url: request.url,\n method: request.method,\n timestamp: Date.now(),\n hasAuth: request.headers.has('Authorization'),\n });\n }\n },\n ],\n beforeRetry: tokenRefresher\n ? [\n async ({ request, error }) => {\n if (!(error instanceof HTTPError) || error.response.status !== 401) {\n return undefined;\n }\n try {\n const newToken = await tokenRefresher();\n if (!newToken) return ky.stop;\n request.headers.set('Authorization', `Bearer ${newToken}`);\n return undefined;\n } catch {\n return ky.stop;\n }\n },\n ]\n : [],\n afterResponse: [\n ({ request, response }) => {\n if (this.logger) {\n this.logger.debug('HTTP Response', {\n type: 'http_response',\n url: request.url,\n method: request.method,\n status: response.status,\n statusText: response.statusText,\n });\n }\n return response;\n },\n ],\n beforeError: [\n async ({ request, error }) => {\n const response = error instanceof HTTPError ? error.response : undefined;\n if (response) {\n const body = await response.json().catch(() => ({})) as { message?: string };\n if (this.logger) {\n this.logger.error('HTTP Request Failed', {\n type: 'http_error',\n url: request.url,\n method: request.method,\n status: response.status,\n statusText: response.statusText,\n error: body.message || `HTTP ${response.status}: ${response.statusText}`,\n });\n }\n const apiError = new APIError(\n body.message || `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n body,\n );\n this.errorsSubject.next(apiError);\n throw apiError;\n }\n return error;\n },\n ],\n },\n });\n\n // Auto-start the bus actor once a token arrives.\n this.token$.subscribe((token) => {\n if (token && !this._actorStarted && !this.disposed) {\n this._actorStarted = true;\n this.actor.start();\n }\n });\n }\n\n // ── Lazy actor construction + per-channel fan-in to bridges ───────────\n //\n // `actor` is exposed so the legacy `SemiontClient` can keep `.actor`\n // pointing at the same ActorStateUnit during the transport-abstraction\n // migration. Once SemiontClient is removed, this should be made\n // private again — external callers should use emit/on/stream/state$.\n\n get actor(): ActorStateUnit {\n if (!this._actor) {\n this._actor = createActorStateUnit({\n baseUrl: this.baseUrl,\n token: () => this.token$.getValue() ?? '',\n channels: [...BRIDGED_CHANNELS],\n });\n for (const channel of BRIDGED_CHANNELS) {\n this._actor.on$<Record<string, unknown>>(channel).subscribe((payload) => {\n for (const bus of this.bridges) {\n (bus.get(channel as keyof EventMap) as { next(v: unknown): void }).next(payload);\n }\n });\n }\n }\n return this._actor;\n }\n\n // ── ITransport — bus primitives ───────────────────────────────────────\n\n async emit<K extends keyof EventMap>(\n channel: K,\n payload: EventMap[K],\n resourceScope?: ResourceId,\n ): Promise<void> {\n busLog('EMIT', channel as string, payload, resourceScope as string | undefined);\n recordBusEmit(channel as string, resourceScope as string | undefined);\n await withSpan(\n `bus.emit:${channel as string}`,\n async () => {\n if (resourceScope !== undefined) {\n await this.actor.emit(\n channel as string,\n payload as unknown as Record<string, unknown>,\n resourceScope as string,\n );\n } else {\n await this.actor.emit(\n channel as string,\n payload as unknown as Record<string, unknown>,\n );\n }\n },\n {\n kind: SpanKind.PRODUCER,\n attrs: {\n 'bus.channel': channel as string,\n ...(resourceScope ? { 'bus.scope': resourceScope as string } : {}),\n },\n },\n );\n }\n\n on<K extends keyof EventMap>(\n channel: K,\n handler: (payload: EventMap[K]) => void,\n ): () => void {\n const sub = this.actor.on$<EventMap[K]>(channel as string).subscribe(handler);\n return () => sub.unsubscribe();\n }\n\n stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]> {\n return this.actor.on$<EventMap[K]>(channel as string);\n }\n\n /**\n * Wire this transport's SSE fan-in into the given bus. Every channel\n * in `BRIDGED_CHANNELS` (and subsequently per-resource scoped channels\n * opened by `subscribeToResource`) is published on the bus. Safe to\n * call multiple times — each bus is added to the fan-out list.\n */\n bridgeInto(bus: EventBus): void {\n this.bridges.push(bus);\n }\n\n subscribeToResource(resourceId: ResourceId): () => void {\n if (this.activeResource) {\n if (this.activeResource.resourceId !== resourceId) {\n throw new Error(\n `HttpTransport already subscribed to resource ${this.activeResource.resourceId}; ` +\n `call the unsubscribe returned from the previous subscribeToResource before subscribing to ${resourceId}.`,\n );\n }\n this.activeResource.refCount++;\n return this.makeUnsubscriber();\n }\n\n this.actor.addChannels([...RESOURCE_SCOPED_CHANNELS], resourceId as string);\n\n const bridgeSubs: Subscription[] = [];\n for (const channel of RESOURCE_SCOPED_CHANNELS) {\n bridgeSubs.push(\n this.actor.on$<Record<string, unknown>>(channel).subscribe((payload) => {\n for (const bus of this.bridges) {\n (bus.get(channel as keyof EventMap) as { next(v: unknown): void }).next(payload);\n }\n }),\n );\n }\n\n this.activeResource = { resourceId, refCount: 1, bridgeSubs };\n return this.makeUnsubscriber();\n }\n\n private makeUnsubscriber(): () => void {\n let called = false;\n return () => {\n if (called) return;\n called = true;\n if (!this.activeResource) return;\n this.activeResource.refCount--;\n if (this.activeResource.refCount > 0) return;\n for (const sub of this.activeResource.bridgeSubs) sub.unsubscribe();\n this.actor.removeChannels([...RESOURCE_SCOPED_CHANNELS]);\n this.activeResource = null;\n };\n }\n\n get state$(): Observable<ConnectionState> {\n return this.actor.state$;\n }\n\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n if (this.activeResource) {\n for (const sub of this.activeResource.bridgeSubs) sub.unsubscribe();\n this.activeResource = null;\n }\n if (this._actor) {\n this._actor.dispose();\n this._actor = null;\n }\n this.errorsSubject.complete();\n }\n\n /**\n * Route a transport-level error onto `errors$`. Used by sibling adapters\n * (e.g. `HttpContentTransport`'s XHR upload path) that don't go through\n * the `ky` `beforeError` hook and need to surface failures on the same\n * stream the rest of the transport publishes to.\n */\n pushError(error: SemiontError): void {\n if (this.disposed) return;\n this.errorsSubject.next(error);\n }\n\n // ── Auth ──────────────────────────────────────────────────────────────\n\n private authHeaders(): Record<string, string> {\n const token = this.token$.getValue() ?? undefined;\n return token ? { Authorization: `Bearer ${token}` } : {};\n }\n\n async authenticatePassword(email: Email, password: string): Promise<AuthResponse> {\n return this.http.post(`${this.baseUrl}/api/tokens/password`, {\n json: { email, password },\n headers: this.authHeaders(),\n }).json();\n }\n\n async authenticateGoogle(credential: GoogleCredential): Promise<AuthResponse> {\n return this.http.post(`${this.baseUrl}/api/tokens/google`, {\n json: { credential },\n headers: this.authHeaders(),\n }).json();\n }\n\n async refreshAccessToken(token: RefreshToken): Promise<TokenRefreshResponse> {\n return this.http.post(`${this.baseUrl}/api/tokens/refresh`, {\n json: { refreshToken: token },\n headers: this.authHeaders(),\n }).json();\n }\n\n async logout(): Promise<void> {\n await this.http.post(`${this.baseUrl}/api/users/logout`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n async acceptTerms(): Promise<void> {\n await this.http.post(`${this.baseUrl}/api/users/accept-terms`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n async getCurrentUser(): Promise<UserResponse> {\n return this.http.get(`${this.baseUrl}/api/users/me`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n async generateMcpToken(): Promise<{ token: string }> {\n return this.http.post(`${this.baseUrl}/api/tokens/mcp-generate`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n async getMediaToken(resourceId: ResourceId): Promise<{ token: string }> {\n return this.http.post(`${this.baseUrl}/api/tokens/media`, {\n json: { resourceId },\n headers: this.authHeaders(),\n }).json();\n }\n\n // ── Admin ─────────────────────────────────────────────────────────────\n\n async listUsers(): Promise<ListUsersResponse> {\n return this.http.get(`${this.baseUrl}/api/admin/users`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n async getUserStats(): Promise<AdminUserStatsResponse> {\n return this.http.get(`${this.baseUrl}/api/admin/users/stats`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n async updateUser(id: UserDID, data: UpdateUserRequest): Promise<UpdateUserResponse> {\n return this.http.patch(`${this.baseUrl}/api/admin/users/${id}`, {\n json: data,\n headers: this.authHeaders(),\n }).json();\n }\n\n async getOAuthConfig(): Promise<OAuthConfigResponse> {\n return this.http.get(`${this.baseUrl}/api/admin/oauth/config`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n // ── Exchange (backup/restore/export/import) ───────────────────────────\n\n async backupKnowledgeBase(): Promise<BackendDownload> {\n const response = await this.http.post(`${this.baseUrl}/api/admin/exchange/backup`, {\n headers: this.authHeaders(),\n });\n return responseToDownload(response);\n }\n\n restoreKnowledgeBase(file: File): Observable<ProgressEvent> {\n return this.sseProgressStream(`${this.baseUrl}/api/admin/exchange/restore`, file);\n }\n\n async exportKnowledgeBase(params?: { includeArchived?: boolean }): Promise<BackendDownload> {\n const searchParams = params?.includeArchived ? new URLSearchParams({ includeArchived: 'true' }) : undefined;\n const response = await this.http.post(`${this.baseUrl}/api/moderate/exchange/export`, {\n headers: this.authHeaders(),\n ...(searchParams ? { searchParams } : {}),\n });\n return responseToDownload(response);\n }\n\n importKnowledgeBase(file: File): Observable<ProgressEvent> {\n return this.sseProgressStream(`${this.baseUrl}/api/moderate/exchange/import`, file);\n }\n\n /**\n * POST a file to a server-sent-events endpoint and surface each `data:`\n * frame as an Observable emission. Completes when the stream closes;\n * errors if the request itself fails or the SSE stream is aborted.\n * The returned Observable is cold — the POST happens on subscribe and\n * is aborted via `AbortController` on unsubscribe.\n */\n private sseProgressStream(url: string, file: File): Observable<ProgressEvent> {\n return new Observable<ProgressEvent>((subscriber) => {\n const ctrl = new AbortController();\n const formData = new FormData();\n formData.append('file', file);\n\n (async () => {\n try {\n const response = await this.http.post(url, {\n body: formData,\n headers: this.authHeaders(),\n signal: ctrl.signal,\n });\n const reader = response.body!.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (!subscriber.closed) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop()!;\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n const event = JSON.parse(line.slice(6)) as ProgressEvent;\n subscriber.next(event);\n }\n }\n }\n subscriber.complete();\n } catch (err) {\n if (!subscriber.closed) subscriber.error(err);\n }\n })();\n\n return () => ctrl.abort();\n });\n }\n\n // ── System status ─────────────────────────────────────────────────────\n\n async healthCheck(): Promise<HealthCheckResponse> {\n return this.http.get(`${this.baseUrl}/api/health`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n async getStatus(): Promise<StatusResponse> {\n return this.http.get(`${this.baseUrl}/api/status`, {\n headers: this.authHeaders(),\n }).json();\n }\n\n // ── Internal: ky accessor for legacy passthroughs (temporary) ─────────\n\n /**\n * Temporary escape hatch for the ongoing transport migration: namespaces\n * that still need to issue ad-hoc HTTP calls (e.g. legacy browse/mark\n * HTTP fallbacks) can borrow the configured `ky` instance here. Will be\n * deleted once all namespaces route through bus channels or through\n * typed methods on this transport.\n */\n get rawHttp(): KyInstance {\n return this.http;\n }\n\n /**\n * Current access token (synchronously read from the BehaviorSubject).\n * Used by content-transport and legacy namespace HTTP fallbacks that\n * need to pass `auth: token` through some code paths.\n */\n getToken(): AccessToken | undefined {\n return this.token$.getValue() ?? undefined;\n }\n}\n\n// Re-export for convenience\nexport type { ConnectionState } from '@semiont/core';\n","/**\n * HttpContentTransport — binary I/O over HTTP.\n *\n * Phase 1 of TRANSPORT-ABSTRACTION. Narrow by design because binary has\n * different backpressure and streaming characteristics than typed command\n * payloads. Uses the HttpTransport's underlying ky instance + token, so\n * retries, logging, and auth behave identically to the rest of the wire.\n *\n * Two `putBinary` paths live side by side, selected by runtime\n * environment + caller intent:\n * - **ky path (default + Node)** — the original `ky.post(...)` path.\n * Keeps retry-with-refresh, beforeError → APIError, observability\n * spans intact. Hits when no `onProgress`/`signal` is passed, OR\n * when `XMLHttpRequest` isn't available in the runtime (Node\n * workers, the CLI). On Node-side `signal`-aborts: the in-flight\n * `fetch` continues in the background and the `cancelled` flag in\n * `yield.resource` suppresses the resolve/reject callbacks.\n * - **XHR path (browsers with `onProgress` or `signal`)** — hand-rolled\n * because `ky` wraps `fetch` which can't observe upload byte-\n * progress today (`Request({ duplex: 'half' })` is the long-term\n * direction; not yet widely available across the webviews this\n * codepath needs to run in). Threads auth + traceparent headers,\n * emits `onProgress` from `xhr.upload.onprogress`, supports\n * cancellation via the `signal` option (calling `xhr.abort()`),\n * and routes failures onto the same `transport.errors$` stream\n * the ky path uses.\n *\n * The runtime check on `XMLHttpRequest` is the load-bearing seam: a\n * Node worker calling `client.yield.resource(...)` (which always passes\n * a `signal` for unsubscribe-aborts) must NOT take the XHR path —\n * `XMLHttpRequest` is undefined and the upload throws synchronously.\n * Browsers always have it; Node does not.\n *\n * v1 limitation: the XHR path does NOT auto-refresh on 401. Mitigation:\n * the session's proactive refresh fires before token expiry, so an\n * upload that *starts* with a fresh token usually completes. An upload\n * spanning the narrow window between expiry and proactive-refresh would\n * fail; the existing `errors$` → modal path surfaces it as session-\n * expired. If retry-with-refresh on the upload path becomes a real\n * complaint, wire a manual retry loop here that reads `token$` afresh.\n */\n\nimport type { AccessToken, ResourceId, PutBinaryOptions, components } from '@semiont/core';\nimport { busLog } from '@semiont/core';\nimport { SpanKind, getActiveTraceparent, withSpan } from '@semiont/observability';\nimport type { HttpTransport } from './http-transport';\nimport { APIError } from './http-transport';\nimport type { IContentTransport, PutBinaryRequest } from '@semiont/core';\n\ntype GetResourceResponse = components['schemas']['GetResourceResponse'];\n\nexport class HttpContentTransport implements IContentTransport {\n constructor(private readonly transport: HttpTransport) {}\n\n async putBinary(\n request: PutBinaryRequest,\n options?: PutBinaryOptions,\n ): Promise<{ resourceId: ResourceId }> {\n const sizeBytes = request.file instanceof File ? request.file.size : request.file.length;\n busLog('PUT', 'content', {\n name: request.name,\n format: request.format,\n storageUri: request.storageUri,\n sizeBytes,\n });\n return withSpan(\n 'content.put',\n async () => {\n const formData = buildFormData(request);\n const headers = this.requestHeaders(options?.auth);\n\n // Branch on caller intent AND runtime support. The ky path is\n // the well-trodden default; the XHR path lights up only when a\n // caller wants byte progress or cancellation AND the runtime\n // has `XMLHttpRequest` (browsers do; Node does not). Without\n // the runtime guard, every Node-side `yield.resource(...)`\n // call (which always passes `signal`) would throw\n // `XMLHttpRequest is not defined`.\n const xhrAvailable = typeof XMLHttpRequest !== 'undefined';\n if (xhrAvailable && (options?.onProgress || options?.signal)) {\n return uploadViaXhr({\n url: `${this.transport.baseUrl}/resources`,\n formData,\n headers,\n onProgress: options.onProgress,\n signal: options.signal,\n onApiError: (err) => this.transport.pushError(err),\n });\n }\n\n const result = await this.transport.rawHttp\n .post(`${this.transport.baseUrl}/resources`, {\n body: formData,\n headers,\n })\n .json<{ resourceId: string }>();\n\n return { resourceId: result.resourceId as ResourceId };\n },\n {\n kind: SpanKind.CLIENT,\n attrs: {\n 'content.format': request.format,\n 'content.size_bytes': sizeBytes,\n },\n },\n );\n }\n\n async getBinary(\n resourceId: ResourceId,\n options?: { auth?: AccessToken },\n ): Promise<{ data: ArrayBuffer; contentType: string }> {\n busLog('GET', 'content', { resourceId });\n return withSpan(\n 'content.get',\n async () => {\n // Pure pipe: no Accept header — the route serves the stored bytes\n // verbatim with their real Content-Type (SIMPLER-JSON-LD.md).\n const response = await this.transport.rawHttp.get(`${this.transport.baseUrl}/resources/${resourceId}`, {\n headers: this.requestHeaders(options?.auth),\n });\n const contentType = response.headers.get('content-type') || 'application/octet-stream';\n const data = await response.arrayBuffer();\n return { data, contentType };\n },\n { kind: SpanKind.CLIENT, attrs: { 'resource.id': resourceId as unknown as string } },\n );\n }\n\n async getBinaryStream(\n resourceId: ResourceId,\n options?: { auth?: AccessToken },\n ): Promise<{ stream: ReadableStream<Uint8Array>; contentType: string }> {\n busLog('GET', 'content', { resourceId, stream: true });\n return withSpan(\n 'content.get',\n async () => {\n // Pure pipe: no Accept header (see getBinary).\n const response = await this.transport.rawHttp.get(`${this.transport.baseUrl}/resources/${resourceId}`, {\n headers: this.requestHeaders(options?.auth),\n });\n const contentType = response.headers.get('content-type') || 'application/octet-stream';\n if (!response.body) {\n throw new Error('Response body is null - cannot create stream');\n }\n return { stream: response.body, contentType };\n },\n {\n kind: SpanKind.CLIENT,\n attrs: { 'resource.id': resourceId as unknown as string, 'content.stream': true },\n },\n );\n }\n\n /**\n * Dereference the resource's JSON-LD graph over HTTP — the LD face an\n * external linked-data client sees. Deliberately HTTP, not the bus\n * (SIMPLER-JSON-LD.md §5).\n */\n async getResourceGraph(\n resourceId: ResourceId,\n options?: { auth?: AccessToken },\n ): Promise<GetResourceResponse> {\n busLog('GET', 'content', { resourceId, graph: true });\n return withSpan(\n 'content.get_graph',\n () =>\n this.transport.rawHttp\n .get(`${this.transport.baseUrl}/resources/${resourceId}/jsonld`, {\n headers: this.requestHeaders(options?.auth),\n })\n .json<GetResourceResponse>(),\n { kind: SpanKind.CLIENT, attrs: { 'resource.id': resourceId as unknown as string, 'content.graph': true } },\n );\n }\n\n dispose(): void {\n // HttpContentTransport has no resources of its own; HttpTransport owns\n // the ky instance and token subject. No-op is correct here.\n }\n\n /** Auth header + W3C trace propagation for the active span. */\n private requestHeaders(override?: AccessToken): Record<string, string> {\n const token = override ?? this.transport.getToken();\n const headers: Record<string, string> = token ? { Authorization: `Bearer ${token}` } : {};\n const trace = getActiveTraceparent();\n if (trace) {\n headers['traceparent'] = trace.traceparent;\n if (trace.tracestate) headers['tracestate'] = trace.tracestate;\n }\n return headers;\n }\n}\n\nfunction buildFormData(request: PutBinaryRequest): FormData {\n const formData = new FormData();\n formData.append('name', request.name);\n formData.append('format', request.format);\n formData.append('storageUri', request.storageUri);\n\n if (request.file instanceof File) {\n formData.append('file', request.file);\n } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(request.file)) {\n // `Buffer` is a Node global; referencing it bare in the browser throws\n // ReferenceError before the isBuffer call. Browser uploads always hit\n // the File branch above; this branch is for Node-side workers.\n const blob = new Blob([new Uint8Array(request.file)], { type: request.format });\n formData.append('file', blob, request.name);\n } else {\n throw new Error('file must be a File or Buffer');\n }\n\n if (request.entityTypes && request.entityTypes.length > 0) {\n formData.append('entityTypes', JSON.stringify(request.entityTypes));\n }\n if (request.language) formData.append('language', request.language);\n if (request.sourceAnnotationId) formData.append('sourceAnnotationId', String(request.sourceAnnotationId));\n if (request.sourceResourceId) formData.append('sourceResourceId', String(request.sourceResourceId));\n if (request.generationPrompt) formData.append('generationPrompt', request.generationPrompt);\n if (request.generator) formData.append('generator', JSON.stringify(request.generator));\n if (request.isDraft !== undefined) formData.append('isDraft', String(request.isDraft));\n\n return formData;\n}\n\ninterface XhrUploadOptions {\n url: string;\n formData: FormData;\n headers: Record<string, string>;\n onProgress?: (event: { bytesUploaded: number; totalBytes: number }) => void;\n signal?: AbortSignal;\n onApiError: (error: APIError) => void;\n}\n\n/**\n * XHR-based POST that exposes `xhr.upload.onprogress` byte counts and\n * supports cancellation via `AbortSignal`. Mirrors the ky path's error\n * shape: 4xx/5xx and network-level failures both surface as `APIError`,\n * and every error is routed onto `transport.errors$` before the promise\n * rejects.\n */\nfunction uploadViaXhr(opts: XhrUploadOptions): Promise<{ resourceId: ResourceId }> {\n const { url, formData, headers, onProgress, signal, onApiError } = opts;\n\n return new Promise((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n\n if (signal?.aborted) {\n const err = new APIError('Upload aborted', 0, 'aborted');\n onApiError(err);\n reject(err);\n return;\n }\n\n xhr.open('POST', url);\n for (const [name, value] of Object.entries(headers)) {\n xhr.setRequestHeader(name, value);\n }\n\n if (onProgress) {\n xhr.upload.onprogress = (e: ProgressEvent) => {\n // `lengthComputable` is true when Content-Length is known. For\n // FormData posts the browser computes it, so this is true in\n // practice; the false branch handles the rare chunked-encoding\n // / gzip-while-uploading case.\n const totalBytes = e.lengthComputable ? e.total : 0;\n onProgress({ bytesUploaded: e.loaded, totalBytes });\n };\n }\n\n xhr.onload = () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n try {\n const body = JSON.parse(xhr.responseText) as { resourceId: string };\n resolve({ resourceId: body.resourceId as ResourceId });\n } catch (parseErr) {\n const err = new APIError(\n `Upload succeeded but response was not valid JSON: ${(parseErr as Error).message}`,\n xhr.status,\n xhr.statusText,\n xhr.responseText,\n );\n onApiError(err);\n reject(err);\n }\n return;\n }\n let body: unknown = xhr.responseText;\n try { body = JSON.parse(xhr.responseText); } catch { /* keep as text */ }\n const message = (body && typeof body === 'object' && 'message' in body && typeof (body as { message: unknown }).message === 'string')\n ? (body as { message: string }).message\n : `HTTP ${xhr.status}: ${xhr.statusText}`;\n const err = new APIError(message, xhr.status, xhr.statusText, body);\n onApiError(err);\n reject(err);\n };\n\n xhr.onerror = () => {\n // Network-level failure (DNS, TCP reset, CORS). XHR doesn't give\n // us a useful status here; classify as `unavailable` via 0 status\n // mapping in classifyApiCode.\n const err = new APIError('Network error during upload', 0, 'network-error');\n onApiError(err);\n reject(err);\n };\n\n xhr.ontimeout = () => {\n const err = new APIError('Upload timed out', 0, 'timeout');\n onApiError(err);\n reject(err);\n };\n\n xhr.onabort = () => {\n // Caller-initiated abort via `signal`. Emit a single APIError so the\n // shape matches the other failure paths; consumers can disambiguate\n // via `signal.aborted` if they need to.\n const err = new APIError('Upload aborted', 0, 'aborted');\n onApiError(err);\n reject(err);\n };\n\n if (signal) {\n const onAbort = () => xhr.abort();\n signal.addEventListener('abort', onAbort, { once: true });\n // No teardown for the listener — once xhr fires onabort/onerror/onload\n // the signal is no longer relevant; the listener is GC'd with the xhr.\n }\n\n xhr.send(formData);\n });\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@semiont/http-transport",
|
|
3
|
+
"version": "0.5.6",
|
|
4
|
+
"description": "HTTP transport adapters for the Semiont SDK",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=24.0.0"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/The-AI-Alliance/semiont.git",
|
|
29
|
+
"directory": "packages/http-transport"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"pretypecheck": "npm run build --workspace=@semiont/core --if-present && npm run build --workspace=@semiont/observability --if-present",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"build": "npm run typecheck && tsup && tsc -p tsconfig.build.json && rollup -c rollup.dts.config.mjs && rm -rf dist-types",
|
|
35
|
+
"watch": "tsup --watch",
|
|
36
|
+
"clean": "rm -rf dist dist-types",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:watch": "vitest",
|
|
39
|
+
"test:coverage": "vitest run --coverage"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@semiont/core": "*",
|
|
43
|
+
"@semiont/observability": "*",
|
|
44
|
+
"ky": "^2.0.2",
|
|
45
|
+
"rxjs": "^7.8.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
49
|
+
"rollup": "^4.61.0",
|
|
50
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
51
|
+
"tsup": "^8.5.1",
|
|
52
|
+
"typescript": "^6.0.2",
|
|
53
|
+
"vitest": "^4.1.8"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"semiont",
|
|
57
|
+
"http",
|
|
58
|
+
"transport",
|
|
59
|
+
"sse",
|
|
60
|
+
"sdk"
|
|
61
|
+
],
|
|
62
|
+
"author": "Semiont Team",
|
|
63
|
+
"license": "Apache-2.0"
|
|
64
|
+
}
|