feat(hub,device): add device plugin type and fix versioned service_id…#306
Merged
Conversation
… derivation Introduce a first-class "device" plugin type in the Hub marketplace, classified by `integration_type: device` in `_provider.yaml` and installed under `~/.flocks/plugins/tools/device/`. Device plugins now surface in the marketplace listing, get recognized during device setup, and are uninstalled with the correct type. Also fixes two regressions surfaced by versioned device plugins whose own `service_id` already contains a `_v...` token (e.g. `onesig_api` for both v2.5.3 D20260321 and D20250710): * `storage_key_to_service_id` previously stripped trailing version suffixes with a greedy regex, collapsing e.g. `onesig_v2_5_3_D20250710_api_v2_5_3_D20250710` to `onesig`. It now prefers the exact `ApiServiceDescriptor` cache mapping and falls back to a non-greedy regex that removes only the last suffix. * `row_to_device` recomputes `service_id` on read so historical rows with a corrupted column self-heal in the response. * `device_startup` adds a one-shot migration that rewrites stale `device_integrations.service_id` rows. * Device CRUD routes now derive `service_id` from the row's `storage_key` instead of trusting the stored column, keeping `sync_service_tool_state` aligned with the descriptor-aware logic. * Frontend tool filter in the device detail panel now matches on the exact versioned `storage_key`, so two versions of the same product no longer cross-contaminate the displayed tool list. Bundled `_provider.yaml` files for `onesig_v2_5_3_D20250710`, `sangfor_af_v8_0_48` and `sangfor_af_v8_0_85` are tagged with `integration_type: device`; their legacy `tools/api/` copies are removed in favour of the canonical `tools/device/` layout. Tests cover both the new plugin-type discovery path and the service_id derivation fix. Co-authored-by: Cursor <cursoragent@cursor.com>
xiami762
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a first-class "device" plugin type in the Hub marketplace, classified by
integration_type: devicein_provider.yamland installed under~/.flocks/plugins/tools/device/. Device plugins now surface in the marketplace listing, get recognized during device setup, and are uninstalled with the correct type.Also fixes two regressions surfaced by versioned device plugins whose own
service_idalready contains a_v...token (e.g.onesig_apifor both v2.5.3 D20260321 and D20250710):storage_key_to_service_idpreviously stripped trailing version suffixes with a greedy regex, collapsing e.g.onesig_v2_5_3_D20250710_api_v2_5_3_D20250710toonesig. It now prefers the exactApiServiceDescriptorcache mapping and falls back to a non-greedy regex that removes only the last suffix.row_to_devicerecomputesservice_idon read so historical rows with a corrupted column self-heal in the response.device_startupadds a one-shot migration that rewrites staledevice_integrations.service_idrows.service_idfrom the row'sstorage_keyinstead of trusting the stored column, keepingsync_service_tool_statealigned with the descriptor-aware logic.storage_key, so two versions of the same product no longer cross-contaminate the displayed tool list.Bundled
_provider.yamlfiles foronesig_v2_5_3_D20250710,sangfor_af_v8_0_48andsangfor_af_v8_0_85are tagged withintegration_type: device; their legacytools/api/copies are removed in favour of the canonicaltools/device/layout. Tests cover both the new plugin-type discovery path and the service_id derivation fix.