发布

  • [OPIK-6947] [FE] feat: pluggable FE plugin system + extract AI Spend to a private plugin (#7119)

    frostbyte_neo 发布于 2026-06-16 10:10:58 +00:00

    • [OPIK-6947] [FE] feat: pluggable FE plugin system + extract AI Spend to a private plugin

    Introduce a manifest-based FE plugin system and move the Cost Intelligence
    (AI Spend) feature out of the public repo into a private plugin that compiles
    into Opik via that system.

    Core (generic, no ai-spend specifics):

    • PluginsStore is the single source of truth: resolves the active plugin list
      (VITE_FE_PLUGINS, falling back to BUILD_MODE), eager-loads + gates plugin
      manifests, and exposes route + sidebar contributions alongside the existing
      component slots.
    • lib/plugins.ts is the contract only: PluginManifest type + definePlugin.
    • Generic LayoutProvider slot (replaces the ai-spend-named provider slot) and a
      sidebar-section registry; SideBar/WorkspaceGuard are ai-spend-agnostic.
    • preserveSymlinks so a symlinked plugin resolves @/ and node_modules against
      the host tree.
    • Leak prevention: .gitignore allowlist + check-public-fe-plugins.sh pre-commit
      guard so private plugin files can never be committed here.
    • dev-runner auto-detects a sibling opik-plugin-ai-spend checkout and symlinks
      it in; Dockerfile passes BUILD_PLUGINS through to VITE_FE_PLUGINS.

    The AI Spend pages, API, shared components, formatters, routes and sidebar now
    live in the private opik-plugin-ai-spend repo and are absent from public builds
    unless the plugin is present. Gating stays in comet via the core AiSpendContext.

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

    • Stage private ai-spend plugin into comet frontend image build

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-6947] [FE] feat: show Cost Intelligence menu only when the ai-spend plugin is installed

    Re-enable the Cost Intelligence entry in the comet user menu, gated on the
    ai-spend plugin actually being present (its manifest is active) AND the user
    having access — via a new PluginsStore.hasPlugin() check. A plugin-less build
    (OSS, or comet without the plugin) no longer shows a link to missing routes.

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

    • [OPIK-6947] [FE] feat: gate Cost Intelligence menu behind a feature toggle

    Add a FE feature toggle (COST_INTELLIGENCE_ENABLED, default off) and require it
    for the Cost Intelligence user-menu entry — alongside the ai-spend plugin being
    installed and the user having access. Lets the entry be enabled per environment
    without a deploy; falls back to the FE default when the backend omits the key.

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

    • [OPIK-6947] [CI] fix: activate ai-spend plugin in the comet frontend build

    DevOps wired the private plugin to be copied into the comet frontend image, but
    the build never set BUILD_PLUGINS, so VITE_FE_PLUGINS stayed empty and the
    ai-spend manifest was filtered out (routes/sidebar/menu inactive despite the
    files being present). Pass BUILD_PLUGINS=comet,ai-spend for the comet frontend
    image so the manifest is activated.

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

    • [OPIK-6947] [CI] fix: declare OPIK_PLUGIN_AI_SPEND_TOKEN in reusable workflow secrets

    The ai-spend plugin checkout references secrets.OPIK_PLUGIN_AI_SPEND_TOKEN but it
    was not declared in build_and_push_docker.yaml's workflow_call secrets block, so
    actionlint failed. Declare it (required: false); callers pass it via
    secrets: inherit.

    Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com


    Co-authored-by: Claude Opus 4.8 noreply@anthropic.com
    Co-authored-by: liyaka liyak@comet.com

    下载附件