Skip to content

refactor(platform): let optional platform families be absent - #4781

Merged
thymikee merged 6 commits into
0.22from
refactor/0.22-optional-platform-families
Nov 20, 2026
Merged

thymikee merged 6 commits into
0.22from
refactor/0.22-optional-platform-families

Conversation

@thymikee

@thymikee thymikee commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Families are declared in one partition and every consumer answers presence from one registry (packages/contracts/src/platform-module.ts). Required: apple, android. Optional: harmonyos, vega, linux, web. 32 files. No linked issue; no scope beyond this PR's review round.

PlatformModuleRegistry.get() on an absent optional family is the single "not installed" answer: UNSUPPORTED_PLATFORM, details.reason: 'plugin-not-installed', the package, its pluginInstallCommand, and a hint.

Consumer Change
src/core/platform-plugin-registry.ts registerPlatformPluginSet(plugins, reportAbsent) owns the absence reporter as one input for the set and rejects a duplicate before any state change. getPlugin existed; its absent-family answer is now that reporter's typed outcome, not a plain unsupported error. tryGetPlugin, registeredPlatforms unchanged
src/core/interactors/register-builtins.ts registerBuiltinPlatformPlugins(reportAbsent) composes the builtin set in one call, so no plugin carries an absence policy
src/platform-runtime-gateway.ts modules is a PlatformModuleRegistry; dropped the missing-module contract error and module.family !== family guard
src/platform-runtime/request-providers.ts platformGatedResolverApplies stays a non-throwing predicate
packages/device-selection composed-inventory-gateways.ts unchanged: unfiltered discovery already swallows a per-family failure, an explicit request propagates registry.get's outcome; tests pass coreVersion
src/daemon-composition.ts, src/platform-runtime-claim-recovery.ts pass coreVersion: readVersion()
src/commands/provider-plugin-catalog.ts delegates the release-channel rule to contracts/platform-module.ts; no new exports subpath

Validation

pnpm check:affected --run --base origin/0.22 --head ca65654ec → exit 0, exactCommit: true (receipt .tmp/validation/run-BvMvAX/receipt.json): format, lint, typecheck, layering, fallow, build, integration-node (155 passed, 13 skipped), vitest-related (97 files, 441 tests), unit (2202 files, 21347 passed, 10 skipped).

CI owns the parked replay-* and authoritative smoke lanes. Hosted Mutants and tvOS Runner Build are unrelated (fixed in #4782). No packed build ships an absent family yet, so the outcome is proven by unit and integration fixtures.

thymikee and others added 3 commits November 19, 2026 22:49
Deliver the three shared prerequisites for moving web, HarmonyOS, Vega and
Linux desktop out of the packed core into platform plugins (ADR 0034),
without moving any platform yet:

- packages/contracts/src/platform-module.ts is the single owner of the
  required/optional family partition (apple+android required, completeness
  still enforced; harmonyos/vega/linux/web optional). The registry gains
  has(), lists only registered families, and get() on an absent optional
  family throws the typed plugin-not-installed AppError. Inventory
  enumeration skips absent optional families silently; the runtime
  gateway and the request-provider gate report the same typed outcome
  before any device binding. BuiltinPluginsCoverAllPlatforms becomes
  BuiltinPluginsCoverRequiredPlatforms (required-only exhaustiveness).
- The engine-free install-hint catalog maps each optional family to its
  @agent-device/* package and the 'agent-device plugins add <package>'
  command; the plugin-not-installed error carries it. Unknown names
  produce no inferred package.
- scripts/check-package.ts gains a declared (empty) absence list of paths
  and module markers that must not appear in the packed core tarball,
  checked against the npm pack file list and the bundled dist; each
  extraction PR adds one line. The rule lives in
  scripts/lib/packed-core-absence.ts with a self-test unit test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- platform-module.ts: keep the four install-hint declarations module-local;
  the catalog lookup is the public surface.
- materialize the two compile-time partition guards in their test files so
  they have consumers.
- check-package.ts: share one readPackedFiles helper between the test-code
  and packed-core-absence content checks instead of duplicating the packed
  file reader.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.17 MB 6.17 MB +1.4 kB
Package (unpacked) 6.17 MB 6.17 MB +1.4 kB
Package (download) 1.88 MB 1.88 MB +446 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 22.0 ms 27.6 ms +5.6 ms
CLI --help 43.6 ms 47.2 ms +3.6 ms

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on a213eef. The verdict and the full list are in the summary comment.

…families

The gate threw plugin-not-installed for any device of an absent optional family, which blocked provider-owned devices and threw from unrelated resolver gates. The typed outcome already comes from the inventory and runtime lookups, so the gate returns false again.
@thymikee

Copy link
Copy Markdown
Member Author

One change is needed before merge at a213eef: the help sentence added at cli-help.ts:488 describes behavior no user can reach yet. It says --platform vega without @agent-device/vega returns plugin-not-installed with agent-device plugins add @agent-device/vega, and that devices skips absent optional families. In this build all six families are compiled in (platform-runtime.ts:92-130, register-builtins.ts:58-65), and no code reads an installed platform plugin. An agent that trusts this help may run plugins add @agent-device/vega for a family that already works in core. Please drop the sentence and add it in the first extraction PR that removes a family from the core composition. The rule: help may promise plugin-not-installed for a family only when that family is absent from the shipped composition.

Not blocking, and you can take or leave these: presence of a family is answered by three sources (the contracts PlatformModuleRegistry, the runtime module map, and the src/core PlatformPlugin registry), and getPlugin (used by interactors.ts:48) still throws a plain UNSUPPORTED_PLATFORM without the typed reason, so deriving the lookups from one registry would let you delete the per-caller guards in platform-runtime-gateway.ts:127 and request-providers.ts:341; the optional-platform hint catalog in platform-module.ts:47 copies the provider plugin catalog but drops the nightly version selector, so a Record<OptionalPlatform, ...> sharing one install-command helper would be total and stay in sync; the new has guard at composed-inventory-gateways.ts:132 duplicates the existing per-family catch and its test passes without it; PACKED_CORE_FORBIDDEN at check-package.ts:219 is empty, so the new absence gate checks nothing until the first extraction PR; and platformGatedResolverApplies at request-providers.ts:337 is a boolean predicate that now throws, so returning false and letting the gateway lookup raise plugin-not-installed would give one owner, while the long ADR comments at platform-runtime.ts:88-91 and :133-135 could be trimmed.

Could the smallest version be just the required/optional partition with the required-only completeness check in createPlatformModuleRegistry, with get throwing plugin-not-installed for an absent optional family? The runtime module map and the PlatformPlugin registry would then answer presence through that registry, as ADR 0034 names it. The help sentence and the empty packed-core gate would wait for the first extraction PR.

On the open review thread (#4781 (comment), throw in request-providers): it does not apply, so please resolve it. That throw fires only when vega's PlatformPlugin is unregistered, which no shipped composition does, and once it is absent the gateway fails with plugin-not-installed anyway, which is the intended outcome. The placement concern is covered by the note above.

The Mutants and Affected decision-kernel mutants checks fail in Stryker's dry run on an unrelated test in the move/script-publication area ('Setting process.umask() is not supported in workers'), and Runner Build (tvOS + visionOS + watchOS) fails at 'Restore and build tvOS XCTest runner'. This diff touches neither area, so these failures look unrelated. No live device run is needed while all six families stay registered.

Keep the required/optional partition and make the platform module registry the one
presence authority (ADR 0034): the required families (apple, android) are still
completeness-checked, an optional family may be absent, and `get` raises the typed
plugin-not-installed outcome for it. The runtime module map and the src/core
PlatformPlugin registry now answer presence through that registry, so the gateway's
missing-module contract error and the throwing request-provider predicate are gone.

Share one release-channel rule with the provider catalog, so an optional family's
install hint names the same nightly release a provider hint does. The version comes
from the composition that builds a registry: contracts does not read host mechanics.

Drop the CLI help sentence that promised plugin-not-installed for families still
compiled into the packed core, and drop the empty packed-core absence gate. Both land
with the first extraction PR that removes a family from the composition.

Refs #4781 review.
@thymikee

Copy link
Copy Markdown
Member Author

Shrunk to the smallest version and force-pushed (a213eef871 → b989170db6, net -14 lines: 476 insertions, 490 deletions across 37 files). Point by point:

Blocking — the help sentence. Dropped. src/commands/schema/cli-help.ts is byte-identical to origin/0.22 again, along with vitest.config.ts and scripts/check-package.ts. No shipped help promises plugin-not-installed for a family that is still compiled into the core. It goes in with the first extraction PR that removes a family from the composition.

Presence answered by three sources; getPlugin throwing a plain UNSUPPORTED_PLATFORM. Taken — this is now the shape. createPlatformModuleRegistry completeness-checks only REQUIRED_PLATFORMS and get answers presence for both kinds: an absent optional family raises the typed outcome, and a composition without a required family does not build. The root runtime map became a PlatformModuleRegistry<PlatformRuntimeModule> passed to the gateway, so Missing platform runtime module for <family> and the module.family !== family guard are both gone — the owner-scoped local-owner check still covers a swapped module. src/core/platform-plugin-registry.ts takes an injected absence reporter at registration, so getPlugin raises the same typed outcome while the registry itself still evaluates neither the version read nor the catalog (its hub closure stays 6 modules). packages/device-selection/src/composed-inventory-gateways.ts reverted to origin/0.22 — see below.

Optional-family catalog copying the provider catalog and dropping the nightly selector. Taken. The catalog is now Readonly<Record<OptionalPlatform, …>>, so a newly optional family cannot ship without its installation row, and its install command goes through the same pluginPackageSelector / pluginInstallCommand / pluginRepairCommand the provider catalog uses. Those live in packages/contracts/src/platform-module.ts and src/commands/provider-plugin-catalog.ts delegates to them, so the @nightly-0.22 rule has one owner. Pinned by a test: a 0.22.0-nightly-0-22.20261118.187 core hints @agent-device/vega@0.22.0-nightly-0-22.20261118.187, a 0.22.0-dev core hints @agent-device/vega@nightly-0.22, a released core hints the bare package. One note on where the helper lives: my first cut put it in a new contracts/plugin-release subpath, and the ADR-0019 eager-closure gate rejected it — a new module grows 21 merge-base entry closures, and the gate's own diagnostic named platform-module.ts as the shared home those closures already evaluate. So it is declared there, and coreVersion arrives as a parameter from whichever composition builds a registry (contracts stays free of the host version read).

The has guard in composed-inventory-gateways.ts. Removed, file back to origin/0.22. The per-family catch already contributes nothing for an absent family, and the added test still passes with the guard gone — it asserts both halves: unfiltered devices skips the family without loading its source, and { platform: 'vega' } fails with plugin-not-installed and its hint.

PACKED_CORE_FORBIDDEN. Removed, with scripts/lib/packed-core-absence.ts, its self-test and its vitest.config.ts entry. An empty forbidden list gated nothing.

platformGatedResolverApplies throwing, and the long ADR comments. Taken — the predicate returns false and never throws (kept from 0d187059b4), and the runtime/interactor lookup the same request performs raises the outcome. The comments at platform-runtime.ts:88 and :135 are trimmed to two lines each.

On the thread at #4781 (comment): replied there and resolved it. The predicate is non-throwing now, so both the placement concern and the throw are gone.

Mutants, Affected decision-kernel mutants and Runner Build (tvOS + visionOS + watchOS) look unrelated as you said: no live device run, no new families registered or unregistered.

Validation on this head: pnpm check:affected --run --base origin/0.22 --head b989170db6 exit 0, exactCommit: true — format, lint, typecheck, layering, fallow, build, integration (155 passed / 13 skipped), related vitest (97 files, 441 tests) and unit (2202 files, 21347 passed / 10 skipped).

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

Thanks for the update. At b989170 the code looks good, and the earlier findings (#4781 (comment)) are fixed: the predicate in request-providers.ts no longer throws and returns false for an absent family (#4781 (comment), which you can resolve).

All 13 checks pass at this commit. There are no known conflicts. No absent-family composition ships yet, so the plugin-not-installed route is proven only by the unit and integration fixtures, not by a packed build. That is expected until the first extraction PR, so no extra evidence is needed.

Not blocking, and you can take or leave these: the getPlugin assertion in platform-plugin-registry-optional-family.test.ts only gets the typed reporter because the preceding test already ran the lazy request-provider wrapper, so running it alone leaves details.reason undefined; merging it into the same scenario as the scope assertions would fix that. The PR body also lists the optional families as Android, Fire TV, TV, Vega and Web, while the code has harmonyos, vega, linux and web. It places platformGatedResolverApplies in src/commands/sessions.ts when it lives in src/platform-runtime/request-providers.ts, and it says getPlugin and registeredPlatforms are added when they already existed on base.

Could plugin-set composition own the interactor registry's absence reporter as one initialization input? The family classification and typed error already belong to contracts/platform-module.ts, and passing the same reporter for each plugin lets registerPlatformPlugin replace the policy before it has rejected a duplicate.

The interactor registry's absence reporter was an argument of
registerPlatformPlugin, so every plugin in a set carried the same reporter and
a duplicate could replace the absence policy before registration rejected it.

Move it to the plugin set: registerPlatformPluginSet takes the plugins and the
reporter together, checks every leaf platform before it changes any state, and
is the only registration path. registerBuiltinPlatformPlugins composes the
builtin set through it once.

getPlugin for an absent optional family still raises the typed
plugin-not-installed outcome.

Fold the getPlugin assertion into the scenario that composes the lazy
request-provider wrapper, so it no longer passes only because another test ran
first, and pin that a rejected duplicate leaves the reporter unchanged.

PR-4781 review: #4781 (comment)
@thymikee

Copy link
Copy Markdown
Member Author

Addressed on ca65654ecc.

Absence reporter is now a plugin-set input. registerPlatformPluginSet(plugins, reportAbsent) replaces registerPlatformPlugin(plugin, absent): it takes the whole set plus the reporter once, and it is the only registration path, so no plugin carries an absence policy. It checks every leaf platform — inside the set and against the registered set — before it assigns the reporter or writes any entry, so a rejected duplicate can no longer replace the absence policy it came to install. registerBuiltinPlatformPlugins(reportAbsent) composes the builtins through that one call. getPlugin on an absent optional family still raises the typed plugin-not-installed outcome.

Test fold. The getPlugin assertion now runs inside the scenario that composes the lazy request-provider wrapper, so it no longer depends on that scenario having run first in the file. A new test composes a set on a fresh registry module, then rejects a set whose plugin claims both a free platform and a taken one, and asserts neither the free platform nor the rejected reporter reached the registry; it fails when the reporter is assigned before the duplicate check. Ran the file alone and the src/core folder.

Body fixes. Families are required apple, android and optional harmonyos, vega, linux, web; platformGatedResolverApplies is placed in src/platform-runtime/request-providers.ts and described as the non-throwing predicate it is; getPlugin and registeredPlatforms are no longer called new — the body now says only getPlugin's absent-family answer changed and that tryGetPlugin and registeredPlatforms are unchanged. Checked the rest against git diff origin/0.22...HEAD: the PACKED_CORE_FORBIDDEN paragraph, src/commands/sessions.ts, and the createInteractionDomainSnapshot/createRecordingDomainSnapshot claims described code that is not in the diff and are gone; the device-selection row now states the real reason no guard was needed.

Request-providers throw thread resolved.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of ca65654

Since the review of b989170: 0 new · 0 still open · 0 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

1 new finding away from what changed since b989170 not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (0b9186494f80).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

At ca65654 the code looks good, and the absence reporter is now one input to the plugin set, which answers the earlier design question. The one open inline thread from the earlier review is fixed: platformGatedResolverApplies in request-providers.ts no longer throws when a family is absent, so please resolve #4781 (comment).

The 13 checks are green at this commit, and there are no conflicts. The new duplicate-set test is a valid regression for the duplicate case. No packed build ships an absent family yet, so the plugin-not-installed route is proven only by unit and integration fixtures, which the earlier review accepted. Once a build that ships an absent family exists, a run that reaches the plugin-not-installed error and prints the install hint would close the evidence gap.

Not blocking, and fine to take or leave: missingOptionalPlatformError in platform-module.ts copies the install and daemon-stop hint from unavailableConnectPluginError in provider-policy.ts. Both use the same installCommand field, so one shared formatter for the hint could serve both builders.

Could platform-module.ts own family presence, with both registries receiving the platform absence reporter from src/core/platform-plugin-absence.ts, and a shared plugin installation module owning release selection and CLI recovery guidance for both catalogs?

@thymikee

Copy link
Copy Markdown
Member Author

Both are out of scope for this PR; they move into the first extraction PR (#4597, web as the first platform contribution), where family presence starts to come from installed plugins instead of compiled-in modules:

  • Family presence: platform-module.ts becomes the single owner, and both the inventory/runtime registry and the platform-plugin registry take the absence reporter from platform-plugin-absence.ts.
  • Installation hint: one shared installation module owns release selection (including the @nightly-0.22 selector) and the install plus daemon-stop hint, used by both missingOptionalPlatformError and unavailableConnectPluginError.

The request-providers thread (r4636329881) is resolved; it is the only review thread on this PR.

@thymikee

Copy link
Copy Markdown
Member Author

Thanks, that answers the design question. Moving family presence and the shared install hint into #4597, where presence starts to come from installed plugins, is the right place, and this PR stays the smallest step. Ready at ca65654.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 20, 2026
@thymikee
thymikee merged commit 3e288ea into 0.22 Nov 20, 2026
13 checks passed
@thymikee
thymikee deleted the refactor/0.22-optional-platform-families branch November 20, 2026 06:41
thymikee added a commit that referenced this pull request Nov 20, 2026
* refactor(platform): let optional platform families be absent

Deliver the three shared prerequisites for moving web, HarmonyOS, Vega and
Linux desktop out of the packed core into platform plugins (ADR 0034),
without moving any platform yet:

- packages/contracts/src/platform-module.ts is the single owner of the
  required/optional family partition (apple+android required, completeness
  still enforced; harmonyos/vega/linux/web optional). The registry gains
  has(), lists only registered families, and get() on an absent optional
  family throws the typed plugin-not-installed AppError. Inventory
  enumeration skips absent optional families silently; the runtime
  gateway and the request-provider gate report the same typed outcome
  before any device binding. BuiltinPluginsCoverAllPlatforms becomes
  BuiltinPluginsCoverRequiredPlatforms (required-only exhaustiveness).
- The engine-free install-hint catalog maps each optional family to its
  @agent-device/* package and the 'agent-device plugins add <package>'
  command; the plugin-not-installed error carries it. Unknown names
  produce no inferred package.
- scripts/check-package.ts gains a declared (empty) absence list of paths
  and module markers that must not appear in the packed core tarball,
  checked against the npm pack file list and the bundled dist; each
  extraction PR adds one line. The rule lives in
  scripts/lib/packed-core-absence.ts with a self-test unit test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* fix(gates): resolve fallow findings in the optional-family change

- platform-module.ts: keep the four install-hint declarations module-local;
  the catalog lookup is the public surface.
- materialize the two compile-time partition guards in their test files so
  they have consumers.
- check-package.ts: share one readPackedFiles helper between the test-code
  and packed-core-absence content checks instead of duplicating the packed
  file reader.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* refactor(platform): drop the test-only required-family predicate

* fix(platform): keep the request-provider gate a predicate for absent families

The gate threw plugin-not-installed for any device of an absent optional family, which blocked provider-owned devices and threw from unrelated resolver gates. The typed outcome already comes from the inventory and runtime lookups, so the gate returns false again.

* refactor(platform): answer family presence from one registry

Keep the required/optional partition and make the platform module registry the one
presence authority (ADR 0034): the required families (apple, android) are still
completeness-checked, an optional family may be absent, and `get` raises the typed
plugin-not-installed outcome for it. The runtime module map and the src/core
PlatformPlugin registry now answer presence through that registry, so the gateway's
missing-module contract error and the throwing request-provider predicate are gone.

Share one release-channel rule with the provider catalog, so an optional family's
install hint names the same nightly release a provider hint does. The version comes
from the composition that builds a registry: contracts does not read host mechanics.

Drop the CLI help sentence that promised plugin-not-installed for families still
compiled into the packed core, and drop the empty packed-core absence gate. Both land
with the first extraction PR that removes a family from the composition.

Refs #4781 review.

* refactor(platform): give the plugin set one absence reporter

The interactor registry's absence reporter was an argument of
registerPlatformPlugin, so every plugin in a set carried the same reporter and
a duplicate could replace the absence policy before registration rejected it.

Move it to the plugin set: registerPlatformPluginSet takes the plugins and the
reporter together, checks every leaf platform before it changes any state, and
is the only registration path. registerBuiltinPlatformPlugins composes the
builtin set through it once.

getPlugin for an absent optional family still raises the typed
plugin-not-installed outcome.

Fold the getPlugin assertion into the scenario that composes the lazy
request-provider wrapper, so it no longer passes only because another test ran
first, and pin that a rejected duplicate leaves the reporter unchanged.

PR-4781 review: #4781 (comment)

---------

Co-authored-by: Mistral Vibe <vibe@mistral.ai>
thymikee added a commit that referenced this pull request Nov 20, 2026
* refactor(platform): let optional platform families be absent

Deliver the three shared prerequisites for moving web, HarmonyOS, Vega and
Linux desktop out of the packed core into platform plugins (ADR 0034),
without moving any platform yet:

- packages/contracts/src/platform-module.ts is the single owner of the
  required/optional family partition (apple+android required, completeness
  still enforced; harmonyos/vega/linux/web optional). The registry gains
  has(), lists only registered families, and get() on an absent optional
  family throws the typed plugin-not-installed AppError. Inventory
  enumeration skips absent optional families silently; the runtime
  gateway and the request-provider gate report the same typed outcome
  before any device binding. BuiltinPluginsCoverAllPlatforms becomes
  BuiltinPluginsCoverRequiredPlatforms (required-only exhaustiveness).
- The engine-free install-hint catalog maps each optional family to its
  @agent-device/* package and the 'agent-device plugins add <package>'
  command; the plugin-not-installed error carries it. Unknown names
  produce no inferred package.
- scripts/check-package.ts gains a declared (empty) absence list of paths
  and module markers that must not appear in the packed core tarball,
  checked against the npm pack file list and the bundled dist; each
  extraction PR adds one line. The rule lives in
  scripts/lib/packed-core-absence.ts with a self-test unit test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* fix(gates): resolve fallow findings in the optional-family change

- platform-module.ts: keep the four install-hint declarations module-local;
  the catalog lookup is the public surface.
- materialize the two compile-time partition guards in their test files so
  they have consumers.
- check-package.ts: share one readPackedFiles helper between the test-code
  and packed-core-absence content checks instead of duplicating the packed
  file reader.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* refactor(platform): drop the test-only required-family predicate

* fix(platform): keep the request-provider gate a predicate for absent families

The gate threw plugin-not-installed for any device of an absent optional family, which blocked provider-owned devices and threw from unrelated resolver gates. The typed outcome already comes from the inventory and runtime lookups, so the gate returns false again.

* refactor(platform): answer family presence from one registry

Keep the required/optional partition and make the platform module registry the one
presence authority (ADR 0034): the required families (apple, android) are still
completeness-checked, an optional family may be absent, and `get` raises the typed
plugin-not-installed outcome for it. The runtime module map and the src/core
PlatformPlugin registry now answer presence through that registry, so the gateway's
missing-module contract error and the throwing request-provider predicate are gone.

Share one release-channel rule with the provider catalog, so an optional family's
install hint names the same nightly release a provider hint does. The version comes
from the composition that builds a registry: contracts does not read host mechanics.

Drop the CLI help sentence that promised plugin-not-installed for families still
compiled into the packed core, and drop the empty packed-core absence gate. Both land
with the first extraction PR that removes a family from the composition.

Refs #4781 review.

* refactor(platform): give the plugin set one absence reporter

The interactor registry's absence reporter was an argument of
registerPlatformPlugin, so every plugin in a set carried the same reporter and
a duplicate could replace the absence policy before registration rejected it.

Move it to the plugin set: registerPlatformPluginSet takes the plugins and the
reporter together, checks every leaf platform before it changes any state, and
is the only registration path. registerBuiltinPlatformPlugins composes the
builtin set through it once.

getPlugin for an absent optional family still raises the typed
plugin-not-installed outcome.

Fold the getPlugin assertion into the scenario that composes the lazy
request-provider wrapper, so it no longer passes only because another test ran
first, and pin that a rejected duplicate leaves the reporter unchanged.

PR-4781 review: #4781 (comment)

---------

Co-authored-by: Mistral Vibe <vibe@mistral.ai>
thymikee added a commit that referenced this pull request Nov 21, 2026
* refactor(platform): let optional platform families be absent

Deliver the three shared prerequisites for moving web, HarmonyOS, Vega and
Linux desktop out of the packed core into platform plugins (ADR 0034),
without moving any platform yet:

- packages/contracts/src/platform-module.ts is the single owner of the
  required/optional family partition (apple+android required, completeness
  still enforced; harmonyos/vega/linux/web optional). The registry gains
  has(), lists only registered families, and get() on an absent optional
  family throws the typed plugin-not-installed AppError. Inventory
  enumeration skips absent optional families silently; the runtime
  gateway and the request-provider gate report the same typed outcome
  before any device binding. BuiltinPluginsCoverAllPlatforms becomes
  BuiltinPluginsCoverRequiredPlatforms (required-only exhaustiveness).
- The engine-free install-hint catalog maps each optional family to its
  @agent-device/* package and the 'agent-device plugins add <package>'
  command; the plugin-not-installed error carries it. Unknown names
  produce no inferred package.
- scripts/check-package.ts gains a declared (empty) absence list of paths
  and module markers that must not appear in the packed core tarball,
  checked against the npm pack file list and the bundled dist; each
  extraction PR adds one line. The rule lives in
  scripts/lib/packed-core-absence.ts with a self-test unit test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* fix(gates): resolve fallow findings in the optional-family change

- platform-module.ts: keep the four install-hint declarations module-local;
  the catalog lookup is the public surface.
- materialize the two compile-time partition guards in their test files so
  they have consumers.
- check-package.ts: share one readPackedFiles helper between the test-code
  and packed-core-absence content checks instead of duplicating the packed
  file reader.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* refactor(platform): drop the test-only required-family predicate

* fix(platform): keep the request-provider gate a predicate for absent families

The gate threw plugin-not-installed for any device of an absent optional family, which blocked provider-owned devices and threw from unrelated resolver gates. The typed outcome already comes from the inventory and runtime lookups, so the gate returns false again.

* refactor(platform): answer family presence from one registry

Keep the required/optional partition and make the platform module registry the one
presence authority (ADR 0034): the required families (apple, android) are still
completeness-checked, an optional family may be absent, and `get` raises the typed
plugin-not-installed outcome for it. The runtime module map and the src/core
PlatformPlugin registry now answer presence through that registry, so the gateway's
missing-module contract error and the throwing request-provider predicate are gone.

Share one release-channel rule with the provider catalog, so an optional family's
install hint names the same nightly release a provider hint does. The version comes
from the composition that builds a registry: contracts does not read host mechanics.

Drop the CLI help sentence that promised plugin-not-installed for families still
compiled into the packed core, and drop the empty packed-core absence gate. Both land
with the first extraction PR that removes a family from the composition.

Refs #4781 review.

* refactor(platform): give the plugin set one absence reporter

The interactor registry's absence reporter was an argument of
registerPlatformPlugin, so every plugin in a set carried the same reporter and
a duplicate could replace the absence policy before registration rejected it.

Move it to the plugin set: registerPlatformPluginSet takes the plugins and the
reporter together, checks every leaf platform before it changes any state, and
is the only registration path. registerBuiltinPlatformPlugins composes the
builtin set through it once.

getPlugin for an absent optional family still raises the typed
plugin-not-installed outcome.

Fold the getPlugin assertion into the scenario that composes the lazy
request-provider wrapper, so it no longer passes only because another test ran
first, and pin that a rejected duplicate leaves the reporter unchanged.

PR-4781 review: #4781 (comment)

---------

Co-authored-by: Mistral Vibe <vibe@mistral.ai>
thymikee added a commit that referenced this pull request Nov 21, 2026
* refactor(platform): let optional platform families be absent

Deliver the three shared prerequisites for moving web, HarmonyOS, Vega and
Linux desktop out of the packed core into platform plugins (ADR 0034),
without moving any platform yet:

- packages/contracts/src/platform-module.ts is the single owner of the
  required/optional family partition (apple+android required, completeness
  still enforced; harmonyos/vega/linux/web optional). The registry gains
  has(), lists only registered families, and get() on an absent optional
  family throws the typed plugin-not-installed AppError. Inventory
  enumeration skips absent optional families silently; the runtime
  gateway and the request-provider gate report the same typed outcome
  before any device binding. BuiltinPluginsCoverAllPlatforms becomes
  BuiltinPluginsCoverRequiredPlatforms (required-only exhaustiveness).
- The engine-free install-hint catalog maps each optional family to its
  @agent-device/* package and the 'agent-device plugins add <package>'
  command; the plugin-not-installed error carries it. Unknown names
  produce no inferred package.
- scripts/check-package.ts gains a declared (empty) absence list of paths
  and module markers that must not appear in the packed core tarball,
  checked against the npm pack file list and the bundled dist; each
  extraction PR adds one line. The rule lives in
  scripts/lib/packed-core-absence.ts with a self-test unit test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* fix(gates): resolve fallow findings in the optional-family change

- platform-module.ts: keep the four install-hint declarations module-local;
  the catalog lookup is the public surface.
- materialize the two compile-time partition guards in their test files so
  they have consumers.
- check-package.ts: share one readPackedFiles helper between the test-code
  and packed-core-absence content checks instead of duplicating the packed
  file reader.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* refactor(platform): drop the test-only required-family predicate

* fix(platform): keep the request-provider gate a predicate for absent families

The gate threw plugin-not-installed for any device of an absent optional family, which blocked provider-owned devices and threw from unrelated resolver gates. The typed outcome already comes from the inventory and runtime lookups, so the gate returns false again.

* refactor(platform): answer family presence from one registry

Keep the required/optional partition and make the platform module registry the one
presence authority (ADR 0034): the required families (apple, android) are still
completeness-checked, an optional family may be absent, and `get` raises the typed
plugin-not-installed outcome for it. The runtime module map and the src/core
PlatformPlugin registry now answer presence through that registry, so the gateway's
missing-module contract error and the throwing request-provider predicate are gone.

Share one release-channel rule with the provider catalog, so an optional family's
install hint names the same nightly release a provider hint does. The version comes
from the composition that builds a registry: contracts does not read host mechanics.

Drop the CLI help sentence that promised plugin-not-installed for families still
compiled into the packed core, and drop the empty packed-core absence gate. Both land
with the first extraction PR that removes a family from the composition.

Refs #4781 review.

* refactor(platform): give the plugin set one absence reporter

The interactor registry's absence reporter was an argument of
registerPlatformPlugin, so every plugin in a set carried the same reporter and
a duplicate could replace the absence policy before registration rejected it.

Move it to the plugin set: registerPlatformPluginSet takes the plugins and the
reporter together, checks every leaf platform before it changes any state, and
is the only registration path. registerBuiltinPlatformPlugins composes the
builtin set through it once.

getPlugin for an absent optional family still raises the typed
plugin-not-installed outcome.

Fold the getPlugin assertion into the scenario that composes the lazy
request-provider wrapper, so it no longer passes only because another test ran
first, and pin that a rejected duplicate leaves the reporter unchanged.

PR-4781 review: #4781 (comment)

---------

Co-authored-by: Mistral Vibe <vibe@mistral.ai>
thymikee added a commit that referenced this pull request Nov 23, 2026
* refactor(platform): let optional platform families be absent

Deliver the three shared prerequisites for moving web, HarmonyOS, Vega and
Linux desktop out of the packed core into platform plugins (ADR 0034),
without moving any platform yet:

- packages/contracts/src/platform-module.ts is the single owner of the
  required/optional family partition (apple+android required, completeness
  still enforced; harmonyos/vega/linux/web optional). The registry gains
  has(), lists only registered families, and get() on an absent optional
  family throws the typed plugin-not-installed AppError. Inventory
  enumeration skips absent optional families silently; the runtime
  gateway and the request-provider gate report the same typed outcome
  before any device binding. BuiltinPluginsCoverAllPlatforms becomes
  BuiltinPluginsCoverRequiredPlatforms (required-only exhaustiveness).
- The engine-free install-hint catalog maps each optional family to its
  @agent-device/* package and the 'agent-device plugins add <package>'
  command; the plugin-not-installed error carries it. Unknown names
  produce no inferred package.
- scripts/check-package.ts gains a declared (empty) absence list of paths
  and module markers that must not appear in the packed core tarball,
  checked against the npm pack file list and the bundled dist; each
  extraction PR adds one line. The rule lives in
  scripts/lib/packed-core-absence.ts with a self-test unit test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* fix(gates): resolve fallow findings in the optional-family change

- platform-module.ts: keep the four install-hint declarations module-local;
  the catalog lookup is the public surface.
- materialize the two compile-time partition guards in their test files so
  they have consumers.
- check-package.ts: share one readPackedFiles helper between the test-code
  and packed-core-absence content checks instead of duplicating the packed
  file reader.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* refactor(platform): drop the test-only required-family predicate

* fix(platform): keep the request-provider gate a predicate for absent families

The gate threw plugin-not-installed for any device of an absent optional family, which blocked provider-owned devices and threw from unrelated resolver gates. The typed outcome already comes from the inventory and runtime lookups, so the gate returns false again.

* refactor(platform): answer family presence from one registry

Keep the required/optional partition and make the platform module registry the one
presence authority (ADR 0034): the required families (apple, android) are still
completeness-checked, an optional family may be absent, and `get` raises the typed
plugin-not-installed outcome for it. The runtime module map and the src/core
PlatformPlugin registry now answer presence through that registry, so the gateway's
missing-module contract error and the throwing request-provider predicate are gone.

Share one release-channel rule with the provider catalog, so an optional family's
install hint names the same nightly release a provider hint does. The version comes
from the composition that builds a registry: contracts does not read host mechanics.

Drop the CLI help sentence that promised plugin-not-installed for families still
compiled into the packed core, and drop the empty packed-core absence gate. Both land
with the first extraction PR that removes a family from the composition.

Refs #4781 review.

* refactor(platform): give the plugin set one absence reporter

The interactor registry's absence reporter was an argument of
registerPlatformPlugin, so every plugin in a set carried the same reporter and
a duplicate could replace the absence policy before registration rejected it.

Move it to the plugin set: registerPlatformPluginSet takes the plugins and the
reporter together, checks every leaf platform before it changes any state, and
is the only registration path. registerBuiltinPlatformPlugins composes the
builtin set through it once.

getPlugin for an absent optional family still raises the typed
plugin-not-installed outcome.

Fold the getPlugin assertion into the scenario that composes the lazy
request-provider wrapper, so it no longer passes only because another test ran
first, and pin that a rejected duplicate leaves the reporter unchanged.

PR-4781 review: #4781 (comment)

---------

Co-authored-by: Mistral Vibe <vibe@mistral.ai>
hannojg pushed a commit to hannojg/agent-device that referenced this pull request Nov 23, 2026
…ck#4781)

* refactor(platform): let optional platform families be absent

Deliver the three shared prerequisites for moving web, HarmonyOS, Vega and
Linux desktop out of the packed core into platform plugins (ADR 0034),
without moving any platform yet:

- packages/contracts/src/platform-module.ts is the single owner of the
  required/optional family partition (apple+android required, completeness
  still enforced; harmonyos/vega/linux/web optional). The registry gains
  has(), lists only registered families, and get() on an absent optional
  family throws the typed plugin-not-installed AppError. Inventory
  enumeration skips absent optional families silently; the runtime
  gateway and the request-provider gate report the same typed outcome
  before any device binding. BuiltinPluginsCoverAllPlatforms becomes
  BuiltinPluginsCoverRequiredPlatforms (required-only exhaustiveness).
- The engine-free install-hint catalog maps each optional family to its
  @agent-device/* package and the 'agent-device plugins add <package>'
  command; the plugin-not-installed error carries it. Unknown names
  produce no inferred package.
- scripts/check-package.ts gains a declared (empty) absence list of paths
  and module markers that must not appear in the packed core tarball,
  checked against the npm pack file list and the bundled dist; each
  extraction PR adds one line. The rule lives in
  scripts/lib/packed-core-absence.ts with a self-test unit test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* fix(gates): resolve fallow findings in the optional-family change

- platform-module.ts: keep the four install-hint declarations module-local;
  the catalog lookup is the public surface.
- materialize the two compile-time partition guards in their test files so
  they have consumers.
- check-package.ts: share one readPackedFiles helper between the test-code
  and packed-core-absence content checks instead of duplicating the packed
  file reader.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* refactor(platform): drop the test-only required-family predicate

* fix(platform): keep the request-provider gate a predicate for absent families

The gate threw plugin-not-installed for any device of an absent optional family, which blocked provider-owned devices and threw from unrelated resolver gates. The typed outcome already comes from the inventory and runtime lookups, so the gate returns false again.

* refactor(platform): answer family presence from one registry

Keep the required/optional partition and make the platform module registry the one
presence authority (ADR 0034): the required families (apple, android) are still
completeness-checked, an optional family may be absent, and `get` raises the typed
plugin-not-installed outcome for it. The runtime module map and the src/core
PlatformPlugin registry now answer presence through that registry, so the gateway's
missing-module contract error and the throwing request-provider predicate are gone.

Share one release-channel rule with the provider catalog, so an optional family's
install hint names the same nightly release a provider hint does. The version comes
from the composition that builds a registry: contracts does not read host mechanics.

Drop the CLI help sentence that promised plugin-not-installed for families still
compiled into the packed core, and drop the empty packed-core absence gate. Both land
with the first extraction PR that removes a family from the composition.

Refs callstack#4781 review.

* refactor(platform): give the plugin set one absence reporter

The interactor registry's absence reporter was an argument of
registerPlatformPlugin, so every plugin in a set carried the same reporter and
a duplicate could replace the absence policy before registration rejected it.

Move it to the plugin set: registerPlatformPluginSet takes the plugins and the
reporter together, checks every leaf platform before it changes any state, and
is the only registration path. registerBuiltinPlatformPlugins composes the
builtin set through it once.

getPlugin for an absent optional family still raises the typed
plugin-not-installed outcome.

Fold the getPlugin assertion into the scenario that composes the lazy
request-provider wrapper, so it no longer passes only because another test ran
first, and pin that a rejected duplicate leaves the reporter unchanged.

PR-4781 review: callstack#4781 (comment)

---------

Co-authored-by: Mistral Vibe <vibe@mistral.ai>
thymikee added a commit that referenced this pull request Nov 24, 2026
* refactor(platform): let optional platform families be absent

Deliver the three shared prerequisites for moving web, HarmonyOS, Vega and
Linux desktop out of the packed core into platform plugins (ADR 0034),
without moving any platform yet:

- packages/contracts/src/platform-module.ts is the single owner of the
  required/optional family partition (apple+android required, completeness
  still enforced; harmonyos/vega/linux/web optional). The registry gains
  has(), lists only registered families, and get() on an absent optional
  family throws the typed plugin-not-installed AppError. Inventory
  enumeration skips absent optional families silently; the runtime
  gateway and the request-provider gate report the same typed outcome
  before any device binding. BuiltinPluginsCoverAllPlatforms becomes
  BuiltinPluginsCoverRequiredPlatforms (required-only exhaustiveness).
- The engine-free install-hint catalog maps each optional family to its
  @agent-device/* package and the 'agent-device plugins add <package>'
  command; the plugin-not-installed error carries it. Unknown names
  produce no inferred package.
- scripts/check-package.ts gains a declared (empty) absence list of paths
  and module markers that must not appear in the packed core tarball,
  checked against the npm pack file list and the bundled dist; each
  extraction PR adds one line. The rule lives in
  scripts/lib/packed-core-absence.ts with a self-test unit test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* fix(gates): resolve fallow findings in the optional-family change

- platform-module.ts: keep the four install-hint declarations module-local;
  the catalog lookup is the public surface.
- materialize the two compile-time partition guards in their test files so
  they have consumers.
- check-package.ts: share one readPackedFiles helper between the test-code
  and packed-core-absence content checks instead of duplicating the packed
  file reader.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* refactor(platform): drop the test-only required-family predicate

* fix(platform): keep the request-provider gate a predicate for absent families

The gate threw plugin-not-installed for any device of an absent optional family, which blocked provider-owned devices and threw from unrelated resolver gates. The typed outcome already comes from the inventory and runtime lookups, so the gate returns false again.

* refactor(platform): answer family presence from one registry

Keep the required/optional partition and make the platform module registry the one
presence authority (ADR 0034): the required families (apple, android) are still
completeness-checked, an optional family may be absent, and `get` raises the typed
plugin-not-installed outcome for it. The runtime module map and the src/core
PlatformPlugin registry now answer presence through that registry, so the gateway's
missing-module contract error and the throwing request-provider predicate are gone.

Share one release-channel rule with the provider catalog, so an optional family's
install hint names the same nightly release a provider hint does. The version comes
from the composition that builds a registry: contracts does not read host mechanics.

Drop the CLI help sentence that promised plugin-not-installed for families still
compiled into the packed core, and drop the empty packed-core absence gate. Both land
with the first extraction PR that removes a family from the composition.

Refs #4781 review.

* refactor(platform): give the plugin set one absence reporter

The interactor registry's absence reporter was an argument of
registerPlatformPlugin, so every plugin in a set carried the same reporter and
a duplicate could replace the absence policy before registration rejected it.

Move it to the plugin set: registerPlatformPluginSet takes the plugins and the
reporter together, checks every leaf platform before it changes any state, and
is the only registration path. registerBuiltinPlatformPlugins composes the
builtin set through it once.

getPlugin for an absent optional family still raises the typed
plugin-not-installed outcome.

Fold the getPlugin assertion into the scenario that composes the lazy
request-provider wrapper, so it no longer passes only because another test ran
first, and pin that a rejected duplicate leaves the reporter unchanged.

PR-4781 review: #4781 (comment)

---------

Co-authored-by: Mistral Vibe <vibe@mistral.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant