@shadowob/shared
Advanced tools
| // src/types/inbox.types.ts | ||
| var BUDDY_INBOX_TOPIC_PREFIX = "shadow:buddy-inbox:"; | ||
| var BUDDY_INBOX_DELIVERY_PERMISSION = "buddy_inbox:deliver"; | ||
| var BUDDY_INBOX_PLATFORM_PERMISSIONS = [BUDDY_INBOX_DELIVERY_PERMISSION]; | ||
| function isBuddyInboxPlatformPermission(value) { | ||
| return typeof value === "string" && BUDDY_INBOX_PLATFORM_PERMISSIONS.includes(value); | ||
| } | ||
| function buddyInboxTopic(agentId) { | ||
| return `${BUDDY_INBOX_TOPIC_PREFIX}${agentId}`; | ||
| } | ||
| function parseBuddyInboxAgentId(topic) { | ||
| if (!topic?.startsWith(BUDDY_INBOX_TOPIC_PREFIX)) return null; | ||
| const agentId = topic.slice(BUDDY_INBOX_TOPIC_PREFIX.length).trim(); | ||
| return agentId || null; | ||
| } | ||
| function isBuddyInboxTopic(topic) { | ||
| return parseBuddyInboxAgentId(topic) !== null; | ||
| } | ||
| var TASK_MESSAGE_CARD_STATUSES = [ | ||
| "queued", | ||
| "claimed", | ||
| "running", | ||
| "completed", | ||
| "failed", | ||
| "canceled", | ||
| "transferred" | ||
| ]; | ||
| var TERMINAL_TASK_MESSAGE_CARD_STATUSES = [ | ||
| "completed", | ||
| "failed", | ||
| "canceled", | ||
| "transferred" | ||
| ]; | ||
| var TASK_MESSAGE_CARD_STATUS_TRANSITIONS = { | ||
| queued: ["queued", "claimed", "running", "completed", "failed", "canceled"], | ||
| claimed: ["claimed", "running", "completed", "failed", "canceled"], | ||
| running: ["running", "completed", "failed", "canceled"], | ||
| completed: ["completed"], | ||
| failed: ["failed", "transferred"], | ||
| canceled: ["canceled"], | ||
| transferred: ["transferred"] | ||
| }; | ||
| function isTerminalTaskMessageCardStatus(status) { | ||
| return TERMINAL_TASK_MESSAGE_CARD_STATUSES.includes( | ||
| status | ||
| ); | ||
| } | ||
| function isTaskMessageCardStatus(value) { | ||
| return typeof value === "string" && TASK_MESSAGE_CARD_STATUSES.includes(value); | ||
| } | ||
| function canTransitionTaskMessageCardStatus(from, to) { | ||
| const allowed = TASK_MESSAGE_CARD_STATUS_TRANSITIONS[from]; | ||
| return allowed.includes(to); | ||
| } | ||
| function isRecord(value) { | ||
| return !!value && typeof value === "object" && !Array.isArray(value); | ||
| } | ||
| function isMessageReferenceCard(card) { | ||
| return card?.kind === "message_reference" && typeof card.title === "string" && isRecord(card.target) && typeof card.target.channelId === "string" && typeof card.target.messageId === "string"; | ||
| } | ||
| function getBuddyInboxTaskCards(message) { | ||
| const cards = message.metadata?.cards; | ||
| if (!Array.isArray(cards)) return []; | ||
| return cards.filter( | ||
| (card) => card?.kind === "task" && typeof card.id === "string" && isTaskMessageCardStatus(card.status) | ||
| ); | ||
| } | ||
| function hasBuddyInboxTaskCard(message) { | ||
| return getBuddyInboxTaskCards(message).length > 0; | ||
| } | ||
| function getBuddyInboxTaskStatuses(message) { | ||
| return getBuddyInboxTaskCards(message).map((card) => card.status); | ||
| } | ||
| function buildBuddyInboxViewMessages(messages, options) { | ||
| void options; | ||
| return [...messages]; | ||
| } | ||
| var DEFAULT_BUDDY_INBOX_ADMISSION_POLICY = { | ||
| defaultMode: "allow", | ||
| rules: [] | ||
| }; | ||
| function parseAdmissionMode(value, fallback) { | ||
| if (value === "allow" || value === "deny" || value === "first_time" || value === "every_time") { | ||
| return value; | ||
| } | ||
| if (value === void 0 || value === null) return fallback; | ||
| throw new Error("Invalid Buddy Inbox admission mode"); | ||
| } | ||
| function parseSubjectKind(value) { | ||
| if (value === "user" || value === "agent" || value === "server_app" || value === "system") { | ||
| return value; | ||
| } | ||
| throw new Error("Invalid Buddy Inbox admission subject kind"); | ||
| } | ||
| function parseOptionalString(value, field, maxLength) { | ||
| if (value === void 0 || value === null || value === "") return void 0; | ||
| if (typeof value !== "string" || value.length > maxLength) { | ||
| throw new Error(`Invalid Buddy Inbox admission ${field}`); | ||
| } | ||
| return value; | ||
| } | ||
| function normalizeBuddyInboxAdmissionPolicy(value) { | ||
| if (value === void 0 || value === null) return { ...DEFAULT_BUDDY_INBOX_ADMISSION_POLICY }; | ||
| if (!isRecord(value)) throw new Error("Invalid Buddy Inbox admission policy"); | ||
| const defaultMode = parseAdmissionMode(value.defaultMode, "allow"); | ||
| const rawRules = value.rules; | ||
| if (rawRules !== void 0 && !Array.isArray(rawRules)) { | ||
| throw new Error("Invalid Buddy Inbox admission rules"); | ||
| } | ||
| const rules = (rawRules ?? []).slice(0, 100).map((entry) => { | ||
| if (!isRecord(entry)) throw new Error("Invalid Buddy Inbox admission rule"); | ||
| return { | ||
| subjectKind: parseSubjectKind(entry.subjectKind), | ||
| subjectId: parseOptionalString(entry.subjectId, "subjectId", 160), | ||
| appKey: parseOptionalString(entry.appKey, "appKey", 120), | ||
| mode: parseAdmissionMode(entry.mode, defaultMode), | ||
| ...entry.approved === true ? { approved: true } : {}, | ||
| note: parseOptionalString(entry.note, "note", 500), | ||
| createdAt: parseOptionalString(entry.createdAt, "createdAt", 64), | ||
| updatedAt: parseOptionalString(entry.updatedAt, "updatedAt", 64) | ||
| }; | ||
| }); | ||
| return { defaultMode, rules }; | ||
| } | ||
| function buddyInboxAdmissionRuleKey(rule) { | ||
| return [rule.subjectKind, rule.subjectId ?? "", rule.appKey ?? ""].join(":"); | ||
| } | ||
| function parsePendingTask(value) { | ||
| if (!isRecord(value)) throw new Error("Invalid Buddy Inbox pending task"); | ||
| const title = parseOptionalString(value.title, "task.title", 180); | ||
| if (!title) throw new Error("Invalid Buddy Inbox pending task title"); | ||
| const body = parseOptionalString(value.body, "task.body", 8e3); | ||
| const priority = value.priority; | ||
| if (priority !== void 0 && priority !== "low" && priority !== "normal" && priority !== "medium" && priority !== "high") { | ||
| throw new Error("Invalid Buddy Inbox pending task priority"); | ||
| } | ||
| const idempotencyKey = parseOptionalString(value.idempotencyKey, "task.idempotencyKey", 240); | ||
| const source = isRecord(value.source) ? value.source : void 0; | ||
| const requirements = isRecord(value.requirements) ? value.requirements : void 0; | ||
| const outputContract = isRecord(value.outputContract) ? value.outputContract : void 0; | ||
| const privacy = isRecord(value.privacy) ? value.privacy : void 0; | ||
| const data = isRecord(value.data) ? value.data : void 0; | ||
| return { | ||
| title, | ||
| ...body ? { body } : {}, | ||
| ...priority ? { priority } : {}, | ||
| ...idempotencyKey ? { idempotencyKey } : {}, | ||
| ...source ? { source } : {}, | ||
| ...requirements ? { requirements } : {}, | ||
| ...outputContract ? { outputContract } : {}, | ||
| ...privacy ? { privacy } : {}, | ||
| ...data ? { data } : {} | ||
| }; | ||
| } | ||
| function normalizeBuddyInboxAdmissionPendingDeliveries(value) { | ||
| if (value === void 0 || value === null) return []; | ||
| if (!Array.isArray(value)) throw new Error("Invalid Buddy Inbox pending deliveries"); | ||
| return value.slice(0, 100).map((entry) => { | ||
| if (!isRecord(entry)) throw new Error("Invalid Buddy Inbox pending delivery"); | ||
| const id = parseOptionalString(entry.id, "pending.id", 80); | ||
| const serverId = parseOptionalString(entry.serverId, "pending.serverId", 160); | ||
| const channelId = parseOptionalString(entry.channelId, "pending.channelId", 160); | ||
| const agentId = parseOptionalString(entry.agentId, "pending.agentId", 160); | ||
| const mode = parseAdmissionMode(entry.mode, "first_time"); | ||
| if (mode !== "first_time" && mode !== "every_time") { | ||
| throw new Error("Invalid Buddy Inbox pending mode"); | ||
| } | ||
| if (!isRecord(entry.subject)) throw new Error("Invalid Buddy Inbox pending subject"); | ||
| if (!isRecord(entry.requestedBy)) throw new Error("Invalid Buddy Inbox pending requester"); | ||
| if (!id || !serverId || !channelId || !agentId) { | ||
| throw new Error("Invalid Buddy Inbox pending delivery identifiers"); | ||
| } | ||
| const requestedAt = parseOptionalString(entry.requestedAt, "pending.requestedAt", 64); | ||
| if (!requestedAt) throw new Error("Invalid Buddy Inbox pending requestedAt"); | ||
| return { | ||
| id, | ||
| serverId, | ||
| channelId, | ||
| agentId, | ||
| mode, | ||
| subject: { | ||
| kind: parseSubjectKind(entry.subject.kind), | ||
| id: parseOptionalString(entry.subject.id, "subject.id", 160), | ||
| appKey: parseOptionalString(entry.subject.appKey, "subject.appKey", 120), | ||
| label: parseOptionalString(entry.subject.label, "subject.label", 160) | ||
| }, | ||
| task: parsePendingTask(entry.task), | ||
| requestedBy: entry.requestedBy, | ||
| requestedAt, | ||
| updatedAt: parseOptionalString(entry.updatedAt, "pending.updatedAt", 64) | ||
| }; | ||
| }); | ||
| } | ||
| // src/types/message.types.ts | ||
| var MESSAGE_COPILOT_CONTEXT_METADATA_KEY = "copilotContext"; | ||
| var MESSAGE_AGENT_CHAIN_METADATA_KEY = "agentChain"; | ||
| function isBoundedMetadataString(value, maxLength, required = false) { | ||
| if (typeof value !== "string") return !required && value == null; | ||
| const trimmed = value.trim(); | ||
| return trimmed.length > 0 && trimmed.length <= maxLength; | ||
| } | ||
| function isMessageCopilotContext(value) { | ||
| if (!value || typeof value !== "object") return false; | ||
| const record = value; | ||
| return record.kind === "server_app_copilot" && isBoundedMetadataString(record.appKey, 120, true) && isBoundedMetadataString(record.serverAppId, 160) && isBoundedMetadataString(record.appId, 160) && isBoundedMetadataString(record.appName, 160) && isBoundedMetadataString(record.serverId, 160) && isBoundedMetadataString(record.serverSlug, 160) && isBoundedMetadataString(record.channelId, 160) && isBoundedMetadataString(record.channelKind, 40); | ||
| } | ||
| function buildMessageCopilotContextMetadata(context) { | ||
| return context && isMessageCopilotContext(context) ? { copilotContext: context } : void 0; | ||
| } | ||
| function isMessageAgentChainMetadata(value) { | ||
| if (!value || typeof value !== "object") return false; | ||
| const record = value; | ||
| const startedAt = record.startedAt; | ||
| return isBoundedMetadataString(record.agentId, 160, true) && typeof record.depth === "number" && Number.isInteger(record.depth) && record.depth >= 0 && record.depth <= 100 && Array.isArray(record.participants) && record.participants.length <= 100 && record.participants.every((participant) => isBoundedMetadataString(participant, 160, true)) && (startedAt == null || typeof startedAt === "number" && Number.isInteger(startedAt) && startedAt >= 0 || isBoundedMetadataString(startedAt, 64, true)) && isBoundedMetadataString(record.rootMessageId, 160); | ||
| } | ||
| function buildMessageAgentChainMetadata(agentChain) { | ||
| return agentChain && isMessageAgentChainMetadata(agentChain) ? { agentChain } : void 0; | ||
| } | ||
| // src/types/runtime-session.types.ts | ||
| var RUNTIME_SESSION_PET_REACTION_BY_STATE = { | ||
| idle: "idle", | ||
| running: "working", | ||
| streaming: "thinking", | ||
| tool_call: "working", | ||
| waiting_for_approval: "waiting", | ||
| blocked: "waiting", | ||
| completed: "success", | ||
| failed: "error", | ||
| stopped: "idle", | ||
| unknown: "idle" | ||
| }; | ||
| function runtimeSessionPetReactionForState(state) { | ||
| return RUNTIME_SESSION_PET_REACTION_BY_STATE[state] ?? "idle"; | ||
| } | ||
| function runtimeSessionSignalToPetReaction(signal) { | ||
| switch (signal) { | ||
| case "running": | ||
| return "working"; | ||
| case "streaming": | ||
| return "thinking"; | ||
| case "tool_call": | ||
| return "working"; | ||
| case "waiting_for_approval": | ||
| case "blocked": | ||
| return "waiting"; | ||
| case "completed": | ||
| return "success"; | ||
| case "failed": | ||
| return "error"; | ||
| case "stopped": | ||
| case "unknown": | ||
| return "idle"; | ||
| default: | ||
| return signal; | ||
| } | ||
| } | ||
| function runtimeSessionStateLooksActive(state) { | ||
| return state === "running" || state === "streaming" || state === "tool_call" || state === "waiting_for_approval" || state === "blocked"; | ||
| } | ||
| // src/types/user.types.ts | ||
| var USER_STATUSES = ["online", "idle", "dnd", "offline"]; | ||
| var BUDDY_PRESENCE_STATUSES = ["online", "busy", "idle", "dnd", "offline"]; | ||
| var BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS = 9e4; | ||
| function normalizeUserStatus(status) { | ||
| if (status === "online" || status === "idle" || status === "dnd" || status === "offline") { | ||
| return status; | ||
| } | ||
| return "offline"; | ||
| } | ||
| function normalizeBuddyPresenceStatus(status, options) { | ||
| if (options?.busy) { | ||
| return "busy"; | ||
| } | ||
| if (status === "busy") { | ||
| return "busy"; | ||
| } | ||
| return normalizeUserStatus(status); | ||
| } | ||
| function normalizePresenceStatus(status, options) { | ||
| return normalizeBuddyPresenceStatus(status, options); | ||
| } | ||
| function isBuddyHeartbeatActive(lastHeartbeat, options) { | ||
| if (!lastHeartbeat) return false; | ||
| const heartbeatMs = lastHeartbeat instanceof Date ? lastHeartbeat.getTime() : new Date(lastHeartbeat).getTime(); | ||
| if (!Number.isFinite(heartbeatMs)) return false; | ||
| const nowMs = options?.nowMs ?? Date.now(); | ||
| const thresholdMs = options?.thresholdMs ?? BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS; | ||
| return nowMs - heartbeatMs <= thresholdMs; | ||
| } | ||
| function normalizeBuddyRuntimePresenceStatus({ | ||
| userStatus, | ||
| agentStatus, | ||
| lastHeartbeat, | ||
| busy = false, | ||
| nowMs | ||
| }) { | ||
| if (busy || agentStatus === "busy") return "busy"; | ||
| if (agentStatus === "running") { | ||
| return isBuddyHeartbeatActive(lastHeartbeat, { nowMs }) ? "online" : "offline"; | ||
| } | ||
| const normalizedAgentStatus = normalizeBuddyPresenceStatus(agentStatus); | ||
| if (normalizedAgentStatus !== "offline") return normalizedAgentStatus; | ||
| return normalizeUserStatus(userStatus); | ||
| } | ||
| function resolvePresenceStatus({ | ||
| userStatus, | ||
| isBot, | ||
| agentStatus, | ||
| lastHeartbeat, | ||
| busy = false, | ||
| nowMs | ||
| }) { | ||
| if (busy) return "busy"; | ||
| if (isBot || agentStatus != null || lastHeartbeat != null) { | ||
| return normalizeBuddyRuntimePresenceStatus({ | ||
| userStatus, | ||
| agentStatus, | ||
| lastHeartbeat, | ||
| nowMs | ||
| }); | ||
| } | ||
| return normalizePresenceStatus(userStatus); | ||
| } | ||
| function getBuddyPresenceExpiresAt(lastHeartbeat, options) { | ||
| if (!lastHeartbeat) return null; | ||
| const heartbeatMs = lastHeartbeat instanceof Date ? lastHeartbeat.getTime() : new Date(lastHeartbeat).getTime(); | ||
| if (!Number.isFinite(heartbeatMs)) return null; | ||
| return new Date( | ||
| heartbeatMs + (options?.thresholdMs ?? BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS) | ||
| ).toISOString(); | ||
| } | ||
| function applyPresenceChangeToRuntime(current, update, options) { | ||
| const observedAt = update.observedAt ?? options?.observedAt ?? (/* @__PURE__ */ new Date()).toISOString(); | ||
| const userStatus = normalizeUserStatus(update.status); | ||
| const hasAgentPresence = current.isBot === true || current.agentStatus != null || current.lastHeartbeat != null || update.agentId != null || update.agentStatus !== void 0 || update.lastHeartbeat !== void 0; | ||
| if (!hasAgentPresence) return { userStatus }; | ||
| const agentStatus = update.agentStatus !== void 0 ? update.agentStatus : current.agentStatus ?? (userStatus === "online" ? "running" : null); | ||
| let lastHeartbeat = current.lastHeartbeat ?? null; | ||
| if (update.lastHeartbeat !== void 0) { | ||
| lastHeartbeat = update.lastHeartbeat; | ||
| } else if (userStatus === "online") { | ||
| lastHeartbeat = observedAt; | ||
| } else if (userStatus === "offline") { | ||
| lastHeartbeat = null; | ||
| } | ||
| return { userStatus, agentStatus, lastHeartbeat }; | ||
| } | ||
| export { | ||
| BUDDY_INBOX_TOPIC_PREFIX, | ||
| BUDDY_INBOX_DELIVERY_PERMISSION, | ||
| BUDDY_INBOX_PLATFORM_PERMISSIONS, | ||
| isBuddyInboxPlatformPermission, | ||
| buddyInboxTopic, | ||
| parseBuddyInboxAgentId, | ||
| isBuddyInboxTopic, | ||
| TASK_MESSAGE_CARD_STATUSES, | ||
| TERMINAL_TASK_MESSAGE_CARD_STATUSES, | ||
| TASK_MESSAGE_CARD_STATUS_TRANSITIONS, | ||
| isTerminalTaskMessageCardStatus, | ||
| isTaskMessageCardStatus, | ||
| canTransitionTaskMessageCardStatus, | ||
| isMessageReferenceCard, | ||
| getBuddyInboxTaskCards, | ||
| hasBuddyInboxTaskCard, | ||
| getBuddyInboxTaskStatuses, | ||
| buildBuddyInboxViewMessages, | ||
| DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, | ||
| normalizeBuddyInboxAdmissionPolicy, | ||
| buddyInboxAdmissionRuleKey, | ||
| normalizeBuddyInboxAdmissionPendingDeliveries, | ||
| MESSAGE_COPILOT_CONTEXT_METADATA_KEY, | ||
| MESSAGE_AGENT_CHAIN_METADATA_KEY, | ||
| isMessageCopilotContext, | ||
| buildMessageCopilotContextMetadata, | ||
| isMessageAgentChainMetadata, | ||
| buildMessageAgentChainMetadata, | ||
| RUNTIME_SESSION_PET_REACTION_BY_STATE, | ||
| runtimeSessionPetReactionForState, | ||
| runtimeSessionSignalToPetReaction, | ||
| runtimeSessionStateLooksActive, | ||
| USER_STATUSES, | ||
| BUDDY_PRESENCE_STATUSES, | ||
| BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, | ||
| normalizeUserStatus, | ||
| normalizeBuddyPresenceStatus, | ||
| normalizePresenceStatus, | ||
| isBuddyHeartbeatActive, | ||
| normalizeBuddyRuntimePresenceStatus, | ||
| resolvePresenceStatus, | ||
| getBuddyPresenceExpiresAt, | ||
| applyPresenceChangeToRuntime | ||
| }; |
| interface Message { | ||
| id: string; | ||
| content: string; | ||
| channelId: string; | ||
| authorId: string; | ||
| threadId: string | null; | ||
| replyToId: string | null; | ||
| isEdited: boolean; | ||
| isPinned: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| author?: { | ||
| id: string; | ||
| username: string; | ||
| displayName: string; | ||
| avatarUrl: string | null; | ||
| isBot: boolean; | ||
| }; | ||
| attachments?: Attachment[]; | ||
| reactions?: ReactionGroup[]; | ||
| metadata?: MessageMetadata | null; | ||
| } | ||
| type MessageMentionKind = 'user' | 'buddy' | 'app' | 'channel' | 'server' | 'here' | 'everyone'; | ||
| interface MessageMentionRange { | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface MessageMention { | ||
| kind: MessageMentionKind; | ||
| /** Canonical target id. For users this is userId, for channels channelId, for servers serverId. */ | ||
| targetId: string; | ||
| /** Canonical text persisted in message content, e.g. <@userId>, <#channelId>. */ | ||
| token: string; | ||
| /** Optional display text selected or typed by the sender before canonicalization. */ | ||
| sourceToken?: string; | ||
| /** Human-readable label used by renderers. */ | ||
| label: string; | ||
| /** Optional source range in content. Clients may omit it; servers may recompute later. */ | ||
| range?: MessageMentionRange; | ||
| serverId?: string; | ||
| serverSlug?: string | null; | ||
| serverName?: string | null; | ||
| channelId?: string; | ||
| channelName?: string | null; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| userId?: string; | ||
| username?: string | null; | ||
| displayName?: string | null; | ||
| avatarUrl?: string | null; | ||
| isBot?: boolean; | ||
| isPrivate?: boolean; | ||
| } | ||
| declare const MESSAGE_COPILOT_CONTEXT_METADATA_KEY: "copilotContext"; | ||
| declare const MESSAGE_AGENT_CHAIN_METADATA_KEY: "agentChain"; | ||
| interface MessageCopilotContext { | ||
| kind: 'server_app_copilot'; | ||
| /** Server app install id when the current surface is an installed server app. */ | ||
| serverAppId?: string | null; | ||
| /** Catalog app id when available. */ | ||
| appId?: string | null; | ||
| /** Stable app key from the app route, e.g. kanban. */ | ||
| appKey: string; | ||
| appName?: string | null; | ||
| serverId?: string | null; | ||
| serverSlug?: string | null; | ||
| /** Channel or Inbox currently opened in the Copilot panel. */ | ||
| channelId?: string | null; | ||
| channelKind?: string | null; | ||
| } | ||
| declare function isMessageCopilotContext(value: unknown): value is MessageCopilotContext; | ||
| declare function buildMessageCopilotContextMetadata(context: MessageCopilotContext | null | undefined): { | ||
| copilotContext: MessageCopilotContext; | ||
| } | undefined; | ||
| interface MessageAgentChainMetadata { | ||
| /** Logical runtime agent id that produced the current message. */ | ||
| agentId: string; | ||
| /** Number of runtime hops from the original trigger to this message. */ | ||
| depth: number; | ||
| /** Bot/user ids that have participated in the chain so far. */ | ||
| participants: string[]; | ||
| /** Runtime start timestamp, usually Date.now(), or an ISO timestamp. */ | ||
| startedAt?: number | string; | ||
| /** Message id that started the chain. */ | ||
| rootMessageId?: string; | ||
| } | ||
| declare function isMessageAgentChainMetadata(value: unknown): value is MessageAgentChainMetadata; | ||
| declare function buildMessageAgentChainMetadata(agentChain: MessageAgentChainMetadata | null | undefined): { | ||
| agentChain: MessageAgentChainMetadata; | ||
| } | undefined; | ||
| interface MessageMetadata { | ||
| /** Runtime trace metadata for agent-to-agent or task-triggered messages. */ | ||
| agentChain?: MessageAgentChainMetadata; | ||
| mentions?: MessageMention[]; | ||
| copilotContext?: MessageCopilotContext; | ||
| collaboration?: { | ||
| id: string; | ||
| rootMessageId: string; | ||
| buddyId: string; | ||
| turn: number; | ||
| target?: 'main' | 'thread'; | ||
| threadId?: string; | ||
| suggestedTextLimit?: number; | ||
| replyDensity?: 'reaction' | 'short' | 'normal' | 'long'; | ||
| }; | ||
| interactive?: Record<string, unknown>; | ||
| interactiveResponse?: Record<string, unknown>; | ||
| interactiveState?: Record<string, unknown>; | ||
| ccConnectDelivery?: Record<string, unknown>; | ||
| shadowDelivery?: Record<string, unknown>; | ||
| /** Unified card protocol. New card-like message surfaces must use this field. */ | ||
| cards?: MessageCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only commerce card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| commerceCards?: CommerceMessageCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only paid-file delivery card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| paidFileCards?: PaidFileCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only OAuth link card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| oauthLinkCards?: OAuthLinkCard[]; | ||
| [key: string]: unknown; | ||
| } | ||
| type MessageCardStatus = 'queued' | 'claimed' | 'running' | 'completed' | 'failed' | 'canceled' | 'transferred'; | ||
| interface MessageCardSource { | ||
| kind: 'user' | 'pat' | 'oauth' | 'agent' | 'system' | 'server_app' | 'buddy'; | ||
| id?: string; | ||
| label?: string; | ||
| userId?: string; | ||
| agentId?: string; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| serverId?: string; | ||
| channelId?: string; | ||
| command?: string; | ||
| resource?: { | ||
| kind: string; | ||
| id: string; | ||
| label?: string; | ||
| url?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| [key: string]: unknown; | ||
| } | ||
| type TaskMessageCardTag = string | { | ||
| id?: string; | ||
| label: string; | ||
| color?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| interface MessageCardApp { | ||
| id?: string; | ||
| appId?: string; | ||
| appKey?: string; | ||
| name?: string | null; | ||
| label?: string | null; | ||
| iconUrl?: string | null; | ||
| logoUrl?: string | null; | ||
| avatarUrl?: string | null; | ||
| imageUrl?: string | null; | ||
| url?: string | null; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageCardReply { | ||
| id?: string; | ||
| messageId?: string; | ||
| cardId?: string; | ||
| authorId?: string; | ||
| authorLabel?: string; | ||
| authorAvatarUrl?: string | null; | ||
| content: string; | ||
| createdAt: string; | ||
| source?: MessageCardSource; | ||
| [key: string]: unknown; | ||
| } | ||
| interface MessageCardClaim { | ||
| id: string; | ||
| actor: MessageCardSource; | ||
| claimedAt: string; | ||
| expiresAt: string; | ||
| } | ||
| interface MessageCardCapability { | ||
| kind: 'task'; | ||
| scope: string[]; | ||
| issuedAt: string; | ||
| expiresAt: string; | ||
| claimId?: string; | ||
| binding?: { | ||
| messageId?: string; | ||
| cardId: string; | ||
| workspaceId?: string; | ||
| }; | ||
| } | ||
| interface TaskMessageRequirementSkill { | ||
| kind: 'runtime-skill'; | ||
| package: string; | ||
| version?: string; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageRequirementTool { | ||
| kind: string; | ||
| name: string; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageRequirements { | ||
| capabilities?: string[]; | ||
| skills?: TaskMessageRequirementSkill[]; | ||
| tools?: TaskMessageRequirementTool[]; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageExpectedArtifact { | ||
| kind: string; | ||
| mimeTypes?: string[]; | ||
| maxBytes?: number; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageSubmitCommand { | ||
| appKey: string; | ||
| command: string; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageOutputContract { | ||
| expectedArtifacts?: TaskMessageExpectedArtifact[]; | ||
| submitCommand?: TaskMessageSubmitCommand; | ||
| [key: string]: unknown; | ||
| } | ||
| type TaskMessagePrivacyDataClass = 'public' | 'server-private' | 'channel-private' | 'financial' | 'secret' | 'cloud-secret'; | ||
| interface TaskMessagePrivacy { | ||
| dataClass: TaskMessagePrivacyDataClass; | ||
| redactionRequired?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskContextPack { | ||
| snapshotAtMessageId: string | null; | ||
| sourceSurface: 'channel' | 'thread' | 'task-thread' | 'app'; | ||
| policy: 'auto_recent' | 'explicit_refs' | 'thread_context' | 'manual'; | ||
| summary: string | null; | ||
| items: Array<{ | ||
| kind: 'message'; | ||
| messageId: string; | ||
| threadId?: string | null; | ||
| authorId: string; | ||
| createdAt: string; | ||
| text: string; | ||
| } | { | ||
| kind: 'resource'; | ||
| resourceType: string; | ||
| resourceId: string; | ||
| title?: string; | ||
| summary?: string; | ||
| } | { | ||
| kind: 'task_result'; | ||
| messageId: string; | ||
| cardId: string; | ||
| title: string; | ||
| summary: string; | ||
| }>; | ||
| omitted: Array<{ | ||
| messageCount: number; | ||
| reason: 'token_budget' | 'permission' | 'privacy' | 'not_relevant'; | ||
| }>; | ||
| tokenEstimate: number; | ||
| } | ||
| interface TaskMessageCard { | ||
| id: string; | ||
| kind: 'task'; | ||
| version: number; | ||
| title: string; | ||
| body?: string; | ||
| status: MessageCardStatus; | ||
| priority?: 'low' | 'normal' | 'medium' | 'high'; | ||
| tags?: TaskMessageCardTag[]; | ||
| app?: MessageCardApp; | ||
| assignee?: { | ||
| agentId?: string; | ||
| userId?: string; | ||
| label?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| source?: MessageCardSource; | ||
| requirements?: TaskMessageRequirements; | ||
| outputContract?: TaskMessageOutputContract; | ||
| privacy?: TaskMessagePrivacy; | ||
| claim?: MessageCardClaim; | ||
| capability?: MessageCardCapability; | ||
| progress?: Array<{ | ||
| at: string; | ||
| status: MessageCardStatus; | ||
| note?: string; | ||
| actor?: MessageCardSource; | ||
| [key: string]: unknown; | ||
| }>; | ||
| replies?: TaskMessageCardReply[]; | ||
| createdAt: string; | ||
| updatedAt?: string; | ||
| data?: Record<string, unknown> & { | ||
| task?: { | ||
| workspaceId?: string; | ||
| threadId?: string; | ||
| revision?: number; | ||
| contextPack?: TaskContextPack; | ||
| [key: string]: unknown; | ||
| }; | ||
| }; | ||
| [key: string]: unknown; | ||
| } | ||
| type GenericMessageCard = { | ||
| id?: string; | ||
| kind: string; | ||
| version?: number; | ||
| title?: string; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| }; | ||
| interface ServerAppMessageCard { | ||
| id?: string; | ||
| kind: 'server_app'; | ||
| version?: number; | ||
| appKey: string; | ||
| title: string; | ||
| description?: string; | ||
| label?: string; | ||
| action?: { | ||
| mode: 'open_app'; | ||
| path?: string; | ||
| }; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| } | ||
| interface MessageReferenceCard { | ||
| id?: string; | ||
| kind: 'message_reference'; | ||
| version?: number; | ||
| title: string; | ||
| description?: string; | ||
| label?: string; | ||
| target: { | ||
| serverId?: string | null; | ||
| serverSlug?: string | null; | ||
| channelId: string; | ||
| messageId: string; | ||
| taskCardId?: string | null; | ||
| inboxAgentId?: string | null; | ||
| kind?: 'channel_message' | 'inbox_message'; | ||
| }; | ||
| source?: MessageCardSource; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| } | ||
| type MessageCard = TaskMessageCard | ServerAppMessageCard | MessageReferenceCard | GenericMessageCard; | ||
| interface CommerceOfferCardInput { | ||
| id?: string; | ||
| kind: 'offer'; | ||
| offerId: string; | ||
| } | ||
| type CommerceMessageCard = CommerceProductCard | CommerceOfferCardInput; | ||
| interface CommerceProductCard { | ||
| id: string; | ||
| kind: 'offer' | 'product'; | ||
| offerId?: string; | ||
| shopId: string; | ||
| shopScope: { | ||
| kind: 'server' | 'user'; | ||
| id: string; | ||
| }; | ||
| productId: string; | ||
| skuId?: string; | ||
| snapshot: { | ||
| name: string; | ||
| summary?: string | null; | ||
| imageUrl?: string | null; | ||
| shopName?: string | null; | ||
| deliveryPromise?: string | null; | ||
| price: number; | ||
| currency: string; | ||
| productType: 'physical' | 'entitlement'; | ||
| billingMode?: 'one_time' | 'fixed_duration' | 'subscription'; | ||
| durationSeconds?: number | null; | ||
| resourceType?: string; | ||
| resourceId?: string; | ||
| capability?: string; | ||
| }; | ||
| purchase: { | ||
| mode: 'direct' | 'select_sku' | 'open_detail'; | ||
| }; | ||
| } | ||
| interface PaidFileCard { | ||
| id: string; | ||
| kind: 'paid_file'; | ||
| fileId: string; | ||
| entitlementId?: string | null; | ||
| deliverableId?: string; | ||
| snapshot: { | ||
| name: string; | ||
| summary?: string | null; | ||
| mime?: string | null; | ||
| sizeBytes?: number | null; | ||
| previewUrl?: string | null; | ||
| }; | ||
| action: { | ||
| mode: 'open_paid_file'; | ||
| }; | ||
| } | ||
| interface OAuthLinkCard { | ||
| id: string; | ||
| kind: 'oauth_link'; | ||
| appId: string; | ||
| clientId?: string | null; | ||
| title: string; | ||
| description?: string | null; | ||
| iconUrl?: string | null; | ||
| meta?: { | ||
| appName?: string | null; | ||
| avatarUrl?: string | null; | ||
| iconUrl?: string | null; | ||
| coverUrl?: string | null; | ||
| homepageUrl?: string | null; | ||
| origin?: string | null; | ||
| }; | ||
| url: string; | ||
| embedUrl?: string | null; | ||
| fallbackUrl?: string | null; | ||
| scopes?: string[]; | ||
| action: { | ||
| mode: 'open_iframe' | 'open_external'; | ||
| }; | ||
| } | ||
| type MentionSuggestionTrigger = '@' | '#'; | ||
| interface MentionSuggestion { | ||
| id: string; | ||
| kind: MessageMentionKind; | ||
| targetId: string; | ||
| token: string; | ||
| label: string; | ||
| description?: string | null; | ||
| serverId?: string; | ||
| serverSlug?: string | null; | ||
| serverName?: string | null; | ||
| channelId?: string; | ||
| channelName?: string | null; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| userId?: string; | ||
| username?: string | null; | ||
| displayName?: string | null; | ||
| avatarUrl?: string | null; | ||
| isBot?: boolean; | ||
| isPrivate?: boolean; | ||
| } | ||
| interface Attachment { | ||
| id: string; | ||
| messageId: string; | ||
| filename: string; | ||
| url: string; | ||
| contentType: string; | ||
| size: number; | ||
| width: number | null; | ||
| height: number | null; | ||
| workspaceNodeId?: string | null; | ||
| kind?: 'file' | 'image' | 'voice'; | ||
| durationMs?: number | null; | ||
| audioCodec?: string | null; | ||
| audioContainer?: string | null; | ||
| waveformPeaks?: number[] | null; | ||
| waveformVersion?: number | null; | ||
| transcript?: { | ||
| id: string; | ||
| status: 'pending' | 'processing' | 'ready' | 'failed'; | ||
| text: string | null; | ||
| language: string | null; | ||
| source: 'client' | 'server' | 'runtime'; | ||
| provider?: string | null; | ||
| confidence?: number | null; | ||
| errorCode?: string | null; | ||
| updatedAt?: string; | ||
| } | null; | ||
| playback?: { | ||
| played: boolean; | ||
| completed: boolean; | ||
| lastPositionMs: number; | ||
| playedCount?: number; | ||
| } | null; | ||
| createdAt: string; | ||
| } | ||
| interface ReactionGroup { | ||
| emoji: string; | ||
| count: number; | ||
| userIds: string[]; | ||
| } | ||
| interface Thread { | ||
| id: string; | ||
| name: string; | ||
| channelId: string; | ||
| parentMessageId: string; | ||
| creatorId: string; | ||
| isArchived: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| } | ||
| interface SendMessageRequest { | ||
| content: string; | ||
| threadId?: string; | ||
| replyToId?: string; | ||
| mentions?: MessageMention[]; | ||
| metadata?: MessageMetadata; | ||
| } | ||
| interface UpdateMessageRequest { | ||
| content: string; | ||
| } | ||
| type NotificationType = 'mention' | 'reply' | 'dm' | 'system'; | ||
| interface Notification { | ||
| id: string; | ||
| userId: string; | ||
| type: NotificationType; | ||
| title: string; | ||
| body: string | null; | ||
| referenceId: string | null; | ||
| referenceType: string | null; | ||
| isRead: boolean; | ||
| createdAt: string; | ||
| } | ||
| export { type Attachment as A, type TaskMessagePrivacy as B, type CommerceMessageCard as C, type TaskMessagePrivacyDataClass as D, type TaskMessageRequirementSkill as E, type TaskMessageRequirementTool as F, type GenericMessageCard as G, type TaskMessageRequirements as H, type TaskMessageSubmitCommand as I, type Thread as J, buildMessageAgentChainMetadata as K, buildMessageCopilotContextMetadata as L, MESSAGE_AGENT_CHAIN_METADATA_KEY as M, type Notification as N, type OAuthLinkCard as O, type PaidFileCard as P, isMessageAgentChainMetadata as Q, type ReactionGroup as R, type SendMessageRequest as S, type TaskContextPack as T, type UpdateMessageRequest as U, isMessageCopilotContext as V, type CommerceOfferCardInput as a, type CommerceProductCard as b, MESSAGE_COPILOT_CONTEXT_METADATA_KEY as c, type MentionSuggestion as d, type MentionSuggestionTrigger as e, type Message as f, type MessageAgentChainMetadata as g, type MessageCard as h, type MessageCardApp as i, type MessageCardCapability as j, type MessageCardClaim as k, type MessageCardSource as l, type MessageCardStatus as m, type MessageCopilotContext as n, type MessageMention as o, type MessageMentionKind as p, type MessageMentionRange as q, type MessageMetadata as r, type MessageReferenceCard as s, type NotificationType as t, type ServerAppMessageCard as u, type TaskMessageCard as v, type TaskMessageCardReply as w, type TaskMessageCardTag as x, type TaskMessageExpectedArtifact as y, type TaskMessageOutputContract as z }; |
| interface Message { | ||
| id: string; | ||
| content: string; | ||
| channelId: string; | ||
| authorId: string; | ||
| threadId: string | null; | ||
| replyToId: string | null; | ||
| isEdited: boolean; | ||
| isPinned: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| author?: { | ||
| id: string; | ||
| username: string; | ||
| displayName: string; | ||
| avatarUrl: string | null; | ||
| isBot: boolean; | ||
| }; | ||
| attachments?: Attachment[]; | ||
| reactions?: ReactionGroup[]; | ||
| metadata?: MessageMetadata | null; | ||
| } | ||
| type MessageMentionKind = 'user' | 'buddy' | 'app' | 'channel' | 'server' | 'here' | 'everyone'; | ||
| interface MessageMentionRange { | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface MessageMention { | ||
| kind: MessageMentionKind; | ||
| /** Canonical target id. For users this is userId, for channels channelId, for servers serverId. */ | ||
| targetId: string; | ||
| /** Canonical text persisted in message content, e.g. <@userId>, <#channelId>. */ | ||
| token: string; | ||
| /** Optional display text selected or typed by the sender before canonicalization. */ | ||
| sourceToken?: string; | ||
| /** Human-readable label used by renderers. */ | ||
| label: string; | ||
| /** Optional source range in content. Clients may omit it; servers may recompute later. */ | ||
| range?: MessageMentionRange; | ||
| serverId?: string; | ||
| serverSlug?: string | null; | ||
| serverName?: string | null; | ||
| channelId?: string; | ||
| channelName?: string | null; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| userId?: string; | ||
| username?: string | null; | ||
| displayName?: string | null; | ||
| avatarUrl?: string | null; | ||
| isBot?: boolean; | ||
| isPrivate?: boolean; | ||
| } | ||
| declare const MESSAGE_COPILOT_CONTEXT_METADATA_KEY: "copilotContext"; | ||
| declare const MESSAGE_AGENT_CHAIN_METADATA_KEY: "agentChain"; | ||
| interface MessageCopilotContext { | ||
| kind: 'server_app_copilot'; | ||
| /** Server app install id when the current surface is an installed server app. */ | ||
| serverAppId?: string | null; | ||
| /** Catalog app id when available. */ | ||
| appId?: string | null; | ||
| /** Stable app key from the app route, e.g. kanban. */ | ||
| appKey: string; | ||
| appName?: string | null; | ||
| serverId?: string | null; | ||
| serverSlug?: string | null; | ||
| /** Channel or Inbox currently opened in the Copilot panel. */ | ||
| channelId?: string | null; | ||
| channelKind?: string | null; | ||
| } | ||
| declare function isMessageCopilotContext(value: unknown): value is MessageCopilotContext; | ||
| declare function buildMessageCopilotContextMetadata(context: MessageCopilotContext | null | undefined): { | ||
| copilotContext: MessageCopilotContext; | ||
| } | undefined; | ||
| interface MessageAgentChainMetadata { | ||
| /** Logical runtime agent id that produced the current message. */ | ||
| agentId: string; | ||
| /** Number of runtime hops from the original trigger to this message. */ | ||
| depth: number; | ||
| /** Bot/user ids that have participated in the chain so far. */ | ||
| participants: string[]; | ||
| /** Runtime start timestamp, usually Date.now(), or an ISO timestamp. */ | ||
| startedAt?: number | string; | ||
| /** Message id that started the chain. */ | ||
| rootMessageId?: string; | ||
| } | ||
| declare function isMessageAgentChainMetadata(value: unknown): value is MessageAgentChainMetadata; | ||
| declare function buildMessageAgentChainMetadata(agentChain: MessageAgentChainMetadata | null | undefined): { | ||
| agentChain: MessageAgentChainMetadata; | ||
| } | undefined; | ||
| interface MessageMetadata { | ||
| /** Runtime trace metadata for agent-to-agent or task-triggered messages. */ | ||
| agentChain?: MessageAgentChainMetadata; | ||
| mentions?: MessageMention[]; | ||
| copilotContext?: MessageCopilotContext; | ||
| collaboration?: { | ||
| id: string; | ||
| rootMessageId: string; | ||
| buddyId: string; | ||
| turn: number; | ||
| target?: 'main' | 'thread'; | ||
| threadId?: string; | ||
| suggestedTextLimit?: number; | ||
| replyDensity?: 'reaction' | 'short' | 'normal' | 'long'; | ||
| }; | ||
| interactive?: Record<string, unknown>; | ||
| interactiveResponse?: Record<string, unknown>; | ||
| interactiveState?: Record<string, unknown>; | ||
| ccConnectDelivery?: Record<string, unknown>; | ||
| shadowDelivery?: Record<string, unknown>; | ||
| /** Unified card protocol. New card-like message surfaces must use this field. */ | ||
| cards?: MessageCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only commerce card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| commerceCards?: CommerceMessageCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only paid-file delivery card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| paidFileCards?: PaidFileCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only OAuth link card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| oauthLinkCards?: OAuthLinkCard[]; | ||
| [key: string]: unknown; | ||
| } | ||
| type MessageCardStatus = 'queued' | 'claimed' | 'running' | 'completed' | 'failed' | 'canceled' | 'transferred'; | ||
| interface MessageCardSource { | ||
| kind: 'user' | 'pat' | 'oauth' | 'agent' | 'system' | 'server_app' | 'buddy'; | ||
| id?: string; | ||
| label?: string; | ||
| userId?: string; | ||
| agentId?: string; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| serverId?: string; | ||
| channelId?: string; | ||
| command?: string; | ||
| resource?: { | ||
| kind: string; | ||
| id: string; | ||
| label?: string; | ||
| url?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| [key: string]: unknown; | ||
| } | ||
| type TaskMessageCardTag = string | { | ||
| id?: string; | ||
| label: string; | ||
| color?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| interface MessageCardApp { | ||
| id?: string; | ||
| appId?: string; | ||
| appKey?: string; | ||
| name?: string | null; | ||
| label?: string | null; | ||
| iconUrl?: string | null; | ||
| logoUrl?: string | null; | ||
| avatarUrl?: string | null; | ||
| imageUrl?: string | null; | ||
| url?: string | null; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageCardReply { | ||
| id?: string; | ||
| messageId?: string; | ||
| cardId?: string; | ||
| authorId?: string; | ||
| authorLabel?: string; | ||
| authorAvatarUrl?: string | null; | ||
| content: string; | ||
| createdAt: string; | ||
| source?: MessageCardSource; | ||
| [key: string]: unknown; | ||
| } | ||
| interface MessageCardClaim { | ||
| id: string; | ||
| actor: MessageCardSource; | ||
| claimedAt: string; | ||
| expiresAt: string; | ||
| } | ||
| interface MessageCardCapability { | ||
| kind: 'task'; | ||
| scope: string[]; | ||
| issuedAt: string; | ||
| expiresAt: string; | ||
| claimId?: string; | ||
| binding?: { | ||
| messageId?: string; | ||
| cardId: string; | ||
| workspaceId?: string; | ||
| }; | ||
| } | ||
| interface TaskMessageRequirementSkill { | ||
| kind: 'runtime-skill'; | ||
| package: string; | ||
| version?: string; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageRequirementTool { | ||
| kind: string; | ||
| name: string; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageRequirements { | ||
| capabilities?: string[]; | ||
| skills?: TaskMessageRequirementSkill[]; | ||
| tools?: TaskMessageRequirementTool[]; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageExpectedArtifact { | ||
| kind: string; | ||
| mimeTypes?: string[]; | ||
| maxBytes?: number; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageSubmitCommand { | ||
| appKey: string; | ||
| command: string; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageOutputContract { | ||
| expectedArtifacts?: TaskMessageExpectedArtifact[]; | ||
| submitCommand?: TaskMessageSubmitCommand; | ||
| [key: string]: unknown; | ||
| } | ||
| type TaskMessagePrivacyDataClass = 'public' | 'server-private' | 'channel-private' | 'financial' | 'secret' | 'cloud-secret'; | ||
| interface TaskMessagePrivacy { | ||
| dataClass: TaskMessagePrivacyDataClass; | ||
| redactionRequired?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskContextPack { | ||
| snapshotAtMessageId: string | null; | ||
| sourceSurface: 'channel' | 'thread' | 'task-thread' | 'app'; | ||
| policy: 'auto_recent' | 'explicit_refs' | 'thread_context' | 'manual'; | ||
| summary: string | null; | ||
| items: Array<{ | ||
| kind: 'message'; | ||
| messageId: string; | ||
| threadId?: string | null; | ||
| authorId: string; | ||
| createdAt: string; | ||
| text: string; | ||
| } | { | ||
| kind: 'resource'; | ||
| resourceType: string; | ||
| resourceId: string; | ||
| title?: string; | ||
| summary?: string; | ||
| } | { | ||
| kind: 'task_result'; | ||
| messageId: string; | ||
| cardId: string; | ||
| title: string; | ||
| summary: string; | ||
| }>; | ||
| omitted: Array<{ | ||
| messageCount: number; | ||
| reason: 'token_budget' | 'permission' | 'privacy' | 'not_relevant'; | ||
| }>; | ||
| tokenEstimate: number; | ||
| } | ||
| interface TaskMessageCard { | ||
| id: string; | ||
| kind: 'task'; | ||
| version: number; | ||
| title: string; | ||
| body?: string; | ||
| status: MessageCardStatus; | ||
| priority?: 'low' | 'normal' | 'medium' | 'high'; | ||
| tags?: TaskMessageCardTag[]; | ||
| app?: MessageCardApp; | ||
| assignee?: { | ||
| agentId?: string; | ||
| userId?: string; | ||
| label?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| source?: MessageCardSource; | ||
| requirements?: TaskMessageRequirements; | ||
| outputContract?: TaskMessageOutputContract; | ||
| privacy?: TaskMessagePrivacy; | ||
| claim?: MessageCardClaim; | ||
| capability?: MessageCardCapability; | ||
| progress?: Array<{ | ||
| at: string; | ||
| status: MessageCardStatus; | ||
| note?: string; | ||
| actor?: MessageCardSource; | ||
| [key: string]: unknown; | ||
| }>; | ||
| replies?: TaskMessageCardReply[]; | ||
| createdAt: string; | ||
| updatedAt?: string; | ||
| data?: Record<string, unknown> & { | ||
| task?: { | ||
| workspaceId?: string; | ||
| threadId?: string; | ||
| revision?: number; | ||
| contextPack?: TaskContextPack; | ||
| [key: string]: unknown; | ||
| }; | ||
| }; | ||
| [key: string]: unknown; | ||
| } | ||
| type GenericMessageCard = { | ||
| id?: string; | ||
| kind: string; | ||
| version?: number; | ||
| title?: string; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| }; | ||
| interface ServerAppMessageCard { | ||
| id?: string; | ||
| kind: 'server_app'; | ||
| version?: number; | ||
| appKey: string; | ||
| title: string; | ||
| description?: string; | ||
| label?: string; | ||
| action?: { | ||
| mode: 'open_app'; | ||
| path?: string; | ||
| }; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| } | ||
| interface MessageReferenceCard { | ||
| id?: string; | ||
| kind: 'message_reference'; | ||
| version?: number; | ||
| title: string; | ||
| description?: string; | ||
| label?: string; | ||
| target: { | ||
| serverId?: string | null; | ||
| serverSlug?: string | null; | ||
| channelId: string; | ||
| messageId: string; | ||
| taskCardId?: string | null; | ||
| inboxAgentId?: string | null; | ||
| kind?: 'channel_message' | 'inbox_message'; | ||
| }; | ||
| source?: MessageCardSource; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| } | ||
| type MessageCard = TaskMessageCard | ServerAppMessageCard | MessageReferenceCard | GenericMessageCard; | ||
| interface CommerceOfferCardInput { | ||
| id?: string; | ||
| kind: 'offer'; | ||
| offerId: string; | ||
| } | ||
| type CommerceMessageCard = CommerceProductCard | CommerceOfferCardInput; | ||
| interface CommerceProductCard { | ||
| id: string; | ||
| kind: 'offer' | 'product'; | ||
| offerId?: string; | ||
| shopId: string; | ||
| shopScope: { | ||
| kind: 'server' | 'user'; | ||
| id: string; | ||
| }; | ||
| productId: string; | ||
| skuId?: string; | ||
| snapshot: { | ||
| name: string; | ||
| summary?: string | null; | ||
| imageUrl?: string | null; | ||
| shopName?: string | null; | ||
| deliveryPromise?: string | null; | ||
| price: number; | ||
| currency: string; | ||
| productType: 'physical' | 'entitlement'; | ||
| billingMode?: 'one_time' | 'fixed_duration' | 'subscription'; | ||
| durationSeconds?: number | null; | ||
| resourceType?: string; | ||
| resourceId?: string; | ||
| capability?: string; | ||
| }; | ||
| purchase: { | ||
| mode: 'direct' | 'select_sku' | 'open_detail'; | ||
| }; | ||
| } | ||
| interface PaidFileCard { | ||
| id: string; | ||
| kind: 'paid_file'; | ||
| fileId: string; | ||
| entitlementId?: string | null; | ||
| deliverableId?: string; | ||
| snapshot: { | ||
| name: string; | ||
| summary?: string | null; | ||
| mime?: string | null; | ||
| sizeBytes?: number | null; | ||
| previewUrl?: string | null; | ||
| }; | ||
| action: { | ||
| mode: 'open_paid_file'; | ||
| }; | ||
| } | ||
| interface OAuthLinkCard { | ||
| id: string; | ||
| kind: 'oauth_link'; | ||
| appId: string; | ||
| clientId?: string | null; | ||
| title: string; | ||
| description?: string | null; | ||
| iconUrl?: string | null; | ||
| meta?: { | ||
| appName?: string | null; | ||
| avatarUrl?: string | null; | ||
| iconUrl?: string | null; | ||
| coverUrl?: string | null; | ||
| homepageUrl?: string | null; | ||
| origin?: string | null; | ||
| }; | ||
| url: string; | ||
| embedUrl?: string | null; | ||
| fallbackUrl?: string | null; | ||
| scopes?: string[]; | ||
| action: { | ||
| mode: 'open_iframe' | 'open_external'; | ||
| }; | ||
| } | ||
| type MentionSuggestionTrigger = '@' | '#'; | ||
| interface MentionSuggestion { | ||
| id: string; | ||
| kind: MessageMentionKind; | ||
| targetId: string; | ||
| token: string; | ||
| label: string; | ||
| description?: string | null; | ||
| serverId?: string; | ||
| serverSlug?: string | null; | ||
| serverName?: string | null; | ||
| channelId?: string; | ||
| channelName?: string | null; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| userId?: string; | ||
| username?: string | null; | ||
| displayName?: string | null; | ||
| avatarUrl?: string | null; | ||
| isBot?: boolean; | ||
| isPrivate?: boolean; | ||
| } | ||
| interface Attachment { | ||
| id: string; | ||
| messageId: string; | ||
| filename: string; | ||
| url: string; | ||
| contentType: string; | ||
| size: number; | ||
| width: number | null; | ||
| height: number | null; | ||
| workspaceNodeId?: string | null; | ||
| kind?: 'file' | 'image' | 'voice'; | ||
| durationMs?: number | null; | ||
| audioCodec?: string | null; | ||
| audioContainer?: string | null; | ||
| waveformPeaks?: number[] | null; | ||
| waveformVersion?: number | null; | ||
| transcript?: { | ||
| id: string; | ||
| status: 'pending' | 'processing' | 'ready' | 'failed'; | ||
| text: string | null; | ||
| language: string | null; | ||
| source: 'client' | 'server' | 'runtime'; | ||
| provider?: string | null; | ||
| confidence?: number | null; | ||
| errorCode?: string | null; | ||
| updatedAt?: string; | ||
| } | null; | ||
| playback?: { | ||
| played: boolean; | ||
| completed: boolean; | ||
| lastPositionMs: number; | ||
| playedCount?: number; | ||
| } | null; | ||
| createdAt: string; | ||
| } | ||
| interface ReactionGroup { | ||
| emoji: string; | ||
| count: number; | ||
| userIds: string[]; | ||
| } | ||
| interface Thread { | ||
| id: string; | ||
| name: string; | ||
| channelId: string; | ||
| parentMessageId: string; | ||
| creatorId: string; | ||
| isArchived: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| } | ||
| interface SendMessageRequest { | ||
| content: string; | ||
| threadId?: string; | ||
| replyToId?: string; | ||
| mentions?: MessageMention[]; | ||
| metadata?: MessageMetadata; | ||
| } | ||
| interface UpdateMessageRequest { | ||
| content: string; | ||
| } | ||
| type NotificationType = 'mention' | 'reply' | 'dm' | 'system'; | ||
| interface Notification { | ||
| id: string; | ||
| userId: string; | ||
| type: NotificationType; | ||
| title: string; | ||
| body: string | null; | ||
| referenceId: string | null; | ||
| referenceType: string | null; | ||
| isRead: boolean; | ||
| createdAt: string; | ||
| } | ||
| export { type Attachment as A, type TaskMessagePrivacy as B, type CommerceMessageCard as C, type TaskMessagePrivacyDataClass as D, type TaskMessageRequirementSkill as E, type TaskMessageRequirementTool as F, type GenericMessageCard as G, type TaskMessageRequirements as H, type TaskMessageSubmitCommand as I, type Thread as J, buildMessageAgentChainMetadata as K, buildMessageCopilotContextMetadata as L, MESSAGE_AGENT_CHAIN_METADATA_KEY as M, type Notification as N, type OAuthLinkCard as O, type PaidFileCard as P, isMessageAgentChainMetadata as Q, type ReactionGroup as R, type SendMessageRequest as S, type TaskContextPack as T, type UpdateMessageRequest as U, isMessageCopilotContext as V, type CommerceOfferCardInput as a, type CommerceProductCard as b, MESSAGE_COPILOT_CONTEXT_METADATA_KEY as c, type MentionSuggestion as d, type MentionSuggestionTrigger as e, type Message as f, type MessageAgentChainMetadata as g, type MessageCard as h, type MessageCardApp as i, type MessageCardCapability as j, type MessageCardClaim as k, type MessageCardSource as l, type MessageCardStatus as m, type MessageCopilotContext as n, type MessageMention as o, type MessageMentionKind as p, type MessageMentionRange as q, type MessageMetadata as r, type MessageReferenceCard as s, type NotificationType as t, type ServerAppMessageCard as u, type TaskMessageCard as v, type TaskMessageCardReply as w, type TaskMessageCardTag as x, type TaskMessageExpectedArtifact as y, type TaskMessageOutputContract as z }; |
+2
-2
| export { CLIENT_EVENTS, ClientEvent, LIMITS, SERVER_EVENTS, ServerEvent } from './constants/index.cjs'; | ||
| export { AgentProcessIdInput, AsrAcceptInput, BadgeCountInput, ClipboardTextInput, CommunityAuthSnapshotInput, CommunityFetchJsonInput, ConnectorConnectionEnabledInput, ConnectorDeleteInput, ConnectorStartSettingsInput, ConnectorWorkDirInput, CreateConnectorBuddyInput, DesktopDiagnosticsSnapshot, DesktopIPCApi, DesktopIpcClient, DesktopIpcInvokeArgs, DesktopIpcInvokeChannel, DesktopIpcInvokeFn, DesktopIpcInvokeInput, DesktopIpcInvokeMap, DesktopIpcInvokeParsedInput, DesktopIpcInvokeResult, DesktopIpcInvokeSchemaMap, DesktopIpcProtocol, DesktopLogExportResult, DesktopNotificationInput, DesktopPlatform, DesktopRuntimeSettingsSnapshot, DesktopSettingsPatchInput, DesktopTtsProvider, DesktopUpdateChannel, DesktopUpdateInfo, DesktopUpdateSettings, DesktopUpdateState, DownloadUpdateUrlInput, ExternalUrlInput, ForceOptionsInput, IPCClient, IPCProcedureArgs, IPCProcedureArgument, IPCProcedureDefinition, IPCProcedureInput, IPCProcedureOutput, IPCProtocolDefinition, IPCProtocolImplementation, IPCServiceClient, IPCServiceDefinition, IPCServiceImplementation, ModelProxyStreamInput, NotificationModeInput, OpenAtLoginInput, OpenCommunityLoginInput, OpenCommunityLoginIpcInput, OptionalPathInput, PackIdInput, PetArchiveImportInput, PetMarketplaceImportInput, PetPanelModeInput, PetWindowDragMoveInput, PetWindowDragStartInput, PetWindowMouseInteractiveInput, PetWindowPointerIdInput, ReaderIdInput, ReaderOpenInput, ReaderResourceSnapshot, ReaderStateSnapshot, RendererLogInput, RuntimeIdInput, SelectDirectoryInput, ShowCommunityInput, ShowCommunityIpcInput, ShowSettingsInput, ShowSettingsIpcInput, SpeechTextInput, StartAgentInput, UpdateSettingsInput, VoiceEngineStatus, VoiceModelInstallInput, agentProcessIdSchema, asrAcceptSchema, badgeCountSchema, clipboardTextSchema, communityAuthSnapshotSchema, communityFetchJsonSchema, connectorConnectionEnabledSchema, connectorDeleteSchema, connectorStartSettingsSchema, connectorWorkDirSchema, createConnectorBuddySchema, defineIPCProtocol, defineIPCService, desktopIpcInvokeSchemas, desktopIpcProtocol, desktopNotificationSchema, desktopSettingsPatchSchema, downloadUpdateUrlSchema, externalUrlSchema, forceOptionsSchema, ipcProcedure, ipcProcedureChannel, ipcVoidInputSchema, ipcVoidOutputSchema, modelProxyStreamSchema, notificationModeSchema, openAtLoginSchema, openCommunityLoginInputSchema, optionalPathInputSchema, packIdInputSchema, parseIPCProcedureInput, parseIPCProcedureOutput, petArchiveImportSchema, petMarketplaceImportSchema, petPanelModeSchema, petWindowDragMoveSchema, petWindowDragStartSchema, petWindowMouseInteractiveSchema, petWindowPointerIdSchema, readerIdInputSchema, readerOpenSchema, rendererLogSchema, runtimeIdInputSchema, selectDirectorySchema, showCommunityInputSchema, showSettingsInputSchema, speechTextSchema, startAgentSchema, updateSettingsSchema, voiceModelInstallSchema } from './desktop-ipc/index.cjs'; | ||
| export { DEFAULT_HOMEPLAY_CATALOG, ShadowHomePlayCatalogItem, ShadowPlayAction, ShadowPlayAvailability, getDefaultHomePlay, getPlayBuddyEmail, getPlayBuddyUsername } from './play-catalog/index.cjs'; | ||
| export { Agent, AgentCapability, AgentInfo, AgentKernelType, AgentStatus, AuthResponse, BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, BUDDY_INBOX_DELIVERY_PERMISSION, BUDDY_INBOX_PLATFORM_PERMISSIONS, BUDDY_INBOX_TOPIC_PREFIX, BUDDY_PRESENCE_STATUSES, BuddyInboxAdmissionMode, BuddyInboxAdmissionPendingDelivery, BuddyInboxAdmissionPendingTask, BuddyInboxAdmissionPolicy, BuddyInboxAdmissionRule, BuddyInboxAdmissionSubjectKind, BuddyInboxPlatformPermission, BuddyInboxTaskFilter, BuddyInboxViewMessage, BuddyInboxViewMode, BuddyPresenceStatus, Channel, ChannelSortBy, ChannelSortDirection, ChannelSortOptions, ChannelType, CreateAgentRequest, CreateChannelRequest, CreateServerRequest, DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, FriendEntry, FriendSource, Friendship, FriendshipStatus, LoginRequest, Member, MemberRole, RUNTIME_SESSION_PET_REACTION_BY_STATE, RegisterRequest, RuntimeSessionAnimationSignal, RuntimeSessionPetActivity, RuntimeSessionPetActivityKind, RuntimeSessionPetReaction, RuntimeSessionState, Server, TASK_MESSAGE_CARD_STATUSES, TASK_MESSAGE_CARD_STATUS_TRANSITIONS, TERMINAL_TASK_MESSAGE_CARD_STATUSES, USER_STATUSES, UpdateChannelRequest, UpdateServerRequest, User, UserMembership, UserMembershipTier, UserProfile, UserStatus, VoiceChannelCredentials, VoiceChannelJoinResult, VoiceChannelLeaveResult, VoiceChannelPolicy, VoiceChannelState, VoiceParticipant, buddyInboxAdmissionRuleKey, buddyInboxMessageMatchesTaskFilter, buddyInboxTopic, buildBuddyInboxViewMessages, canTransitionTaskMessageCardStatus, getBuddyInboxTaskCards, getBuddyInboxTaskMessageIds, getBuddyInboxTaskStatuses, hasBuddyInboxTaskCard, isBuddyHeartbeatActive, isBuddyInboxPlatformPermission, isBuddyInboxTaskReply, isBuddyInboxTopic, isMessageReferenceCard, isTaskMessageCardStatus, isTaskReplyNotificationCard, isTerminalTaskMessageCardStatus, normalizeBuddyInboxAdmissionPendingDeliveries, normalizeBuddyInboxAdmissionPolicy, normalizeBuddyPresenceStatus, normalizeBuddyRuntimePresenceStatus, normalizeUserStatus, parseBuddyInboxAgentId, runtimeSessionPetReactionForState, runtimeSessionSignalToPetReaction, runtimeSessionStateLooksActive } from './types/index.cjs'; | ||
| export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, G as GenericMessageCard, M as MESSAGE_COPILOT_CONTEXT_METADATA_KEY, c as MentionSuggestion, d as MentionSuggestionTrigger, e as Message, f as MessageCard, g as MessageCardApp, h as MessageCardCapability, i as MessageCardClaim, j as MessageCardSource, k as MessageCardStatus, l as MessageCopilotContext, m as MessageMention, n as MessageMentionKind, o as MessageMentionRange, p as MessageMetadata, q as MessageReferenceCard, N as Notification, r as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, s as ServerAppMessageCard, T as TaskMessageCard, t as TaskMessageCardReply, u as TaskMessageCardTag, v as TaskMessageExpectedArtifact, w as TaskMessageOutputContract, x as TaskMessagePrivacy, y as TaskMessagePrivacyDataClass, z as TaskMessageRequirementSkill, B as TaskMessageRequirementTool, D as TaskMessageRequirements, E as TaskMessageSubmitCommand, F as Thread, U as UpdateMessageRequest, H as buildMessageCopilotContextMetadata, I as isMessageCopilotContext } from './message.types-CQX9uQpa.cjs'; | ||
| export { Agent, AgentCapability, AgentInfo, AgentKernelType, AgentStatus, AuthResponse, BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, BUDDY_INBOX_DELIVERY_PERMISSION, BUDDY_INBOX_PLATFORM_PERMISSIONS, BUDDY_INBOX_TOPIC_PREFIX, BUDDY_PRESENCE_STATUSES, BuddyInboxAdmissionMode, BuddyInboxAdmissionPendingDelivery, BuddyInboxAdmissionPendingTask, BuddyInboxAdmissionPolicy, BuddyInboxAdmissionRule, BuddyInboxAdmissionSubjectKind, BuddyInboxPlatformPermission, BuddyInboxViewMessage, BuddyInboxViewMode, BuddyPresenceStatus, Channel, ChannelSortBy, ChannelSortDirection, ChannelSortOptions, ChannelType, CreateAgentRequest, CreateChannelRequest, CreateServerRequest, DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, FriendEntry, FriendSource, Friendship, FriendshipStatus, LoginRequest, Member, MemberRole, PresenceChangePayload, PresenceSnapshotPayload, PresenceStatus, RUNTIME_SESSION_PET_REACTION_BY_STATE, RegisterRequest, RuntimeSessionAnimationSignal, RuntimeSessionPetActivity, RuntimeSessionPetActivityKind, RuntimeSessionPetReaction, RuntimeSessionState, Server, TASK_MESSAGE_CARD_STATUSES, TASK_MESSAGE_CARD_STATUS_TRANSITIONS, TERMINAL_TASK_MESSAGE_CARD_STATUSES, USER_STATUSES, UpdateChannelRequest, UpdateServerRequest, User, UserMembership, UserMembershipTier, UserProfile, UserStatus, VoiceChannelCredentials, VoiceChannelJoinResult, VoiceChannelLeaveResult, VoiceChannelPolicy, VoiceChannelState, VoiceParticipant, applyPresenceChangeToRuntime, buddyInboxAdmissionRuleKey, buddyInboxTopic, buildBuddyInboxViewMessages, canTransitionTaskMessageCardStatus, getBuddyInboxTaskCards, getBuddyInboxTaskStatuses, getBuddyPresenceExpiresAt, hasBuddyInboxTaskCard, isBuddyHeartbeatActive, isBuddyInboxPlatformPermission, isBuddyInboxTopic, isMessageReferenceCard, isTaskMessageCardStatus, isTerminalTaskMessageCardStatus, normalizeBuddyInboxAdmissionPendingDeliveries, normalizeBuddyInboxAdmissionPolicy, normalizeBuddyPresenceStatus, normalizeBuddyRuntimePresenceStatus, normalizePresenceStatus, normalizeUserStatus, parseBuddyInboxAgentId, resolvePresenceStatus, runtimeSessionPetReactionForState, runtimeSessionSignalToPetReaction, runtimeSessionStateLooksActive } from './types/index.cjs'; | ||
| export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, G as GenericMessageCard, M as MESSAGE_AGENT_CHAIN_METADATA_KEY, c as MESSAGE_COPILOT_CONTEXT_METADATA_KEY, d as MentionSuggestion, e as MentionSuggestionTrigger, f as Message, g as MessageAgentChainMetadata, h as MessageCard, i as MessageCardApp, j as MessageCardCapability, k as MessageCardClaim, l as MessageCardSource, m as MessageCardStatus, n as MessageCopilotContext, o as MessageMention, p as MessageMentionKind, q as MessageMentionRange, r as MessageMetadata, s as MessageReferenceCard, N as Notification, t as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, u as ServerAppMessageCard, T as TaskContextPack, v as TaskMessageCard, w as TaskMessageCardReply, x as TaskMessageCardTag, y as TaskMessageExpectedArtifact, z as TaskMessageOutputContract, B as TaskMessagePrivacy, D as TaskMessagePrivacyDataClass, E as TaskMessageRequirementSkill, F as TaskMessageRequirementTool, H as TaskMessageRequirements, I as TaskMessageSubmitCommand, J as Thread, U as UpdateMessageRequest, K as buildMessageAgentChainMetadata, L as buildMessageCopilotContextMetadata, Q as isMessageAgentChainMetadata, V as isMessageCopilotContext } from './message.types-KkQdHFE5.cjs'; | ||
| export { BgPattern, CAT_AVATAR_COUNT, CatConfig, CatDecoration, CatExpression, CatPattern, MessageMentionTextSegment, SlashCommandAction, assignMentionRanges, buildMentionMarkdownLinks, canonicalMentionToken, canonicalizeMentionContent, escapeMarkdownLinkLabel, extractSlashCommandActions, formatDate, generateInviteCode, generateRandomCatConfig, getAllCatAvatars, getCatAvatar, getCatAvatarByUserId, getCatSvgString, isCanonicalMentionToken, isValidEmail, mentionDisplayText, parseCanonicalMentionToken, renderCatSvg, segmentTextByMentions, slugify } from './utils/index.cjs'; | ||
| import 'zod'; |
+2
-2
| export { CLIENT_EVENTS, ClientEvent, LIMITS, SERVER_EVENTS, ServerEvent } from './constants/index.js'; | ||
| export { AgentProcessIdInput, AsrAcceptInput, BadgeCountInput, ClipboardTextInput, CommunityAuthSnapshotInput, CommunityFetchJsonInput, ConnectorConnectionEnabledInput, ConnectorDeleteInput, ConnectorStartSettingsInput, ConnectorWorkDirInput, CreateConnectorBuddyInput, DesktopDiagnosticsSnapshot, DesktopIPCApi, DesktopIpcClient, DesktopIpcInvokeArgs, DesktopIpcInvokeChannel, DesktopIpcInvokeFn, DesktopIpcInvokeInput, DesktopIpcInvokeMap, DesktopIpcInvokeParsedInput, DesktopIpcInvokeResult, DesktopIpcInvokeSchemaMap, DesktopIpcProtocol, DesktopLogExportResult, DesktopNotificationInput, DesktopPlatform, DesktopRuntimeSettingsSnapshot, DesktopSettingsPatchInput, DesktopTtsProvider, DesktopUpdateChannel, DesktopUpdateInfo, DesktopUpdateSettings, DesktopUpdateState, DownloadUpdateUrlInput, ExternalUrlInput, ForceOptionsInput, IPCClient, IPCProcedureArgs, IPCProcedureArgument, IPCProcedureDefinition, IPCProcedureInput, IPCProcedureOutput, IPCProtocolDefinition, IPCProtocolImplementation, IPCServiceClient, IPCServiceDefinition, IPCServiceImplementation, ModelProxyStreamInput, NotificationModeInput, OpenAtLoginInput, OpenCommunityLoginInput, OpenCommunityLoginIpcInput, OptionalPathInput, PackIdInput, PetArchiveImportInput, PetMarketplaceImportInput, PetPanelModeInput, PetWindowDragMoveInput, PetWindowDragStartInput, PetWindowMouseInteractiveInput, PetWindowPointerIdInput, ReaderIdInput, ReaderOpenInput, ReaderResourceSnapshot, ReaderStateSnapshot, RendererLogInput, RuntimeIdInput, SelectDirectoryInput, ShowCommunityInput, ShowCommunityIpcInput, ShowSettingsInput, ShowSettingsIpcInput, SpeechTextInput, StartAgentInput, UpdateSettingsInput, VoiceEngineStatus, VoiceModelInstallInput, agentProcessIdSchema, asrAcceptSchema, badgeCountSchema, clipboardTextSchema, communityAuthSnapshotSchema, communityFetchJsonSchema, connectorConnectionEnabledSchema, connectorDeleteSchema, connectorStartSettingsSchema, connectorWorkDirSchema, createConnectorBuddySchema, defineIPCProtocol, defineIPCService, desktopIpcInvokeSchemas, desktopIpcProtocol, desktopNotificationSchema, desktopSettingsPatchSchema, downloadUpdateUrlSchema, externalUrlSchema, forceOptionsSchema, ipcProcedure, ipcProcedureChannel, ipcVoidInputSchema, ipcVoidOutputSchema, modelProxyStreamSchema, notificationModeSchema, openAtLoginSchema, openCommunityLoginInputSchema, optionalPathInputSchema, packIdInputSchema, parseIPCProcedureInput, parseIPCProcedureOutput, petArchiveImportSchema, petMarketplaceImportSchema, petPanelModeSchema, petWindowDragMoveSchema, petWindowDragStartSchema, petWindowMouseInteractiveSchema, petWindowPointerIdSchema, readerIdInputSchema, readerOpenSchema, rendererLogSchema, runtimeIdInputSchema, selectDirectorySchema, showCommunityInputSchema, showSettingsInputSchema, speechTextSchema, startAgentSchema, updateSettingsSchema, voiceModelInstallSchema } from './desktop-ipc/index.js'; | ||
| export { DEFAULT_HOMEPLAY_CATALOG, ShadowHomePlayCatalogItem, ShadowPlayAction, ShadowPlayAvailability, getDefaultHomePlay, getPlayBuddyEmail, getPlayBuddyUsername } from './play-catalog/index.js'; | ||
| export { Agent, AgentCapability, AgentInfo, AgentKernelType, AgentStatus, AuthResponse, BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, BUDDY_INBOX_DELIVERY_PERMISSION, BUDDY_INBOX_PLATFORM_PERMISSIONS, BUDDY_INBOX_TOPIC_PREFIX, BUDDY_PRESENCE_STATUSES, BuddyInboxAdmissionMode, BuddyInboxAdmissionPendingDelivery, BuddyInboxAdmissionPendingTask, BuddyInboxAdmissionPolicy, BuddyInboxAdmissionRule, BuddyInboxAdmissionSubjectKind, BuddyInboxPlatformPermission, BuddyInboxTaskFilter, BuddyInboxViewMessage, BuddyInboxViewMode, BuddyPresenceStatus, Channel, ChannelSortBy, ChannelSortDirection, ChannelSortOptions, ChannelType, CreateAgentRequest, CreateChannelRequest, CreateServerRequest, DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, FriendEntry, FriendSource, Friendship, FriendshipStatus, LoginRequest, Member, MemberRole, RUNTIME_SESSION_PET_REACTION_BY_STATE, RegisterRequest, RuntimeSessionAnimationSignal, RuntimeSessionPetActivity, RuntimeSessionPetActivityKind, RuntimeSessionPetReaction, RuntimeSessionState, Server, TASK_MESSAGE_CARD_STATUSES, TASK_MESSAGE_CARD_STATUS_TRANSITIONS, TERMINAL_TASK_MESSAGE_CARD_STATUSES, USER_STATUSES, UpdateChannelRequest, UpdateServerRequest, User, UserMembership, UserMembershipTier, UserProfile, UserStatus, VoiceChannelCredentials, VoiceChannelJoinResult, VoiceChannelLeaveResult, VoiceChannelPolicy, VoiceChannelState, VoiceParticipant, buddyInboxAdmissionRuleKey, buddyInboxMessageMatchesTaskFilter, buddyInboxTopic, buildBuddyInboxViewMessages, canTransitionTaskMessageCardStatus, getBuddyInboxTaskCards, getBuddyInboxTaskMessageIds, getBuddyInboxTaskStatuses, hasBuddyInboxTaskCard, isBuddyHeartbeatActive, isBuddyInboxPlatformPermission, isBuddyInboxTaskReply, isBuddyInboxTopic, isMessageReferenceCard, isTaskMessageCardStatus, isTaskReplyNotificationCard, isTerminalTaskMessageCardStatus, normalizeBuddyInboxAdmissionPendingDeliveries, normalizeBuddyInboxAdmissionPolicy, normalizeBuddyPresenceStatus, normalizeBuddyRuntimePresenceStatus, normalizeUserStatus, parseBuddyInboxAgentId, runtimeSessionPetReactionForState, runtimeSessionSignalToPetReaction, runtimeSessionStateLooksActive } from './types/index.js'; | ||
| export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, G as GenericMessageCard, M as MESSAGE_COPILOT_CONTEXT_METADATA_KEY, c as MentionSuggestion, d as MentionSuggestionTrigger, e as Message, f as MessageCard, g as MessageCardApp, h as MessageCardCapability, i as MessageCardClaim, j as MessageCardSource, k as MessageCardStatus, l as MessageCopilotContext, m as MessageMention, n as MessageMentionKind, o as MessageMentionRange, p as MessageMetadata, q as MessageReferenceCard, N as Notification, r as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, s as ServerAppMessageCard, T as TaskMessageCard, t as TaskMessageCardReply, u as TaskMessageCardTag, v as TaskMessageExpectedArtifact, w as TaskMessageOutputContract, x as TaskMessagePrivacy, y as TaskMessagePrivacyDataClass, z as TaskMessageRequirementSkill, B as TaskMessageRequirementTool, D as TaskMessageRequirements, E as TaskMessageSubmitCommand, F as Thread, U as UpdateMessageRequest, H as buildMessageCopilotContextMetadata, I as isMessageCopilotContext } from './message.types-CQX9uQpa.js'; | ||
| export { Agent, AgentCapability, AgentInfo, AgentKernelType, AgentStatus, AuthResponse, BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, BUDDY_INBOX_DELIVERY_PERMISSION, BUDDY_INBOX_PLATFORM_PERMISSIONS, BUDDY_INBOX_TOPIC_PREFIX, BUDDY_PRESENCE_STATUSES, BuddyInboxAdmissionMode, BuddyInboxAdmissionPendingDelivery, BuddyInboxAdmissionPendingTask, BuddyInboxAdmissionPolicy, BuddyInboxAdmissionRule, BuddyInboxAdmissionSubjectKind, BuddyInboxPlatformPermission, BuddyInboxViewMessage, BuddyInboxViewMode, BuddyPresenceStatus, Channel, ChannelSortBy, ChannelSortDirection, ChannelSortOptions, ChannelType, CreateAgentRequest, CreateChannelRequest, CreateServerRequest, DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, FriendEntry, FriendSource, Friendship, FriendshipStatus, LoginRequest, Member, MemberRole, PresenceChangePayload, PresenceSnapshotPayload, PresenceStatus, RUNTIME_SESSION_PET_REACTION_BY_STATE, RegisterRequest, RuntimeSessionAnimationSignal, RuntimeSessionPetActivity, RuntimeSessionPetActivityKind, RuntimeSessionPetReaction, RuntimeSessionState, Server, TASK_MESSAGE_CARD_STATUSES, TASK_MESSAGE_CARD_STATUS_TRANSITIONS, TERMINAL_TASK_MESSAGE_CARD_STATUSES, USER_STATUSES, UpdateChannelRequest, UpdateServerRequest, User, UserMembership, UserMembershipTier, UserProfile, UserStatus, VoiceChannelCredentials, VoiceChannelJoinResult, VoiceChannelLeaveResult, VoiceChannelPolicy, VoiceChannelState, VoiceParticipant, applyPresenceChangeToRuntime, buddyInboxAdmissionRuleKey, buddyInboxTopic, buildBuddyInboxViewMessages, canTransitionTaskMessageCardStatus, getBuddyInboxTaskCards, getBuddyInboxTaskStatuses, getBuddyPresenceExpiresAt, hasBuddyInboxTaskCard, isBuddyHeartbeatActive, isBuddyInboxPlatformPermission, isBuddyInboxTopic, isMessageReferenceCard, isTaskMessageCardStatus, isTerminalTaskMessageCardStatus, normalizeBuddyInboxAdmissionPendingDeliveries, normalizeBuddyInboxAdmissionPolicy, normalizeBuddyPresenceStatus, normalizeBuddyRuntimePresenceStatus, normalizePresenceStatus, normalizeUserStatus, parseBuddyInboxAgentId, resolvePresenceStatus, runtimeSessionPetReactionForState, runtimeSessionSignalToPetReaction, runtimeSessionStateLooksActive } from './types/index.js'; | ||
| export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, G as GenericMessageCard, M as MESSAGE_AGENT_CHAIN_METADATA_KEY, c as MESSAGE_COPILOT_CONTEXT_METADATA_KEY, d as MentionSuggestion, e as MentionSuggestionTrigger, f as Message, g as MessageAgentChainMetadata, h as MessageCard, i as MessageCardApp, j as MessageCardCapability, k as MessageCardClaim, l as MessageCardSource, m as MessageCardStatus, n as MessageCopilotContext, o as MessageMention, p as MessageMentionKind, q as MessageMentionRange, r as MessageMetadata, s as MessageReferenceCard, N as Notification, t as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, u as ServerAppMessageCard, T as TaskContextPack, v as TaskMessageCard, w as TaskMessageCardReply, x as TaskMessageCardTag, y as TaskMessageExpectedArtifact, z as TaskMessageOutputContract, B as TaskMessagePrivacy, D as TaskMessagePrivacyDataClass, E as TaskMessageRequirementSkill, F as TaskMessageRequirementTool, H as TaskMessageRequirements, I as TaskMessageSubmitCommand, J as Thread, U as UpdateMessageRequest, K as buildMessageAgentChainMetadata, L as buildMessageCopilotContextMetadata, Q as isMessageAgentChainMetadata, V as isMessageCopilotContext } from './message.types-KkQdHFE5.js'; | ||
| export { BgPattern, CAT_AVATAR_COUNT, CatConfig, CatDecoration, CatExpression, CatPattern, MessageMentionTextSegment, SlashCommandAction, assignMentionRanges, buildMentionMarkdownLinks, canonicalMentionToken, canonicalizeMentionContent, escapeMarkdownLinkLabel, extractSlashCommandActions, formatDate, generateInviteCode, generateRandomCatConfig, getAllCatAvatars, getCatAvatar, getCatAvatarByUserId, getCatSvgString, isCanonicalMentionToken, isValidEmail, mentionDisplayText, parseCanonicalMentionToken, renderCatSvg, segmentTextByMentions, slugify } from './utils/index.js'; | ||
| import 'zod'; |
+15
-9
@@ -71,2 +71,3 @@ import { | ||
| DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, | ||
| MESSAGE_AGENT_CHAIN_METADATA_KEY, | ||
| MESSAGE_COPILOT_CONTEXT_METADATA_KEY, | ||
@@ -78,20 +79,20 @@ RUNTIME_SESSION_PET_REACTION_BY_STATE, | ||
| USER_STATUSES, | ||
| applyPresenceChangeToRuntime, | ||
| buddyInboxAdmissionRuleKey, | ||
| buddyInboxMessageMatchesTaskFilter, | ||
| buddyInboxTopic, | ||
| buildBuddyInboxViewMessages, | ||
| buildMessageAgentChainMetadata, | ||
| buildMessageCopilotContextMetadata, | ||
| canTransitionTaskMessageCardStatus, | ||
| getBuddyInboxTaskCards, | ||
| getBuddyInboxTaskMessageIds, | ||
| getBuddyInboxTaskStatuses, | ||
| getBuddyPresenceExpiresAt, | ||
| hasBuddyInboxTaskCard, | ||
| isBuddyHeartbeatActive, | ||
| isBuddyInboxPlatformPermission, | ||
| isBuddyInboxTaskReply, | ||
| isBuddyInboxTopic, | ||
| isMessageAgentChainMetadata, | ||
| isMessageCopilotContext, | ||
| isMessageReferenceCard, | ||
| isTaskMessageCardStatus, | ||
| isTaskReplyNotificationCard, | ||
| isTerminalTaskMessageCardStatus, | ||
@@ -102,8 +103,10 @@ normalizeBuddyInboxAdmissionPendingDeliveries, | ||
| normalizeBuddyRuntimePresenceStatus, | ||
| normalizePresenceStatus, | ||
| normalizeUserStatus, | ||
| parseBuddyInboxAgentId, | ||
| resolvePresenceStatus, | ||
| runtimeSessionPetReactionForState, | ||
| runtimeSessionSignalToPetReaction, | ||
| runtimeSessionStateLooksActive | ||
| } from "./chunk-OSMIYTN4.js"; | ||
| } from "./chunk-ATHTS7JM.js"; | ||
| import { | ||
@@ -143,2 +146,3 @@ CAT_AVATAR_COUNT, | ||
| LIMITS, | ||
| MESSAGE_AGENT_CHAIN_METADATA_KEY, | ||
| MESSAGE_COPILOT_CONTEXT_METADATA_KEY, | ||
@@ -152,2 +156,3 @@ RUNTIME_SESSION_PET_REACTION_BY_STATE, | ||
| agentProcessIdSchema, | ||
| applyPresenceChangeToRuntime, | ||
| asrAcceptSchema, | ||
@@ -157,6 +162,6 @@ assignMentionRanges, | ||
| buddyInboxAdmissionRuleKey, | ||
| buddyInboxMessageMatchesTaskFilter, | ||
| buddyInboxTopic, | ||
| buildBuddyInboxViewMessages, | ||
| buildMentionMarkdownLinks, | ||
| buildMessageAgentChainMetadata, | ||
| buildMessageCopilotContextMetadata, | ||
@@ -190,4 +195,4 @@ canTransitionTaskMessageCardStatus, | ||
| getBuddyInboxTaskCards, | ||
| getBuddyInboxTaskMessageIds, | ||
| getBuddyInboxTaskStatuses, | ||
| getBuddyPresenceExpiresAt, | ||
| getCatAvatar, | ||
@@ -206,9 +211,8 @@ getCatAvatarByUserId, | ||
| isBuddyInboxPlatformPermission, | ||
| isBuddyInboxTaskReply, | ||
| isBuddyInboxTopic, | ||
| isCanonicalMentionToken, | ||
| isMessageAgentChainMetadata, | ||
| isMessageCopilotContext, | ||
| isMessageReferenceCard, | ||
| isTaskMessageCardStatus, | ||
| isTaskReplyNotificationCard, | ||
| isTerminalTaskMessageCardStatus, | ||
@@ -222,2 +226,3 @@ isValidEmail, | ||
| normalizeBuddyRuntimePresenceStatus, | ||
| normalizePresenceStatus, | ||
| normalizeUserStatus, | ||
@@ -244,2 +249,3 @@ notificationModeSchema, | ||
| rendererLogSchema, | ||
| resolvePresenceStatus, | ||
| runtimeIdInputSchema, | ||
@@ -246,0 +252,0 @@ runtimeSessionPetReactionForState, |
+73
-42
@@ -29,2 +29,3 @@ "use strict"; | ||
| DEFAULT_BUDDY_INBOX_ADMISSION_POLICY: () => DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, | ||
| MESSAGE_AGENT_CHAIN_METADATA_KEY: () => MESSAGE_AGENT_CHAIN_METADATA_KEY, | ||
| MESSAGE_COPILOT_CONTEXT_METADATA_KEY: () => MESSAGE_COPILOT_CONTEXT_METADATA_KEY, | ||
@@ -36,20 +37,20 @@ RUNTIME_SESSION_PET_REACTION_BY_STATE: () => RUNTIME_SESSION_PET_REACTION_BY_STATE, | ||
| USER_STATUSES: () => USER_STATUSES, | ||
| applyPresenceChangeToRuntime: () => applyPresenceChangeToRuntime, | ||
| buddyInboxAdmissionRuleKey: () => buddyInboxAdmissionRuleKey, | ||
| buddyInboxMessageMatchesTaskFilter: () => buddyInboxMessageMatchesTaskFilter, | ||
| buddyInboxTopic: () => buddyInboxTopic, | ||
| buildBuddyInboxViewMessages: () => buildBuddyInboxViewMessages, | ||
| buildMessageAgentChainMetadata: () => buildMessageAgentChainMetadata, | ||
| buildMessageCopilotContextMetadata: () => buildMessageCopilotContextMetadata, | ||
| canTransitionTaskMessageCardStatus: () => canTransitionTaskMessageCardStatus, | ||
| getBuddyInboxTaskCards: () => getBuddyInboxTaskCards, | ||
| getBuddyInboxTaskMessageIds: () => getBuddyInboxTaskMessageIds, | ||
| getBuddyInboxTaskStatuses: () => getBuddyInboxTaskStatuses, | ||
| getBuddyPresenceExpiresAt: () => getBuddyPresenceExpiresAt, | ||
| hasBuddyInboxTaskCard: () => hasBuddyInboxTaskCard, | ||
| isBuddyHeartbeatActive: () => isBuddyHeartbeatActive, | ||
| isBuddyInboxPlatformPermission: () => isBuddyInboxPlatformPermission, | ||
| isBuddyInboxTaskReply: () => isBuddyInboxTaskReply, | ||
| isBuddyInboxTopic: () => isBuddyInboxTopic, | ||
| isMessageAgentChainMetadata: () => isMessageAgentChainMetadata, | ||
| isMessageCopilotContext: () => isMessageCopilotContext, | ||
| isMessageReferenceCard: () => isMessageReferenceCard, | ||
| isTaskMessageCardStatus: () => isTaskMessageCardStatus, | ||
| isTaskReplyNotificationCard: () => isTaskReplyNotificationCard, | ||
| isTerminalTaskMessageCardStatus: () => isTerminalTaskMessageCardStatus, | ||
@@ -60,4 +61,6 @@ normalizeBuddyInboxAdmissionPendingDeliveries: () => normalizeBuddyInboxAdmissionPendingDeliveries, | ||
| normalizeBuddyRuntimePresenceStatus: () => normalizeBuddyRuntimePresenceStatus, | ||
| normalizePresenceStatus: () => normalizePresenceStatus, | ||
| normalizeUserStatus: () => normalizeUserStatus, | ||
| parseBuddyInboxAgentId: () => parseBuddyInboxAgentId, | ||
| resolvePresenceStatus: () => resolvePresenceStatus, | ||
| runtimeSessionPetReactionForState: () => runtimeSessionPetReactionForState, | ||
@@ -126,5 +129,2 @@ runtimeSessionSignalToPetReaction: () => runtimeSessionSignalToPetReaction, | ||
| } | ||
| function isTaskReplyNotificationCard(card) { | ||
| return isRecord(card.data) && card.data.taskReplyNotification === true; | ||
| } | ||
| function isMessageReferenceCard(card) { | ||
@@ -137,3 +137,3 @@ return card?.kind === "message_reference" && typeof card.title === "string" && isRecord(card.target) && typeof card.target.channelId === "string" && typeof card.target.messageId === "string"; | ||
| return cards.filter( | ||
| (card) => card?.kind === "task" && typeof card.id === "string" && isTaskMessageCardStatus(card.status) && !isTaskReplyNotificationCard(card) | ||
| (card) => card?.kind === "task" && typeof card.id === "string" && isTaskMessageCardStatus(card.status) | ||
| ); | ||
@@ -144,36 +144,8 @@ } | ||
| } | ||
| function hasBuddyInboxTaskReplyNotificationCard(message) { | ||
| const cards = message.metadata?.cards; | ||
| return Array.isArray(cards) && cards.some(isTaskReplyNotificationCard); | ||
| } | ||
| function getBuddyInboxTaskStatuses(message) { | ||
| return getBuddyInboxTaskCards(message).map((card) => card.status); | ||
| } | ||
| function buddyInboxMessageMatchesTaskFilter(message, filter) { | ||
| const statuses = getBuddyInboxTaskStatuses(message); | ||
| if (statuses.length === 0) return false; | ||
| if (filter === "all") return true; | ||
| if (filter === "done") return statuses.every((status) => isTerminalTaskMessageCardStatus(status)); | ||
| return statuses.some((status) => !isTerminalTaskMessageCardStatus(status)); | ||
| } | ||
| function getBuddyInboxTaskMessageIds(messages) { | ||
| const ids = /* @__PURE__ */ new Set(); | ||
| for (const message of messages) { | ||
| if (hasBuddyInboxTaskCard(message)) ids.add(message.id); | ||
| } | ||
| return ids; | ||
| } | ||
| function isBuddyInboxTaskReply(message, taskMessageIds) { | ||
| return Boolean(message.replyToId && taskMessageIds.has(message.replyToId)); | ||
| } | ||
| function buildBuddyInboxViewMessages(messages, options) { | ||
| if (!options.isInboxChannel) return [...messages]; | ||
| const taskMessageIds = getBuddyInboxTaskMessageIds(messages); | ||
| const taskFilter = options.taskFilter ?? "all"; | ||
| return messages.filter((message) => { | ||
| if (isBuddyInboxTaskReply(message, taskMessageIds)) return false; | ||
| if (hasBuddyInboxTaskReplyNotificationCard(message)) return false; | ||
| if (!hasBuddyInboxTaskCard(message)) return taskFilter === "all"; | ||
| return buddyInboxMessageMatchesTaskFilter(message, taskFilter); | ||
| }); | ||
| void options; | ||
| return [...messages]; | ||
| } | ||
@@ -299,2 +271,3 @@ var DEFAULT_BUDDY_INBOX_ADMISSION_POLICY = { | ||
| var MESSAGE_COPILOT_CONTEXT_METADATA_KEY = "copilotContext"; | ||
| var MESSAGE_AGENT_CHAIN_METADATA_KEY = "agentChain"; | ||
| function isBoundedMetadataString(value, maxLength, required = false) { | ||
@@ -313,2 +286,11 @@ if (typeof value !== "string") return !required && value == null; | ||
| } | ||
| function isMessageAgentChainMetadata(value) { | ||
| if (!value || typeof value !== "object") return false; | ||
| const record = value; | ||
| const startedAt = record.startedAt; | ||
| return isBoundedMetadataString(record.agentId, 160, true) && typeof record.depth === "number" && Number.isInteger(record.depth) && record.depth >= 0 && record.depth <= 100 && Array.isArray(record.participants) && record.participants.length <= 100 && record.participants.every((participant) => isBoundedMetadataString(participant, 160, true)) && (startedAt == null || typeof startedAt === "number" && Number.isInteger(startedAt) && startedAt >= 0 || isBoundedMetadataString(startedAt, 64, true)) && isBoundedMetadataString(record.rootMessageId, 160); | ||
| } | ||
| function buildMessageAgentChainMetadata(agentChain) { | ||
| return agentChain && isMessageAgentChainMetadata(agentChain) ? { agentChain } : void 0; | ||
| } | ||
@@ -376,2 +358,5 @@ // src/types/runtime-session.types.ts | ||
| } | ||
| function normalizePresenceStatus(status, options) { | ||
| return normalizeBuddyPresenceStatus(status, options); | ||
| } | ||
| function isBuddyHeartbeatActive(lastHeartbeat, options) { | ||
@@ -400,2 +385,45 @@ if (!lastHeartbeat) return false; | ||
| } | ||
| function resolvePresenceStatus({ | ||
| userStatus, | ||
| isBot, | ||
| agentStatus, | ||
| lastHeartbeat, | ||
| busy = false, | ||
| nowMs | ||
| }) { | ||
| if (busy) return "busy"; | ||
| if (isBot || agentStatus != null || lastHeartbeat != null) { | ||
| return normalizeBuddyRuntimePresenceStatus({ | ||
| userStatus, | ||
| agentStatus, | ||
| lastHeartbeat, | ||
| nowMs | ||
| }); | ||
| } | ||
| return normalizePresenceStatus(userStatus); | ||
| } | ||
| function getBuddyPresenceExpiresAt(lastHeartbeat, options) { | ||
| if (!lastHeartbeat) return null; | ||
| const heartbeatMs = lastHeartbeat instanceof Date ? lastHeartbeat.getTime() : new Date(lastHeartbeat).getTime(); | ||
| if (!Number.isFinite(heartbeatMs)) return null; | ||
| return new Date( | ||
| heartbeatMs + (options?.thresholdMs ?? BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS) | ||
| ).toISOString(); | ||
| } | ||
| function applyPresenceChangeToRuntime(current, update, options) { | ||
| const observedAt = update.observedAt ?? options?.observedAt ?? (/* @__PURE__ */ new Date()).toISOString(); | ||
| const userStatus = normalizeUserStatus(update.status); | ||
| const hasAgentPresence = current.isBot === true || current.agentStatus != null || current.lastHeartbeat != null || update.agentId != null || update.agentStatus !== void 0 || update.lastHeartbeat !== void 0; | ||
| if (!hasAgentPresence) return { userStatus }; | ||
| const agentStatus = update.agentStatus !== void 0 ? update.agentStatus : current.agentStatus ?? (userStatus === "online" ? "running" : null); | ||
| let lastHeartbeat = current.lastHeartbeat ?? null; | ||
| if (update.lastHeartbeat !== void 0) { | ||
| lastHeartbeat = update.lastHeartbeat; | ||
| } else if (userStatus === "online") { | ||
| lastHeartbeat = observedAt; | ||
| } else if (userStatus === "offline") { | ||
| lastHeartbeat = null; | ||
| } | ||
| return { userStatus, agentStatus, lastHeartbeat }; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
@@ -409,2 +437,3 @@ 0 && (module.exports = { | ||
| DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, | ||
| MESSAGE_AGENT_CHAIN_METADATA_KEY, | ||
| MESSAGE_COPILOT_CONTEXT_METADATA_KEY, | ||
@@ -416,20 +445,20 @@ RUNTIME_SESSION_PET_REACTION_BY_STATE, | ||
| USER_STATUSES, | ||
| applyPresenceChangeToRuntime, | ||
| buddyInboxAdmissionRuleKey, | ||
| buddyInboxMessageMatchesTaskFilter, | ||
| buddyInboxTopic, | ||
| buildBuddyInboxViewMessages, | ||
| buildMessageAgentChainMetadata, | ||
| buildMessageCopilotContextMetadata, | ||
| canTransitionTaskMessageCardStatus, | ||
| getBuddyInboxTaskCards, | ||
| getBuddyInboxTaskMessageIds, | ||
| getBuddyInboxTaskStatuses, | ||
| getBuddyPresenceExpiresAt, | ||
| hasBuddyInboxTaskCard, | ||
| isBuddyHeartbeatActive, | ||
| isBuddyInboxPlatformPermission, | ||
| isBuddyInboxTaskReply, | ||
| isBuddyInboxTopic, | ||
| isMessageAgentChainMetadata, | ||
| isMessageCopilotContext, | ||
| isMessageReferenceCard, | ||
| isTaskMessageCardStatus, | ||
| isTaskReplyNotificationCard, | ||
| isTerminalTaskMessageCardStatus, | ||
@@ -440,4 +469,6 @@ normalizeBuddyInboxAdmissionPendingDeliveries, | ||
| normalizeBuddyRuntimePresenceStatus, | ||
| normalizePresenceStatus, | ||
| normalizeUserStatus, | ||
| parseBuddyInboxAgentId, | ||
| resolvePresenceStatus, | ||
| runtimeSessionPetReactionForState, | ||
@@ -444,0 +475,0 @@ runtimeSessionSignalToPetReaction, |
@@ -1,3 +0,3 @@ | ||
| import { j as MessageCardSource, D as TaskMessageRequirements, w as TaskMessageOutputContract, x as TaskMessagePrivacy, p as MessageMetadata, k as MessageCardStatus, T as TaskMessageCard, f as MessageCard, q as MessageReferenceCard } from '../message.types-CQX9uQpa.cjs'; | ||
| export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, G as GenericMessageCard, M as MESSAGE_COPILOT_CONTEXT_METADATA_KEY, c as MentionSuggestion, d as MentionSuggestionTrigger, e as Message, g as MessageCardApp, h as MessageCardCapability, i as MessageCardClaim, l as MessageCopilotContext, m as MessageMention, n as MessageMentionKind, o as MessageMentionRange, N as Notification, r as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, s as ServerAppMessageCard, t as TaskMessageCardReply, u as TaskMessageCardTag, v as TaskMessageExpectedArtifact, y as TaskMessagePrivacyDataClass, z as TaskMessageRequirementSkill, B as TaskMessageRequirementTool, E as TaskMessageSubmitCommand, F as Thread, U as UpdateMessageRequest, H as buildMessageCopilotContextMetadata, I as isMessageCopilotContext } from '../message.types-CQX9uQpa.cjs'; | ||
| import { l as MessageCardSource, H as TaskMessageRequirements, z as TaskMessageOutputContract, B as TaskMessagePrivacy, r as MessageMetadata, m as MessageCardStatus, v as TaskMessageCard, h as MessageCard, s as MessageReferenceCard } from '../message.types-KkQdHFE5.cjs'; | ||
| export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, G as GenericMessageCard, M as MESSAGE_AGENT_CHAIN_METADATA_KEY, c as MESSAGE_COPILOT_CONTEXT_METADATA_KEY, d as MentionSuggestion, e as MentionSuggestionTrigger, f as Message, g as MessageAgentChainMetadata, i as MessageCardApp, j as MessageCardCapability, k as MessageCardClaim, n as MessageCopilotContext, o as MessageMention, p as MessageMentionKind, q as MessageMentionRange, N as Notification, t as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, u as ServerAppMessageCard, T as TaskContextPack, w as TaskMessageCardReply, x as TaskMessageCardTag, y as TaskMessageExpectedArtifact, D as TaskMessagePrivacyDataClass, E as TaskMessageRequirementSkill, F as TaskMessageRequirementTool, I as TaskMessageSubmitCommand, J as Thread, U as UpdateMessageRequest, K as buildMessageAgentChainMetadata, L as buildMessageCopilotContextMetadata, Q as isMessageAgentChainMetadata, V as isMessageCopilotContext } from '../message.types-KkQdHFE5.cjs'; | ||
@@ -171,3 +171,2 @@ type AgentStatus = 'running' | 'stopped' | 'error'; | ||
| type BuddyInboxViewMode = 'chat' | 'tasks'; | ||
| type BuddyInboxTaskFilter = 'all' | 'open' | 'done'; | ||
| interface BuddyInboxViewMessage { | ||
@@ -178,3 +177,2 @@ id: string; | ||
| } | ||
| declare function isTaskReplyNotificationCard(card: MessageCard): boolean; | ||
| declare function isMessageReferenceCard(card: MessageCard): card is MessageReferenceCard; | ||
@@ -184,9 +182,5 @@ declare function getBuddyInboxTaskCards(message: BuddyInboxViewMessage): TaskMessageCard[]; | ||
| declare function getBuddyInboxTaskStatuses(message: BuddyInboxViewMessage): MessageCardStatus[]; | ||
| declare function buddyInboxMessageMatchesTaskFilter(message: BuddyInboxViewMessage, filter: BuddyInboxTaskFilter): boolean; | ||
| declare function getBuddyInboxTaskMessageIds(messages: readonly BuddyInboxViewMessage[]): Set<string>; | ||
| declare function isBuddyInboxTaskReply(message: BuddyInboxViewMessage, taskMessageIds: ReadonlySet<string>): boolean; | ||
| declare function buildBuddyInboxViewMessages<TMessage extends BuddyInboxViewMessage>(messages: readonly TMessage[], options: { | ||
| isInboxChannel: boolean; | ||
| mode?: BuddyInboxViewMode; | ||
| taskFilter?: BuddyInboxTaskFilter; | ||
| }): TMessage[]; | ||
@@ -292,5 +286,19 @@ type BuddyInboxAdmissionMode = 'allow' | 'deny' | 'first_time' | 'every_time'; | ||
| type BuddyPresenceStatus = UserStatus | 'busy'; | ||
| type PresenceStatus = BuddyPresenceStatus; | ||
| declare const USER_STATUSES: readonly ["online", "idle", "dnd", "offline"]; | ||
| declare const BUDDY_PRESENCE_STATUSES: readonly ["online", "busy", "idle", "dnd", "offline"]; | ||
| declare const BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS = 90000; | ||
| interface PresenceChangePayload { | ||
| userId: string; | ||
| status: UserStatus; | ||
| agentId?: string | null; | ||
| agentStatus?: string | null; | ||
| lastHeartbeat?: string | null; | ||
| observedAt?: string | null; | ||
| expiresAt?: string | null; | ||
| } | ||
| interface PresenceSnapshotPayload { | ||
| channelId: string; | ||
| members: PresenceChangePayload[]; | ||
| } | ||
| declare function normalizeUserStatus(status?: string | null): UserStatus; | ||
@@ -300,2 +308,5 @@ declare function normalizeBuddyPresenceStatus(status?: string | null, options?: { | ||
| }): BuddyPresenceStatus; | ||
| declare function normalizePresenceStatus(status?: string | null, options?: { | ||
| busy?: boolean; | ||
| }): PresenceStatus; | ||
| declare function isBuddyHeartbeatActive(lastHeartbeat?: string | number | Date | null, options?: { | ||
@@ -312,2 +323,25 @@ nowMs?: number; | ||
| }): BuddyPresenceStatus; | ||
| declare function resolvePresenceStatus({ userStatus, isBot, agentStatus, lastHeartbeat, busy, nowMs, }: { | ||
| userStatus?: string | null; | ||
| isBot?: boolean | null; | ||
| agentStatus?: string | null; | ||
| lastHeartbeat?: string | number | Date | null; | ||
| busy?: boolean; | ||
| nowMs?: number; | ||
| }): PresenceStatus; | ||
| declare function getBuddyPresenceExpiresAt(lastHeartbeat?: string | number | Date | null, options?: { | ||
| thresholdMs?: number; | ||
| }): string | null; | ||
| declare function applyPresenceChangeToRuntime(current: { | ||
| userStatus?: string | null; | ||
| isBot?: boolean | null; | ||
| agentStatus?: string | null; | ||
| lastHeartbeat?: string | null; | ||
| }, update: PresenceChangePayload, options?: { | ||
| observedAt?: string; | ||
| }): { | ||
| userStatus: UserStatus; | ||
| agentStatus?: string | null; | ||
| lastHeartbeat?: string | null; | ||
| }; | ||
| interface User { | ||
@@ -365,2 +399,2 @@ id: string; | ||
| export { type Agent, type AgentCapability, type AgentInfo, type AgentKernelType, type AgentStatus, type AuthResponse, BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, BUDDY_INBOX_DELIVERY_PERMISSION, BUDDY_INBOX_PLATFORM_PERMISSIONS, BUDDY_INBOX_TOPIC_PREFIX, BUDDY_PRESENCE_STATUSES, type BuddyInboxAdmissionMode, type BuddyInboxAdmissionPendingDelivery, type BuddyInboxAdmissionPendingTask, type BuddyInboxAdmissionPolicy, type BuddyInboxAdmissionRule, type BuddyInboxAdmissionSubjectKind, type BuddyInboxPlatformPermission, type BuddyInboxTaskFilter, type BuddyInboxViewMessage, type BuddyInboxViewMode, type BuddyPresenceStatus, type Channel, type ChannelSortBy, type ChannelSortDirection, type ChannelSortOptions, type ChannelType, type CreateAgentRequest, type CreateChannelRequest, type CreateServerRequest, DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, type FriendEntry, type FriendSource, type Friendship, type FriendshipStatus, type LoginRequest, type Member, type MemberRole, MessageCard, MessageCardSource, MessageCardStatus, MessageMetadata, MessageReferenceCard, RUNTIME_SESSION_PET_REACTION_BY_STATE, type RegisterRequest, type RuntimeSessionAnimationSignal, type RuntimeSessionPetActivity, type RuntimeSessionPetActivityKind, type RuntimeSessionPetReaction, type RuntimeSessionState, type Server, TASK_MESSAGE_CARD_STATUSES, TASK_MESSAGE_CARD_STATUS_TRANSITIONS, TERMINAL_TASK_MESSAGE_CARD_STATUSES, TaskMessageCard, TaskMessageOutputContract, TaskMessagePrivacy, TaskMessageRequirements, USER_STATUSES, type UpdateChannelRequest, type UpdateServerRequest, type User, type UserMembership, type UserMembershipTier, type UserProfile, type UserStatus, type VoiceChannelCredentials, type VoiceChannelJoinResult, type VoiceChannelLeaveResult, type VoiceChannelPolicy, type VoiceChannelState, type VoiceParticipant, buddyInboxAdmissionRuleKey, buddyInboxMessageMatchesTaskFilter, buddyInboxTopic, buildBuddyInboxViewMessages, canTransitionTaskMessageCardStatus, getBuddyInboxTaskCards, getBuddyInboxTaskMessageIds, getBuddyInboxTaskStatuses, hasBuddyInboxTaskCard, isBuddyHeartbeatActive, isBuddyInboxPlatformPermission, isBuddyInboxTaskReply, isBuddyInboxTopic, isMessageReferenceCard, isTaskMessageCardStatus, isTaskReplyNotificationCard, isTerminalTaskMessageCardStatus, normalizeBuddyInboxAdmissionPendingDeliveries, normalizeBuddyInboxAdmissionPolicy, normalizeBuddyPresenceStatus, normalizeBuddyRuntimePresenceStatus, normalizeUserStatus, parseBuddyInboxAgentId, runtimeSessionPetReactionForState, runtimeSessionSignalToPetReaction, runtimeSessionStateLooksActive }; | ||
| export { type Agent, type AgentCapability, type AgentInfo, type AgentKernelType, type AgentStatus, type AuthResponse, BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, BUDDY_INBOX_DELIVERY_PERMISSION, BUDDY_INBOX_PLATFORM_PERMISSIONS, BUDDY_INBOX_TOPIC_PREFIX, BUDDY_PRESENCE_STATUSES, type BuddyInboxAdmissionMode, type BuddyInboxAdmissionPendingDelivery, type BuddyInboxAdmissionPendingTask, type BuddyInboxAdmissionPolicy, type BuddyInboxAdmissionRule, type BuddyInboxAdmissionSubjectKind, type BuddyInboxPlatformPermission, type BuddyInboxViewMessage, type BuddyInboxViewMode, type BuddyPresenceStatus, type Channel, type ChannelSortBy, type ChannelSortDirection, type ChannelSortOptions, type ChannelType, type CreateAgentRequest, type CreateChannelRequest, type CreateServerRequest, DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, type FriendEntry, type FriendSource, type Friendship, type FriendshipStatus, type LoginRequest, type Member, type MemberRole, MessageCard, MessageCardSource, MessageCardStatus, MessageMetadata, MessageReferenceCard, type PresenceChangePayload, type PresenceSnapshotPayload, type PresenceStatus, RUNTIME_SESSION_PET_REACTION_BY_STATE, type RegisterRequest, type RuntimeSessionAnimationSignal, type RuntimeSessionPetActivity, type RuntimeSessionPetActivityKind, type RuntimeSessionPetReaction, type RuntimeSessionState, type Server, TASK_MESSAGE_CARD_STATUSES, TASK_MESSAGE_CARD_STATUS_TRANSITIONS, TERMINAL_TASK_MESSAGE_CARD_STATUSES, TaskMessageCard, TaskMessageOutputContract, TaskMessagePrivacy, TaskMessageRequirements, USER_STATUSES, type UpdateChannelRequest, type UpdateServerRequest, type User, type UserMembership, type UserMembershipTier, type UserProfile, type UserStatus, type VoiceChannelCredentials, type VoiceChannelJoinResult, type VoiceChannelLeaveResult, type VoiceChannelPolicy, type VoiceChannelState, type VoiceParticipant, applyPresenceChangeToRuntime, buddyInboxAdmissionRuleKey, buddyInboxTopic, buildBuddyInboxViewMessages, canTransitionTaskMessageCardStatus, getBuddyInboxTaskCards, getBuddyInboxTaskStatuses, getBuddyPresenceExpiresAt, hasBuddyInboxTaskCard, isBuddyHeartbeatActive, isBuddyInboxPlatformPermission, isBuddyInboxTopic, isMessageReferenceCard, isTaskMessageCardStatus, isTerminalTaskMessageCardStatus, normalizeBuddyInboxAdmissionPendingDeliveries, normalizeBuddyInboxAdmissionPolicy, normalizeBuddyPresenceStatus, normalizeBuddyRuntimePresenceStatus, normalizePresenceStatus, normalizeUserStatus, parseBuddyInboxAgentId, resolvePresenceStatus, runtimeSessionPetReactionForState, runtimeSessionSignalToPetReaction, runtimeSessionStateLooksActive }; |
@@ -1,3 +0,3 @@ | ||
| import { j as MessageCardSource, D as TaskMessageRequirements, w as TaskMessageOutputContract, x as TaskMessagePrivacy, p as MessageMetadata, k as MessageCardStatus, T as TaskMessageCard, f as MessageCard, q as MessageReferenceCard } from '../message.types-CQX9uQpa.js'; | ||
| export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, G as GenericMessageCard, M as MESSAGE_COPILOT_CONTEXT_METADATA_KEY, c as MentionSuggestion, d as MentionSuggestionTrigger, e as Message, g as MessageCardApp, h as MessageCardCapability, i as MessageCardClaim, l as MessageCopilotContext, m as MessageMention, n as MessageMentionKind, o as MessageMentionRange, N as Notification, r as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, s as ServerAppMessageCard, t as TaskMessageCardReply, u as TaskMessageCardTag, v as TaskMessageExpectedArtifact, y as TaskMessagePrivacyDataClass, z as TaskMessageRequirementSkill, B as TaskMessageRequirementTool, E as TaskMessageSubmitCommand, F as Thread, U as UpdateMessageRequest, H as buildMessageCopilotContextMetadata, I as isMessageCopilotContext } from '../message.types-CQX9uQpa.js'; | ||
| import { l as MessageCardSource, H as TaskMessageRequirements, z as TaskMessageOutputContract, B as TaskMessagePrivacy, r as MessageMetadata, m as MessageCardStatus, v as TaskMessageCard, h as MessageCard, s as MessageReferenceCard } from '../message.types-KkQdHFE5.js'; | ||
| export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, G as GenericMessageCard, M as MESSAGE_AGENT_CHAIN_METADATA_KEY, c as MESSAGE_COPILOT_CONTEXT_METADATA_KEY, d as MentionSuggestion, e as MentionSuggestionTrigger, f as Message, g as MessageAgentChainMetadata, i as MessageCardApp, j as MessageCardCapability, k as MessageCardClaim, n as MessageCopilotContext, o as MessageMention, p as MessageMentionKind, q as MessageMentionRange, N as Notification, t as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, u as ServerAppMessageCard, T as TaskContextPack, w as TaskMessageCardReply, x as TaskMessageCardTag, y as TaskMessageExpectedArtifact, D as TaskMessagePrivacyDataClass, E as TaskMessageRequirementSkill, F as TaskMessageRequirementTool, I as TaskMessageSubmitCommand, J as Thread, U as UpdateMessageRequest, K as buildMessageAgentChainMetadata, L as buildMessageCopilotContextMetadata, Q as isMessageAgentChainMetadata, V as isMessageCopilotContext } from '../message.types-KkQdHFE5.js'; | ||
@@ -171,3 +171,2 @@ type AgentStatus = 'running' | 'stopped' | 'error'; | ||
| type BuddyInboxViewMode = 'chat' | 'tasks'; | ||
| type BuddyInboxTaskFilter = 'all' | 'open' | 'done'; | ||
| interface BuddyInboxViewMessage { | ||
@@ -178,3 +177,2 @@ id: string; | ||
| } | ||
| declare function isTaskReplyNotificationCard(card: MessageCard): boolean; | ||
| declare function isMessageReferenceCard(card: MessageCard): card is MessageReferenceCard; | ||
@@ -184,9 +182,5 @@ declare function getBuddyInboxTaskCards(message: BuddyInboxViewMessage): TaskMessageCard[]; | ||
| declare function getBuddyInboxTaskStatuses(message: BuddyInboxViewMessage): MessageCardStatus[]; | ||
| declare function buddyInboxMessageMatchesTaskFilter(message: BuddyInboxViewMessage, filter: BuddyInboxTaskFilter): boolean; | ||
| declare function getBuddyInboxTaskMessageIds(messages: readonly BuddyInboxViewMessage[]): Set<string>; | ||
| declare function isBuddyInboxTaskReply(message: BuddyInboxViewMessage, taskMessageIds: ReadonlySet<string>): boolean; | ||
| declare function buildBuddyInboxViewMessages<TMessage extends BuddyInboxViewMessage>(messages: readonly TMessage[], options: { | ||
| isInboxChannel: boolean; | ||
| mode?: BuddyInboxViewMode; | ||
| taskFilter?: BuddyInboxTaskFilter; | ||
| }): TMessage[]; | ||
@@ -292,5 +286,19 @@ type BuddyInboxAdmissionMode = 'allow' | 'deny' | 'first_time' | 'every_time'; | ||
| type BuddyPresenceStatus = UserStatus | 'busy'; | ||
| type PresenceStatus = BuddyPresenceStatus; | ||
| declare const USER_STATUSES: readonly ["online", "idle", "dnd", "offline"]; | ||
| declare const BUDDY_PRESENCE_STATUSES: readonly ["online", "busy", "idle", "dnd", "offline"]; | ||
| declare const BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS = 90000; | ||
| interface PresenceChangePayload { | ||
| userId: string; | ||
| status: UserStatus; | ||
| agentId?: string | null; | ||
| agentStatus?: string | null; | ||
| lastHeartbeat?: string | null; | ||
| observedAt?: string | null; | ||
| expiresAt?: string | null; | ||
| } | ||
| interface PresenceSnapshotPayload { | ||
| channelId: string; | ||
| members: PresenceChangePayload[]; | ||
| } | ||
| declare function normalizeUserStatus(status?: string | null): UserStatus; | ||
@@ -300,2 +308,5 @@ declare function normalizeBuddyPresenceStatus(status?: string | null, options?: { | ||
| }): BuddyPresenceStatus; | ||
| declare function normalizePresenceStatus(status?: string | null, options?: { | ||
| busy?: boolean; | ||
| }): PresenceStatus; | ||
| declare function isBuddyHeartbeatActive(lastHeartbeat?: string | number | Date | null, options?: { | ||
@@ -312,2 +323,25 @@ nowMs?: number; | ||
| }): BuddyPresenceStatus; | ||
| declare function resolvePresenceStatus({ userStatus, isBot, agentStatus, lastHeartbeat, busy, nowMs, }: { | ||
| userStatus?: string | null; | ||
| isBot?: boolean | null; | ||
| agentStatus?: string | null; | ||
| lastHeartbeat?: string | number | Date | null; | ||
| busy?: boolean; | ||
| nowMs?: number; | ||
| }): PresenceStatus; | ||
| declare function getBuddyPresenceExpiresAt(lastHeartbeat?: string | number | Date | null, options?: { | ||
| thresholdMs?: number; | ||
| }): string | null; | ||
| declare function applyPresenceChangeToRuntime(current: { | ||
| userStatus?: string | null; | ||
| isBot?: boolean | null; | ||
| agentStatus?: string | null; | ||
| lastHeartbeat?: string | null; | ||
| }, update: PresenceChangePayload, options?: { | ||
| observedAt?: string; | ||
| }): { | ||
| userStatus: UserStatus; | ||
| agentStatus?: string | null; | ||
| lastHeartbeat?: string | null; | ||
| }; | ||
| interface User { | ||
@@ -365,2 +399,2 @@ id: string; | ||
| export { type Agent, type AgentCapability, type AgentInfo, type AgentKernelType, type AgentStatus, type AuthResponse, BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, BUDDY_INBOX_DELIVERY_PERMISSION, BUDDY_INBOX_PLATFORM_PERMISSIONS, BUDDY_INBOX_TOPIC_PREFIX, BUDDY_PRESENCE_STATUSES, type BuddyInboxAdmissionMode, type BuddyInboxAdmissionPendingDelivery, type BuddyInboxAdmissionPendingTask, type BuddyInboxAdmissionPolicy, type BuddyInboxAdmissionRule, type BuddyInboxAdmissionSubjectKind, type BuddyInboxPlatformPermission, type BuddyInboxTaskFilter, type BuddyInboxViewMessage, type BuddyInboxViewMode, type BuddyPresenceStatus, type Channel, type ChannelSortBy, type ChannelSortDirection, type ChannelSortOptions, type ChannelType, type CreateAgentRequest, type CreateChannelRequest, type CreateServerRequest, DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, type FriendEntry, type FriendSource, type Friendship, type FriendshipStatus, type LoginRequest, type Member, type MemberRole, MessageCard, MessageCardSource, MessageCardStatus, MessageMetadata, MessageReferenceCard, RUNTIME_SESSION_PET_REACTION_BY_STATE, type RegisterRequest, type RuntimeSessionAnimationSignal, type RuntimeSessionPetActivity, type RuntimeSessionPetActivityKind, type RuntimeSessionPetReaction, type RuntimeSessionState, type Server, TASK_MESSAGE_CARD_STATUSES, TASK_MESSAGE_CARD_STATUS_TRANSITIONS, TERMINAL_TASK_MESSAGE_CARD_STATUSES, TaskMessageCard, TaskMessageOutputContract, TaskMessagePrivacy, TaskMessageRequirements, USER_STATUSES, type UpdateChannelRequest, type UpdateServerRequest, type User, type UserMembership, type UserMembershipTier, type UserProfile, type UserStatus, type VoiceChannelCredentials, type VoiceChannelJoinResult, type VoiceChannelLeaveResult, type VoiceChannelPolicy, type VoiceChannelState, type VoiceParticipant, buddyInboxAdmissionRuleKey, buddyInboxMessageMatchesTaskFilter, buddyInboxTopic, buildBuddyInboxViewMessages, canTransitionTaskMessageCardStatus, getBuddyInboxTaskCards, getBuddyInboxTaskMessageIds, getBuddyInboxTaskStatuses, hasBuddyInboxTaskCard, isBuddyHeartbeatActive, isBuddyInboxPlatformPermission, isBuddyInboxTaskReply, isBuddyInboxTopic, isMessageReferenceCard, isTaskMessageCardStatus, isTaskReplyNotificationCard, isTerminalTaskMessageCardStatus, normalizeBuddyInboxAdmissionPendingDeliveries, normalizeBuddyInboxAdmissionPolicy, normalizeBuddyPresenceStatus, normalizeBuddyRuntimePresenceStatus, normalizeUserStatus, parseBuddyInboxAgentId, runtimeSessionPetReactionForState, runtimeSessionSignalToPetReaction, runtimeSessionStateLooksActive }; | ||
| export { type Agent, type AgentCapability, type AgentInfo, type AgentKernelType, type AgentStatus, type AuthResponse, BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, BUDDY_INBOX_DELIVERY_PERMISSION, BUDDY_INBOX_PLATFORM_PERMISSIONS, BUDDY_INBOX_TOPIC_PREFIX, BUDDY_PRESENCE_STATUSES, type BuddyInboxAdmissionMode, type BuddyInboxAdmissionPendingDelivery, type BuddyInboxAdmissionPendingTask, type BuddyInboxAdmissionPolicy, type BuddyInboxAdmissionRule, type BuddyInboxAdmissionSubjectKind, type BuddyInboxPlatformPermission, type BuddyInboxViewMessage, type BuddyInboxViewMode, type BuddyPresenceStatus, type Channel, type ChannelSortBy, type ChannelSortDirection, type ChannelSortOptions, type ChannelType, type CreateAgentRequest, type CreateChannelRequest, type CreateServerRequest, DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, type FriendEntry, type FriendSource, type Friendship, type FriendshipStatus, type LoginRequest, type Member, type MemberRole, MessageCard, MessageCardSource, MessageCardStatus, MessageMetadata, MessageReferenceCard, type PresenceChangePayload, type PresenceSnapshotPayload, type PresenceStatus, RUNTIME_SESSION_PET_REACTION_BY_STATE, type RegisterRequest, type RuntimeSessionAnimationSignal, type RuntimeSessionPetActivity, type RuntimeSessionPetActivityKind, type RuntimeSessionPetReaction, type RuntimeSessionState, type Server, TASK_MESSAGE_CARD_STATUSES, TASK_MESSAGE_CARD_STATUS_TRANSITIONS, TERMINAL_TASK_MESSAGE_CARD_STATUSES, TaskMessageCard, TaskMessageOutputContract, TaskMessagePrivacy, TaskMessageRequirements, USER_STATUSES, type UpdateChannelRequest, type UpdateServerRequest, type User, type UserMembership, type UserMembershipTier, type UserProfile, type UserStatus, type VoiceChannelCredentials, type VoiceChannelJoinResult, type VoiceChannelLeaveResult, type VoiceChannelPolicy, type VoiceChannelState, type VoiceParticipant, applyPresenceChangeToRuntime, buddyInboxAdmissionRuleKey, buddyInboxTopic, buildBuddyInboxViewMessages, canTransitionTaskMessageCardStatus, getBuddyInboxTaskCards, getBuddyInboxTaskStatuses, getBuddyPresenceExpiresAt, hasBuddyInboxTaskCard, isBuddyHeartbeatActive, isBuddyInboxPlatformPermission, isBuddyInboxTopic, isMessageReferenceCard, isTaskMessageCardStatus, isTerminalTaskMessageCardStatus, normalizeBuddyInboxAdmissionPendingDeliveries, normalizeBuddyInboxAdmissionPolicy, normalizeBuddyPresenceStatus, normalizeBuddyRuntimePresenceStatus, normalizePresenceStatus, normalizeUserStatus, parseBuddyInboxAgentId, resolvePresenceStatus, runtimeSessionPetReactionForState, runtimeSessionSignalToPetReaction, runtimeSessionStateLooksActive }; |
+15
-9
@@ -8,2 +8,3 @@ import { | ||
| DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, | ||
| MESSAGE_AGENT_CHAIN_METADATA_KEY, | ||
| MESSAGE_COPILOT_CONTEXT_METADATA_KEY, | ||
@@ -15,20 +16,20 @@ RUNTIME_SESSION_PET_REACTION_BY_STATE, | ||
| USER_STATUSES, | ||
| applyPresenceChangeToRuntime, | ||
| buddyInboxAdmissionRuleKey, | ||
| buddyInboxMessageMatchesTaskFilter, | ||
| buddyInboxTopic, | ||
| buildBuddyInboxViewMessages, | ||
| buildMessageAgentChainMetadata, | ||
| buildMessageCopilotContextMetadata, | ||
| canTransitionTaskMessageCardStatus, | ||
| getBuddyInboxTaskCards, | ||
| getBuddyInboxTaskMessageIds, | ||
| getBuddyInboxTaskStatuses, | ||
| getBuddyPresenceExpiresAt, | ||
| hasBuddyInboxTaskCard, | ||
| isBuddyHeartbeatActive, | ||
| isBuddyInboxPlatformPermission, | ||
| isBuddyInboxTaskReply, | ||
| isBuddyInboxTopic, | ||
| isMessageAgentChainMetadata, | ||
| isMessageCopilotContext, | ||
| isMessageReferenceCard, | ||
| isTaskMessageCardStatus, | ||
| isTaskReplyNotificationCard, | ||
| isTerminalTaskMessageCardStatus, | ||
@@ -39,8 +40,10 @@ normalizeBuddyInboxAdmissionPendingDeliveries, | ||
| normalizeBuddyRuntimePresenceStatus, | ||
| normalizePresenceStatus, | ||
| normalizeUserStatus, | ||
| parseBuddyInboxAgentId, | ||
| resolvePresenceStatus, | ||
| runtimeSessionPetReactionForState, | ||
| runtimeSessionSignalToPetReaction, | ||
| runtimeSessionStateLooksActive | ||
| } from "../chunk-OSMIYTN4.js"; | ||
| } from "../chunk-ATHTS7JM.js"; | ||
| export { | ||
@@ -53,2 +56,3 @@ BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, | ||
| DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, | ||
| MESSAGE_AGENT_CHAIN_METADATA_KEY, | ||
| MESSAGE_COPILOT_CONTEXT_METADATA_KEY, | ||
@@ -60,20 +64,20 @@ RUNTIME_SESSION_PET_REACTION_BY_STATE, | ||
| USER_STATUSES, | ||
| applyPresenceChangeToRuntime, | ||
| buddyInboxAdmissionRuleKey, | ||
| buddyInboxMessageMatchesTaskFilter, | ||
| buddyInboxTopic, | ||
| buildBuddyInboxViewMessages, | ||
| buildMessageAgentChainMetadata, | ||
| buildMessageCopilotContextMetadata, | ||
| canTransitionTaskMessageCardStatus, | ||
| getBuddyInboxTaskCards, | ||
| getBuddyInboxTaskMessageIds, | ||
| getBuddyInboxTaskStatuses, | ||
| getBuddyPresenceExpiresAt, | ||
| hasBuddyInboxTaskCard, | ||
| isBuddyHeartbeatActive, | ||
| isBuddyInboxPlatformPermission, | ||
| isBuddyInboxTaskReply, | ||
| isBuddyInboxTopic, | ||
| isMessageAgentChainMetadata, | ||
| isMessageCopilotContext, | ||
| isMessageReferenceCard, | ||
| isTaskMessageCardStatus, | ||
| isTaskReplyNotificationCard, | ||
| isTerminalTaskMessageCardStatus, | ||
@@ -84,4 +88,6 @@ normalizeBuddyInboxAdmissionPendingDeliveries, | ||
| normalizeBuddyRuntimePresenceStatus, | ||
| normalizePresenceStatus, | ||
| normalizeUserStatus, | ||
| parseBuddyInboxAgentId, | ||
| resolvePresenceStatus, | ||
| runtimeSessionPetReactionForState, | ||
@@ -88,0 +94,0 @@ runtimeSessionSignalToPetReaction, |
@@ -1,2 +0,2 @@ | ||
| import { o as MessageMentionRange, m as MessageMention } from '../message.types-CQX9uQpa.cjs'; | ||
| import { q as MessageMentionRange, o as MessageMention } from '../message.types-KkQdHFE5.cjs'; | ||
@@ -3,0 +3,0 @@ type CatPattern = 'none' | 'tabby' | 'tuxedo' | 'siamese' | 'calico' | 'bicolor'; |
@@ -1,2 +0,2 @@ | ||
| import { o as MessageMentionRange, m as MessageMention } from '../message.types-CQX9uQpa.js'; | ||
| import { q as MessageMentionRange, o as MessageMention } from '../message.types-KkQdHFE5.js'; | ||
@@ -3,0 +3,0 @@ type CatPattern = 'none' | 'tabby' | 'tuxedo' | 'siamese' | 'calico' | 'bicolor'; |
+1
-1
| { | ||
| "name": "@shadowob/shared", | ||
| "version": "1.1.49", | ||
| "version": "1.1.50", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
| // src/types/inbox.types.ts | ||
| var BUDDY_INBOX_TOPIC_PREFIX = "shadow:buddy-inbox:"; | ||
| var BUDDY_INBOX_DELIVERY_PERMISSION = "buddy_inbox:deliver"; | ||
| var BUDDY_INBOX_PLATFORM_PERMISSIONS = [BUDDY_INBOX_DELIVERY_PERMISSION]; | ||
| function isBuddyInboxPlatformPermission(value) { | ||
| return typeof value === "string" && BUDDY_INBOX_PLATFORM_PERMISSIONS.includes(value); | ||
| } | ||
| function buddyInboxTopic(agentId) { | ||
| return `${BUDDY_INBOX_TOPIC_PREFIX}${agentId}`; | ||
| } | ||
| function parseBuddyInboxAgentId(topic) { | ||
| if (!topic?.startsWith(BUDDY_INBOX_TOPIC_PREFIX)) return null; | ||
| const agentId = topic.slice(BUDDY_INBOX_TOPIC_PREFIX.length).trim(); | ||
| return agentId || null; | ||
| } | ||
| function isBuddyInboxTopic(topic) { | ||
| return parseBuddyInboxAgentId(topic) !== null; | ||
| } | ||
| var TASK_MESSAGE_CARD_STATUSES = [ | ||
| "queued", | ||
| "claimed", | ||
| "running", | ||
| "completed", | ||
| "failed", | ||
| "canceled", | ||
| "transferred" | ||
| ]; | ||
| var TERMINAL_TASK_MESSAGE_CARD_STATUSES = [ | ||
| "completed", | ||
| "failed", | ||
| "canceled", | ||
| "transferred" | ||
| ]; | ||
| var TASK_MESSAGE_CARD_STATUS_TRANSITIONS = { | ||
| queued: ["queued", "claimed", "running", "completed", "failed", "canceled"], | ||
| claimed: ["claimed", "running", "completed", "failed", "canceled"], | ||
| running: ["running", "completed", "failed", "canceled"], | ||
| completed: ["completed"], | ||
| failed: ["failed", "transferred"], | ||
| canceled: ["canceled"], | ||
| transferred: ["transferred"] | ||
| }; | ||
| function isTerminalTaskMessageCardStatus(status) { | ||
| return TERMINAL_TASK_MESSAGE_CARD_STATUSES.includes( | ||
| status | ||
| ); | ||
| } | ||
| function isTaskMessageCardStatus(value) { | ||
| return typeof value === "string" && TASK_MESSAGE_CARD_STATUSES.includes(value); | ||
| } | ||
| function canTransitionTaskMessageCardStatus(from, to) { | ||
| const allowed = TASK_MESSAGE_CARD_STATUS_TRANSITIONS[from]; | ||
| return allowed.includes(to); | ||
| } | ||
| function isRecord(value) { | ||
| return !!value && typeof value === "object" && !Array.isArray(value); | ||
| } | ||
| function isTaskReplyNotificationCard(card) { | ||
| return isRecord(card.data) && card.data.taskReplyNotification === true; | ||
| } | ||
| function isMessageReferenceCard(card) { | ||
| return card?.kind === "message_reference" && typeof card.title === "string" && isRecord(card.target) && typeof card.target.channelId === "string" && typeof card.target.messageId === "string"; | ||
| } | ||
| function getBuddyInboxTaskCards(message) { | ||
| const cards = message.metadata?.cards; | ||
| if (!Array.isArray(cards)) return []; | ||
| return cards.filter( | ||
| (card) => card?.kind === "task" && typeof card.id === "string" && isTaskMessageCardStatus(card.status) && !isTaskReplyNotificationCard(card) | ||
| ); | ||
| } | ||
| function hasBuddyInboxTaskCard(message) { | ||
| return getBuddyInboxTaskCards(message).length > 0; | ||
| } | ||
| function hasBuddyInboxTaskReplyNotificationCard(message) { | ||
| const cards = message.metadata?.cards; | ||
| return Array.isArray(cards) && cards.some(isTaskReplyNotificationCard); | ||
| } | ||
| function getBuddyInboxTaskStatuses(message) { | ||
| return getBuddyInboxTaskCards(message).map((card) => card.status); | ||
| } | ||
| function buddyInboxMessageMatchesTaskFilter(message, filter) { | ||
| const statuses = getBuddyInboxTaskStatuses(message); | ||
| if (statuses.length === 0) return false; | ||
| if (filter === "all") return true; | ||
| if (filter === "done") return statuses.every((status) => isTerminalTaskMessageCardStatus(status)); | ||
| return statuses.some((status) => !isTerminalTaskMessageCardStatus(status)); | ||
| } | ||
| function getBuddyInboxTaskMessageIds(messages) { | ||
| const ids = /* @__PURE__ */ new Set(); | ||
| for (const message of messages) { | ||
| if (hasBuddyInboxTaskCard(message)) ids.add(message.id); | ||
| } | ||
| return ids; | ||
| } | ||
| function isBuddyInboxTaskReply(message, taskMessageIds) { | ||
| return Boolean(message.replyToId && taskMessageIds.has(message.replyToId)); | ||
| } | ||
| function buildBuddyInboxViewMessages(messages, options) { | ||
| if (!options.isInboxChannel) return [...messages]; | ||
| const taskMessageIds = getBuddyInboxTaskMessageIds(messages); | ||
| const taskFilter = options.taskFilter ?? "all"; | ||
| return messages.filter((message) => { | ||
| if (isBuddyInboxTaskReply(message, taskMessageIds)) return false; | ||
| if (hasBuddyInboxTaskReplyNotificationCard(message)) return false; | ||
| if (!hasBuddyInboxTaskCard(message)) return taskFilter === "all"; | ||
| return buddyInboxMessageMatchesTaskFilter(message, taskFilter); | ||
| }); | ||
| } | ||
| var DEFAULT_BUDDY_INBOX_ADMISSION_POLICY = { | ||
| defaultMode: "allow", | ||
| rules: [] | ||
| }; | ||
| function parseAdmissionMode(value, fallback) { | ||
| if (value === "allow" || value === "deny" || value === "first_time" || value === "every_time") { | ||
| return value; | ||
| } | ||
| if (value === void 0 || value === null) return fallback; | ||
| throw new Error("Invalid Buddy Inbox admission mode"); | ||
| } | ||
| function parseSubjectKind(value) { | ||
| if (value === "user" || value === "agent" || value === "server_app" || value === "system") { | ||
| return value; | ||
| } | ||
| throw new Error("Invalid Buddy Inbox admission subject kind"); | ||
| } | ||
| function parseOptionalString(value, field, maxLength) { | ||
| if (value === void 0 || value === null || value === "") return void 0; | ||
| if (typeof value !== "string" || value.length > maxLength) { | ||
| throw new Error(`Invalid Buddy Inbox admission ${field}`); | ||
| } | ||
| return value; | ||
| } | ||
| function normalizeBuddyInboxAdmissionPolicy(value) { | ||
| if (value === void 0 || value === null) return { ...DEFAULT_BUDDY_INBOX_ADMISSION_POLICY }; | ||
| if (!isRecord(value)) throw new Error("Invalid Buddy Inbox admission policy"); | ||
| const defaultMode = parseAdmissionMode(value.defaultMode, "allow"); | ||
| const rawRules = value.rules; | ||
| if (rawRules !== void 0 && !Array.isArray(rawRules)) { | ||
| throw new Error("Invalid Buddy Inbox admission rules"); | ||
| } | ||
| const rules = (rawRules ?? []).slice(0, 100).map((entry) => { | ||
| if (!isRecord(entry)) throw new Error("Invalid Buddy Inbox admission rule"); | ||
| return { | ||
| subjectKind: parseSubjectKind(entry.subjectKind), | ||
| subjectId: parseOptionalString(entry.subjectId, "subjectId", 160), | ||
| appKey: parseOptionalString(entry.appKey, "appKey", 120), | ||
| mode: parseAdmissionMode(entry.mode, defaultMode), | ||
| ...entry.approved === true ? { approved: true } : {}, | ||
| note: parseOptionalString(entry.note, "note", 500), | ||
| createdAt: parseOptionalString(entry.createdAt, "createdAt", 64), | ||
| updatedAt: parseOptionalString(entry.updatedAt, "updatedAt", 64) | ||
| }; | ||
| }); | ||
| return { defaultMode, rules }; | ||
| } | ||
| function buddyInboxAdmissionRuleKey(rule) { | ||
| return [rule.subjectKind, rule.subjectId ?? "", rule.appKey ?? ""].join(":"); | ||
| } | ||
| function parsePendingTask(value) { | ||
| if (!isRecord(value)) throw new Error("Invalid Buddy Inbox pending task"); | ||
| const title = parseOptionalString(value.title, "task.title", 180); | ||
| if (!title) throw new Error("Invalid Buddy Inbox pending task title"); | ||
| const body = parseOptionalString(value.body, "task.body", 8e3); | ||
| const priority = value.priority; | ||
| if (priority !== void 0 && priority !== "low" && priority !== "normal" && priority !== "medium" && priority !== "high") { | ||
| throw new Error("Invalid Buddy Inbox pending task priority"); | ||
| } | ||
| const idempotencyKey = parseOptionalString(value.idempotencyKey, "task.idempotencyKey", 240); | ||
| const source = isRecord(value.source) ? value.source : void 0; | ||
| const requirements = isRecord(value.requirements) ? value.requirements : void 0; | ||
| const outputContract = isRecord(value.outputContract) ? value.outputContract : void 0; | ||
| const privacy = isRecord(value.privacy) ? value.privacy : void 0; | ||
| const data = isRecord(value.data) ? value.data : void 0; | ||
| return { | ||
| title, | ||
| ...body ? { body } : {}, | ||
| ...priority ? { priority } : {}, | ||
| ...idempotencyKey ? { idempotencyKey } : {}, | ||
| ...source ? { source } : {}, | ||
| ...requirements ? { requirements } : {}, | ||
| ...outputContract ? { outputContract } : {}, | ||
| ...privacy ? { privacy } : {}, | ||
| ...data ? { data } : {} | ||
| }; | ||
| } | ||
| function normalizeBuddyInboxAdmissionPendingDeliveries(value) { | ||
| if (value === void 0 || value === null) return []; | ||
| if (!Array.isArray(value)) throw new Error("Invalid Buddy Inbox pending deliveries"); | ||
| return value.slice(0, 100).map((entry) => { | ||
| if (!isRecord(entry)) throw new Error("Invalid Buddy Inbox pending delivery"); | ||
| const id = parseOptionalString(entry.id, "pending.id", 80); | ||
| const serverId = parseOptionalString(entry.serverId, "pending.serverId", 160); | ||
| const channelId = parseOptionalString(entry.channelId, "pending.channelId", 160); | ||
| const agentId = parseOptionalString(entry.agentId, "pending.agentId", 160); | ||
| const mode = parseAdmissionMode(entry.mode, "first_time"); | ||
| if (mode !== "first_time" && mode !== "every_time") { | ||
| throw new Error("Invalid Buddy Inbox pending mode"); | ||
| } | ||
| if (!isRecord(entry.subject)) throw new Error("Invalid Buddy Inbox pending subject"); | ||
| if (!isRecord(entry.requestedBy)) throw new Error("Invalid Buddy Inbox pending requester"); | ||
| if (!id || !serverId || !channelId || !agentId) { | ||
| throw new Error("Invalid Buddy Inbox pending delivery identifiers"); | ||
| } | ||
| const requestedAt = parseOptionalString(entry.requestedAt, "pending.requestedAt", 64); | ||
| if (!requestedAt) throw new Error("Invalid Buddy Inbox pending requestedAt"); | ||
| return { | ||
| id, | ||
| serverId, | ||
| channelId, | ||
| agentId, | ||
| mode, | ||
| subject: { | ||
| kind: parseSubjectKind(entry.subject.kind), | ||
| id: parseOptionalString(entry.subject.id, "subject.id", 160), | ||
| appKey: parseOptionalString(entry.subject.appKey, "subject.appKey", 120), | ||
| label: parseOptionalString(entry.subject.label, "subject.label", 160) | ||
| }, | ||
| task: parsePendingTask(entry.task), | ||
| requestedBy: entry.requestedBy, | ||
| requestedAt, | ||
| updatedAt: parseOptionalString(entry.updatedAt, "pending.updatedAt", 64) | ||
| }; | ||
| }); | ||
| } | ||
| // src/types/message.types.ts | ||
| var MESSAGE_COPILOT_CONTEXT_METADATA_KEY = "copilotContext"; | ||
| function isBoundedMetadataString(value, maxLength, required = false) { | ||
| if (typeof value !== "string") return !required && value == null; | ||
| const trimmed = value.trim(); | ||
| return trimmed.length > 0 && trimmed.length <= maxLength; | ||
| } | ||
| function isMessageCopilotContext(value) { | ||
| if (!value || typeof value !== "object") return false; | ||
| const record = value; | ||
| return record.kind === "server_app_copilot" && isBoundedMetadataString(record.appKey, 120, true) && isBoundedMetadataString(record.serverAppId, 160) && isBoundedMetadataString(record.appId, 160) && isBoundedMetadataString(record.appName, 160) && isBoundedMetadataString(record.serverId, 160) && isBoundedMetadataString(record.serverSlug, 160) && isBoundedMetadataString(record.channelId, 160) && isBoundedMetadataString(record.channelKind, 40); | ||
| } | ||
| function buildMessageCopilotContextMetadata(context) { | ||
| return context && isMessageCopilotContext(context) ? { copilotContext: context } : void 0; | ||
| } | ||
| // src/types/runtime-session.types.ts | ||
| var RUNTIME_SESSION_PET_REACTION_BY_STATE = { | ||
| idle: "idle", | ||
| running: "working", | ||
| streaming: "thinking", | ||
| tool_call: "working", | ||
| waiting_for_approval: "waiting", | ||
| blocked: "waiting", | ||
| completed: "success", | ||
| failed: "error", | ||
| stopped: "idle", | ||
| unknown: "idle" | ||
| }; | ||
| function runtimeSessionPetReactionForState(state) { | ||
| return RUNTIME_SESSION_PET_REACTION_BY_STATE[state] ?? "idle"; | ||
| } | ||
| function runtimeSessionSignalToPetReaction(signal) { | ||
| switch (signal) { | ||
| case "running": | ||
| return "working"; | ||
| case "streaming": | ||
| return "thinking"; | ||
| case "tool_call": | ||
| return "working"; | ||
| case "waiting_for_approval": | ||
| case "blocked": | ||
| return "waiting"; | ||
| case "completed": | ||
| return "success"; | ||
| case "failed": | ||
| return "error"; | ||
| case "stopped": | ||
| case "unknown": | ||
| return "idle"; | ||
| default: | ||
| return signal; | ||
| } | ||
| } | ||
| function runtimeSessionStateLooksActive(state) { | ||
| return state === "running" || state === "streaming" || state === "tool_call" || state === "waiting_for_approval" || state === "blocked"; | ||
| } | ||
| // src/types/user.types.ts | ||
| var USER_STATUSES = ["online", "idle", "dnd", "offline"]; | ||
| var BUDDY_PRESENCE_STATUSES = ["online", "busy", "idle", "dnd", "offline"]; | ||
| var BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS = 9e4; | ||
| function normalizeUserStatus(status) { | ||
| if (status === "online" || status === "idle" || status === "dnd" || status === "offline") { | ||
| return status; | ||
| } | ||
| return "offline"; | ||
| } | ||
| function normalizeBuddyPresenceStatus(status, options) { | ||
| if (options?.busy) { | ||
| return "busy"; | ||
| } | ||
| if (status === "busy") { | ||
| return "busy"; | ||
| } | ||
| return normalizeUserStatus(status); | ||
| } | ||
| function isBuddyHeartbeatActive(lastHeartbeat, options) { | ||
| if (!lastHeartbeat) return false; | ||
| const heartbeatMs = lastHeartbeat instanceof Date ? lastHeartbeat.getTime() : new Date(lastHeartbeat).getTime(); | ||
| if (!Number.isFinite(heartbeatMs)) return false; | ||
| const nowMs = options?.nowMs ?? Date.now(); | ||
| const thresholdMs = options?.thresholdMs ?? BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS; | ||
| return nowMs - heartbeatMs <= thresholdMs; | ||
| } | ||
| function normalizeBuddyRuntimePresenceStatus({ | ||
| userStatus, | ||
| agentStatus, | ||
| lastHeartbeat, | ||
| busy = false, | ||
| nowMs | ||
| }) { | ||
| if (busy || agentStatus === "busy") return "busy"; | ||
| if (agentStatus === "running") { | ||
| return isBuddyHeartbeatActive(lastHeartbeat, { nowMs }) ? "online" : "offline"; | ||
| } | ||
| const normalizedAgentStatus = normalizeBuddyPresenceStatus(agentStatus); | ||
| if (normalizedAgentStatus !== "offline") return normalizedAgentStatus; | ||
| return normalizeUserStatus(userStatus); | ||
| } | ||
| export { | ||
| BUDDY_INBOX_TOPIC_PREFIX, | ||
| BUDDY_INBOX_DELIVERY_PERMISSION, | ||
| BUDDY_INBOX_PLATFORM_PERMISSIONS, | ||
| isBuddyInboxPlatformPermission, | ||
| buddyInboxTopic, | ||
| parseBuddyInboxAgentId, | ||
| isBuddyInboxTopic, | ||
| TASK_MESSAGE_CARD_STATUSES, | ||
| TERMINAL_TASK_MESSAGE_CARD_STATUSES, | ||
| TASK_MESSAGE_CARD_STATUS_TRANSITIONS, | ||
| isTerminalTaskMessageCardStatus, | ||
| isTaskMessageCardStatus, | ||
| canTransitionTaskMessageCardStatus, | ||
| isTaskReplyNotificationCard, | ||
| isMessageReferenceCard, | ||
| getBuddyInboxTaskCards, | ||
| hasBuddyInboxTaskCard, | ||
| getBuddyInboxTaskStatuses, | ||
| buddyInboxMessageMatchesTaskFilter, | ||
| getBuddyInboxTaskMessageIds, | ||
| isBuddyInboxTaskReply, | ||
| buildBuddyInboxViewMessages, | ||
| DEFAULT_BUDDY_INBOX_ADMISSION_POLICY, | ||
| normalizeBuddyInboxAdmissionPolicy, | ||
| buddyInboxAdmissionRuleKey, | ||
| normalizeBuddyInboxAdmissionPendingDeliveries, | ||
| MESSAGE_COPILOT_CONTEXT_METADATA_KEY, | ||
| isMessageCopilotContext, | ||
| buildMessageCopilotContextMetadata, | ||
| RUNTIME_SESSION_PET_REACTION_BY_STATE, | ||
| runtimeSessionPetReactionForState, | ||
| runtimeSessionSignalToPetReaction, | ||
| runtimeSessionStateLooksActive, | ||
| USER_STATUSES, | ||
| BUDDY_PRESENCE_STATUSES, | ||
| BUDDY_HEARTBEAT_ONLINE_THRESHOLD_MS, | ||
| normalizeUserStatus, | ||
| normalizeBuddyPresenceStatus, | ||
| isBuddyHeartbeatActive, | ||
| normalizeBuddyRuntimePresenceStatus | ||
| }; |
| interface Message { | ||
| id: string; | ||
| content: string; | ||
| channelId: string; | ||
| authorId: string; | ||
| threadId: string | null; | ||
| replyToId: string | null; | ||
| isEdited: boolean; | ||
| isPinned: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| author?: { | ||
| id: string; | ||
| username: string; | ||
| displayName: string; | ||
| avatarUrl: string | null; | ||
| isBot: boolean; | ||
| }; | ||
| attachments?: Attachment[]; | ||
| reactions?: ReactionGroup[]; | ||
| metadata?: MessageMetadata | null; | ||
| } | ||
| type MessageMentionKind = 'user' | 'buddy' | 'app' | 'channel' | 'server' | 'here' | 'everyone'; | ||
| interface MessageMentionRange { | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface MessageMention { | ||
| kind: MessageMentionKind; | ||
| /** Canonical target id. For users this is userId, for channels channelId, for servers serverId. */ | ||
| targetId: string; | ||
| /** Canonical text persisted in message content, e.g. <@userId>, <#channelId>. */ | ||
| token: string; | ||
| /** Optional display text selected or typed by the sender before canonicalization. */ | ||
| sourceToken?: string; | ||
| /** Human-readable label used by renderers. */ | ||
| label: string; | ||
| /** Optional source range in content. Clients may omit it; servers may recompute later. */ | ||
| range?: MessageMentionRange; | ||
| serverId?: string; | ||
| serverSlug?: string | null; | ||
| serverName?: string | null; | ||
| channelId?: string; | ||
| channelName?: string | null; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| userId?: string; | ||
| username?: string | null; | ||
| displayName?: string | null; | ||
| avatarUrl?: string | null; | ||
| isBot?: boolean; | ||
| isPrivate?: boolean; | ||
| } | ||
| declare const MESSAGE_COPILOT_CONTEXT_METADATA_KEY: "copilotContext"; | ||
| interface MessageCopilotContext { | ||
| kind: 'server_app_copilot'; | ||
| /** Server app install id when the current surface is an installed server app. */ | ||
| serverAppId?: string | null; | ||
| /** Catalog app id when available. */ | ||
| appId?: string | null; | ||
| /** Stable app key from the app route, e.g. kanban. */ | ||
| appKey: string; | ||
| appName?: string | null; | ||
| serverId?: string | null; | ||
| serverSlug?: string | null; | ||
| /** Channel or Inbox currently opened in the Copilot panel. */ | ||
| channelId?: string | null; | ||
| channelKind?: string | null; | ||
| } | ||
| declare function isMessageCopilotContext(value: unknown): value is MessageCopilotContext; | ||
| declare function buildMessageCopilotContextMetadata(context: MessageCopilotContext | null | undefined): { | ||
| copilotContext: MessageCopilotContext; | ||
| } | undefined; | ||
| interface MessageMetadata { | ||
| mentions?: MessageMention[]; | ||
| copilotContext?: MessageCopilotContext; | ||
| collaboration?: { | ||
| id: string; | ||
| rootMessageId: string; | ||
| buddyId: string; | ||
| turn: number; | ||
| target?: 'main' | 'thread'; | ||
| threadId?: string; | ||
| suggestedTextLimit?: number; | ||
| replyDensity?: 'reaction' | 'short' | 'normal' | 'long'; | ||
| }; | ||
| interactive?: Record<string, unknown>; | ||
| interactiveResponse?: Record<string, unknown>; | ||
| interactiveState?: Record<string, unknown>; | ||
| /** Unified card protocol. New card-like message surfaces must use this field. */ | ||
| cards?: MessageCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only commerce card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| commerceCards?: CommerceMessageCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only paid-file delivery card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| paidFileCards?: PaidFileCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only OAuth link card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| oauthLinkCards?: OAuthLinkCard[]; | ||
| [key: string]: unknown; | ||
| } | ||
| type MessageCardStatus = 'queued' | 'claimed' | 'running' | 'completed' | 'failed' | 'canceled' | 'transferred'; | ||
| interface MessageCardSource { | ||
| kind: 'user' | 'pat' | 'oauth' | 'agent' | 'system' | 'server_app' | 'buddy'; | ||
| id?: string; | ||
| label?: string; | ||
| userId?: string; | ||
| agentId?: string; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| serverId?: string; | ||
| channelId?: string; | ||
| command?: string; | ||
| resource?: { | ||
| kind: string; | ||
| id: string; | ||
| label?: string; | ||
| url?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| [key: string]: unknown; | ||
| } | ||
| type TaskMessageCardTag = string | { | ||
| id?: string; | ||
| label: string; | ||
| color?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| interface MessageCardApp { | ||
| id?: string; | ||
| appId?: string; | ||
| appKey?: string; | ||
| name?: string | null; | ||
| label?: string | null; | ||
| iconUrl?: string | null; | ||
| logoUrl?: string | null; | ||
| avatarUrl?: string | null; | ||
| imageUrl?: string | null; | ||
| url?: string | null; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageCardReply { | ||
| id?: string; | ||
| messageId?: string; | ||
| cardId?: string; | ||
| authorId?: string; | ||
| authorLabel?: string; | ||
| authorAvatarUrl?: string | null; | ||
| content: string; | ||
| createdAt: string; | ||
| source?: MessageCardSource; | ||
| [key: string]: unknown; | ||
| } | ||
| interface MessageCardClaim { | ||
| id: string; | ||
| actor: MessageCardSource; | ||
| claimedAt: string; | ||
| expiresAt: string; | ||
| } | ||
| interface MessageCardCapability { | ||
| kind: 'task'; | ||
| scope: string[]; | ||
| issuedAt: string; | ||
| expiresAt: string; | ||
| claimId?: string; | ||
| binding?: { | ||
| messageId?: string; | ||
| cardId: string; | ||
| workspaceId?: string; | ||
| }; | ||
| } | ||
| interface TaskMessageRequirementSkill { | ||
| kind: 'runtime-skill'; | ||
| package: string; | ||
| version?: string; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageRequirementTool { | ||
| kind: string; | ||
| name: string; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageRequirements { | ||
| capabilities?: string[]; | ||
| skills?: TaskMessageRequirementSkill[]; | ||
| tools?: TaskMessageRequirementTool[]; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageExpectedArtifact { | ||
| kind: string; | ||
| mimeTypes?: string[]; | ||
| maxBytes?: number; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageSubmitCommand { | ||
| appKey: string; | ||
| command: string; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageOutputContract { | ||
| expectedArtifacts?: TaskMessageExpectedArtifact[]; | ||
| submitCommand?: TaskMessageSubmitCommand; | ||
| [key: string]: unknown; | ||
| } | ||
| type TaskMessagePrivacyDataClass = 'public' | 'server-private' | 'channel-private' | 'financial' | 'secret' | 'cloud-secret'; | ||
| interface TaskMessagePrivacy { | ||
| dataClass: TaskMessagePrivacyDataClass; | ||
| redactionRequired?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageCard { | ||
| id: string; | ||
| kind: 'task'; | ||
| version: number; | ||
| title: string; | ||
| body?: string; | ||
| status: MessageCardStatus; | ||
| priority?: 'low' | 'normal' | 'medium' | 'high'; | ||
| tags?: TaskMessageCardTag[]; | ||
| app?: MessageCardApp; | ||
| assignee?: { | ||
| agentId?: string; | ||
| userId?: string; | ||
| label?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| source?: MessageCardSource; | ||
| requirements?: TaskMessageRequirements; | ||
| outputContract?: TaskMessageOutputContract; | ||
| privacy?: TaskMessagePrivacy; | ||
| claim?: MessageCardClaim; | ||
| capability?: MessageCardCapability; | ||
| progress?: Array<{ | ||
| at: string; | ||
| status: MessageCardStatus; | ||
| note?: string; | ||
| actor?: MessageCardSource; | ||
| [key: string]: unknown; | ||
| }>; | ||
| replies?: TaskMessageCardReply[]; | ||
| createdAt: string; | ||
| updatedAt?: string; | ||
| data?: Record<string, unknown> & { | ||
| task?: { | ||
| workspaceId?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| }; | ||
| [key: string]: unknown; | ||
| } | ||
| type GenericMessageCard = { | ||
| id?: string; | ||
| kind: string; | ||
| version?: number; | ||
| title?: string; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| }; | ||
| interface ServerAppMessageCard { | ||
| id?: string; | ||
| kind: 'server_app'; | ||
| version?: number; | ||
| appKey: string; | ||
| title: string; | ||
| description?: string; | ||
| label?: string; | ||
| action?: { | ||
| mode: 'open_app'; | ||
| path?: string; | ||
| }; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| } | ||
| interface MessageReferenceCard { | ||
| id?: string; | ||
| kind: 'message_reference'; | ||
| version?: number; | ||
| title: string; | ||
| description?: string; | ||
| label?: string; | ||
| target: { | ||
| serverId?: string | null; | ||
| serverSlug?: string | null; | ||
| channelId: string; | ||
| messageId: string; | ||
| taskCardId?: string | null; | ||
| inboxAgentId?: string | null; | ||
| kind?: 'channel_message' | 'inbox_message'; | ||
| }; | ||
| source?: MessageCardSource; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| } | ||
| type MessageCard = TaskMessageCard | ServerAppMessageCard | MessageReferenceCard | GenericMessageCard; | ||
| interface CommerceOfferCardInput { | ||
| id?: string; | ||
| kind: 'offer'; | ||
| offerId: string; | ||
| } | ||
| type CommerceMessageCard = CommerceProductCard | CommerceOfferCardInput; | ||
| interface CommerceProductCard { | ||
| id: string; | ||
| kind: 'offer' | 'product'; | ||
| offerId?: string; | ||
| shopId: string; | ||
| shopScope: { | ||
| kind: 'server' | 'user'; | ||
| id: string; | ||
| }; | ||
| productId: string; | ||
| skuId?: string; | ||
| snapshot: { | ||
| name: string; | ||
| summary?: string | null; | ||
| imageUrl?: string | null; | ||
| shopName?: string | null; | ||
| deliveryPromise?: string | null; | ||
| price: number; | ||
| currency: string; | ||
| productType: 'physical' | 'entitlement'; | ||
| billingMode?: 'one_time' | 'fixed_duration' | 'subscription'; | ||
| durationSeconds?: number | null; | ||
| resourceType?: string; | ||
| resourceId?: string; | ||
| capability?: string; | ||
| }; | ||
| purchase: { | ||
| mode: 'direct' | 'select_sku' | 'open_detail'; | ||
| }; | ||
| } | ||
| interface PaidFileCard { | ||
| id: string; | ||
| kind: 'paid_file'; | ||
| fileId: string; | ||
| entitlementId?: string | null; | ||
| deliverableId?: string; | ||
| snapshot: { | ||
| name: string; | ||
| summary?: string | null; | ||
| mime?: string | null; | ||
| sizeBytes?: number | null; | ||
| previewUrl?: string | null; | ||
| }; | ||
| action: { | ||
| mode: 'open_paid_file'; | ||
| }; | ||
| } | ||
| interface OAuthLinkCard { | ||
| id: string; | ||
| kind: 'oauth_link'; | ||
| appId: string; | ||
| clientId?: string | null; | ||
| title: string; | ||
| description?: string | null; | ||
| iconUrl?: string | null; | ||
| meta?: { | ||
| appName?: string | null; | ||
| avatarUrl?: string | null; | ||
| iconUrl?: string | null; | ||
| coverUrl?: string | null; | ||
| homepageUrl?: string | null; | ||
| origin?: string | null; | ||
| }; | ||
| url: string; | ||
| embedUrl?: string | null; | ||
| fallbackUrl?: string | null; | ||
| scopes?: string[]; | ||
| action: { | ||
| mode: 'open_iframe' | 'open_external'; | ||
| }; | ||
| } | ||
| type MentionSuggestionTrigger = '@' | '#'; | ||
| interface MentionSuggestion { | ||
| id: string; | ||
| kind: MessageMentionKind; | ||
| targetId: string; | ||
| token: string; | ||
| label: string; | ||
| description?: string | null; | ||
| serverId?: string; | ||
| serverSlug?: string | null; | ||
| serverName?: string | null; | ||
| channelId?: string; | ||
| channelName?: string | null; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| userId?: string; | ||
| username?: string | null; | ||
| displayName?: string | null; | ||
| avatarUrl?: string | null; | ||
| isBot?: boolean; | ||
| isPrivate?: boolean; | ||
| } | ||
| interface Attachment { | ||
| id: string; | ||
| messageId: string; | ||
| filename: string; | ||
| url: string; | ||
| contentType: string; | ||
| size: number; | ||
| width: number | null; | ||
| height: number | null; | ||
| workspaceNodeId?: string | null; | ||
| kind?: 'file' | 'image' | 'voice'; | ||
| durationMs?: number | null; | ||
| audioCodec?: string | null; | ||
| audioContainer?: string | null; | ||
| waveformPeaks?: number[] | null; | ||
| waveformVersion?: number | null; | ||
| transcript?: { | ||
| id: string; | ||
| status: 'pending' | 'processing' | 'ready' | 'failed'; | ||
| text: string | null; | ||
| language: string | null; | ||
| source: 'client' | 'server' | 'runtime'; | ||
| provider?: string | null; | ||
| confidence?: number | null; | ||
| errorCode?: string | null; | ||
| updatedAt?: string; | ||
| } | null; | ||
| playback?: { | ||
| played: boolean; | ||
| completed: boolean; | ||
| lastPositionMs: number; | ||
| playedCount?: number; | ||
| } | null; | ||
| createdAt: string; | ||
| } | ||
| interface ReactionGroup { | ||
| emoji: string; | ||
| count: number; | ||
| userIds: string[]; | ||
| } | ||
| interface Thread { | ||
| id: string; | ||
| name: string; | ||
| channelId: string; | ||
| parentMessageId: string; | ||
| creatorId: string; | ||
| isArchived: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| } | ||
| interface SendMessageRequest { | ||
| content: string; | ||
| threadId?: string; | ||
| replyToId?: string; | ||
| mentions?: MessageMention[]; | ||
| metadata?: MessageMetadata; | ||
| } | ||
| interface UpdateMessageRequest { | ||
| content: string; | ||
| } | ||
| type NotificationType = 'mention' | 'reply' | 'dm' | 'system'; | ||
| interface Notification { | ||
| id: string; | ||
| userId: string; | ||
| type: NotificationType; | ||
| title: string; | ||
| body: string | null; | ||
| referenceId: string | null; | ||
| referenceType: string | null; | ||
| isRead: boolean; | ||
| createdAt: string; | ||
| } | ||
| export { type Attachment as A, type TaskMessageRequirementTool as B, type CommerceMessageCard as C, type TaskMessageRequirements as D, type TaskMessageSubmitCommand as E, type Thread as F, type GenericMessageCard as G, buildMessageCopilotContextMetadata as H, isMessageCopilotContext as I, MESSAGE_COPILOT_CONTEXT_METADATA_KEY as M, type Notification as N, type OAuthLinkCard as O, type PaidFileCard as P, type ReactionGroup as R, type SendMessageRequest as S, type TaskMessageCard as T, type UpdateMessageRequest as U, type CommerceOfferCardInput as a, type CommerceProductCard as b, type MentionSuggestion as c, type MentionSuggestionTrigger as d, type Message as e, type MessageCard as f, type MessageCardApp as g, type MessageCardCapability as h, type MessageCardClaim as i, type MessageCardSource as j, type MessageCardStatus as k, type MessageCopilotContext as l, type MessageMention as m, type MessageMentionKind as n, type MessageMentionRange as o, type MessageMetadata as p, type MessageReferenceCard as q, type NotificationType as r, type ServerAppMessageCard as s, type TaskMessageCardReply as t, type TaskMessageCardTag as u, type TaskMessageExpectedArtifact as v, type TaskMessageOutputContract as w, type TaskMessagePrivacy as x, type TaskMessagePrivacyDataClass as y, type TaskMessageRequirementSkill as z }; |
| interface Message { | ||
| id: string; | ||
| content: string; | ||
| channelId: string; | ||
| authorId: string; | ||
| threadId: string | null; | ||
| replyToId: string | null; | ||
| isEdited: boolean; | ||
| isPinned: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| author?: { | ||
| id: string; | ||
| username: string; | ||
| displayName: string; | ||
| avatarUrl: string | null; | ||
| isBot: boolean; | ||
| }; | ||
| attachments?: Attachment[]; | ||
| reactions?: ReactionGroup[]; | ||
| metadata?: MessageMetadata | null; | ||
| } | ||
| type MessageMentionKind = 'user' | 'buddy' | 'app' | 'channel' | 'server' | 'here' | 'everyone'; | ||
| interface MessageMentionRange { | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface MessageMention { | ||
| kind: MessageMentionKind; | ||
| /** Canonical target id. For users this is userId, for channels channelId, for servers serverId. */ | ||
| targetId: string; | ||
| /** Canonical text persisted in message content, e.g. <@userId>, <#channelId>. */ | ||
| token: string; | ||
| /** Optional display text selected or typed by the sender before canonicalization. */ | ||
| sourceToken?: string; | ||
| /** Human-readable label used by renderers. */ | ||
| label: string; | ||
| /** Optional source range in content. Clients may omit it; servers may recompute later. */ | ||
| range?: MessageMentionRange; | ||
| serverId?: string; | ||
| serverSlug?: string | null; | ||
| serverName?: string | null; | ||
| channelId?: string; | ||
| channelName?: string | null; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| userId?: string; | ||
| username?: string | null; | ||
| displayName?: string | null; | ||
| avatarUrl?: string | null; | ||
| isBot?: boolean; | ||
| isPrivate?: boolean; | ||
| } | ||
| declare const MESSAGE_COPILOT_CONTEXT_METADATA_KEY: "copilotContext"; | ||
| interface MessageCopilotContext { | ||
| kind: 'server_app_copilot'; | ||
| /** Server app install id when the current surface is an installed server app. */ | ||
| serverAppId?: string | null; | ||
| /** Catalog app id when available. */ | ||
| appId?: string | null; | ||
| /** Stable app key from the app route, e.g. kanban. */ | ||
| appKey: string; | ||
| appName?: string | null; | ||
| serverId?: string | null; | ||
| serverSlug?: string | null; | ||
| /** Channel or Inbox currently opened in the Copilot panel. */ | ||
| channelId?: string | null; | ||
| channelKind?: string | null; | ||
| } | ||
| declare function isMessageCopilotContext(value: unknown): value is MessageCopilotContext; | ||
| declare function buildMessageCopilotContextMetadata(context: MessageCopilotContext | null | undefined): { | ||
| copilotContext: MessageCopilotContext; | ||
| } | undefined; | ||
| interface MessageMetadata { | ||
| mentions?: MessageMention[]; | ||
| copilotContext?: MessageCopilotContext; | ||
| collaboration?: { | ||
| id: string; | ||
| rootMessageId: string; | ||
| buddyId: string; | ||
| turn: number; | ||
| target?: 'main' | 'thread'; | ||
| threadId?: string; | ||
| suggestedTextLimit?: number; | ||
| replyDensity?: 'reaction' | 'short' | 'normal' | 'long'; | ||
| }; | ||
| interactive?: Record<string, unknown>; | ||
| interactiveResponse?: Record<string, unknown>; | ||
| interactiveState?: Record<string, unknown>; | ||
| /** Unified card protocol. New card-like message surfaces must use this field. */ | ||
| cards?: MessageCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only commerce card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| commerceCards?: CommerceMessageCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only paid-file delivery card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| paidFileCards?: PaidFileCard[]; | ||
| /** | ||
| * @deprecated Compatibility-only OAuth link card array. | ||
| * New card-like protocols must use `cards`; do not use this field for new product decisions. | ||
| */ | ||
| oauthLinkCards?: OAuthLinkCard[]; | ||
| [key: string]: unknown; | ||
| } | ||
| type MessageCardStatus = 'queued' | 'claimed' | 'running' | 'completed' | 'failed' | 'canceled' | 'transferred'; | ||
| interface MessageCardSource { | ||
| kind: 'user' | 'pat' | 'oauth' | 'agent' | 'system' | 'server_app' | 'buddy'; | ||
| id?: string; | ||
| label?: string; | ||
| userId?: string; | ||
| agentId?: string; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| serverId?: string; | ||
| channelId?: string; | ||
| command?: string; | ||
| resource?: { | ||
| kind: string; | ||
| id: string; | ||
| label?: string; | ||
| url?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| [key: string]: unknown; | ||
| } | ||
| type TaskMessageCardTag = string | { | ||
| id?: string; | ||
| label: string; | ||
| color?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| interface MessageCardApp { | ||
| id?: string; | ||
| appId?: string; | ||
| appKey?: string; | ||
| name?: string | null; | ||
| label?: string | null; | ||
| iconUrl?: string | null; | ||
| logoUrl?: string | null; | ||
| avatarUrl?: string | null; | ||
| imageUrl?: string | null; | ||
| url?: string | null; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageCardReply { | ||
| id?: string; | ||
| messageId?: string; | ||
| cardId?: string; | ||
| authorId?: string; | ||
| authorLabel?: string; | ||
| authorAvatarUrl?: string | null; | ||
| content: string; | ||
| createdAt: string; | ||
| source?: MessageCardSource; | ||
| [key: string]: unknown; | ||
| } | ||
| interface MessageCardClaim { | ||
| id: string; | ||
| actor: MessageCardSource; | ||
| claimedAt: string; | ||
| expiresAt: string; | ||
| } | ||
| interface MessageCardCapability { | ||
| kind: 'task'; | ||
| scope: string[]; | ||
| issuedAt: string; | ||
| expiresAt: string; | ||
| claimId?: string; | ||
| binding?: { | ||
| messageId?: string; | ||
| cardId: string; | ||
| workspaceId?: string; | ||
| }; | ||
| } | ||
| interface TaskMessageRequirementSkill { | ||
| kind: 'runtime-skill'; | ||
| package: string; | ||
| version?: string; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageRequirementTool { | ||
| kind: string; | ||
| name: string; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageRequirements { | ||
| capabilities?: string[]; | ||
| skills?: TaskMessageRequirementSkill[]; | ||
| tools?: TaskMessageRequirementTool[]; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageExpectedArtifact { | ||
| kind: string; | ||
| mimeTypes?: string[]; | ||
| maxBytes?: number; | ||
| required?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageSubmitCommand { | ||
| appKey: string; | ||
| command: string; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageOutputContract { | ||
| expectedArtifacts?: TaskMessageExpectedArtifact[]; | ||
| submitCommand?: TaskMessageSubmitCommand; | ||
| [key: string]: unknown; | ||
| } | ||
| type TaskMessagePrivacyDataClass = 'public' | 'server-private' | 'channel-private' | 'financial' | 'secret' | 'cloud-secret'; | ||
| interface TaskMessagePrivacy { | ||
| dataClass: TaskMessagePrivacyDataClass; | ||
| redactionRequired?: boolean; | ||
| [key: string]: unknown; | ||
| } | ||
| interface TaskMessageCard { | ||
| id: string; | ||
| kind: 'task'; | ||
| version: number; | ||
| title: string; | ||
| body?: string; | ||
| status: MessageCardStatus; | ||
| priority?: 'low' | 'normal' | 'medium' | 'high'; | ||
| tags?: TaskMessageCardTag[]; | ||
| app?: MessageCardApp; | ||
| assignee?: { | ||
| agentId?: string; | ||
| userId?: string; | ||
| label?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| source?: MessageCardSource; | ||
| requirements?: TaskMessageRequirements; | ||
| outputContract?: TaskMessageOutputContract; | ||
| privacy?: TaskMessagePrivacy; | ||
| claim?: MessageCardClaim; | ||
| capability?: MessageCardCapability; | ||
| progress?: Array<{ | ||
| at: string; | ||
| status: MessageCardStatus; | ||
| note?: string; | ||
| actor?: MessageCardSource; | ||
| [key: string]: unknown; | ||
| }>; | ||
| replies?: TaskMessageCardReply[]; | ||
| createdAt: string; | ||
| updatedAt?: string; | ||
| data?: Record<string, unknown> & { | ||
| task?: { | ||
| workspaceId?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| }; | ||
| [key: string]: unknown; | ||
| } | ||
| type GenericMessageCard = { | ||
| id?: string; | ||
| kind: string; | ||
| version?: number; | ||
| title?: string; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| }; | ||
| interface ServerAppMessageCard { | ||
| id?: string; | ||
| kind: 'server_app'; | ||
| version?: number; | ||
| appKey: string; | ||
| title: string; | ||
| description?: string; | ||
| label?: string; | ||
| action?: { | ||
| mode: 'open_app'; | ||
| path?: string; | ||
| }; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| } | ||
| interface MessageReferenceCard { | ||
| id?: string; | ||
| kind: 'message_reference'; | ||
| version?: number; | ||
| title: string; | ||
| description?: string; | ||
| label?: string; | ||
| target: { | ||
| serverId?: string | null; | ||
| serverSlug?: string | null; | ||
| channelId: string; | ||
| messageId: string; | ||
| taskCardId?: string | null; | ||
| inboxAgentId?: string | null; | ||
| kind?: 'channel_message' | 'inbox_message'; | ||
| }; | ||
| source?: MessageCardSource; | ||
| data?: Record<string, unknown>; | ||
| [key: string]: unknown; | ||
| } | ||
| type MessageCard = TaskMessageCard | ServerAppMessageCard | MessageReferenceCard | GenericMessageCard; | ||
| interface CommerceOfferCardInput { | ||
| id?: string; | ||
| kind: 'offer'; | ||
| offerId: string; | ||
| } | ||
| type CommerceMessageCard = CommerceProductCard | CommerceOfferCardInput; | ||
| interface CommerceProductCard { | ||
| id: string; | ||
| kind: 'offer' | 'product'; | ||
| offerId?: string; | ||
| shopId: string; | ||
| shopScope: { | ||
| kind: 'server' | 'user'; | ||
| id: string; | ||
| }; | ||
| productId: string; | ||
| skuId?: string; | ||
| snapshot: { | ||
| name: string; | ||
| summary?: string | null; | ||
| imageUrl?: string | null; | ||
| shopName?: string | null; | ||
| deliveryPromise?: string | null; | ||
| price: number; | ||
| currency: string; | ||
| productType: 'physical' | 'entitlement'; | ||
| billingMode?: 'one_time' | 'fixed_duration' | 'subscription'; | ||
| durationSeconds?: number | null; | ||
| resourceType?: string; | ||
| resourceId?: string; | ||
| capability?: string; | ||
| }; | ||
| purchase: { | ||
| mode: 'direct' | 'select_sku' | 'open_detail'; | ||
| }; | ||
| } | ||
| interface PaidFileCard { | ||
| id: string; | ||
| kind: 'paid_file'; | ||
| fileId: string; | ||
| entitlementId?: string | null; | ||
| deliverableId?: string; | ||
| snapshot: { | ||
| name: string; | ||
| summary?: string | null; | ||
| mime?: string | null; | ||
| sizeBytes?: number | null; | ||
| previewUrl?: string | null; | ||
| }; | ||
| action: { | ||
| mode: 'open_paid_file'; | ||
| }; | ||
| } | ||
| interface OAuthLinkCard { | ||
| id: string; | ||
| kind: 'oauth_link'; | ||
| appId: string; | ||
| clientId?: string | null; | ||
| title: string; | ||
| description?: string | null; | ||
| iconUrl?: string | null; | ||
| meta?: { | ||
| appName?: string | null; | ||
| avatarUrl?: string | null; | ||
| iconUrl?: string | null; | ||
| coverUrl?: string | null; | ||
| homepageUrl?: string | null; | ||
| origin?: string | null; | ||
| }; | ||
| url: string; | ||
| embedUrl?: string | null; | ||
| fallbackUrl?: string | null; | ||
| scopes?: string[]; | ||
| action: { | ||
| mode: 'open_iframe' | 'open_external'; | ||
| }; | ||
| } | ||
| type MentionSuggestionTrigger = '@' | '#'; | ||
| interface MentionSuggestion { | ||
| id: string; | ||
| kind: MessageMentionKind; | ||
| targetId: string; | ||
| token: string; | ||
| label: string; | ||
| description?: string | null; | ||
| serverId?: string; | ||
| serverSlug?: string | null; | ||
| serverName?: string | null; | ||
| channelId?: string; | ||
| channelName?: string | null; | ||
| appId?: string; | ||
| appKey?: string; | ||
| appName?: string | null; | ||
| iconUrl?: string | null; | ||
| userId?: string; | ||
| username?: string | null; | ||
| displayName?: string | null; | ||
| avatarUrl?: string | null; | ||
| isBot?: boolean; | ||
| isPrivate?: boolean; | ||
| } | ||
| interface Attachment { | ||
| id: string; | ||
| messageId: string; | ||
| filename: string; | ||
| url: string; | ||
| contentType: string; | ||
| size: number; | ||
| width: number | null; | ||
| height: number | null; | ||
| workspaceNodeId?: string | null; | ||
| kind?: 'file' | 'image' | 'voice'; | ||
| durationMs?: number | null; | ||
| audioCodec?: string | null; | ||
| audioContainer?: string | null; | ||
| waveformPeaks?: number[] | null; | ||
| waveformVersion?: number | null; | ||
| transcript?: { | ||
| id: string; | ||
| status: 'pending' | 'processing' | 'ready' | 'failed'; | ||
| text: string | null; | ||
| language: string | null; | ||
| source: 'client' | 'server' | 'runtime'; | ||
| provider?: string | null; | ||
| confidence?: number | null; | ||
| errorCode?: string | null; | ||
| updatedAt?: string; | ||
| } | null; | ||
| playback?: { | ||
| played: boolean; | ||
| completed: boolean; | ||
| lastPositionMs: number; | ||
| playedCount?: number; | ||
| } | null; | ||
| createdAt: string; | ||
| } | ||
| interface ReactionGroup { | ||
| emoji: string; | ||
| count: number; | ||
| userIds: string[]; | ||
| } | ||
| interface Thread { | ||
| id: string; | ||
| name: string; | ||
| channelId: string; | ||
| parentMessageId: string; | ||
| creatorId: string; | ||
| isArchived: boolean; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| } | ||
| interface SendMessageRequest { | ||
| content: string; | ||
| threadId?: string; | ||
| replyToId?: string; | ||
| mentions?: MessageMention[]; | ||
| metadata?: MessageMetadata; | ||
| } | ||
| interface UpdateMessageRequest { | ||
| content: string; | ||
| } | ||
| type NotificationType = 'mention' | 'reply' | 'dm' | 'system'; | ||
| interface Notification { | ||
| id: string; | ||
| userId: string; | ||
| type: NotificationType; | ||
| title: string; | ||
| body: string | null; | ||
| referenceId: string | null; | ||
| referenceType: string | null; | ||
| isRead: boolean; | ||
| createdAt: string; | ||
| } | ||
| export { type Attachment as A, type TaskMessageRequirementTool as B, type CommerceMessageCard as C, type TaskMessageRequirements as D, type TaskMessageSubmitCommand as E, type Thread as F, type GenericMessageCard as G, buildMessageCopilotContextMetadata as H, isMessageCopilotContext as I, MESSAGE_COPILOT_CONTEXT_METADATA_KEY as M, type Notification as N, type OAuthLinkCard as O, type PaidFileCard as P, type ReactionGroup as R, type SendMessageRequest as S, type TaskMessageCard as T, type UpdateMessageRequest as U, type CommerceOfferCardInput as a, type CommerceProductCard as b, type MentionSuggestion as c, type MentionSuggestionTrigger as d, type Message as e, type MessageCard as f, type MessageCardApp as g, type MessageCardCapability as h, type MessageCardClaim as i, type MessageCardSource as j, type MessageCardStatus as k, type MessageCopilotContext as l, type MessageMention as m, type MessageMentionKind as n, type MessageMentionRange as o, type MessageMetadata as p, type MessageReferenceCard as q, type NotificationType as r, type ServerAppMessageCard as s, type TaskMessageCardReply as t, type TaskMessageCardTag as u, type TaskMessageExpectedArtifact as v, type TaskMessageOutputContract as w, type TaskMessagePrivacy as x, type TaskMessagePrivacyDataClass as y, type TaskMessageRequirementSkill as z }; |
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
695707
1.69%11937
1.66%