feat(plugins): in-repo country plugin system#147
Draft
carvalab wants to merge 1 commit into
Draft
Conversation
carvalab
force-pushed
the
feature-plugin-system
branch
2 times, most recently
from
July 24, 2026 02:31
8c395eb to
65a0898
Compare
Stage 1 of the proposal at docs/plugin-proposal.md: manifests + runtimes for AR, IN, TH, and a global default tax engine, with Settings → Integraciones managing install/activation/connector config through the new /api/plugins/* routes. Shared contract (shared/plugin-api.ts) owns both browser-safe types and Zod schemas, including the catalog/install/connector/payment-method wire shapes. Backend adds the SQLite state (migration v34) and activation- aware tax resolution; frontend renders capability display text and configuration field metadata straight from each manifest, so adding a country or provider no longer needs frontend changes. Backend: activation-aware tax dispatcher, runtime registry with hosted/in-process capability enforcement, connector handler dispatch, provisionBuiltinTaxPackage for first-run setup and idle restarts, reinstall from 'uninstalled' status, 32 KiB connector config cap, 32-byte secret-field detection with camelCase normalization, 256 KiB envelope cap, host-provider must list 'hosted' providers in connectorIds, and a shared Zod envelope bundle validator. Frontend: Zod-validated API responses, generic capability-configuration form driven by capability.configuration.fields, manifest-derived localized labels/descriptions, plugin-driven payment method list with QrCode icon, shared InstallationStatus / InstallationFeature / PaymentMethod types in @flo-plugin-api, and Settings → Integraciones tab on AR store showing 2 packages, 5 AR capabilities, manifest permissions, and the per-capability activation gate. Tests: npm test green (lint, tsc, full suite including plugin-contracts, plugin-routes, plugin-default; npm test wired the plugin-default suite into the cors chain). Docs: docs/plugin-architecture.md, docs/plugin-authoring.md, docs/plugin-proposal.md, docs/plugin-references.md. Note: migration v34 ships without plugin_packages / plugin_outbox tables (speculative schema surface removed); the activation gate now treats hosted fiscal the same as hosted payment/delivery (requires authorized + broker-verified connector); review comments from review-risk / review-reliability / oracle agents addressed. Refs: docs/plugin-proposal.md, docs/plugin-authoring.md
carvalab
force-pushed
the
feature-plugin-system
branch
from
July 24, 2026 02:51
65a0898 to
3c377d1
Compare
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.
Summary
Stage 1 of the plugin proposal: a country plugin system that lives in the repo, with a Settings → Integraciones UI to install, activate, and configure each capability.
What's in this PR:
global.defaultpackage for countries without one. Each country package owns its own Zod config schema and the in-process tax math; payment/delivery/fiscal stay declared-only (hosted) for the Stage 3 broker. Some of that are examples, I will delete before the final PR.shared/plugin-api.tsthat both sides import. Browser-safe Zod schemas cover the manifest, runtime bundle, request/result envelopes, the catalog response, installation, feature, connector, and payment-method wire shapes, plus a typedPluginRegistryanddefinePluginRuntimeBundle(). The sharedinstallationFeatureSchemanow allowsinstallationId: nullso unactivated features don't carry an empty string.active. AR/IN win overglobal.default; the global default wins for everything else.connector_verification_hostedinstead of a local "verified" stamp.main/plugins/connector-handlers.tsis the only file that knows provider names. The route dispatches tovalidate/summarizebycapability.provider. Unknown providers get 400, never a silent generic store.plugin_packages/plugin_outboxspeculative tables were dropped because nothing reads them.npm testis green;test:plugin-contracts,test:plugin-routes, andtest:plugin-defaultare wired into the test chain. Semver range parser now covers||and prerelease forms.docs/plugin-architecture.md,docs/plugin-authoring.md,docs/plugin-proposal.md,docs/plugin-references.md.Visual
Settings → Integraciones on a fresh AR store (
/settings/?tab=plugins):plugin_installations+plugin_featuresSelf-review notes
ascasts.uninstalledworks (deletes child features/connector rows + resets status).Test plan (asking for help)
This PR is draft for proposal. I want to merge after two things:
test:plugin-defaultis now wired intotest:corsso it runs in CI; please check the test pipeline on your end@itsbkm @khaira777 — could you run through the country packages on a fresh DB please?
then open Settings → Integraciones on the AR/IN/TH seeded stores. And also no broke taxes.
Out of scope (Stage 2 / Stage 3)
docs/plugin-proposal.md)utility_processABI executionRefs:
docs/plugin-proposal.md,docs/plugin-authoring.md,docs/plugin-architecture.md