activity_sdk_native_pack_pipeline.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #pragma once
  2. #include <cstdint>
  3. #include <span>
  4. #include "../../../middleware/content/packages/reader/reader.h"
  5. #include "../../../state/activity_sdk/generation/pack_writer.h"
  6. #include "../../../state/activity_sdk/identity.h"
  7. #include "activity_sdk_activity_inventory.h"
  8. #include "activity_sdk_external_placements.h"
  9. #include "activity_sdk_lua_artifacts.h"
  10. #include "activity_sdk_topology_inventory.h"
  11. namespace sunrise::client::content::activity::sdk_generation::native_pack_pipeline {
  12. namespace pack = state::activity_sdk::generation::pack;
  13. /** Exact fail-closed stages of one native all-activity publication. */
  14. enum class Status : std::uint8_t {
  15. ready,
  16. cancelled,
  17. invalidInput,
  18. activityEnrichment,
  19. topologyEnrichment,
  20. squadFacts,
  21. actorRsat,
  22. squadLink,
  23. authoredSceneFacts,
  24. authoredSceneLinks,
  25. dialogueCues,
  26. authoredText,
  27. behaviors,
  28. policyInputs,
  29. policy,
  30. composition,
  31. identity,
  32. luaBuild,
  33. publication,
  34. luaPublication,
  35. };
  36. /** Real pack-building boundaries exposed to presentation without changing generation state. */
  37. enum class Phase : std::uint8_t {
  38. activityMetadata,
  39. worldTopology,
  40. squadFacts,
  41. actorDefinitions,
  42. squadLinks,
  43. authoredSceneFacts,
  44. authoredSceneLinks,
  45. dialogueCues,
  46. authoredText,
  47. behaviors,
  48. actionPolicies,
  49. packTables,
  50. luaDeclarations,
  51. outputFiles,
  52. };
  53. /** Optional worker cancellation probe checked across package-backed stages. */
  54. using CancelProbe = bool (*)(void* context) noexcept;
  55. /** Optional observer used only to present the current pack-building phase. */
  56. using ProgressProbe = void (*)(void* context, Phase phase) noexcept;
  57. /** Final identity returned only after every requested output commits. */
  58. struct Result final {
  59. state::activity_sdk::identity::Expected identity{};
  60. pack::Digest payloadSha256{};
  61. std::uint64_t fileBytes{};
  62. std::uint32_t luaFiles{};
  63. };
  64. /** @return Stable diagnostic name for one pipeline outcome. */
  65. [[nodiscard]] const char* status_name(Status value) noexcept;
  66. /**
  67. * Builds and publishes the current activity and panel SDK without touching runtime State.
  68. * The caller may use an isolated sibling tree and commit it after its wider estate validates.
  69. * @param luaDeclarations Writes the sdk/lua tree. Off leaves an empty lua directory for the commit.
  70. */
  71. [[nodiscard]] Status stage(const wchar_t* sdkDirectory,
  72. const wchar_t* packPath,
  73. const middleware::content::packages::reader::Source& source,
  74. const pack::Digest& sourceFingerprint,
  75. const activity_inventory::Snapshot& activities,
  76. topology_inventory::Snapshot& topology,
  77. std::span<const lua_artifacts::ScenarioWorldSource> scenarioWorldSources,
  78. const external_placements::Index& externalPlacements,
  79. bool luaDeclarations,
  80. CancelProbe cancel,
  81. void* cancelContext,
  82. ProgressProbe progress,
  83. void* progressContext,
  84. Result& output) noexcept;
  85. } // namespace sunrise::client::content::activity::sdk_generation::native_pack_pipeline