Skip to content

Trigger Profiles M2: full trigger surface + profile sharing#9

Merged
LordVicky merged 17 commits into
devfrom
trigger-profiles-m2
Jul 10, 2026
Merged

Trigger Profiles M2: full trigger surface + profile sharing#9
LordVicky merged 17 commits into
devfrom
trigger-profiles-m2

Conversation

@LordVicky

Copy link
Copy Markdown
Owner

Summary

Implements the M2 design spec (docs/superpowers/specs/2026-07-10-trigger-profiles-m2-design.md), executed task-by-task with per-task reviews and a final whole-branch review (verdict: ready to merge).

Phase A — Full trigger surface

  • Trigger effects are now a 7-mode discriminated union: off, feedback, weapon, vibration (+ optional frequencyHz), multi-feedback (10 resistance zones), slope (ramping resistance), multi-vibration (zoned vibration + frequency). Strict validator with legacy M1 normalization — every existing profile still validates unchanged.
  • vdsd: new companion command 0x41 APPLY_ADAPTIVE_TRIGGER_EFFECT_V2 (plan said 0x21; that id collides with SET_HOST_PERSONA) with full FFB encoding, plus slope support in the global intensity scaler (0 → off). First C++ unit test target (trigger_effect_v2_test).
  • Engine routes classic modes over V1 (old daemons keep working) and new arms over V2; byte-level payloads verified against the daemon parser in review.
  • Shared TriggerEffectEditor exposes all modes in the profile editor, modifiers, and Trigger Lab (TEST constrained to V1 modes — daemon 0x0D limitation; V2 modes preview via the draft path).

Phase B/C — Sharing

  • Optional meta block (game/author/description/source, whitelisted + length-capped).
  • Import/export via native dialogs; imports are always copies (fresh id, name suffixed) with per-file error reporting.
  • Repo library (profiles/library/ + index.json), scripts/build-index.mjs --check, and the repo's first CI workflow gating library PRs through the real validator.
  • In-app Library browser: fetches the repo index (HTTPS-only, 10s timeout, size caps, filename whitelist — traversal-proof), disk cache with stale/offline banners, per-entry install through the same validate-and-copy path, provenance shown in the editor.

Testing

  • 387 vitest tests + typecheck clean; trigger_effect_v2_test OK; e2e threads a multi-feedback+slope profile JSON → store → engine → V2 sink payloads.
  • Pending human pass: feel-test the new modes on hardware (slope byte layout is per community docs; needs a controller).

🤖 Generated with Claude Code

LordVicky and others added 17 commits July 10, 2026 09:39
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds encode_companion_trigger_effect_v2 (modes: V1 0-2 delegated, 3 off,
4 multi-feedback, 5 slope via new kTriggerEffectSlope 0x22, 6
multi-vibration), extends CompanionTriggerEffect with frequency_hz,
zone_percents, end_percent, end_force_percent, and wires companion
command 0x41 APPLY_ADAPTIVE_TRIGGER_EFFECT_V2 (0x21 from the brief
collides with SET_HOST_PERSONA). Linux vdsd FFB call sites now use the
V2 encoder. Adds trigger_effect_v2_test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Shared TriggerEffectEditor component with all seven effect modes, used by
the profile editor slot cards, modifier rows (compact variant), and the
Trigger Lab card. Zone strip renders ten vertical sliders; vibration modes
get a 1-255 frequency field. Trigger Lab now holds a TriggerEffectSpec and
tests V1 modes through a new bridge:previewAdaptiveTriggerEffect IPC so
edited percents are heard; V2-only modes point at profile draft preview
(the daemon 0x1F handler is V1-only).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t guard

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
revert-to-main.sh (user's local root-privileged revert script) and
.remember/remember.md (agent handoff scratch) were tracked by mistake;
remove them from the index (files kept on disk) and ignore both paths
so they cannot be re-committed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
scale_trigger_effect had no case for the slope opcode (0x22), so
SET_TRIGGER_EFFECT_INTENSITY was ignored for slope profiles -- at
intensity 0 a slope effect stayed at full force. Add a slope case:
percent 0 turns the trigger off; otherwise both 3-bit strength codes
packed in trigger[3] (bits 0-2 start, bits 3-5 end, stored as
strength-1) are scaled with scale_strength_code, matching the zone
modes. Promote scale_trigger_effect to a public span-based function so
the unit test can exercise it directly, and extend
trigger_effect_v2_test with percent-0 and percent-50 slope asserts.

Also whitelist vds/tests/ in vds/.gitignore: the whitelist-style
ignore file silently excluded the test source even though
CMakeLists.txt builds it unconditionally, so a fresh clone could not
configure.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LordVicky
LordVicky merged commit 2976047 into dev Jul 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant