@happyvertical/smrt-support

中文文档
0.62.1发布于 2026/11/17MITTypeScriptES Module近 30 天下载 1.4万

AI-first Support Cases: channel-neutral intake, lifecycle, routing, service targets, and service time for the SMRT framework

原始使用文档
文档目录10 节
  1. Installation
  2. Open and manage a case
  3. Case lifecycle
  4. Major services
  5. Commercial separation
  6. Permissions
  7. Svelte entry point
  8. Related packages
  9. Development
  10. Decimal-hours-only shared evidence

@happyvertical/smrt-support

AI-first, channel-neutral Support Cases for s-m-r-t. Chat messages and email can create or join one tenant-scoped case, while the package owns lifecycle, routing, service targets, escalation, human handoff, and auditable service time.

Support owns the client interaction and ticket. Delivery work remains in @happyvertical/smrt-projects; a support work link connects the two without making Support execute repository work.

Installation

pnpm add @happyvertical/smrt-support @happyvertical/smrt-timesheets

Add svelte for the optional operator surfaces. Support's ServiceTimeEntry extends the smrt-timesheets entry (#3288). Under pnpm, declare @happyvertical/smrt-timesheets directly: the CLI's manifest discovery reads only top-level packages, so without it smrt db:migrate / db:status stop planning the timesheets snapshot tables (service_charge_snapshots, service_compensation_snapshots). Stored @happyvertical/smrt-projects:ServiceTimeEntry references do not yet resolve when smrt-support is installed, and neither does @happyvertical/smrt-timesheets:ServiceTimeEntry (support's subtype replaces it): reference @happyvertical/smrt-support:ServiceTimeEntry. See the smrt-timesheets README migration note.

Open and manage a case

Case-side models expose generated read operations, but writes go through service facades so lifecycle and audit evidence cannot be bypassed:

import { SupportCaseService } from '@happyvertical/smrt-support';

const support = await SupportCaseService.create({ db: 'support.db' });
const supportCase = await support.openCase({
  tenantId: 'tenant-1',
  subject: 'Cannot publish the weekly edition',
  description: 'The publish action returns a validation error.',
  channelKind: 'chat',
  clientProfileId: 'profile-42',
  threadKey: 'chat:room-7:thread-12',
});

await support.recordInteraction(supportCase, {
  sourceKey: `manual:${crypto.randomUUID()}`,
  direction: 'internal',
  channelKind: 'api',
  actorKind: 'specialist',
  body: 'Reproduced and collecting validation details.',
});

Application schemas must be migrated before runtime; Support verifies its tables and does not create them on demand.

Case lifecycle

new → triaged → assigned → in_progress
  → waiting_on_client | escalated
  → resolved → closed

Resolved cases may reopen with preserved history. Interactions and case events form the complete handoff timeline. Transport sourceKey values make replayed chat/email ingestion idempotent.

Major services

ServiceResponsibility
SupportCaseServiceCase writes, transitions, interactions, timeline, work links
SupportIntakeServiceBound chat/email create-or-join intake
SupportAiWorkflowAcknowledge, classify, answer, troubleshoot, resolve
HumanHandoffServiceLossless context packaging and deduplicated handoff
SupportRoutingServiceExplainable qualification, availability, and workload ranking
ServiceTargetEngineCovered-time clocks and durable escalation jobs
ServiceTimeEntryServiceOne evidence contract for human and agent time
TimeEntryApprovalServiceApproval plus client/provider commercial snapshots
SupportPlanAdminServicePermission-gated support and compensation plans

The AI workflow fails toward a human. Client requests, low confidence, high severity, sensitive categories, failed resolution, and policy limits always remain handoff triggers.

When typed decisions are configured, the default classification boundary uses the case plan's ordered severity definitions and evaluates sensitivity as a predicate. SupportPolicy.allowedCategories is optional: supplying values turns category into a closed decision vocabulary; leaving it empty preserves free-category generation. A configured ambiguous severity/category stays unassigned and hands off to a human; an exactly ambiguous sensitivity predicate does so too. The recorded classification confidence is an operating aggregate for audit only, never a calibrated answer confidence or the policy answer threshold. App-injected SupportAiBoundary implementations remain authoritative.

Commercial separation

Managed Support Plans define client coverage, targets, included time, and overage pricing. Support Compensation Plans define provider earnings. Approved time creates separate charge and compensation snapshots so margin remains measurable and historical plan edits cannot rewrite evidence.

Permissions

Importing the package registers these permission definitions:

  • support.reassign-case
  • support.approve-time-entry
  • support.manage-plans

Privileged services accept a SupportPrincipal and reject cross-tenant operations.

Svelte entry point

@happyvertical/smrt-support/svelte exports presentational CaseQueue, CaseDetail, TargetList, RoutingRationale, and TimeEntryApprovalQueue components plus model-to-view adapters. Hosts own data loading and actions. TimeEntryApprovalQueue lives in smrt-timesheets and is re-exported here.

Development

pnpm --filter @happyvertical/smrt-support test
pnpm --filter @happyvertical/smrt-support typecheck
pnpm --filter @happyvertical/smrt-support build

See AGENTS.md for lifecycle, idempotency, timing, settlement, and concurrency invariants.

Decimal-hours-only shared evidence

The shared Timesheets service supports exact decimal-hours-only sources with null durationSeconds; see Timesheets. The support entry subtype preserves this representation and its view displays durationHours(). Support case-time recording and support-plan approval remain seconds-based; approval rejects absent seconds before writing charges. Use the shared ServiceEvidenceService with an hours-aware commercial resolver for accepted decimal-hours evidence and its immutable commercial snapshots.

版本与发布记录

@happyvertical/smrt-support 共发布 292 个版本,首次发布于 2026/07/11;过去 12 个月发布了 292 个版本。

版本发布日期距今
0.62.1latest2026/11/17今天
0.62.02026/11/17今天
0.61.62026/11/161 天前
0.61.52026/11/161 天前
0.61.42026/11/161 天前
0.61.32026/11/152 天前

关于 @happyvertical/smrt-support 的常见问题

@happyvertical/smrt-support 是什么?

AI-first Support Cases: channel-neutral intake, lifecycle, routing, service targets, and service time for the SMRT framework

如何安装 @happyvertical/smrt-support?

在项目目录运行 npm install @happyvertical/smrt-support,或使用 pnpm add / yarn add / bun add。

@happyvertical/smrt-support 支持 TypeScript 吗?

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

@happyvertical/smrt-support 支持 ESM 还是 CommonJS?

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

@happyvertical/smrt-support 可以商用吗?

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

@happyvertical/smrt-support 的下载量有多少?

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

@happyvertical/smrt-support 还在维护吗?

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