@f5-sales-demo/xcsh-f5-core

中文文档
23.10.13发布于 2026/11/13MITTypeScriptESM + CJS构建来源已验证近 30 天下载 2202

Node-compatible specification-backed F5 operations with bound plans and host approvals

原始使用文档
文档目录3 节
  1. Host contract
  2. Optional CLI enrichment
  3. Development and release gates

xcsh F5 core

@f5-sales-demo/xcsh-f5-core provides specification-backed F5 resource operations for a Node host. Its exported ESM and CommonJS bundles contain the pinned CLI specification and shared resource implementation. They run without an external xcsh executable, Bun, an agent loop, or a model provider. Editors supply their own embedded Node runtime, sign-in, selected model, and approval UI.

The initial inventory matches xcsh's 94 indexed CRUD resource kinds. It does not claim coverage of every operation in the larger API catalog. The generated projection preserves the CLI's validation metadata, matching operation metadata, and all transitively referenced request/response schemas. The runtime checks its SHA-256 before use. specificationReceipt records the upstream release, commit, asset hashes, CLI input hashes, and projection hash. It has no network fallback.

Host contract

Create one F5Core instance for the owning workspace. Supply four adapters:

  • getContext synchronously returns the explicitly activated workspace/context, HTTPS API origin, namespace, and a monotonic revision. The host must include credential, environment, namespace, activation and external file changes in that revision, and verify cached state against its canonical persistence.
  • getCredentials resolves F5 credentials privately for that exact snapshot. Native editor credentials and model selection never enter this interface.
  • approve shows the validated plan and returns its exact hash with the user's decision. A canceled, late, or changed approval cannot dispatch a write.
  • persist atomically stores a private receipt. Failure before dispatch blocks the operation. Failures after a dispatched mutation require reconciliation.

The host retains Contexts activation, persistence, watchers, environment resolution, rollback and resource views. The core reads no profile files or environment defaults. Resolve payload environment variables privately before planning, under the same revision; never substitute variables after approval.

Derive the conversation identity from the trusted editor invocation, not model arguments. bind returns an opaque handle. Discovery, field description, validation, inspection, planning and execution require that handle. A changed context invalidates it. Secret references are private to each binding and are restored only within their originating binding; they are never persisted.

import { F5Core } from '@f5-sales-demo/xcsh-f5-core';

const core = new F5Core({
  getContext: currentActivatedContext,
  getCredentials: resolveF5Credentials,
  approve: showExactPlanApproval,
  persist: persistPrivateReceipt,
});
const binding = await core.bind(editorConversationId);
const description = await core.describe(binding, 'http_loadbalancer', {
  field: 'spec.more_option.custom_errors',
});
const plan = await core.plan(binding, 'create', manifests);
const result = await core.execute(binding, plan.id, cancellationSignal);

Plans are immutable and single-use. The complete batch validates before any write. Approval binds the original manifests, operation, namespace, workspace, context revision, credentials, specification hash and observed resource state. The core rechecks the context synchronously immediately before transport dispatch and verifies independent readback afterward. Updates/deletions require a nonempty UID and resource version. Immutable selection changes are rejected; the core never silently deletes and recreates a resource.

The production transport makes one attempt, follows no redirects, and honors cancellation. An uncertain response, failed verification, or failure to persist a dispatched mutation consumes the plan and reports UNCERTAIN_MUTATION. Reconcile with a fresh read and a fresh plan; do not replay the old approval. F5CoreError.completed counts independently verified entries in a partial operation. A host-provided transport must preserve these dispatch and no-retry semantics; it is a trusted adapter, not an extension point for model input.

Optional CLI enrichment

xcsh f5-core capabilities --json returns protocol version 1 and the installed CLI's specification hash. xcsh f5-core discover --json returns its indexed resource inventory without credentials or starting an agent. The CLI advertises only its exposed discovery enhancement. negotiateCapabilities accepts a matching protocol/specification and returns the understood capability intersection separately from the always-available bundled capabilities. Absence, command failure, malformed output and incompatible versions leave the bundled core usable. CLI mutation delegation is not advertised.

Development and release gates

Bootstrap the repository with its exact Bun version before tests. From the repository root:

bash scripts/ci-bun-install.sh
bun --cwd=packages/f5-core run test
bun --cwd=packages/f5-core run check

Development builds use Bun and the repository TypeScript compiler. Published Node entrypoints use the prebuilt bundles; their runtime does not invoke the build tools. Tests include plain-Node execution from an empty directory with no external CLI or Bun on PATH. Synthetic transports prove algorithm and artifact behavior, not live cloud or editor specialist acceptance.

The normal publication workflow places this package after resource-management and before the CLI. Publish in a coordinated new release so consumers receive the matching shared resource implementation. Publication, merge, production VSIX acceptance in both editors, and marketplace acceptance remain separate gates under xcsh #5072 and vscode-xcsh #1708. The Kiro routing gate is unresolved; this package does not bypass it or select ordinary chat as a substitute.

Approval entries include the exact redacted writable configuration for create and update, and the observed configuration for delete. Hosts must display this review material alongside the plan hash and changes before approving it.

Public ESM and CommonJS declarations are bundled from the same implementation and can be consumed under Node16 or NodeNext module resolution. The monorepo uses a source mapping for this package so fresh checkout type checks do not require a build first.

版本与发布记录

@f5-sales-demo/xcsh-f5-core 共发布 11 个版本,首次发布于 2026/10/28;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
23.10.13latest2026/11/131 天前
23.10.122026/11/113 天前
23.10.112026/11/113 天前
23.10.82026/11/0410 天前
23.10.72026/10/3114 天前
23.10.62026/10/3114 天前

关于 @f5-sales-demo/xcsh-f5-core 的常见问题

@f5-sales-demo/xcsh-f5-core 是什么?

Node-compatible specification-backed F5 operations with bound plans and host approvals

如何安装 @f5-sales-demo/xcsh-f5-core?

在项目目录运行 npm install @f5-sales-demo/xcsh-f5-core,或使用 pnpm add / yarn add / bun add。

@f5-sales-demo/xcsh-f5-core 支持 TypeScript 吗?

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

@f5-sales-demo/xcsh-f5-core 支持 ESM 还是 CommonJS?

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

@f5-sales-demo/xcsh-f5-core 需要什么版本的 Node.js?

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

@f5-sales-demo/xcsh-f5-core 可以商用吗?

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

@f5-sales-demo/xcsh-f5-core 的下载量有多少?

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

@f5-sales-demo/xcsh-f5-core 还在维护吗?

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