Skip to content

feat(hub,device): add device plugin type and fix versioned service_id…#306

Merged
xiami762 merged 1 commit into
devfrom
feat/hub-device-plugin-type
May 22, 2026
Merged

feat(hub,device): add device plugin type and fix versioned service_id…#306
xiami762 merged 1 commit into
devfrom
feat/hub-device-plugin-type

Conversation

@duguwanglong
Copy link
Copy Markdown
Contributor

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.

… 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>
@duguwanglong duguwanglong requested a review from xiami762 May 22, 2026 07:30
@xiami762 xiami762 merged commit e7988a2 into dev May 22, 2026
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.

2 participants