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

@guandata/decidex

v0.1.2

Published

CLI for building and operating Decidex ontologies, agents, skills, sessions, and evaluations.

Readme

Decidex CLI

基于 Decidex 当前 HTTP API 的零依赖 Node.js CLI。要求 Node.js 22+。

npm link
decidex version --json
decidex auth login --base-url https://decidex.example.com
decidex auth status
decidex context show

auth login 会打开一个 CLI 专用 Chrome Profile;在浏览器完成密码、企业 OIDC 或 Galaxy OIDC 登录后,CLI 通过 Chrome DevTools 读取 HttpOnly decidex_session 并保存到 ~/.config/decidex/config.json(权限 0600)。后续登录会复用这个专用 Profile。

也可以从浏览器开发者工具复制 Cookie header,通过 stdin 导入,避免把凭据写进 shell history:

pbpaste | decidex auth import --base-url https://decidex.example.com

Agent

创建 agent.json

{
  "name": "经营分析助手",
  "description": "回答经营问题",
  "instructions": "优先基于已绑定的业务本体回答。",
  "openingMessage": "想分析什么?",
  "presetQuestions": ["本月收入如何?"]
}

创建后,把响应里的 agent.id 写回文件顶层即可执行更新:

decidex agent apply agent.json
decidex agent export AGENT_ID agent.zip
decidex agent import agent.zip
decidex agent publish AGENT_ID --email [email protected]

agent.json 也可以直接声明本体、BI 资产、Skill、默认模型和推理强度:

{
  "name": "经营分析助手",
  "instructions": "优先基于已绑定的业务本体回答。",
  "bizOntologyBindings": [{ "networkId": "NETWORK_ID", "versionId": "VERSION_ID" }],
  "contextReferences": [],
  "pluginSelection": { "enabledPluginIdentities": ["personal:ORG_ID:SKILL_ID"] },
  "sessionDefaultModelCatalogEntryId": "MODEL_ENTRY_ID",
  "sessionDefaultReasoningEffort": "medium"
}

上传参考文件和执行冒烟问题:

decidex agent file add AGENT_ID references/*.md
decidex agent file list AGENT_ID
decidex agent models AGENT_ID
decidex agent run AGENT_ID --message "分析本月销售异常" --wait
decidex agent run AGENT_ID --input smoke.md --wait --follow --output smoke-result.json
printf '%s' '分析本月销售异常' | decidex agent run AGENT_ID --input - --wait

--follow 只把状态和工作轨迹写入 stderr;最终 JSON 仍可稳定写入文件:

{
  "schemaVersion": 1,
  "sessionId": "SESSION_ID",
  "runId": "RUN_ID",
  "status": "SUCCEEDED",
  "error": null,
  "answer": "销售异常主要来自转化率下降。",
  "artifacts": [
    { "name": "结果.xlsx", "path": "artifacts/结果.xlsx", "sizeBytes": 39775 }
  ],
  "startedAt": "2026-09-02T01:00:00.000Z",
  "finishedAt": "2026-09-02T01:02:00.000Z",
  "durationMs": 120000
}

运行后可以直接列出、批量下载产物并诊断 Run:

decidex session list --status running
decidex session view SESSION_ID
decidex session send SESSION_ID --message "继续拆解渠道" --wait --follow
decidex session stop SESSION_ID
decidex session artifacts list SESSION_ID
decidex session artifacts download SESSION_ID --all --dir ./artifacts
decidex session evidence list SESSION_ID
decidex session evidence download SESSION_ID --all --dir ./evidence
decidex run diagnose RUN_ID --session-id SESSION_ID --json

session send --wait 要求消息立即启动;会话正忙时服务端会在入队前返回冲突,避免 CLI 假失败后重试造成重复入队。不带 --wait 时结果可能是 kind=directkind=queued

session evidence 通过服务端会话文件索引发现实际 .boe 文件;证据文件位于 workspace/analysis/biz-ontology-evidence/,不会混入普通产物列表。下载默认拒绝覆盖已有文件,也拒绝通过符号链接写出目标目录;确认覆盖普通文件时加 --overwriterun diagnose 未显式传 --session-id 时会使用最近 50 条本地 Run 映射;若本地配置不可写,远端 Run 仍会继续,CLI 会先输出 Session/Run ID,之后可用显式 ID 恢复诊断。当前后端未向用户 API 暴露 Runner 的 Pod termination reason 和资源指标,结果会将这两项标记为 not_exposed

Skill

decidex skill list
decidex skill upload skill.zip
decidex skill update SKILL_ID skill.zip
decidex skill download SKILL_ID skill.zip
decidex skill delete SKILL_ID

skill update 会先读取线上 fingerprint,再执行乐观锁更新,避免覆盖并发修改。

Evaluation

评测案例文件可以是数组,也可以使用 { "cases": [...] }

{
  "cases": [
    {
      "task": "本月销售下滑来自流量、转化率还是客单价?",
      "rubric": "必须给出时间范围、指标证据和拆解过程;证据不足时降低结论强度。"
    }
  ]
}

先查看差异,再同步:

decidex eval cases plan AGENT_ID cases.json
decidex eval cases apply AGENT_ID cases.json

# 显式删除线上文件中不存在的案例
decidex eval cases plan AGENT_ID cases.json --prune
decidex eval cases apply AGENT_ID cases.json --prune

同步以 task 为稳定键;本地或线上存在重复 task 时会停止。apply 先新增和更新,最后才执行 --prune 删除。当前后端没有案例版本号或幂等键:同一个 Agent 的评测案例只能由一个写入者同步,禁止并发执行 apply/--prune

评测运行文件复用服务端契约:

{
  "caseIds": ["CASE_ID"],
  "targetModelSelection": { "modelEntryId": "MODEL_ENTRY_ID", "reasoningEffort": "medium" },
  "judgeModelSelection": { "modelEntryId": "MODEL_ENTRY_ID", "reasoningEffort": "medium" }
}
decidex eval run AGENT_ID eval-run.json --cases all --wait --output eval-result.json
decidex eval stop AGENT_ID RUN_ID

CLI 按最新 origin/main 校验该文件:只接受 caseIdstargetModelSelectionjudgeModelSelection。使用 --cases all 时由 CLI 获取并覆盖 caseIds;Agent 没有评测案例时会在本地停止。

查询、接管或批量监控已经启动的评测:

decidex eval runs list AGENT_ID
decidex eval runs get AGENT_ID RUN_ID
decidex eval runs wait AGENT_ID RUN_ID --follow --output result.json
decidex eval runs watch evaluation-runs.json --parallel 3 --follow --output summary.json
decidex eval evidence download AGENT_ID RUN_ID --all --dir ./evidence

evaluation-runs.json

{
  "runs": [
    { "label": "A/S07", "agentId": "AGENT_ID", "runId": "RUN_ID" },
    { "label": "B/S07", "agentId": "AGENT_ID", "runId": "RUN_ID" }
  ]
}

watch 只在状态或计数变化时向 stderr 输出进度,最终 JSON 保留每个 Run 的完整 Case 结果;任一 Run 失败、停止或监控出错时退出码为 1。

eval evidence download 按 Case 分目录下载评测会话中的 .boe。该命令要求服务端评测详情返回 targetSessionId;旧版服务端会给出明确升级提示。

组织

decidex org use ORGANIZATION_ID

Galaxy 模式的组织由 BI 租户登录态决定,服务端会拒绝手动切换。

业务本体

本体构建复用 Decidex 的完整导出/导入契约,避免 CLI 重复维护对象、属性、关系、行动、风险等子资源 schema:

decidex ontology export ONTOLOGY_ID ontology.json
decidex ontology plan ontology.json --name 新本体
decidex ontology apply ontology.json --name 新本体

# 覆盖已有本体:plan 默认不写入,apply 会先由服务端预检并创建备份版本
decidex ontology plan ontology.json --network-id ONTOLOGY_ID
decidex ontology apply ontology.json --network-id ONTOLOGY_ID

未封装的接口可直接调用:

decidex api GET /api/personal-agents
decidex api PATCH /api/auth/active-organization --data organization.json

CI 中可使用 DECIDEX_BASE_URLDECIDEX_SESSION,无需写本地配置。非本机 HTTP 地址默认被拒绝,确有可信内网明文部署时需设置 DECIDEX_ALLOW_INSECURE_HTTP=1

DECIDEX_BASE_URLDECIDEX_SESSION 必须成对提供。CLI 不会把配置文件中保存的 Cookie 复用到另一个 --base-url;切换环境时请重新执行 auth login/auth import

当前边界

  • CLI 已覆盖交互登录、Agent/本体/Skill 构建、会话续问与停止、产物下载、评测案例同步和评测运行。
  • 当前上传与下载会整包载入内存,适合常规场景包和产物;超大文件需要后续增加流式传输。
  • 组织列表与服务端已验证身份、评测案例并发版本控制、Runner Pod/OOM/资源诊断、长期机器凭据仍需要后端接口支持。