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

@haneinfo/state-machine

v0.26.9

Published

State machine mechanism: StateMachine definitions (states, transitions, frozen states) and the runtime for business-object instances, registered with @haneinfo/definition-registry.

Readme

@haneinfo/state-machine

See agent-guide.md for integration details.

Instance readers and stored query values

Reads allow the submitter, holders of state-machine:instance:read, or an instance reader grant. ADMIN continues to use existing RBAC. mine=true still means submitter ownership. Number lookups apply the same rule before pagination.

StateMachineReaderGrants.grantAssigned(instanceId, userIds, tx) is a grant-only service exported by StateMachineModule. Assignment injects it and supplies the task transaction; grants use createMany({ skipDuplicates: true }) (PostgreSQL ON CONFLICT DO NOTHING). There is no revoke operation or additional read port. Custom stores must implement grantReaders, isReader, and readableBy instance/number filters. Apps must migrate the Prisma fragment and backfill existing tasks before upgrading. The (instance_id, user_id) primary key supports indexed reader lookups; the separate user_id index supports user-led scans.

INSERT INTO state_machine_instance_readers (instance_id, user_id, reason)
SELECT DISTINCT instance_id, assignee_id, 'ASSIGNED'
FROM assignment_tasks
ON CONFLICT (instance_id, user_id) DO NOTHING;

Top-level text, textarea, number, date and datetime formula fields can be declared in spec.listView.fields. Queries read stored results through the ordinary JSONB path. Queries never recompute formulas or backfill missing historical values. Select, switch, nested and container fields remain unsupported.

Date comparisons

GT/GTE/LT/LTE compare numbers, valid calendar dates (YYYY-MM-DD), or timezone-qualified datetimes (YYYY-MM-DDTHH:mm:ss with optional fractional seconds and Z or +/-HH:mm). Both operands must have the same category. Dates use calendar order; datetimes compare UTC instants at millisecond precision. Invalid dates, mixed categories and empty operands yield false. EQ/NEQ/IN retain strict scalar equality; matching instants with different textual offsets are still unequal for those operators.

Instance privacy and submitter names

All person-facing instance reads (detail including history, available transitions and exact number lookup) return INSTANCE_NOT_FOUND, HTTP 404, message Instance not found, with no suggestion for both missing and unreadable instances. No read permission name is exposed. USER transitions and data updates check readability before revision, state and write authorization; readable users missing the write/business permission still receive 403. Submitter ownership, effective instance:read and permanent reader grants are unchanged. Internal get/history remain trusted mechanism APIs without a person parameter; there is no delete endpoint.

Authorized detail, instance list and numbering reads include submitterName: string | null. Optional identity-store findActiveNamesByIds resolves unique submitter ids once per result batch. Missing, inactive and deleted identities, absent identity capability and older providers return null without per-row fallbacks. No schema migration or people-lookup HTTP route is added. Numbering MCP wraps names in $userContent; exact unreadable/missing numbers return the same error, while recent-number lists still filter before paging.

Delegated Assignment attribution

ASSIGNMENT triggers may include optional actingUserId and onBehalfOfId. Existing userId and triggerUserId remain the actual actor. Attribution is persisted in the existing transition decision JSON and exposed as optional history fields, including getFor's embedded history. Notification outcomes merge with this metadata instead of replacing it. No history schema migration is needed. The decision remains draft (202610-6b1f). Assignment owns delegation validity and response policy.

When the resolver is installed, StateMachine takes its optional shared transaction advisory lock before instance creation or any instance row lock/write. Delegation creation/revocation takes the exclusive lock on the same key. Normal instance transactions remain concurrent; a graph mutation briefly blocks new instance writers until its backfill/cancellation commits. This closes the race where creation and state entry could otherwise miss each other's uncommitted rows. The advisory lock always precedes instance locks; task CAS and delegation-row shared locks remain inside that transaction. No extra table or worker is added.

Instance access lists (draft implementation)

Implemented against draft decision 202610-c8e3; the decision remains draft. This section supersedes the earlier reader-only model and human transition eligibility. Upgrade the affected mechanisms together and apply the App migration before starting the new runtime. The maintainer selected source-specific uniqueness: (instanceId, principalType, principalId, source). Existing model/table names are retained. principalType is USER or ROLE; principalId is a user id or role machine name; level is READ or WRITE; source is ASSIGNED, DELEGATED or GRANTED. Each row also has nullable grantedBy and createdAt. Indexes cover instanceId and (principalType, principalId). Permanent ASSIGNED/DELEGATED entries are READ and survive every task/delegation status. Manual GRANTED entries coexist with them; removing GRANTED never removes permanent readership.

All instance reads use submitter, effective state-machine:instance:read, or a matching USER/ROLE entry. Roles come from RBAC authorizationOfUser once per query, passed into persistence; no direct RBAC-table joins. WRITE also requires an existing readable instance, then submitter, effective state-machine:instance:write, or matching WRITE. Human transitions still check their declared business permission. Assignment/Timer transition authorization is unchanged. Unreadable instances return INSTANCE_NOT_FOUND/404; readable callers without write/manage eligibility receive 403.

Only the submitter or state-machine:instance:admin can manage access; instance administrators can manage any instance list. Grantees cannot regrant. InteractiveAuthGuard protects GET/PUT /state-machine-instances/:id/access and DELETE /state-machine-instances/:id/access/:principalType/:principalId. PUT targets GRANTED only, never changes permanent rows. DELETE removes GRANTED if present; a permanent-only target returns ACCESS_NOT_MANAGEABLE/409. Missing manual targets are idempotent. GET returns sources, levels, principalName and grantedByName; user names share one authorized findActiveNamesByIds batch, role display labels share one RBAC lookup, unavailable names are null. Names are plain text. maxGrantedAccess defaults to 100. Only active users or existing roles can be granted; the submitter cannot receive a USER grant. Errors include ACCESS_PRINCIPAL_INVALID/400, ACCESS_LIMIT_EXCEEDED/409 and ACCESS_NOT_MANAGEABLE/409. Repeated equal grants have no effects.

StateMachineMcpTools.commands now also returns list_instance_access using :instance:read. It returns items in $userContent and offers no grant/remove tools. Changed individual grants notify with state-machine-access:; equal retries do not notify again. Role grants and removals never notify. Missing inbox capability skips delivery. Actual inbox failures roll back the mutation. ACCESS history uses the existing decision JSON and emits state-machine.access.recorded in the same transaction; collaboration adds ACCESS to its existing SQL timeline union. State, revision and transition events do not change for access mutations. List/export counts and pagination include personal and role access in one parameterized EXISTS; snapshot exports abort on role-name changes.

Migration SQL ships at @haneinfo/state-machine/prisma/instance-access.sql. It renames user_id to principal_id and reason to source, preserves created_at, adds principal_type/level/granted_by, converts legacy rows to USER/READ and ASSIGNED (recognized delegation becomes DELEGATED), and backfills every assignment task regardless of status. It expects the Assignment delegation columns; Apps without Assignment/Delegation must omit the corresponding task queries/backfill. Do not reset an existing database. See the package repository validation/equipment-loan/instance-access/report.md for adoption evidence and the explicitly selected uniqueness adjustment; no decision text is changed.

Configure runtime.stateMachine.maxGrantedAccess (positive integer, default 100). Apply prisma/instance-access.sql in your App migration before upgrading. Custom StateMachineStore implementations must implement listAccess, putGranted and deleteGranted and accept optional roles/source/level in reader methods. The new optional RBAC role-label lookup requires plugin API 1.14.0.

Access management eligibility (draft 202610-e2a9)

GET /state-machine-instances/:id/access adds canManage: boolean alongside the unchanged items. The service shares its submitter/instance-admin eligibility calculation with PUT/DELETE; readers can inspect but cannot regrant access. list_instance_access adds the same canManage next to its existing wrapped items. It remains read-only. No database or plugin-api contract changes apply.

Optional attachments (draft decision 202610-5f3b)

Attachment activity uses existing history with triggerType ATTACHMENT and optional decision.attachment (action, id, plain-text fileName). No storage keys, state/revision changes or notifications are introduced. Collaboration classifies these history rows as ATTACHMENT in its existing SQL union; MCP retains decision $userContent wrapping. See @haneinfo/attachments/agent-guide.md for authorization, storage, scanning, migration and retention. Apps adopting the optional package add its reverse instance relation; the core fragment does not depend on attachments.

Document generation (draft 202610-d4f6)

The optional @haneinfo/document-templates package adds DOCUMENT activity using existing history and decision.document (templateCode, templateVersion, format), attributed by triggerUserId. No tables, state/revision changes or notifications are added. Collaboration classifies the row as DOCUMENT in its existing authorized SQL timeline. Instance history and timeline fields remain unchanged. Read the document-templates agent guide for fonts, configuration, HTTP and read-only MCP.

Instance lifecycle (draft 202610-f1a8)

Implemented from draft decision 202610-f1a8; the decision remains draft. Upgrade state-machine, list-view, collaboration, attachments, import-export, assignment and timer together. No frontend, automatic archive or bulk lifecycle operations are included. Permanently purged data cannot be restored by this API: database and private file backups must cover the entire deletion retention period and be restored consistently.

The instance fragment adds nullable archivedAt/archivedBy/deletedAt/deletedBy, preserving old instances as active. Apply prisma/instance-lifecycle.sql before running the upgraded packages. Indexes (machineCode, archivedAt), (deletedAt) and (submitterId, deletedAt) support archive queries, expiry scans and owner recycle lists. No new table is introduced. Install collaboration's Cascade migration when that package is present; the App adds comments CollaborationComment[] and follows CollaborationFollow[] reverse instance relations. Attachments already has Cascade; application numbers retain Restrict.

Only FINAL instances can be archived. Archive is a view flag: all existing authorized reads and writes, including comments, access grants, following, attachments and exports, remain available. Unarchive clears both archive columns. Only INITIAL instances without any transition evidence or StateMachineNumber record can be soft-deleted; START, ACCESS, ATTACHMENT, DOCUMENT and LIFECYCLE activity are not state transitions. Returned, rejected and voided applications cannot be deleted. Lifecycle operations do not change state, data or revision and are idempotent without duplicate history/events. They reuse instanceManagementAllowed, also used by access-list management. Readability is checked before submitter/instance:admin eligibility; WRITE and assigned readership do not grant eligibility. An admin without ordinary read access gets 404 on active instances.

All routes require InteractiveAuthGuard:

| Method | Route | Operation | | --- | --- | --- | | POST | /state-machine-instances/:id/archive | Archive FINAL | | POST | /state-machine-instances/:id/unarchive | Clear archive | | DELETE | /state-machine-instances/:id | Soft-delete draft | | POST | /state-machine-instances/:id/undelete | Restore within retention | | GET | /state-machine-instances/deleted?offset=0&limit=50 | Recoverable deletions, newest first |

The deleted collection precedes the :id route, caps limit at 200 and returns total plus id, machineCode, machineVersion, state, submitterId, startedAt, deletedAt, deletedBy, deletedByName and remainingRetentionDays. Owners see only their own drafts deleted by themselves; instance:admin sees all recoverable deletions. Admin-deleted drafts require admin restoration. Expired restoration is INSTANCE_NOT_FOUND even before the worker physically removes the row. Repeated DELETE by an eligible actor succeeds while its deleted row exists; after physical purge it returns 404.

Public instance reads include archived and nullable archivedAt. Internal get returns null for deleted rows; history and every authorized HTTP/MCP instance read return exactly the missing-id INSTANCE_NOT_FOUND/404, Instance not found, with no suggestion. Lists always exclude deletions. List endpoints accept archived EXCLUDE (default), INCLUDE or ONLY; exact-number and single reads ignore archive flags. INSTANCE_NOT_ARCHIVABLE and INSTANCE_NOT_DELETABLE use 409; readable but ineligible lifecycle actions use FORBIDDEN/403. MCP exposes only existing read tools and archived metadata, never lifecycle mutations or a recycle-list tool.

Each changed action writes LIFECYCLE history with decision.lifecycle.action (ARCHIVED, RESTORED, DELETED, UNDELETED) and synchronously emits state-machine.instance.archived/restored/deleted/undeleted in the same transaction. Payload: instanceId, historyId, userId, at (ISO). No notification is sent. state-machine.instance.purging has payload { instanceId } and runs before database deletion in that same transaction; listeners must use event.tx. Listener failures roll back all database changes.

runtime.stateMachine supports deletedRetentionDays=30 (0–36500; 0 makes rows immediately eligible), purgeBatchSize=100 (1–500), purgePollIntervalMs=60000 (1–2147483647) and purgeWorkerEnabled=true. Direct module registration uses the same strict schema. Optional background-jobs registers state-machine.instances.purge; the producer enqueues on bootstrap and each interval, can be disabled, and waits for pending enqueue on shutdown. BACKGROUND_JOBS_WORKER_ENABLED is App wiring for the core worker; set purgeWorkerEnabled=false as well to stop this producer. Without background-jobs, human lifecycle actions still work and no jobs are enqueued. A purge batch is one job transaction, uses instance/delegation locks, checkpoints cancellation, and can retry safely. Numbered deleted rows are inconsistent: log an error and keep them (Restrict remains the final database defense). Repair such rows promptly: they count against the bounded candidate batch. Custom stores must implement lifecycle persistence and make their default find/list exclude deleted rows.

Instance tags (draft 202610-2c5d)

Implemented from draft 202610-2c5d; the decision remains draft. See @haneinfo/tags/agent-guide.md for data, migration and authorization. TAG history uses optional decision.tag with action, normalizedKey and label. It does not change state/revision or count as a lifecycle transition. The App adds tags InstanceTag[] only when installing the optional plugin; permanent purge removes tags through its Cascade foreign key.

Concurrent field editing (draft 202610-8b3e)

Implemented from draft decision 202610-8b3e; the decision remains draft. Upgrade state-machine, form, definition-registry and plugin-api together (API contract 1.18.0). Apply prisma/concurrent-editing.sql before enabling the new runtime. StateMachineInstance.fieldRevisions is JSONB with default {}; the SQL backfills every existing top-level data key to the instance's current revision. Empty or non-object data is safe. Reruns fill missing keys without overwriting existing revisions or deletion tombstones. Copy the fragment and SQL into an App migration; never reset a database to adopt it. Internal/custom stores must maintain revisions in create/update.

PATCH /state-machine-instances/:id/data/fields is protected by InteractiveAuthGuard. Body: { baseRevision, fields: { stableFieldId: value }, remove?: [stableFieldId] }. Use 1–200 distinct field ids across both collections, each at most 200 characters, and JSON values. Id falls back to Form key when absent. Layout children retain Form's flat data scope; subforms replace the entire array. Formula fields, numbering targets, disabled fields and layout-only ids are not editable. Conditional disabled checks apply to both current and proposed data. Unknown ids return FIELD_UNKNOWN (400); read-only ids return FIELD_NOT_EDITABLE (400), including remove. There is no row merge.

Under the instance row lock, check readability (missing, unreadable or deleted: identical INSTANCE_NOT_FOUND/404), then submitter/effective instance:write/USER-or-ROLE WRITE (403), then frozen/CHOICE/FINAL (STATE_FROZEN/409). A field conflicts only when its recorded revision exceeds baseRevision and its proposed value/presence differs deeply from current data. Any conflict aborts the entire patch. Equal stale values succeed. Future baseRevision is INVALID_INPUT/400. Success returns { revision, data, changedByOthers }; the last list contains keys revised after the base but absent from this request, including computed fields and tombstones. Every successful request increments revision, even when its normalized data is unchanged. Formula recalculation and every other actual top-level data change update fieldRevisions; unchanged values retain their revision. Removed keys retain their revision as tombstones; patch preparation preserves explicit absence. Full replacement keeps its existing expectedRevision contract and normalization.

VERSION_CONFLICT/409 uses the existing details object: { currentRevision, conflicts: [{ fieldId, current, mine }] }. Missing values use null plus currentMissing/mineMissing. Small values remain original JSON. Each value has a 1 KiB UTF-8 serialized limit and all values share a 48 KiB budget; excess values use null plus currentTruncated/mineTruncated and currentBytes/mineBytes. At most 200 conflicts and 200 characters / 256 serialized UTF-8 bytes per returned id keep the array below 256 KiB; oversized legacy ids carry fieldIdTruncated. Replacement conflicts use the same bounded format. Transition-only revision conflicts carry an empty conflicts array. Only authorized writers receive details. There is no data-write MCP tool; the existing MCP catalog and read tools are unchanged. MechanismError.toJSON preserves this same details envelope for MCP consumers.

INITIAL data updates select prepareData(..., { requireRequired: false }) on the server. Type, options, numeric/row bounds, formats, formulas and visibility remain checked (INVALID_DATA/422); only required checks, including visible/enabled required fields and row columns, are skipped. Every transition still uses full validation, including USER, ASSIGNMENT, TIMER and CHOICE. Clients cannot select draft mode. Start retains its existing allowance for incomplete initial data.

Both patch and full replacement emit state-machine.data.updated in the write transaction, payload { instanceId, revision, fields: [actuallyChangedFieldId] }, with no values. Observer failure rolls back the write. There was no prior data update event; no second event, history or notification is added. Transition events remain unchanged.

Set runtime.stateMachine.dataPatchRatePerMinute (integer 0–1000000, default 60; 0 disables it). The injected STATE_MACHINE_CLOCK drives a process-local sliding minute window per instance/user. Valid authorized attempts consume budget, including subsequent conflict/validation failures; excess returns RATE_LIMITED/429 and details.retryAfterSeconds. This is single-process protection; multiple processes do not share a limit. Clients should debounce autosave by at least two seconds.

Validation and byte-exact App restoration: validation/equipment-loan/concurrent-editing/report.md.

Capability flags

A single-instance read reports what the caller may do now: canArchive, canUnarchive, canDelete and canEdit. They come from the same shared rules the lifecycle routes and data edits enforce (instanceCapabilities), so a screen never has to guess permissions.

Unified search (draft 202610-a3d8)

Draft implementation; the decision remains draft. Specs may declare search: { fields: string[] } (stable field ids, key fallback). JSON Schema checks shape; semantic validation (validateSearchFields, INVALID_SEARCH_FIELD at /spec/search/fields/<i>) accepts only top-level text, textarea, select, number, date and datetime fields and rejects subforms, nested/container children, user pickers, formulas, read-only fields (disabledWhen or the numbering field), duplicates and unknown ids; SEARCH_SUBJECT_REQUIRED without a subject. searchFieldsOf(bundle) returns the valid declarations of an instance's pinned bundle. Nothing is indexed by default.

StateMachineSearchProvider is the instance source: all numbers (new numbersOf store method), the submitter's active name, the machine name and declared values (select: label and value), each field ≤2,000 and the row ≤20,000 code points. It includes archived and soft-deleted instances. @haneinfo/search constructs it; nothing runs without that package. start() now emits state-machine.start.recorded (instanceId, machineCode) in the creating transaction after onStarted listeners; existing listeners filter by name and are unaffected. The manifest requires plugin API 1.19.0.

Instance analytics (draft 202610-c7b4)

Draft implementation; the decision remains draft. Specs may declare reporting: { dimensions: [{ fieldId }], measures: [{ fieldId, ops? }] } (stable field ids, key fallback). JSON Schema checks shape (ops: unique, non-empty, among count, sum, avg, min, max); semantic validation (validateReportingFields, INVALID_REPORTING_FIELD at /spec/reporting/{dimensions|measures}/<i>) accepts dimensions that are top-level text, select, number, date, datetime or switch fields and not formulas, and measures that are top-level number fields (formula results included); duplicates, unknown ids, nested fields, other types, formula dimensions and repeated ops are rejected, and REPORTING_SUBJECT_REQUIRED without a subject. reportingFieldsOf(spec, subject) returns the valid declarations (invalid ones are skipped).

closedStateStaysSql(scope) is a read-only history helper for @haneinfo/instance-analytics: one row per closed stay (instance_id, state, entered_at, left_at) for the instance ids a caller-named CTE returns, using only state-entering history rows (STATE_ENTRY_TRIGGER_TYPES: START, USER, ASSIGNMENT, TIMER, CHOICE). The entry is the latest entry into that state at or before the exit, so rows written in the same millisecond pair correctly; a missing entry (incomplete early history) yields NULL and is skipped. Nothing runs without the instance-analytics package. The manifest requires plugin API 1.20.0.

Data change log and revision diff (draft 202610-d9a5)

Draft implementation; the decision remains draft. Every write of instance data appends one InstanceDataChange row per changed top-level field, in the same transaction as the write; if the append fails, the data write rolls back with it. Apply prisma/data-changes.sql (table, CHECK constraints, cascade foreign key, indexes (instance_id, revision) and (instance_id, field_id, revision)) and the fragment's InstanceDataChange model before starting the runtime. There is no backfill.

| Write path | source | Actor | | --- | --- | --- | | start (HTTP POST /state-machines/:code/instances, Assignment/Timer callers) | CREATE | USER submitter, or SYSTEM without one | | start with source: 'IMPORT' (import-export confirmation) | IMPORT | USER who confirmed the import | | updateFields (PATCH …/data/fields) and updateData (PATCH …/data) | PATCH | USER caller | | transition (numbering and Form preparation during a transition) | TRANSITION | USER for USER/ASSIGNMENT triggers, MECHANISM timer:<code> for timers | | automatic CHOICE routing | TRANSITION | MECHANISM choice:<state> |

A numbered field is always attributed to MECHANISM numbering. Columns: revision (the revision the write produced), fieldId, before/after (JSON; SQL NULL when the field was absent, JSON null for a null value), truncated, actorType, actorId, source, at. Formula fields are derived and never recorded. A value larger than dataChangeValueMaxBytes (default 65,536 UTF-8 bytes of JSON) is stored as SQL NULL with truncated: true, so only "this field changed here" is known. A write that changes no recorded field appends nothing. No domain event or timeline entry is added; rows are append-only and there is no API to change or delete them (they go with a permanent purge through the cascade).

Reads share instance readership (submitter, state-machine:instance:read, readers and access lists, delegation); unreadable, unknown and soft-deleted instances are INSTANCE_NOT_FOUND (404); archived instances stay readable. Old values remain visible to everyone who can read the instance until it is purged.

  • GET /state-machine-instances/:id/changes?fromRevision=&toRevision=&fieldId=&limit=&cursor= — newest first (revision desc, field id asc); revision bounds are inclusive; limit defaults to 50 and may not exceed dataChangePageMaxLimit (default 200); nextCursor is opaque. Items: { revision, fieldId, before?, after?, beforeTruncated?, afterTruncated?, truncated, actorType, actorId, actorName, source, at }; actorName is the active display name of USER actors, resolved in one batch. Displayed values are bounded by diffValueMaxChars (default 2,000).
  • GET /state-machine-instances/:id/diff?fromRevision=&toRevision= — both snapshots are rebuilt from the current data by undoing recorded changes newer than each revision, formula fields are removed, and @haneinfo/diff compares them; a field changed and changed back does not appear. toRevision may not exceed the current revision. A field whose value at one end was too large to store is reported as changed (with the unknown side marked truncated) when it changed in the range. Response { fromRevision, toRevision, historyStartsAtRevision, summary, changes, truncated }, bounded by diffMaxChanges (default 5,000).

Both responses carry historyStartsAtRevision: the lowest recorded revision, or null. A fromRevision lower than it (or any fromRevision when it is null) returns HISTORY_NOT_AVAILABLE (409, details.historyStartsAtRevision); instances created before the upgrade start their history at their first recorded write. Invalid input is INVALID_INPUT (400).

MCP (read only, user-bound, existing <ns>:instance:read scope): get_instance_changes and diff_instance_revisions. Field ids, path segments, values and actor names are wrapped as $userContent. Configuration (runtime.stateMachine, no secrets): dataChangeValueMaxBytes 1–1,048,576, diffMaxChanges 1–50,000, diffValueMaxChars 1–100,000, dataChangePageMaxLimit 1–1,000. The manifest requires plugin API 1.21.0 (start accepts source).

Object references (draft 202610-f7a2)

StateMachineObjectTypeProvider is the state-machine-instance object type of the optional @haneinfo/references package, which constructs and registers it (nothing here runs without that package). Readability and write access reuse the instance rules through accessibleInstances, the batch form of instanceAccessAllowed (one access-list query for the batch); soft-deleted instances are never readable. The store adds findMany, readerIdsAmong and numbersOfMany. Preview cards use the first application number (or the machine name and UTC creation date) as title, the submitter's active name as subtitle, the state and its label, the archived flag and /instances/<id>. A created or removed link appends a REFERENCE history entry with decision.reference (action, linkId, kind, direction, other { type, id, number }) on each end whose readers (submitter and access-list users, role members through RBAC) can all read the other end, then emits references.linked / references.unlinked in the same transaction. REFERENCE does not count as a transition for the draft deletion rule. The lifecycle purge event deletes the purged instance's edges in the purge transaction. Requires plugin API 1.23.0.

Inherited access rows (draft 202610-b1d6)

The access list gains the source INHERITED and the nullable viaNodeId (column via_node_id, indexed). INHERITED rows are written only by the optional @haneinfo/spaces package from the container an instance is placed in: USER or ROLE, READ or WRITE, with the granting space node in viaNodeId. Every read rule already counts them (submitter, instance permission or a matching row of any source), so detail reads, lists, exports, search, reports and references follow container access with no change. The store adds replaceInherited(instanceIds, rows), which makes the INHERITED rows of exactly those instances equal to rows in the caller's transaction (stale rows deleted, changed rows updated, new rows inserted, unchanged rows untouched) and never reads, changes or removes rows of another source; assertInheritedRows validates the rows first.

Existing sources behave exactly as before: GRANTED stays the only source the access list API creates, adjusts, counts against maxGrantedAccess and removes; a principal with only an INHERITED row gets ACCESS_NOT_MANAGEABLE from DELETE, and a principal with both keeps the INHERITED row when the GRANTED one is removed. GET /state-machine-instances/:id/access lists INHERITED rows with their viaNodeId. The history trigger type SPACE records placements (not a transition for the draft deletion rule). Apply prisma/inherited-access.sql in an App migration and add viaNodeId with @@index([viaNodeId]) to the App's fragment: it widens the source and permanent-row CHECK constraints and requires via_node_id exactly on INHERITED rows. Requires plugin API 1.24.0 (INSTANCE_ACCESS_SOURCES).

Generated MCP read tools declaration (draft 202610-c5e8)

Draft implementation; the decision remains draft. Specs may declare mcp: { tools: ('list' | 'get' | 'search' | 'report')[], toolName? } to opt into the per-machine read tools of the optional @haneinfo/mcp-generated-tools package; nothing is generated without it. JSON Schema checks shape (1–4 known kinds, toolName matching ^[a-z][a-z0-9_]*$, 1–32 characters). Semantic validation (validateMcpToolsDeclaration) reports DUPLICATE_MCP_TOOL, INVALID_MCP_TOOL, MCP_TOOL_DECLARATION_REQUIRED (search without search.fields, report without reporting) at /spec/mcp/tools/<i>, and INVALID_MCP_TOOL_NAME for an invalid toolName or, without one, a code whose derived name (lower case, other characters _) is longer than 32; the kind registration passes metadata.code for that check (validateStateMachineSpec(spec, context, code)). mcpToolsOf(spec, code, maxNameLength?) returns { tools, fragment } for a published machine (known kinds once each, in list/get/search/report order; fragment null when invalid) or null without a declaration. StateMachineRuntime.getFor now also satisfies the optional StateMachineRuntimePort.getFor of plugin API 1.25.0, which the manifest requires.

Localized labels, state tones and display reads (draft 202610-a8d3)

Draft implementation; the decision remains draft. State and transition label accept a string or a zh-TW/en locale map ($defs/label, the plugin-api schema; INVALID_LOCALIZED_TEXT for whitespace-only translations; /label/* free-text paths). States may declare tone (neutral, info, success, warning, danger); without it the type decides (INITIAL and FINAL neutral, NORMAL and CHOICE info).

Public reads resolve labels in the request locale (?locale= zh-TW or en, else INVALID_LOCALE/400, then Accept-Language, then zh-TW; requestLocale(query, acceptLanguage) is exported for other controllers): GET /state-machine-instances/:id, GET /state-machine-instances, start, transition and PATCH …/data return the instance with its bundle localized (every Form and StateMachine of it) plus stateLabel and stateTone. GET …/available keeps available (keys, same rules) and adds transitions: [{ key, label, from, to, toLabel }] (from is the current state). getFor(userId, id, { locale }), listFor(userId, filter, { locale }) and availableTransitionsFor(userId, id, { locale }) are the service forms; internal get keeps the pinned definitions as published. Pure helpers: localizeStateMachineSpec, localizeBundle, stateLabelOf, transitionLabelOf, stateToneFor, presentInstance, availableTransitionsOf. reportingFieldsOf and searchFieldsOf take an optional locale; search indexes every translation of a select option label. Reference previews, notifications and MCP use zh-TW. Requires plugin API 1.26.0.

Human routing recovery (draft decision 202610-d1f4)

GET /state-machine-instances/:id/available keeps available and localized transitions, and adds routingFailed and canRetryRouting. The flags are computed from the pinned CHOICE state and latest failed routing evidence; reads never retry automatically.

POST /state-machine-instances/:id/retry-routing accepts optional expectedRevision and reevaluates automatic routing only for a failed CHOICE instance. Readability is checked first (404), then submitter or state-machine:instance:write authority (403). A manual WRITE access grant alone does not authorize recovery. Success returns the localized new instance; continued failure commits fresh routing evidence and returns ASSIGNEE_UNRESOLVED. Non-failed routing returns ROUTING_NOT_FAILED. Concurrent retries serialize on the instance lock. No migration.