@felan-ai/ext-prompt-history

中文文档
0.9.3发布于 2026/11/13MITTypeScriptES Module构建来源已验证近 30 天下载 2899

TUI prompt-history picker for Felan

原始使用文档
文档目录3 节
  1. Composition
  2. Development
  3. Attribution

@felan-ai/ext-prompt-history

Prompt-history search through generic UI, with an optional native TUI picker.

The default extension registers /prompt-history, Ctrl+R, and Cmd+R. It opens with live current-session prompts and provides explicit query and scope controls for session, current-project, and all-project history. Search remains fuzzy and incremental, with newest-first deduplication and at most 50 results. Selecting a result opens its full text; it never inserts, submits, or runs a prompt.

The optional native picker renders inline by default with two full-width horizontal separators. Set presentation.promptHistory.displayMode in $FELAN_AGENT_DIR/tui/settings.json to overlay for a centered popup. Overlay mode uses a complete four-edge frame. Its editor insertion and TUI-only behavior remain available through the named factory. Display mode does not affect the default generic UI.

Composition

The default root requires the shared history-only Sessions service and uses the always-present pi.ui API for presentation:

import extension from '@felan-ai/ext-prompt-history';
import { SESSIONS_HISTORY_SERVICE } from '@felan-ai/agent-core';

services.set(SESSIONS_HISTORY_SERVICE, sessionHistory);

Current-session searches extract prompts from the live session manager. Project and global searches use only provider-visible sessions, pin each complete journal to its revision and branch, and retain issued references internally. Duplicate entries, invalid cursors, revision drift, and oversized histories fail explicitly. Unavailable reads produce incomplete search results rather than an empty complete success. The legacy feature-service exports remain available for callers, but the default root neither declares nor consumes them.

The generic view exposes validated query/scope fields, result detail actions, and scan progress. It requires no presenter hint, hasUI, or client-mode decision. Project/global scans preserve batches of four sessions. Stopping a search or changing its query prevents further batches and discards obsolete results after in-flight reads finish. Opening returns after initial publication rather than holding the command open while the user browses. Closing and shutdown abort and join outstanding reads and UI work before closing the handles.

Queries are bounded to 4,096 UTF-8 bytes. Result previews are bounded to 512 bytes; project/session labels use 128-byte previews. A clipped prompt preview is marked. Selected prompts are not truncated: the existing 64 MiB display limit is enforced, and full text is paged into encoded-byte-bounded 24 KiB chunks. Text is escaped for literal Markdown display. Oversized selections fail explicitly instead of silently losing text. Element identity, revision, action target, and field values are checked before use. No generic action inserts text into an editor or executes a prompt.

The named factory remains available for direct composition, including its local TUI fallback:

import { createPromptHistoryExtension } from '@felan-ai/ext-prompt-history';

const extension = createPromptHistoryExtension(host);

This native picker preserves scope cycling, inline/overlay presentation, and replacement of the local editor with the selected prompt. Display configuration belongs to the TUI, which reads released settings.json preferences as a read-only fallback. The extension declares no display settings.

The package does not access the filesystem, network, credentials, or ambient Pi configuration directly. Historical prompts can contain private source, paths, commands, or credentials supplied in earlier user messages. Hosts should keep session discovery local, bounded, and explicit about which projects are visible.

Configured hosts load the package through their extension list. Historical access comes from the session-scoped provider, not from a client-local store.

Development

pnpm --filter @felan-ai/ext-prompt-history build
pnpm --filter @felan-ai/ext-prompt-history type-check
pnpm --filter @felan-ai/ext-prompt-history test

Attribution

This package adapts the MIT-licensed pi-prompt-history implementation. See NOTICE and LICENSE.

版本与发布记录

@felan-ai/ext-prompt-history 共发布 28 个版本,首次发布于 2026/08/29;过去 12 个月发布了 28 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.3latest2026/11/13今天
0.9.22026/11/131 天前
0.9.12026/11/104 天前
0.9.02026/11/059 天前
0.8.52026/11/0212 天前
0.8.42026/10/3015 天前

其他发布通道:bootstrap → 0.0.0。

关于 @felan-ai/ext-prompt-history 的常见问题

@felan-ai/ext-prompt-history 是什么?

TUI prompt-history picker for Felan

如何安装 @felan-ai/ext-prompt-history?

在项目目录运行 npm install @felan-ai/ext-prompt-history,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@felan-ai/agent-core(^0.15.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@felan-ai/ext-prompt-history 支持 TypeScript 吗?

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

@felan-ai/ext-prompt-history 支持 ESM 还是 CommonJS?

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

@felan-ai/ext-prompt-history 需要什么版本的 Node.js?

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

@felan-ai/ext-prompt-history 可以商用吗?

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

@felan-ai/ext-prompt-history 的下载量有多少?

根据 npm 官方下载统计,@felan-ai/ext-prompt-history 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,899 次,日均约 97 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@felan-ai/ext-prompt-history 还在维护吗?

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