@ayayaq/vivi

中文文档
0.17.1发布于 2026/11/07Apache-2.0TypeScriptESM + CJS近 30 天下载 2602

A small headless, provider-neutral tool-calling agent loop

原始使用文档
文档目录11 节
  1. Optional context management (since 0.14.0)
  2. Workspace instructions and tool images (available in 0.16.0)
  3. Optional clarification questions (since 0.12.0)
  4. Optional decision review
  5. Install
  6. Optional model capabilities
  7. Optional shared memory (published 0.5.0)
  8. Optional instruction-only skills (published 0.6.0)
  9. Small headless example
  10. Develop and learn more
  11. Dependency policy

vivi

A small, headless TypeScript tool-calling loop. @ayayaq/vivi provides messages, provider adapters, agent turns, and optional trusted tools. Your host owns approvals, credentials, storage, filesystem policy, and UI. Node.js 22+, ESM and CommonJS. Only the optional skills module loads the maintained YAML parser dependency.

Public npm latest was verified as 0.17.0 on 2026-11-01. Published 0.17.0 adds generic OpenAI request projection and safe error details, plus the OpenRouter reasoning-replay fix. Hosts still own authentication, storage and approval policy; core does not add ChatGPT sign-in or Skip permissions UI. See the release provenance and RELEASING.md.

Patch 0.17.1 is prepared separately and is not yet published. It recognizes valid SSE with missing/incorrect media types and improves safe diagnostics for other responses. Authentication stays host-owned; the actual reported ChatGPT session remains unverified. Use the frozen reviewed archive and receipt for publication, not a repack of this checkout. See RELEASING.md.

Optional context management (since 0.14.0)

The root API adds full projected-request occupancy, explicit known/unknown capacities, measureContext, manual/automatic portable compaction, separate source-bound checkpoints, and one classified-overflow retry. Canonical raw history and tool/approval evidence stay unchanged. Hosts own durable checkpoint storage and UI; extra summary usage is separate. See CONTEXT.md. This feature is available in published 0.14.0.

Workspace instructions and tool images (available in 0.16.0)

Fresh host-owned getContextPrefix messages are measured before each dispatch without entering canonical history. Optional image-bearing tool results carry immutable snapshot references to vision-capable provider adapters; hosts retain file permissions and storage. See fresh prefixes and tool image observations. No attachment command or host adoption is included.

Optional clarification questions (since 0.12.0)

The opt-in @ayayaq/vivi/extensions/questions subpath offers a renderer-neutral request_user_input tool for 1–3 questions, choices, free text and explicit skip/cancel. A host callback collects actual human input; without one, no tool is advertised. Answers are ordinary tool results and never authorize actions or change approval modes. Both normal and Plan-mode hosts can use the extension under their own tool policy. See the question host contract and offline example. This addition is available from published 0.12.0; hosts adopt it under their own policy.

Optional queued-message steering is available in 0.16.0. Hosts own queue acknowledgement and force-send cancellation; see STEERING.md.

Optional decision review

This module is published in verified stable 0.7.0 and absent from immutable 0.6.0. Exact registry bytes and clean Node 22/24 consumers are verified; host adoption follows separately.

@ayayaq/vivi/decisions provides frozen exact-action snapshots, allow / ask / deny recommendations, and dedicated OpenAI Decisions / OpenRouter Jev adapters. It never grants permissions or executes tools. Host rules, eligibility, privacy, manual review, and audit stay with your application. See DECISIONS.md and the offline examples/decisions.mjs before adopting it.

Verified 0.8.0 adds optional host-prepared effect metadata and pure review routing on the same subpath. Host adoption remains separately reviewed; see the contract.

Install

The latest verified public npm release is 0.17.0:

npm install --save-exact @ayayaq/[email protected]

The registry archive matches the preserved release packet exactly. Its source, metadata patch, hashes and reproducibility limits are recorded in the release provenance. Host adoption remains a separate integration decision. Hosts retain connections, processes, credentials, actual sends and UI. See MCP.md and RELEASING.md.

0.10.0 also adds owned scopes, /events session snapshots and /events/stream ordered accepted-message replay. Its registry bytes are verified and unchanged. See the host commit and bounded replay contract.

Optional model capabilities

The @ayayaq/vivi/providers/deepseek adapter (since 0.15.0) supports ordinary DeepSeek Chat Completions independently of web retrieval and decision review, with native all-turn reasoning retention and catalog-derived capabilities. See the DeepSeek host contract.

The optional @ayayaq/vivi/providers/models subpath is published in verified registry 0.4.0 and absent from immutable 0.3.0. Hosts can adopt it through separate reviewed changes that preserve their documented capability coverage and selection behavior.

import { normalizeModelCapabilities, reasoningSelectionSupport } from '@ayayaq/vivi/providers/models'

const capabilities = normalizeModelCapabilities({
  apiVersion: 1,
  provider: 'openai',
  protocol: 'responses',
  model: { id: 'gpt-5.1' }
})
console.log(capabilities.tools) // supported
console.log(reasoningSelectionSupport(capabilities, { mode: 'disabled' })) // supported

Normalization is pure and endpoint-aware. It preserves exact IDs and supported/unsupported/unknown states, including separate reasoning, effort selection, explicit disable, and mandatory status. Default means no override, independently of explicit disable. No models are fetched or selected, and no request is changed. Hosts retain credentials, catalog fetching/cache, defaults, moderation, and access policy. The contract and provenance explains the bounded seed registry, paired host evidence, and the release/adoption gate.

Optional shared memory (published 0.5.0)

The optional @ayayaq/vivi/extensions/memory module extracts the desktop v1 bounded memory service, codec, revisions, user-level context formatter and tool guidance. It is published in verified 0.5.0 and absent from immutable 0.4.0. Hosts supply atomic persistence/recovery and mandatory tool-policy callbacks; approvals, planning mode, operation admission/drain, app-wide store paths and multi-process locking remain host-owned. See the memory contract and offline policy example. No host integration or session-note migration is included.

Optional instruction-only skills (published 0.6.0)

The optional @ayayaq/vivi/extensions/skills module reads ordinary Agent Skills SKILL.md files, advertises a compact per-turn catalog, and loads instructions/resources on demand. It includes an original read-only skill creator and an optional SKILL.md-only save tool behind exact-content host approval and revision-checked persistence. Hosts choose approved sources, own their app-wide stores and apply existing permissions. No scripts/plugins execute, no workspace is scanned, and no current turn hot-reloads. This module is published in verified 0.6.0 and absent from immutable 0.5.0. Desktop/CLI adoption remains separately reviewed. See the format and host contract and offline example.

Small headless example

This example needs no terminal framework, app, provider key, or network request:

import { runAgent } from '@ayayaq/vivi'
import { createToolRegistry } from '@ayayaq/vivi/extensions'
import { calculatorExtension } from '@ayayaq/vivi/extensions/calculator'

const registry = createToolRegistry([calculatorExtension])
const result = await runAgent({
  provider: { async generate({ messages }) {
    const answer = messages.find(message => message.kind === 'tool_result')
    return answer
      ? { content: answer.content, toolCalls: [] }
      : { content: '', toolCalls: [
        { id: 'calc-1', name: 'calculate', arguments: { expression: '2*(3+4)' } }
      ] }
  } },
  messages: [{ kind: 'message', role: 'user', content: 'Calculate 2*(3+4)' }],
  tools: registry.tools,
  executeTool: registry.executeTool
})
console.log(result.status, result.content) // completed {"result":14}

Extension code runs in-process and is trusted. Registration is not a security sandbox; each host enforces its own permissions and approvals. Real provider adapters are available through @ayayaq/vivi/providers/openai and @ayayaq/vivi/providers/openrouter.

Develop and learn more

npm ci
npm run check

Checks use fake providers and HTTP, build both module formats, and install packed consumers. The package includes builds, declarations, source, examples, and documentation; installation runs no build script.

Dependency policy

Source development requires npm >=11.17.0. Read the seven-day dependency cooldown before installing or updating dependencies.

版本与发布记录

@ayayaq/vivi 共发布 21 个版本,首次发布于 2026/10/04;过去 12 个月发布了 21 个版本。

版本发布日期距今
0.17.1latest2026/11/07今天
0.17.02026/11/026 天前
0.16.02026/10/2711 天前
0.15.12026/10/2117 天前
0.15.02026/10/1820 天前
0.14.02026/10/1820 天前

关于 @ayayaq/vivi 的常见问题

@ayayaq/vivi 是什么?

A small headless, provider-neutral tool-calling agent loop

如何安装 @ayayaq/vivi?

在项目目录运行 npm install @ayayaq/vivi,或使用 pnpm add / yarn add / bun add。

@ayayaq/vivi 支持 TypeScript 吗?

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

@ayayaq/vivi 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ayayaq/vivi 需要什么版本的 Node.js?

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

@ayayaq/vivi 可以商用吗?

@ayayaq/vivi 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@ayayaq/vivi 的下载量有多少?

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

@ayayaq/vivi 还在维护吗?

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