@estiva-app/conversation

中文文档
0.42.0发布于 2026/11/14MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 7638

The conversation rules of the Estiva SPEC (§6.2–§6.8, §11): comment and mention strengths, threading, one shape for a message and a thread, resolving a thread, the line rule, the edit, reaction and attachment folds, NIP-22 comment and reply builders, draf

原始使用文档

@estiva-app/conversation

The conversation rules of the Estiva SPEC §6.2–§6.8, for an app that would rather not implement them itself. Peek, Ship and estiva-agent read conversations through it.

A convenience, never a requirement. SPEC §9's conversation checks (C10–C18) are written so an app can build conversations from the specification alone, and this package's tests are those checks (test/conformance.test.ts for C10–C16, test/membership.test.ts for C17 and C18, test/textMentions.test.ts for C28). If you find this package disagreeing with the SPEC, the package is wrong.

npm install @estiva-app/conversation @estiva-app/protocol

@estiva-app/protocol is a peer. Nothing here opens a socket, holds a credential or touches a browser global: the relay read is a QueryFn you pass, the clock is a createdAtMs you pass, and drafts take their storage.

What is in it

SPECexports
comment or mention§6.4isCommentOn, strengthOn, threadStrength, anchorsOf, isReply, namedInBody
threading§6.4 RepliesparentOf, groupThreads
one shape for a message, a reply and a thread, every app's: a top-level message present, deleted or not returned§6.3–§6.8foldThreads, Message, Thread
resolving a thread: the newest counts, in its message's Folder§6.4 Resolving a thread, C51resolutionOf, resolutionsByTarget, resolutionTargetOf
where a message's lines draw: a link alone on its line is its file's row§13.2, §13.6.2, C21placeLines, writtenUrlOf, urlNames
writing§6.4, §13.6buildComment, buildReply, placeOf, referenceTagsFor, mentionTagsFor
what a composer's pick writes§13.1mentionText, messageReference, urgentTagsFor, URGENT_TAG
what the shared comment box holds, as the message it writes, and back§13.1composerText, composerDocument, withoutNewUrgency, composerDraft
what a box shows under itself while a comment is written or edited: the one file's card (an edit's own card, with its ✕) and each block link's part, and the embed a send or an edit writes§13.6.1, §13.6.2boxReadOf, boxLinksOf, embedsToSend, embedsToEdit, namedBefore, withoutCard, linkTargetOf
what [ offers, and in what order: Files, then Messages, a message found by its own words§13.1rankReferences, referenceSectionsOf, messageCandidate, referenceMatch, fileReference, referenceSearch, MESSAGE_TIER, FILE_TIER, REFERENCE_CAPS
a message as a preview line says it, a link as what it names; the words it is found by§13.1, §13.6.2openingWords, referenceWord, messageWords
ordering§6.2, §6.3trustedTs, orderingMs, byOrder
edits and attachments§6.8editTargetOf, foldEdits, foldAttachments
reactions§6.6REACTION_HORIZON, reactionHorizon, reactionTargetOf, reactionEmojiOf, foldReactions
the reactions to a person§6.6, §11.8reactionsToMeFilter, reactionTakeBackFilter, keepReactionToMe, reactionsToMe, reactionStreamOf, newReactionsIn, reactionsSeenWrites
one read for all of the above§6.6, §6.8decorationsOf
which controls to offer§6.5offersEditAndDelete
drafts—createDraftStore, draftKeys
membership§11.8membershipOf, membersOf, streamOf, membershipFilters, candidateFilesOf, buildMembershipChange
muting§11.8parseMutedBlob, serializeMutedBlob, buildMutedEvent, mutedFilter, mutedFromFollowed
places and following§11.8 Places and followingfollowingOf, placeKindOf, placeFilters, unreadOnPlace, isUnreadOnPlace, buildLevelChange, parseTeamsBlob, serializeTeamsBlob, buildTeamsEvent, teamsFilter
read state§11.1–§11.6channelContext, fileContext, threadContext, loadSlotIdentity, advanceContexts, fetchReadState, publishReadState, createReadStateQueue, watchDwell, mergeSlots, effectiveReadAt, THREAD_RULE_FROM, REPLY_FLOOR_CONTEXT, capReadStateContexts, reactionsContext, REACTIONS_FLOOR_CONTEXT, reactionsSeenOf, isCarriedContextId
unread§11.3, §11.8unreadIn, isUnread
a mention in a file's text§11.8, §13.1mentionAddsFor, newlyNamedPeople, peopleNamedInText

Chat, an edit, a reaction and a deletion are built with @estiva-app/protocol's buildMessage, buildEdit, buildReaction and buildDeletion.

Read state takes its environment like the rest: slot storage and randomness (loadSlotIdentity), the relay query, the signer and NIP-44 (fetchReadState, publishReadState). When to write can come from here too: createReadStateQueue is the one queue a tab marks read through (the debounce, the read-back of its own slot before every whole-blob publish, the backoff, a change of person), and watchDwell marks what stayed on screen for READ_DWELL_MS. Ship and Leaf use both; an app may still write its own.

Light a dot from the files you already load, not from discovery alone. A file's membership comes from membershipOf over that file's own events, which an app already holds for any file it shows. membershipFilters is for listing "your files", and a busy person's results are cut short by the relay's limit (each filter returned 2,000 events for one person in 90 days on 2026-10-01). A dot built only on discovery would miss a file the limit dropped.

What is not in it

The views (CON-18), the composer's editor and its @, !@, [ and / menus (@estiva-app/ui/editor, which writes through mentionText and messageReference above), a Folder's roster (the relay's kind:39002), and anything only one app needs.

版本与发布记录

@estiva-app/conversation 共发布 47 个版本,首次发布于 2026/09/30;过去 12 个月发布了 47 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.42.0latest2026/11/14今天
0.41.02026/11/14今天
0.40.02026/11/13今天
0.39.02026/11/112 天前
0.38.02026/11/113 天前
0.37.02026/11/113 天前

关于 @estiva-app/conversation 的常见问题

@estiva-app/conversation 是什么?

The conversation rules of the Estiva SPEC (§6.2–§6.8, §11): comment and mention strengths, threading, one shape for a message and a thread, resolving a thread, the line rule, the edit, reaction and attachment folds, NIP-22 comment and reply builders, draf

如何安装 @estiva-app/conversation?

在项目目录运行 npm install @estiva-app/conversation,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@estiva-app/protocol(>=0.58.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@estiva-app/conversation 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@estiva-app/conversation 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@estiva-app/conversation 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@estiva-app/conversation 可以商用吗?

@estiva-app/conversation 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@estiva-app/conversation 的下载量有多少?

根据 npm 官方下载统计,@estiva-app/conversation 在 2026/10/14 – 2026/11/12 这 30 天内被下载 7,638 次,日均约 255 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@estiva-app/conversation 还在维护吗?

最新版本 0.42.0 发布于 2026/11/14(今天);至今共发布 47 个版本,其中过去 12 个月发布了 47 个;首次发布于 2026/09/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。