Files
pocketpaw/ee/fleet/__init__.py
Prakash Dalai df5c77dee2 feat(fleet): installable bundle runtime + Sales Fleet template (#940)
* feat(fleet): installable bundle runtime + Sales Fleet template

A FleetTemplate is a YAML manifest naming a soul template + pocket +
connector list + scope tags. install_fleet() orchestrates the install
using existing primitives — SoulFactory, ConnectorRegistry, pocket
service — without introducing new runtime concepts. Sales Fleet ships
as the first bundled example.

What landed:

- ee/fleet/models.py
  - FleetConnector — name + config + optional flag.
  - FleetTemplate — name, display_name, version, soul_template ref,
    pocket name + widgets, connector list, scope list, open metadata.
  - FleetInstallStep + FleetInstallReport — per-step status
    (succeeded/skipped/failed) so partial installs are observable
    without re-running the whole pipeline.

- ee/fleet/installer.py
  - load_fleet(path_or_name) reads YAML/JSON or resolves a bundled
    name (sales-fleet → src/pocketpaw/fleet_templates/sales-fleet.yaml).
  - install_fleet(fleet, *, soul_factory, connector_registry,
    pocket_creator) — pure orchestrator. Each external dep is
    injectable so tests substitute fakes; production callers pass
    the real services.
  - Each step is wrapped: per-step exceptions are caught + logged
    + marked as failed in the report so install never crashes the
    runtime.
  - Optional connectors get "skipped" when missing; required get
    "failed" so admins see what to fix.

- src/pocketpaw/fleet_templates/sales-fleet.yaml
  - Arrow soul + Pipeline pocket + HubSpot + Gong connectors,
    scoped org:sales:*. Connectors marked optional so the demo
    install works without external API keys.

Tests: 15 new in tests/cloud/test_fleet_installer.py covering:
  - YAML + JSON manifest loading + bundled-by-name resolution +
    missing-file error
  - install_fleet creates soul + pocket + registers connectors
    with mocked deps
  - Skips pocket cleanly when creator unavailable
  - Optional missing connector → skipped, required missing → failed
  - Per-step exception is captured in the report
  - Returns early on soul creation failure (no orphan pocket)
  - Sales Fleet bundled, has Arrow soul + sales scope
  - Sales Fleet connectors all optional (demo-friendly)
  - Report.succeeded() + failed_steps() helpers

First PR of Move 7 PR-B. PR-C ships the Install Fleet UI.

* style(fleet): ruff auto-fix

* fix(fleet): point PyYAML import error at pocketpaw[soul]

PyYAML is pulled in transitively via pocketpaw[soul] -> soul-protocol[engine].
The error message was pointing at the transitive package, which sent operators
chasing the wrong install command. Point it at the pocketpaw extra that
actually owns the dependency.

---------

Co-authored-by: Prakash-1 <prakash-1@Mac.lan>
2026-04-16 09:30:34 +05:30

26 lines
811 B
Python

# Fleet — installable bundles of soul + pocket + connectors + scopes.
# Created: 2026-04-13 (Move 7 PR-B) — A FleetTemplate is a YAML manifest
# that a non-technical operator can install with one command. Reads the
# manifest, creates the soul (via SoulFactory.from_template), creates the
# pocket, registers the listed connectors, and seeds scope tags. Outputs
# an InstallReport so the UI/CLI can show what landed and what failed.
from ee.fleet.installer import (
FleetInstallReport,
FleetInstallStep,
install_fleet,
list_bundled_fleets,
load_fleet,
)
from ee.fleet.models import FleetConnector, FleetTemplate
__all__ = [
"FleetConnector",
"FleetInstallReport",
"FleetInstallStep",
"FleetTemplate",
"install_fleet",
"list_bundled_fleets",
"load_fleet",
]