npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@twinsearth/dsh-agent-preset-registry

v3.5.0

Published

Declarative Agent preset registry and profile-backed editing

Readme


description: "通过声明式 preset 选择 Agent 的工具、提示词和技能。同一进程可以运行多种组合。配置失败会显示在列表中;现有 Agent 保留已经使用的组合。" kind: "package-reference"

@twinsearth/dsh-agent-preset-registry

English | 中文

概述

通过声明式 preset 选择 Agent 的工具、提示词和技能。同一进程可以运行多种组合。配置失败会显示在列表中;现有 Agent 保留已经使用的组合。

目录


使用此包

最小配置

- id: agent-preset-registry
  name: '@twinsearth/dsh-agent-preset-registry'
  config:
    default: standard
- id: preset-standard
  name: '@twinsearth/dsh-agent-preset'
  config:
    id: standard
    plugins: []

| 字段 | 默认值 | 含义 | |---|---|---| | default | 必填 | 未显式指定时使用的 preset ID |

Web 内置定义来自 dsh-web-app bundle。定义使用普通插件行;注册表不扫描目录,也不接受 preset 路径。agent-preset-registry 条目的 volatile 字段 selectedDefault 保留用户默认值,新会话优先使用它而不是部署 default。profile patch 仍可能带有已废弃的 modeSelectionEnabled 字段;注册表未声明该字段,既不读取也不重写它。

注册表不写入任何声明。read Remote 把一条声明的子插件列表按 entry-list YAML 方言(含 !!js 条件)渲染回来,供客户端展示 preset 的组成;没有任何接口接受 YAML 写回。新建 preset 或覆盖内置 preset 都是 bundle 补丁:插入一行 @twinsearth/dsh-agent-preset,或按该行 id 写覆盖补丁,再用 plugin_manager 安装到 profile;创造模式在对话中编写这类 bundle。

理解实现

每个声明在启动时创建注册表拥有的 scope 和内存 Loader 树。更新或移除声明会让旧代际退役;Agent、子 Agent 和临时历史读取各自持有引用,最后一个引用释放后才销毁插件树。插件注册继承 preset scope,Agent scope 的父链接决定可见性;Agent loop 仍由宿主共享。

preset 的服务提供方及其消费方必须共享同一个 cordis:group 隔离 realm。条目局部隔离不会沿 Agent 注册 scope 传播:组外的普通 Context 查找(包括 agent.ctx)仍选择 Host realm。agentPresets.serviceFor() 显式检查保留的组合,不改变普通服务查找。

激活审计检查导入失败、缺失服务和向全局泄漏的服务。导入失败、激活失败和泄漏会拒绝挂载。等待 Host 服务的行保持挂载,每次读取和绑定都在 Host Loader 树结算后重新审计,因此启动顺序不决定结果。失败只禁用该定义的新绑定。presetForSession(session) 同步读取最新记录的预设 ID,未记录时返回 null。会话日志保存 preset ID 和空白会话的切换记录;重启恢复使用该 ID 的当前定义,缺失时拒绝恢复。若空白会话已记录所请求的 preset 且正运行其当前版本,select 不做任何改动,也不追加切换记录或触发 tools/change。

inspectCompositions() 读取本注册表仍保留的全部代际;传入 Agent 上下文时只选择它绑定的精确代际,在此没有绑定时返回空列表。每个 AgentPresetInspection 包含 preset ID、纯数据形式的活动模块引用及解析基址,以及泄漏的服务名。检查器查询运行中的服务,而不是模块级挂载表;结果不包含 Loader 树或 fiber。这些记录定义在 composition-inventory.ts 中。

| 文件 | 职责 | |---|---| | index.ts | 注册、代际与 Agent 绑定 | | mount.ts | 隔离插件树与激活审计 |

延伸阅读

  • Scope — 注册隔离。
  • Agent — 会话运行时。
  • Cordis — 插件配置与生命周期。

模型体验

Preset 选择

模型看到的内容

没有直接内容:所选 preset 的 plugins 拥有模型可见的工具和提示词片段。

Token 影响

本包自身没有;每个挂载的 plugins 行声明自己的工具和片段。

KV Cache effect

已有 Agent 保留插件和提示词。新 Agent 从当前定义构建前缀。

已知限制与待办

  • preset 不是安全沙箱:YAML 及插件可以执行 Host 代码。用户覆盖替换完整子插件列表,不自动合并内置列表的未来更新。进程退出后不保存旧代际的插件实现。

开发备注

无。