@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
28 lines • 1.26 kB
JavaScript
/**
* The `@adonis-agora/media` diagnostics contract this bridge reads, re-declared here so the
* integration couples to the *wire contract* (the `agora:media:*` channel) rather than importing the
* media package — `@adonis-agora/media` stays an OPTIONAL, structurally-typed peer. Keep these mirrors
* in sync with that library's core `diagnostics.ts` (`UploadCompletePayload`).
*/
/** The channel a media library publishes `upload.complete` on: `agora:media:upload.complete`. */
export const UPLOAD_COMPLETE_CHANNEL = 'agora:media:upload.complete';
/** Pull `.payload` off a diagnostics-channel message without an unguarded cast. */
export function envelopePayload(message) {
if (typeof message === 'object' && message !== null && 'payload' in message) {
return message.payload;
}
return undefined;
}
function isNonEmptyString(value) {
return typeof value === 'string' && value.length > 0;
}
export function isUploadCompleteEvent(payload) {
if (typeof payload !== 'object' || payload === null) {
return false;
}
const candidate = payload;
return (isNonEmptyString(candidate.id) &&
isNonEmptyString(candidate.disk) &&
isNonEmptyString(candidate.key));
}
//# sourceMappingURL=media-events.js.map