Logonomic macOS: Qt source, rebuilding and replacement

The selected macOS Qt libraries are dynamically linked. SOURCE_ACCESS.md lists
the exact upstream source archives, their sizes and SHA-256 hashes. The Qt SPDX
documents and PAYLOAD inventory in SBOM/Qt identify the selected installed kit.
macos-qt-deployment-sidecar.json binds that kit to the deployed framework,
plugin and QML files. Deployment changes load paths and code signatures; the
producer verifies that the remaining native content matches the recorded kit.
This records correspondence to the installed kit, not a Qt build attestation.

Use the supplied LGPL/GPL texts and Qt source archives for the Qt components.
The Logonomic commercial terms and the recorded copyright-owner permissions
govern the separately owned application components. This package does not
require publication of proprietary Logonomic sources or objects to replace its
dynamically linked Qt libraries.

Build modified Qt

1. Download the archives in SOURCE_ACCESS.md and verify each recorded size and
   SHA-256. Extract qtbase, qtdeclarative and qtsvg; include qtwebsockets when the
   selected application contains its framework or QML module. Retain the
   license and attribution files. Apply your changes to those source trees.
2. Use an Apple Clang/Xcode SDK that supports the application's recorded minimum
   macOS version. Configure a Release, shared-library Qt build for arm64 (or a
   universal build containing arm64). Use the installed Qt SPDX configure
   arguments as the starting point, replacing machine-specific paths. Keep the
   deployed Qt version, module set and binary interface compatible. Qt's source
   build instructions are https://doc.qt.io/qt-6/build-sources.html.
3. Configure qtbase with -shared -release and a separate installation prefix,
   and CMAKE_OSX_ARCHITECTURES=arm64 plus the application's deployment target.
   Build/install the other selected modules against that prefix. A binary
   interface change requires a compatible application build; simply renaming
   another Qt version does not make it compatible.

Replace Qt in a copy of the application

4. Quit Logonomic and its recovery application. Preserve the distributed app
   and make a separate writable copy with `ditto Logonomic.app Modified.app`.
   Work on that copy. Do not alter a running terminal or the shared broker's
   installed runtime/state.
5. The main layout is Contents/Frameworks, Contents/PlugIns and
   Contents/Resources/qml. The dedicated recovery application is
   Contents/MacOS/soter.app and has the same internal Qt layout. Some outer
   framework/QML entries are relative links to that nested application's
   identical Qt files. Inspect each link with `readlink`; replace the actual
   destination, preserving the relative link and framework Versions layout.
   Use the deployment sidecar's deployed_path/source_path pairs as the file
   map. Replace each affected framework together with its matching plugins and
   QML resources. Keep the application executables and protected material.
6. Preserve the recorded @rpath framework identities and relative load paths.
   `otool -L` and `otool -l` show the dependencies and LC_RPATH entries. Adjust
   changed install names with `install_name_tool` if your Qt build uses an
   absolute build prefix. Dependencies must resolve to the modified bundle or
   Apple system libraries, never to the development machine's Qt installation.

Qt copies inside CLI helper packages

7. CLI packages can carry their own Qt libraries. In the seven-provider macOS
   bundle, Kimi uses
   Contents/Resources/cli_addons/logonomic.cli.kimi/helpers/runtime/QtCore.
   Replacing the outer or recovery QtCore does not replace this copy. Its
   package.files.json entry identifies notices/runtime.txt and
   provenance/runtime.txt; retain those notices and record your modified Qt
   source, build and replacement bytes in the provenance file. The qtbase
   archive in SOURCE_ACCESS.md supplies its matching original source.
8. Use the matching Logonomic CLI add-on SDK tools logonomic_cli_addon_index,
   logonomic_cli_addon_validate and logonomic_cli_addon_stage. They are the
   standalone targets in sdk/logonomic_cli_addon_sdk; the application also
   supplies the stage tool in Contents/MacOS. These tools need no proprietary
   application rebuild. Copy the whole Contents/Resources/cli_addons directory
   into a separate writable work directory, preserving all package files and
   their executable modes. Work on this copy with Logonomic closed. Package
   roots and members must remain ordinary directories/files, without symlinks.
9. Replace Kimi's helpers/runtime/QtCore with your ABI-compatible QtCore and
   preserve the package's load paths using otool/install_name_tool as in step
   6. Keep non-system dependencies within the package. Ad-hoc sign every changed
   native package image now, before rebuilding its index:

     codesign --force --sign - --timestamp=none <changed-image>
     codesign --verify --strict --all-architectures <changed-image>

   Run the index tool on the copied Kimi package, retaining every existing
   third-party declaration. For the supplied package these are:

     logonomic_cli_addon_index <copied-kimi-directory> \
       --third-party assets/kimi.svg notices/lobe_icons_mit.txt provenance/lobe_icons.json \
       --third-party assets/kimi-color.svg notices/lobe_icons_mit.txt provenance/lobe_icons.json \
       --third-party adapter/kimi_adapter notices/tomlplusplus-LICENSE.txt provenance/tomlplusplus.json \
       --third-party helpers/kimi_helper notices/tomlplusplus-LICENSE.txt provenance/tomlplusplus.json \
       --third-party helpers/runtime/QtCore notices/runtime.txt provenance/runtime.txt

   If your replacement introduces another runtime file, include its matching
   notice/provenance declaration too. Do not omit existing declarations or
   classify third-party code as package-owned. The index is package.files.json;
   the tool recalculates its file sizes and hashes. Do not re-sign or edit a
   package member after this step without regenerating the index again.
10. Validate every copied package, including the unchanged providers:

      logonomic_cli_addon_validate <absolute-package-directory> --platform macos-arm64

    Each successful result begins `OK <package-id> <generation-digest>`. Create
    an artifact-set.json outside the packages with artifact_set_version 1 and
    a packages array containing every provider. Each entry has exactly
    `directory` (its absolute copied path) and `generation_digest` (the digest
    just reported). Use Kimi's new digest; do not reuse its original receipt.
    Stage this complete set into a fresh directory and generate a new receipt:

      logonomic_cli_addon_stage --input <artifact-set.json> \
        --output <fresh-stage>/cli_addons \
        --evidence <fresh-stage>/cli-addons.evidence.json --platform macos-arm64
      logonomic_cli_addon_stage --verify <fresh-stage>/cli_addons \
        --evidence <fresh-stage>/cli-addons.evidence.json --platform macos-arm64

    Create <fresh-stage> first; its cli_addons destination must not exist.
11. Move the old cli_addons directory and cli-addons.evidence.json from
    Modified.app/Contents/Resources into your external backup, then place the
    new staged directory and receipt at those exact resource paths. Preserve
    Contents/MacOS/cli_addons and Contents/MacOS/cli-addons.evidence.json as the
    existing relative aliases into Resources. Verify with the stage command
    above using the actual Contents/Resources paths; the SDK deliberately
    refuses an alias as its verification root. If the copy has official bundle
    or assembly records, move official-cli-addon-bundle.json and
    official-cli-addon-assembly.json, including their MacOS aliases, into the
    external backup. The replacement is your local generation, not the original
    official assembly. Retain the original artifact and provenance unchanged.

Re-sign the modified copy for local use

12. Replacing Qt invalidates the original signatures. Ad-hoc sign each replaced
   native image outside the already indexed CLI packages with
   `codesign --force --sign - --timestamp=none <image>`.
   Sign changed framework bundles after their inner code, then the nested
   soter.app, and finally Modified.app with the same command. Do not add the
   hardened-runtime option when creating this local ad-hoc replacement. The
   replacement has your local signature, not Varinomics' distribution identity
   or notarization. No Apple developer enrollment is needed for ad-hoc signing.
13. Verify both app signatures with `codesign --verify --strict --all-architectures
   <app>`. Launch the copied application from Finder, or run its
   Contents/MacOS/logonomic directly for loader diagnostics. Confirm its normal
   window, affected Qt features, and ordinary dedicated Soter recovery using
   disposable sessions. Existing product licensing remains applicable; this
   procedure does not issue or activate a software license.

Retain the original application, your modified sources, build commands and
replacement map so you can revert or reproduce the modified copy. The original
artifact inventory identifies the distributed bytes; it does not attest your
replacement build or signatures.

Supplier references:
https://doc.qt.io/qt-6/macos-deployment.html
https://developer.apple.com/library/archive/technotes/tn2206/
