diff --git a/README.md b/README.md index cfbff1f..04cf4ae 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ ## Documents +- [RFC-0013: Host management and PackageKit](rfc/RFC-0013-host-management-and-packagekit.md) — + accepted D-093: `archipelagod`, typed Host Extension/Managed Overlay interfaces, + PackageKit backend and installed-host CLI routing; implementation pending. + - [RFC-0012: System service and D-Bus](rfc/RFC-0012-system-service-and-dbus.md) — accepted D-092 (2026-11-07): installed-system daemon, per-action Polkit, durable asynchronous transactions and native GUI/CLI clients; implementation pending. diff --git a/rfc/RFC-0001-architecture.md b/rfc/RFC-0001-architecture.md index 4274508..cfe4d25 100644 --- a/rfc/RFC-0001-architecture.md +++ b/rfc/RFC-0001-architecture.md @@ -12,7 +12,9 @@ Archipelago is an Arch Linux-based, OSTree-managed generic Linux distribution an It provides a declarative way to build, publish, install, update, rebase, roll back and manage operating-system compositions. It also manages selected runtime workloads while preserving the standard Linux filesystem and execution contracts. -D-062 selects Rust for the primary `archipelago` binary and its functional modules. Laboratory tooling +D-062 selects Rust for the primary `archipelago` binary and its functional modules. +D-093 adds the `archipelagod` service entrypoint from the same shared engine; the +unified user CLI remains `archipelago`. Laboratory tooling may use other languages; exact FFI/adapter interfaces remain implementation contracts. The project must support three execution contexts through one primary `archipelago` CLI/binary: @@ -123,6 +125,12 @@ see [RFC-0007](RFC-0007-ostree-platform-integration.md). ## 5. System components +D-093 routes installed-host management through `archipelagod`. CLI and native +clients use typed D-Bus interfaces; a PackageKit backend adapts Host Extension +packages, while Managed Overlays retain a distinct ordered-layer interface. +See [RFC-0013](RFC-0013-host-management-and-packagekit.md). This extends D-092's +update service without introducing another package/deployment engine. + ### 5.1 Source Registry Git is the source of truth for: diff --git a/rfc/RFC-0002-layers-and-overlays.md b/rfc/RFC-0002-layers-and-overlays.md index 613b0ce..81255bb 100644 --- a/rfc/RFC-0002-layers-and-overlays.md +++ b/rfc/RFC-0002-layers-and-overlays.md @@ -223,6 +223,12 @@ Purpose layers must not assume that a particular hardware model is present unles ## 6. Managed Overlay responsibilities +D-093 accepts managed-overlay control through `archipelagod` D-Bus for CLI and +future UIs: inspect the selected context, prepare a complete ordered exact-commit +selection, then stage a checked plan. Overlays are not PackageKit packages. +[RFC-0013](RFC-0013-host-management-and-packagekit.md) defines this API and preserves +the dependency, snapshot, ordering, permission and recomposition rules below. + Managed Overlays may provide: - DKMS modules and other kernel modules. diff --git a/rfc/RFC-0004-host-extensions.md b/rfc/RFC-0004-host-extensions.md index 31aefc1..25a3d35 100644 --- a/rfc/RFC-0004-host-extensions.md +++ b/rfc/RFC-0004-host-extensions.md @@ -49,6 +49,14 @@ This policy does not prohibit users from reporting bugs in unmodified Archipelag ## 3. No direct mutation of the live system +D-093 accepts native-package management through PackageKit's Archipelago backend +and direct CLI use of the same `archipelagod` D-Bus interface. Both create checked +plans and staged deployments; PackageKit is not the ALPM live-host backend or an +independent resolver. Snapshot-bound identities, FD import of local files, original +caller authorization, ownership/removal limits and pending/restart UX are defined +in [RFC-0013](RFC-0013-host-management-and-packagekit.md). Existing enablement, +provenance, atomic reapplication and persistence contracts remain binding. + Host Extensions must not run pacman against the live immutable host `/usr`. Instead: diff --git a/rfc/RFC-0009-cli-contract.md b/rfc/RFC-0009-cli-contract.md index e671d5f..f6fa914 100644 --- a/rfc/RFC-0009-cli-contract.md +++ b/rfc/RFC-0009-cli-contract.md @@ -7,6 +7,15 @@ ## 1. One binary, three contexts +D-093 refines executable packaging: `archipelago` is the unified CLI and +`archipelagod` the canonical system-service entrypoint sharing its Rust engine. +All installed-host management groups route through typed D-Bus contracts; +Host Extensions, Managed Overlays and PackageKit adaptation are specified in +[RFC-0013](RFC-0013-host-management-and-packagekit.md). Future host methods are +capability-gated until specified/implemented; no generic shell RPC or direct +root fallback. Local help/version/authoring and build/live/offline workflows retain +their context-appropriate direct execution. Service routing does not imply remote builds. + D-067 accepts the unified command coverage, checked plan/apply lifecycle, shared results/errors and durable operation records, explicit desired/pending/booted state, capability reporting and initial operation without a mandatory daemon (the latter diff --git a/rfc/RFC-0012-system-service-and-dbus.md b/rfc/RFC-0012-system-service-and-dbus.md index 48e3312..a902ab3 100644 --- a/rfc/RFC-0012-system-service-and-dbus.md +++ b/rfc/RFC-0012-system-service-and-dbus.md @@ -1,12 +1,18 @@ # RFC-0012: Installed-System Service and D-Bus Transactions - **Status:** Accepted — D-092, explicit user approval 2026-11-07 -- **Version:** 1.0 contract; implementation pending +- **Version:** 1.1 contract; implementation pending (D-093 additive host interfaces) - **Scope:** Installed-system control, update transactions, authorization and clients - **Amends:** RFC-0001 §5.8; RFC-0009's initial no-daemon requirement for installed systems ## 1. Decision and boundary +D-093 extends this contract through +[RFC-0013](RFC-0013-host-management-and-packagekit.md): named `archipelagod`, +installed-host CLI routing, Host Extensions/Managed Overlays and a PackageKit +backend. Existing major-1 manager/transaction signatures remain stable; Stage and +Download authorize each stored plan's kind/actions, not a blanket update privilege. + GNOME Software, Discover and the installed-system CLI use one system D-Bus service for OS update control. Clients run as the invoking user. The service performs privileged operations using the existing Archipelago transaction engine and OSTree. @@ -15,8 +21,9 @@ part of the normal client protocol. Passwordless permission is a policy decision not an inherent consequence of using D-Bus. The service is itself userspace code; the privileged system writer does not become an unprivileged process. -Keep one primary Rust binary: `archipelago daemon` is its internal system-service -entrypoint. Build-host and installer/offline operations retain direct execution +Keep one primary Rust CLI and shared engine. D-093 names the service entrypoint +`archipelagod`; `archipelago daemon` may remain an alias to that same mode. +Build-host and installer/offline operations retain direct execution where their existing contracts require it. A root maintenance path may use the same engine offline, but it must acquire the same sysroot lock and never race the service. An unavailable service is not permission for clients to fall back to @@ -38,7 +45,7 @@ the running D-091 SDDM update pipeline are independent of this implementation. | Polkit / logind | Action authorization and authenticated local-session identity | | GUI / CLI | Presentation, explicit user intent, subscribing/reconnecting, displaying errors | -The service runs as root in a system unit `archipelago-daemon.service`, `Type=dbus`, +The service runs as root in a system unit `archipelagod.service`, `Type=dbus`, with `BusName=org.archipelago.System1`; D-Bus activation invokes that unit. Do not require a separately enabled always-running daemon or a service per GUI. It may exit when idle with no accepted operation or outstanding request; active work must @@ -115,7 +122,8 @@ No arbitrary command, URL, root path, repository key, environment variable or unchecked client-supplied plan body is accepted. Targets must be SHA-256 commit identities verified for the currently configured track; plan IDs select immutable service-owned plans. A changed remote tip never silently retargets an accepted -operation. Explicit future rebase/Purpose/extension methods require their own +operation. D-093/RFC-0013 adds typed extension/overlay/broker interfaces and verified +local-file FD import. Future rebase/Purpose/account methods require their own contracts and capabilities; v1 does not route them through a generic `Execute`. Deduplication records for download/stage must survive restart and be retained at @@ -238,7 +246,8 @@ user or grant all system bus peers root-equivalent access. | `stage-update` | Active local `wheel` user: yes, no password for current-track update; other callers require administrator authorization | | `cancel` | Initiating UID in an active local session, or root: yes; another caller requires administrator authorization | | `read-logs` | Root or active local administrator: yes; others require administrator authorization | -| Future rebase/Purpose/local-package/override/rollback/cleanup actions | Separate actions requiring administrator authorization; not implicitly granted by `stage-update` | +| Extension/local-package/override/overlay actions | Separate administrator authorization under RFC-0013; never implicitly granted by `stage-update` | +| Future rebase/Purpose/rollback/cleanup actions | Separate administrator authorization; not implicitly granted by `stage-update` | `stage-update` only preserves the configured trusted track, Purpose and complete existing extension intent. It cannot change repositories/keys, permit downgrades, diff --git a/rfc/RFC-0013-host-management-and-packagekit.md b/rfc/RFC-0013-host-management-and-packagekit.md new file mode 100644 index 0000000..97e92a1 --- /dev/null +++ b/rfc/RFC-0013-host-management-and-packagekit.md @@ -0,0 +1,469 @@ +# RFC-0013: archipelagod, Host Extensions, Managed Overlays and PackageKit + +- **Status:** Accepted — D-093, explicit user approval 2026-11-07 +- **Version:** 1.0 contract; implementation pending +- **Scope:** Installed-host D-Bus control and PackageKit Host Extension adapter +- **Extends:** RFC-0012 / D-092; refines RFC-0001, RFC-0002, RFC-0004 and RFC-0009 + +## 1. Accepted direction + +`archipelagod` is the installed-system authority for Archipelago operations. +The `archipelago` CLI, native OS-update plugins, PackageKit adapter and future +host-management UIs are clients of its typed system D-Bus interfaces. The daemon +owns checked plans, execution, cache, durable transactions, locks and reconciliation. +It delegates storage/deployment to OSTree and package execution to the existing +isolated composition engine. No frontend invokes live-host pacman or gains an +independent deployment writer. + +Host Extensions can be installed/removed through **PackageKit**, whose Archipelago +backend calls archipelagod over D-Bus. Managed Overlays use a separate typed D-Bus +interface, also used by the CLI; they are not represented as fake packages. +OS image updates remain in the native GNOME Software/Discover Archipelago plugins. +Flatpak/fwupd continue to use their own backends. + +This is an accepted implementation contract, not a claim that a daemon, PackageKit +backend or general overlay engine is already implemented. Frozen API semantics +cannot be advertised until their engine and acceptance paths actually work. + +## 2. Executable, service and CLI scope + +Canonical service entrypoint: `/usr/bin/archipelagod`; systemd unit: +`archipelagod.service`, `Type=dbus`, `BusName=org.archipelago.System1`. +Keep the D-092 bus name, object paths and existing method signatures stable. +The old planned `archipelago-daemon.service` may be an alias, never a second unit +starting another daemon. `archipelago daemon` may remain a compatibility/internal +alias to the same service mode. D-Bus activation targets the canonical unit. + +`archipelago` remains the unified user CLI. `archipelagod` is a service entrypoint +from the same Rust workspace/shared modules, not a forked package/composition +implementation. Packaging may use a thin second executable target or an alias +with explicit service-mode dispatch; neither duplicates business logic. D-093 +refines the earlier single-executable packaging assumption to allow this named +daemon while retaining a single CLI and one transaction engine. + +**All installed-host management commands** route through the daemon: status/diff, +updates, extensions/overrides/history, overlays, Purpose/rebase, deployments and +host accounts when their methods are implemented. Local `help`, binary `version`, +manifest editing and offline validation need no RPC. Builder, registry publishing, +live installation and explicitly offline maintenance remain direct contexts under +their existing privilege/lock contracts. This does not turn D-Bus into a remote +builder protocol. Installed-host root invocation uses the same daemon and locks; +it is not an implicit direct-mode escape hatch. + +Unavailable host methods return Unsupported. No generic `Execute(argv)` or shell +RPC is introduced to pretend that the entire CLI is implemented. Additional +Purpose/account/rebase method schemas require an explicit additive contract before +advertisement; their routing through archipelagod is settled here. + +## 3. Shared plans and transaction model + +Use RFC-0012's Manager and Transaction, durable operation IDs, request-ID retries, +GetSnapshot, progress, error names, cancellation boundaries and restart recovery. +Additive capabilities: `host-extensions-v1`, `managed-overlays-v1`, +`local-package-import-v1`, `packagekit-broker-v1`. Report each only when implemented. +The Manager minor version increases; major remains 1. + +Extend immutable plans with `kind`, `required_actions`, authenticated initiator, +exact managed base/layer commits, shared snapshot, booted/pending identities, +desired-state generation, requested-vs-resolved packages, package/source checksums, +overlay order, bounded replacement permissions and expected support transition. +Expose an inspectable sanitized diff and all removals/replacements before staging. + +Additive transaction kinds are `extension-enable`, `package-import`, +`extension-change`, `extension-restore`, `overlay-change`, `package-catalog-refresh` +and `overlay-catalog-refresh`. Planning success retains RFC-0012's `planned` +outcome with plan ID; import success uses `imported` with `input_id: s`, +`checksum: s`, `size_bytes: t` and sanitized package identity; catalog refresh uses +`catalog-ready` with context/revision. These outcomes do not claim staged effects. +Payload-changing Stage results use the existing `staged`/`no-change` outcomes and +exact deployment identity. An enable/disable-only plan records the feature policy +as `configured`, with `changed: b`, without fabricating a new deployment or changing +booted support status. Advertise additive kinds/outcomes with the corresponding v1.1 features +so older clients do not misinterpret an unfamiliar result as an OS update. + +`Manager.Download` and `Manager.Stage` accept supported **service-owned plan kinds**, +not just OS-update plans. Their signatures stay unchanged. Authorization is derived +from stored plan contents and required actions; the method name `Stage` never +implies passwordless `stage-update` for arbitrary plans. Reject client-supplied +action names or attempts to relabel an extension/overlay plan as an OS update. +Require request IDs and retain the RFC-0012 deduplication/reconciliation guarantees. + +Planning is side-effect-free with respect to desired state/deployments. Importing +local bytes may persist a bounded protected input, but does not enable/apply it. +Successful payload staging commits the new generation and selects it for next boot +under D-077; a feature-policy-only change does not change boot selection. +Failures keep the previous generation, pending deployment and boot selection +unless a real committed effect is reconciled and explicitly reported. Never remove +persistent application/user data or historical extension inputs as part of removal. + +New requests can accumulate against an Archipelago-owned pending generation under +RFC-0009; all clients must select the same explicit context and expected generation. +An unrelated pending deployment cannot be silently replaced. Query responses carry +`context_id: s`, an opaque service-generated binding of selected base/snapshot and +effective intent generation. Every Prepare call below requires it; drift is PlanStale. +The frontend displays whether changes target the booted base or an existing pending +generation. Replanning after drift requires a new review/request, not silent retarget. + +## 4. Host Extension interface + +Object `/org/archipelago/System1/HostExtensions`, interface +`org.archipelago.System1.HostExtensions`. Expose through ObjectManager. +Read-only `Revision: t`; emit PropertiesChanged when effective/requested state changes. + +| Method | Inputs | Outputs | +|---|---|---| +| `GetState` | — | `a{sv} state` | +| `Search` | `s query, as filters, s cursor, u limit` | `aa{sv} packages, s next_cursor, s context_id` | +| `Resolve` | `as names, s context_id` | `aa{sv} packages` | +| `GetPackage` | `s package_id, s context_id` | `a{sv} package` | +| `GetHistory` | `s cursor, u limit` | `aa{sv} generations, s next_cursor` | +| `PrepareEnable` | `b enabled, s context_id, a{sv} options` | `o transaction` | +| `ImportPackage` | `h fd, a{sv} options` | `o transaction` | +| `PrepareChange` | `aa{sv} requests, s context_id, a{sv} options` | `o transaction` | +| `PrepareRestore` | `s generation_id, s context_id, a{sv} options` | `o transaction` | + +Options use RFC-0012 `interactive`, `offline`, `request_id` where applicable; +ImportPackage also requires a request ID. Enable/disable, request changes, overrides +and restore each yield a plan consumed through Manager.Stage. Disable fails while +requests remain; it is not a hidden remove-all. Read methods are bounded and use +the local base-bound catalog. Missing catalog yields Unavailable; a separate +`RefreshCatalog(a{sv} options) -> o transaction` fetches/verifies the selected base's +snapshot catalogs with the same bounded/coalesced read-only lifecycle. + +### 4.1 Package state and identity + +GetState provides `context_id`, `enabled: b`, `booted`, `pending`, `desired` maps, +and separately `requested: aa{sv}` and `resolved: aa{sv}`. Each includes selected +base/snapshot and support provenance. No global mutable package DB is authoritative +for all deployments. Queries distinguish `managed`, `extension-explicit`, +`extension-dependency` and `available` ownership/state. Managed packages can be +inspected but cannot be removed through Host Extension package removal. + +Package descriptors contain `package_id: s` (opaque), `name: s`, `version: s`, +`architecture: s`, `source: s` (`repository`, `local`, `unknown`), `repository: s` +when applicable, `snapshot_id: s`, `checksum: s`, `owner: s`, +`booted: b`, `pending: b`, `explicit: b`, and a sanitized summary. +Package IDs bind exact identity, source and context; filenames/names alone do not. +Unknown legacy provenance remains unknown. Repository additions preserve supported +status only on a verified supported composition and retain D-088's `customed` +annotation; local files/overrides/custom overlays do not acquire that guarantee. + +### 4.2 Requested mutations + +PrepareChange accepts a bounded array of discriminated request maps: + +- `op=add-repository`, `package_id: s` from the selected snapshot catalog; +- `op=add-local`, `input_id: s` from a successful ImportPackage; +- `op=remove`, `request_id: s` identifying an explicit extension request; +- `op=override-repository`, `package_id: s`, `replaces: s`, `reason: s`; +- `op=override-local`, `input_id: s`, `replaces: s`, `reason: s`; +- `op=reset-override`, `request_id: s` identifying the override being reset. + +`request_id` inside these request maps identifies durable extension intent, not the +options' transaction retry token. Unknown discriminants/keys fail validation. +Unsupported search filters fail explicitly. The v1 filter vocabulary is `installed`, +`available`, `managed`, `extension-explicit`, `extension-dependency`, `repository`, +`local`; `installed` refers to booted state. Contradictory state/source filters are +InvalidArgument. Search cursors bind catalog/context and filter/query identity; +do not continue a page stream against a different snapshot after a base change. +Dependencies are resolved by the daemon from the selected base snapshot. An addition +that needs replacement reports Conflict; it cannot silently become an override. +Base packages are not removable; reset-override restores the selected managed base's +package. Removing a dependency still required by surviving requests fails with the +dependents identified; removing an explicit request rebuilds the remaining closure. +All changes in one request are atomic and expose exact consequences in the plan. + +Snapshot retirement/unavailability is an explicit error, not fallback to the live +Arch mirror. Update recomposes from the new base DB with all retained requests, +never from stale mutated package DB state. Restore revalidates the recorded inputs +and base; it does not reinterpret old identities as packages from a newer snapshot. + +### 4.3 Local package FD import + +Clients open the file and pass a Unix FD; the daemon does not open arbitrary caller +paths. Accept only bounded regular-file content, copy into a root-owned retained +input, hash the **copied bytes**, parse package identity and apply normal trust/input +validation before issuing `input_id`. An FD is not immutable: concurrent source +modification must not permit a validated/different-byte TOCTOU. Retained bytes, +checksum and parsed identity are what planning/execution use. Ignore the supplied +filename as authority; do not execute scriptlets while inspecting/importing. + +Enforce import quota/size and request ownership, do not expose private paths in +public responses, and remove only unreferenced transient partial copies on failure. +Committed local inputs/history retain their existing explicit-cleanup policy. +Import never changes the source classification to repository even if name/version +match. Required local signature/unsigned-input handling follows the configured +trust contract; PackageKit cannot weaken it by a transaction flag. + +## 5. Managed Overlay interface + +Object `/org/archipelago/System1/ManagedOverlays`, interface +`org.archipelago.System1.ManagedOverlays`, read-only `Revision: t` and normal +ObjectManager/PropertiesChanged integration. + +| Method | Inputs | Outputs | +|---|---|---| +| `GetState` | — | `a{sv} state` | +| `ListAvailable` | `s query, s cursor, u limit` | `aa{sv} overlays, s next_cursor, s context_id` | +| `GetOverlay` | `s overlay_id, s commit` | `a{sv} overlay` | +| `RefreshCatalog` | `a{sv} options` | `o transaction` | +| `PrepareSet` | `aa{sv} selection, s context_id, a{sv} options` | `o transaction` | + +Selection is the **complete ordered desired list**, not an ambiguous delta. Each +element has `overlay_id: s` (configured registry identity) and `commit: s` (verified +exact layer commit). No arbitrary URL or client-provided trust key. CLI add/remove/ +order fetches state, edits that list and calls PrepareSet with the original context. +Concurrent list edits fail PlanStale rather than losing the other caller's change. +Duplicates are invalid. Empty selection explicitly removes all overlays through +recomposition. Adding/updating/removing/reordering all produce inspectable plans. + +State and descriptors expose Core/Purpose identities, snapshot/architecture, +booted/pending/desired order, required overlays, before/after constraints, +incompatibilities, packages and bounded file-operation permissions/provenance. +Metadata must be trusted and verified against the actual layer commit; finding a +name in a catalog is not sufficient authorization to execute arbitrary content. + +Preserve D-023/D-025/D-039/D-040/D-054: common snapshot, deterministic package owner, +no implicit dependency insertion or list reordering, no later-position overwrite +privilege, expected owners and bounded operations/reasons, symlinks as objects, +no blanket `replace_lower_layer_files`, no disguised lower-package deletion. +Missing dependencies, cycles, incompatibility and snapshot mismatch fail before +payload composition. Removal rebuilds the remaining composition and reassigns +still-needed dependencies without mutating original layer commits or persistent data. +Host Extensions are reapplied afterward in full under D-056. Failure cannot silently +drop an overlay/extension or activate a clean fallback. Custom combinations do not +become officially supported because their constituent overlays are signed. + +General overlay composition is required before advertising managed-overlays-v1. +The existing test-marker prototype is not an implementation of this interface. +Layer serialization and general release-gate evidence remain their own contracts. + +## 6. PackageKit integration and role matrix + +Architecture: + +```text +GNOME Software / Discover PackageKit frontend + -> org.freedesktop.PackageKit (system bus, packagekitd) + -> Archipelago PackageKit backend + -> org.archipelago.System1 (system bus, archipelagod) + -> common plans / isolated package execution / OSTree deployment + +Native OS plugin and archipelago CLI -> org.archipelago.System1 directly +``` + +Implement a real PackageKit backend against the pinned PackageKit ABI, not a +replacement masquerading as the standard PackageKit D-Bus service. It translates +PackageKit package transactions to Host Extension queries/plans/transactions. +The stock ALPM backend must not be selected on an Archipelago installed host. +No PackageKit-specific pacman database, alternate resolver or separate state writer. + +| PackageKit role | Archipelago mapping / boundary | +|---|---| +| SearchNames / Resolve / GetDetails / GetPackages | Base-bound catalog and booted package state; ownership clearly identified | +| RefreshCache | HostExtensions.RefreshCatalog; force does not change snapshot | +| InstallPackages | PrepareChange add-repository for exact package IDs, then authorized Stage | +| InstallFiles | Protected local file handoff -> ImportPackage -> PrepareChange add-local -> Stage | +| RemovePackages | Remove explicit extension intent and recompose surviving closure | +| Simulation flag | Return the actual daemon plan/diff; no intent/deployment mutation | +| Download-only flag | Manager.Download of exact plan; never Stage | +| GetUpdates | No independent package updates from a fixed base snapshot; OS updates belong to the native OS plugin | +| UpdatePackages / UpgradeSystem / repository mutation / repair | Unsupported in this backend unless a future explicit contract adds them | + +Advertise only implemented, semantically faithful roles, filters and transaction +flags. Unsupported flags are rejected, never silently ignored. PackageKit `only +trusted` must be honored; absence of that flag is not permission to bypass daemon +trust policy. Preserve untrusted/local provenance. Version selection cannot escape +the base snapshot. OS-update refresh and PackageKit catalog refresh share cache/ +concurrency coordination but remain different result kinds. + +PackageKit package IDs keep its `name;version;arch;data` syntax. `data` is a backend +opaque identifier bound to snapshot/repository/source/context, not an accepted +filesystem path or URL. Validate each ID by resolving it against daemon-owned +catalog state; stale/forged IDs fail, never silently resolve to a new version. +Exact encoding is a versioned backend implementation detail and must be tested +against PackageKit parsing; frontend state must not depend on parsing it. + +RemovePackages cannot remove Core/Purpose/overlay-owned packages or dependencies +still needed by surviving intent. `allow_deps=false` rejects a plan requiring extra +removals; `allow_deps=true` permits only consequences the daemon plan exposes, not +permission to remove managed packages or silently drop additional explicit requests. +Explicitly requested dependents require explicit request selection. `autoremove` +cannot preserve unrequested orphan dependencies or trigger independent live cleanup: +the recomposition contract determines the surviving closure. If a flag combination +requires different semantics, reject it before effects rather than approximating it. + +Host Extension enablement remains explicit. PackageKit Install may proceed only +when enabled, or after a frontend explicitly obtains consent and stages a separate +enable plan. A generic InstallPackages call does not silently enable the feature. +Frontend integration must make this usable rather than exposing an unexplained +failure loop. Existing support/provenance disclosures remain accurate under D-088. + +### 6.1 Staged installation semantics + +PackageKit completion means that its requested deployment transaction successfully +**staged**, not that the booted `/usr` changed. Emit its system restart requirement, +normal terminal result and real phase progress; do not emit a false live-installed +state. Package queries report actual booted installed state; pending additions/ +removals are separately exposed through archipelagod and shown by the adapted +frontends as “after restart”. Repeated requests attach/no-op against matching +pending intent instead of creating duplicate requests or reverting pending state. + +PackageKit frontend integration must reconcile optimistic UI state with the daemon's +booted/pending split. A stock plugin that cannot show this honestly is not sufficient +acceptance evidence. The client must not launch a newly staged executable as though +it exists in the current deployment. Removal does not remove current running files. +Reboot remains explicit; one OS pending deployment represents all staged changes. + +No per-package update entries duplicate the native OS image update. Application +ownership chooses the backend: native packages/Host Extensions use PackageKit, +OS resource uses native Archipelago, Flatpak uses Flatpak. Presenting the same app +from different legitimate sources is allowed if source labels are clear. +Native application metadata must map to the actual package IDs in the base-bound +catalog; an AppStream name or rolling-repository recommendation cannot select an +unavailable package version. AppStream availability and PackageKit plugin loading +are separate integration checks, not consequences of providing the daemon methods. + +### 6.2 Authorization and caller delegation + +PackageKit is a privileged broker, but the originating user's authorization must +not disappear when its backend calls archipelagod as root. Record original caller, +PackageKit transaction ID and Archipelago operation ID together. Ordinary clients +cannot submit a fabricated UID or bypass policy by claiming to be PackageKit. + +Add broker interface `org.archipelago.System1.PackageKitBroker` on +`/org/archipelago/System1/PackageKitBroker`: + +- `CreateContext(s packagekit_transaction, s original_sender) -> s context_token`; +- `ImportPackage(s context_token, h fd, a{sv} options) -> o transaction`; +- `PrepareChange(s context_token, aa{sv} requests, s context_id, a{sv} options) -> o transaction`; +- `Download(s context_token, s plan_id, a{sv} options) -> o transaction`; +- `Stage(s context_token, s plan_id, a{sv} options) -> o transaction`; +- `Cancel(s context_token, s operation_id, a{sv} options) -> b accepted`. + +Restrict this interface to the authenticated owner of `org.freedesktop.PackageKit` +with the expected service credentials; bind token to that unique bus connection, +the PackageKit transaction and verified original unique sender/session. PackageKit +backend/core glue must derive the original sender from its actual transaction, +not a client hint or unvalidated UID field. If the pinned backend API does not expose +enough information, implement reviewed glue or keep mutation roles unavailable. +Do not silently treat such requests as trusted root automation. + +archipelagod remains final authorization authority and checks the original subject +against its action policy. PackageKit's own checks are additional, not a bypass. +Align shipped PackageKit and Archipelago policies to avoid duplicate prompts while +preserving identical effective authorization to direct CLI calls. Document the +exact verified handoff; never temporarily grant all wheel users arbitrary backend +root execution. A passed PackageKit password check alone is not a universal daemon +authorization token. Existing Polkit retention may avoid repeated prompts for the +same action; do not invent reusable root bearer credentials. + +Tokens are opaque, memory-only, scope-bound and expire with broker connection; +accepted durable operations continue after PackageKit/GUI disconnect. Audit records +survive; tokens do not. After broker restart, recovery uses transaction/operation +correlation and explicit authorization, not replaying orphaned tokens or blindly +reissuing InstallPackages. Broker request deduplication uses original UID plus a +broker transaction namespace, method and exact inputs, and remains distinct from +unrelated direct-client retry IDs. + +PackageKit cancellation maps to cooperative Transaction.Cancel. If atomic staging +has begun, report cancellation unavailable/too late and the real terminal result. +Closing the PackageKit client is not permission to kill a daemon transaction. +Map Busy/PlanStale/trust/no-track/no-space/authorization failures to the closest +PackageKit error with an operation diagnostic reference; do not report success +merely because a backend RPC returned an accepted object path. + +## 7. Extended authorization matrix + +Use the `org.archipelago.system.` action prefix and RFC-0012 interaction rules. +Reads are sanitized/passwordless; catalog refresh and repository-only planning +are allowed to active local sessions and root automation with bounded resources. +Local import/private history or other sensitive inspection requires authorization. + +| Action | Operations | Default mutation policy | +|---|---|---| +| `extension-enable` | Enable/disable feature | Administrator authorization | +| `extension-change` | Add/remove repository-name requests | Administrator authorization | +| `extension-local` | Import/add local package inputs | Administrator authorization | +| `extension-override` | Explicit whole-package replacement/reset | Administrator authorization | +| `extension-restore` | Restore retained generation | Administrator authorization | +| `overlay-change` | Add/update/remove/reorder managed overlays | Administrator authorization | + +For these actions active local users may request `auth_admin_keep`; inactive/remote +interactive callers require `auth_admin`; noninteractive unauthorized calls fail. +Authenticated root automation retains explicit audited permission. When a plan +requires several actions, authorize all of them before mutation. Merely being active +local wheel is not a passwordless extension/overlay grant: D-092's passwordless +exception applies only to the existing trusted-track **OS update** operation. +Local import/planning that requires sensitive inputs uses the matching action. + +No backend can use Manager.Download to bypass local-input/private-plan authorization. +Plan ownership/access and required actions are checked for Download and Stage, +including broker calls. General history queries expose sanitized provenance only; +protected local file locations and raw logs require the separate read authorization. + +## 8. Packaging and migration + +Ship archipelagod, bus activation/policy, Polkit actions and CLI bindings in Core. +Desktop Purposes add PackageKit, the **Archipelago** backend, and working native +PackageKit frontend integration alongside native OS/Flatpak/fwupd backends. +The daemon remains authoritative even when PackageKit is absent on Core/Server/IoT. + +Current source constraints to remove deliberately: + +- GNOME native OS plugin declares a global PackageKit conflict; narrow ownership + to the OS resource so native Host Extension applications can coexist. +- Stock GNOME Software package lacks the needed PackageKit plugin in the reviewed + snapshot; build/package a matching plugin or supported adaptation, validate ABI. +- Discover launcher currently selects only Archipelago/Flatpak/fwupd; add the tested + PackageKit backend with native-package ownership and staged-state integration. +- Both desktop finalizers currently mask packagekit.service; remove those masks + only in images carrying the replacement Archipelago PackageKit backend and policy. + Never unmask stock ALPM as a transitional shortcut. + +PackageKit and native clients share daemon capabilities/status; no dual writers +during migration. Same-version private package signatures/ABI constraints remain +part of normal build input validation. Removing compatibility helpers must not +break an installed client during an in-progress operation. Preserve root-owned +journal migration and rollback compatibility from RFC-0012. + +## 9. Acceptance in the normal pipeline + +Extend existing installed-VM acceptance, not a separate unchecked release path: + +1. CLI and PackageKit install the same repository package from the selected base + snapshot with equivalent plan/provenance/support; verify staged then booted state. +2. Two native package frontends, CLI and OS updater cannot create overlapping writers; + stale package/context IDs fail; repeated PackageKit requests do not duplicate intent. +3. Local package FD import retains exact copied checksum, applies configured trust, + records unsupported provenance and survives update/rollback; reject path/FD races. +4. Remove explicit extension, reject removal of managed package/required dependency, + preserve persistent data, and reapply the complete remaining set on OS update. +5. PackageKit simulation/download-only never stage. Unsupported flags/roles fail + before effects. Restart requirement and current/pending application state are honest. +6. Validate original-subject delegation, spoofed broker/sender rejection, no duplicate + authorization prompts, reconnect/cancel/crash and no privilege-policy widening. +7. CLI/D-Bus add/remove/reorder a real Managed Overlay; validate common snapshot, + ordering/missing dependencies/conflicts/permissions and reapplication of extensions. +8. GUI displays one OS update, native packages via PackageKit, Flatpaks via Flatpak; + GNOME/Discover PackageKit plugins load and no ALPM backend touches live `/usr`. +9. Disabled capabilities/unsupported future CLI methods fail explicitly rather than + invoking old direct paths. Daemon aliases cannot start a second writer. + +Archive exact versions, source revisions, PackageKit role/flag matrix, D-Bus policy, +original-subject evidence (without secrets), plans and deployment identities. +These scenarios do not claim general reproducibility or all overlay release gates. + +## 10. Remaining implementation details + +Architecture/routing, action policies, method semantics and backend boundaries are +accepted by D-093. Still implementation work: pinned PackageKit ABI and sender +handoff API, role/flag mapping constants, generated introspection/bindings, package +ID encoding, journal migration, overlay engine coverage, trusted catalog format, +frontend pending-state presentation and measured operational limits. General trust +policy for local unsigned artifacts and future host-operation schemas remain in +their own contracts. Do not infer approval to weaken trust or invent absent methods. + +Upstream integration reference (reviewed 2026-11-07, not a frozen build input): +[PackageKit backend API](https://github.com/PackageKit/PackageKit/blob/main/src/pk-backend.h). +Use the actual pinned release's API/transaction semantics during implementation. diff --git a/spec/contract-registry.md b/spec/contract-registry.md index 14a2f91..add581c 100644 --- a/spec/contract-registry.md +++ b/spec/contract-registry.md @@ -1,5 +1,16 @@ # Accepted contract registry +### Host management and PackageKit amendment — D-093 (2026-11-07) + +Accepted: `archipelagod` as the named service entrypoint sharing the CLI's engine; +all installed-host management routed through typed system D-Bus APIs. Host Extension +packages are available through PackageKit's Archipelago backend and the same direct +CLI API; Managed Overlays use explicit ordered-selection APIs. Plans retain exact +snapshot/input/intent identity; original user authorization survives PackageKit +mediation; no live ALPM or parallel deployment writer. Staged changes are presented +as pending restart, not live installation. [RFC-0013](../rfc/RFC-0013-host-management-and-packagekit.md) +is normative, extending RFC-0012 additively. Implementation/acceptance remain pending. + ### Installed-system service amendment — D-092 (2026-11-07) Accepted: system D-Bus control for GNOME Software, Discover and installed CLI, diff --git a/spec/decision-log.md b/spec/decision-log.md index a67a7e3..ed5d005 100644 --- a/spec/decision-log.md +++ b/spec/decision-log.md @@ -1,5 +1,33 @@ # Archipelago Decision Log +## D-093 — archipelagod, PackageKit Host Extensions and D-Bus host management (Accepted, 2026-11-07) + +The user explicitly requests contract-level adoption and immediate Git publication +of Host Extension package installation through PackageKit backed by D-Bus, Managed +Overlays over D-Bus and CLI-wide installed-host management through `archipelagod`. +Accept [RFC-0013](../rfc/RFC-0013-host-management-and-packagekit.md), extending D-092. +The canonical daemon/unit are `archipelagod`/`archipelagod.service`, retaining the +existing bus name, transaction API and shared Rust engine; `archipelago` remains +the unified CLI. This refines single-executable packaging without creating a second +package/composition engine. All installed-host management uses typed daemon APIs; +build/live/offline contexts retain direct execution and common locking guarantees. + +PackageKit's Archipelago backend is a D-Bus client, not the live ALPM backend or an +OS updater. It operates on base-snapshot-bound Host Extension intent; local packages +use protected FD import, exact-byte checksums and retained provenance. Original +caller authorization survives privileged PackageKit mediation. Separate admin +actions cover enable/change/local/override/restore/overlay mutations; D-092's +passwordless current-track update permission does not grant these actions. +Managed Overlays use explicit ordered, exact-commit desired sets and preserve +snapshot/dependency/conflict/replacement contracts. All changes use shared checked +plans, atomic composition, staged deployments and explicit reboot. Native OS, +PackageKit package, Flatpak and fwupd frontends coexist with explicit ownership. + +Architecture and contract are accepted for implementation. PackageKit ABI/glue, +general overlay implementation, future host method schemas and verification remain +work, not implied capabilities or release evidence. D-091's active SDDM pipeline +is independent and must still be completed. + ## D-092 — Installed-system D-Bus service and user-controlled transactions (Accepted, 2026-11-07) The user explicitly accepts the proposed rpm-ostree-inspired service architecture diff --git a/spec/gnome-desktop.md b/spec/gnome-desktop.md index 4d64884..8cdbacf 100644 --- a/spec/gnome-desktop.md +++ b/spec/gnome-desktop.md @@ -1,5 +1,12 @@ # GNOME Desktop, Flatpak and Toolbx +D-093 adds PackageKit's Archipelago backend for native Host Extension packages, +alongside the native Archipelago OS plugin, Flatpak and fwupd. The stock live ALPM +backend must not run. Replace the OS plugin's global PackageKit conflict with +explicit resource ownership, supply the matching PackageKit frontend plugin, and +show staged package changes as pending reboot. Native OS updates remain on the +direct D-Bus path. See [RFC-0013](../rfc/RFC-0013-host-management-and-packagekit.md). + D-092 (2026-11-07) selects native system D-Bus integration for GNOME Software, Discover and installed-system CLI through the shared Archipelago update service. See [RFC-0012](../rfc/RFC-0012-system-service-and-dbus.md). This supersedes the diff --git a/spec/kde-desktop.md b/spec/kde-desktop.md index 44ef788..0f25760 100644 --- a/spec/kde-desktop.md +++ b/spec/kde-desktop.md @@ -60,6 +60,14 @@ handoff still to be checked. Do not start two display managers together. ## Discover and update identity +D-093 adds Discover's PackageKit frontend for Host Extensions through PackageKit's +Archipelago backend -> archipelagod D-Bus. Keep the native Archipelago OS backend +and independent Flatpak/fwupd backends. Replace the current restricted launcher +and PackageKit mask only with the verified replacement backend; never enable live +ALPM. Present staged native packages as pending restart and preserve original-user +authorization. Managed Overlays use their separate daemon interface, not fake +PackageKit packages. See [RFC-0013](../rfc/RFC-0013-host-management-and-packagekit.md). + D-092 supersedes the initial pkexec/helper integration transport with native system D-Bus transactions shared by Discover, GNOME Software and CLI. Authorization, progress, cancellation and restart reconciliation follow diff --git a/spec/open-questions.md b/spec/open-questions.md index 5c8f462..94870c7 100644 --- a/spec/open-questions.md +++ b/spec/open-questions.md @@ -1,11 +1,19 @@ # Archipelago Open Questions +D-093 extends the installed-service contract to `archipelagod`, typed Host Extension +and Managed Overlay interfaces, PackageKit's Archipelago backend and installed-host +CLI routing: [RFC-0013](../rfc/RFC-0013-host-management-and-packagekit.md). +These architectural choices are resolved. Remaining implementation: pinned +PackageKit ABI, authenticated original-sender handoff, role/flag and staged-state +frontend mapping, local input import, real overlay-engine coverage and verification. +Rebase/Purpose/account methods still need their own schemas before advertisement. + D-092 resolves the installed-system daemon and GUI transport choices in questions 42/43/45 through [RFC-0012](../rfc/RFC-0012-system-service-and-dbus.md): system D-Bus, per-action Polkit, shared durable transactions and native clients. Implementation choices remain: Rust binding, journal migration/rollback compatibility, worker ownership, measured limits, unit sandbox and pipeline coverage. Future rebase, -Purpose, extension and account D-Bus method schemas remain outside v1; they must +Purpose and account D-Bus method schemas remain outside v1; they must not be exposed through an unrestricted generic command method. D-090 settles cadence/storage direction: replace daily builds with snapshot capture @@ -48,9 +56,10 @@ corresponding implementation becomes stable; numbered questions retain their IDs ## Draft implementation proposals under review D-081/D-082 add next-new-stable gates: production CLI/Russian localization, native -GUI image updates with package diff, and Desktop Plymouth integration. The exact -Software/PackageKit adapter/API remains an implementation choice requiring evidence; -the stock ALPM backend is not an OS updater. The existing-cycle exception does not +GUI image updates with package diff, and Desktop Plymouth integration. D-092/D-093 +now select native OS D-Bus and PackageKit Host Extension adapters; pinned ABI/glue +and runtime evidence remain implementation work. The stock ALPM backend is not an +OS updater. The existing-cycle exception does not close these requirements. D-079 selects `stable/core` and `stable/gnome` with a narrowly scoped exception for @@ -184,8 +193,9 @@ question 72 tracks the remaining control-layer integration contract. 43. Resolved by D-092: on-demand system service for installed update control; build/live/offline direct execution remains available under common locks. 44. How are remote builder selection and job execution represented? -45. Resolved for v1 installed updates by D-092/RFC-0012. Future host-operation API - extensions require separate method/schema contracts and capability advertisement. +45. Resolved for installed updates by D-092/RFC-0012 and extensions/overlays/PackageKit + by D-093/RFC-0013. Other host-operation methods require additive schemas and + capability advertisement; daemon routing itself is already accepted. ## Independent layer builds and Arch package compatibility