hanamesh-usage:Consent-gated device signature Usage events

Technical Documentation

When developing HanaMesh-related plugins or workflows in DSH, you often need to know “whether the user consents to reporting,” “which open/use/install events have been recorded locally,” and how to sync minimal structured facts to the server while avoiding storing prompts, conversation content, or credentials. If each plugin persists data independently, Consent, device identity, and reporting formats become difficult to unify. This document introduces the community plugin hanamesh-usage: it maintains a local Declaration tri-state usage summary within the host, provides consent gating, device signing, event buffering, and server reporting; the production path only stores minimal structured information.

What is this plugin?

hanamesh-usage is a Usage (activity) plugin in the HanaMesh ecosystem, released by maintainer yzsnstotz and categorized as a Workflow in the SkillHub directory. The repository description is: Consent-gated, device-signed HanaMesh usage events for DSH (MIT license). It works with the optional hanamesh-core to obtain device identity and consent toggles; when core is absent, it can still record locally but does not report to the Server.

Core Features

Local summary and event pipeline

The plugin maintains a Declaration tri-state usage summary locally and handles the collection, signing, and buffering of Usage events. Go-live events are created and reported only when consent is granted and fields are complete; when not consented, no UsageEvent is created, and no server reporting occurs—the local Declaration summary remains intact.

When consent is withdrawn, the local event buffer is cleared first, followed by invoking the Server deletion endpoint; offline, only local deletion occurs, with a retryable state preserved. The Declaration remains local and is not uploaded as a summary.

A go-live event must contain seven keys: deviceId, hanaRef, action, occurredAt, eventId, nonce, and signature. Since rc.7, optional fields sourceHanaRef, targetRef, and receipt are only included in the event when non-null; receipts contain only vendor ID, model name, and count, without prompts, responses, or credentials. The production path does not store prompts, conversations, files, full results, private paths, or credentials.

Client and command observation

The Usage client wraps some feature bits (e.g., main, settings.section, plugins.bundle.config, plugins.row.config) via Cordis internal/get, and reports issue / presented through its own Remote after components commit content to the DOM; on the Host side, it wraps commands registration via Cordis, pairing command/run with command/done(success) to produce facts of the same shape as use consumption. record is provided for other HanaMesh plugins to deliver open / use; installation and uninstallation are observed and generated by the Loader, supporting optional attribution and use-specific receipt fields. The same idempotencyKey causing a conflict will yield rejected: EVENT_IDENTITY_CONFLICT.

Local HTTP and Cordis services

The Host exposes a set of local APIs, such as:

  • GET /api/hanamesh/usage
  • GET /api/hanamesh/usage/view
  • POST /api/hanamesh/usage/export
  • GET /api/hanamesh/usage/health
  • GET /api/hanamesh/usage/events
  • GET /api/hanamesh/usage/panel and /panel/view, /panel/remote (since rc.16)

ctx.hanameshUsage provides query, export, health, drain, reconcile, record, panel, and remote capabilities. GET /api/hanamesh/usage/health reflects core: 'absent' when core is not present.

Usage development panel

After installing the bundle normally, the client registers the “Usage development panel” via settings.section. Access path: HanaMesh.app → Settings → Usage development panel. On refresh, it only issues GET requests to the authenticated route /api/hanamesh/usage/panel/view for this package; HTML is rendered within a script-less, form-less sandbox iframe; read failures display a bounded error without creating events. The panel displays events, actions, timestamps, and signature verification status for the current Core device, and does not output nonces or raw signatures.

Server-side read-back (this device)

remote() and GET /api/hanamesh/usage/panel/remote only read this device’s records on the server (via Core requesting signatures on public routes, with a window of 90 days from the present backward). Read-back does not write local state and is not affected by the consent toggle; it can be used for post-withdrawal deletion verification. It is offline when no server address is available; on rejection or unreachability, it is state:'unknown'.

Configurable items (Q61)

The Cordis plugin config supports examples such as:

{"eventRetentionDays": 90, "queryLimit": 100}
  • eventRetentionDays defaults to 90, pruning only sent-final events beyond the retention window; pending events are not pruned by age.
  • queryLimit defaults to 100, with a range of 1–1000, shared by summary and event queries.

Invalid values yield INVALID_CONFIG. The Usage development panel and panel().policy display the actual values; reading config does not write or alter consent.

Installation and activation

hanamesh-usage is a DSH bundle that declares dsh.bundle.patch. Run under a specified profile:

dsh plugin --profile <p> add hanamesh-usage

It activates upon installation; no manual cordis.patch.yml is required. Both hanamesh-core and this package insert only their own Loader entries; this package does not transitively install from Core, nor does it import other HanaMesh plugins.

Dependency notes: Device identity and consent come from hanamesh-core (optional). When core is absent, only local recording occurs without reporting.

Upgrading from the legacy @hanamesh/dsh-activity (rc.3): The storage-domain changes from hanamesh_activity to hanamesh_usage; legacy records are neither migrated nor deleted. To preserve them, export via POST /api/hanamesh/activity/export on rc.3 first.

Host version: The public peer range includes DSH >=0.2.0-rc.2 <0.3.0-0 || >=0.2.1-0 <0.3.0-0 and corresponding Cordis and zod ranges; range admission does not mean every version has been verified in real Desktops—consult the repository compatibility docs and the current DSH version before installing.

The first Plugin Manager scan records the current profile’s own plugins as install events, with occurredAt as the scan time, serving as weak Adoption evidence.

Typical Usage

1. Check health and summary after installation

After installing the bundle and optionally enabling hanamesh-core, use the local API to check status, e.g.:

curl -s http://127.0.0.1:<port>/api/hanamesh/usage/health

Use the response to determine whether core is absent and whether the reporting path is available.

2. Open the development panel in settings

Path: HanaMesh.app → Settings → Usage development panel. Useful for viewing this device’s events and signature verification results without triggering additional collection logic.

3. Deliver usage facts from other HanaMesh plugins

On the Host side, use ctx.hanameshUsage.record to deliver open or use (install/uninstall are observed by the Loader). Optional parameters include sourceHanaRef, targetRef, and, for use only, receipt { providerId, model, count }; comply with idempotency and field contracts to avoid identity-conflict rejection.

4. Export and query

  • Export: POST /api/hanamesh/usage/export
  • Query: via ctx.hanameshUsage.query or GET /api/hanamesh/usage / /view, noting queryLimit and pagination parameters.

5. Verify server-side records for this device

When Connection and Core are available, use remote() or the authenticated route GET /api/hanamesh/usage/panel/remote to read back the server-side event list for this device, to compare with local or withdrawal results.

Use Cases and Notes

Who it’s for: Developers and teams building or integrating HanaMesh plugins who need unified Consent, device-signed Usage events in DSH, and control over minimal reported fields.

Permissions and Security: The plugin runs with the current DSH process’s permissions; read the GitHub repository source and MIT license before installing to confirm the consent gate and data boundaries meet your compliance requirements. Client DOM/command observation mechanisms do not prove the rendering authenticity of a compromised client; entries in the panel and test-supply identifiers (e.g., panelTestSupply) that are not marked as test should be treated as “authenticity unknown.”

Ecosystem notes: DSH adopts an “everything is a plugin” philosophy; community directories such as SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer.

Versions: The repository’s package.json currently lists version 0.3.0-rc.5; the README continuously documents rc-level compatibility and nonce-historical behaviors—read the repository’s docs/compatibility/ and release notes before upgrading; typically no storage deletion is needed.

Conclusion

hanamesh-usage consolidates HanaMesh Usage’s consent gate, local Declaration, device-signed events, and constrained reporting into a single DSH bundle, and provides local APIs, a development panel, and a server-side read-back entry point. Directory page: https://www.skillhub.cn/plugins/yzsnstotz/hanamesh-usage; source and full documentation: https://github.com/yzsnstotz/hanamesh-usage.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye