@aephia/atlas-kit 0.6.0-next.13 → 0.6.0-next.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cargo/actions/deposit.d.ts +2 -2
- package/dist/cargo/actions/deposit.d.ts.map +1 -1
- package/dist/cargo/actions/deposit.js +28 -117
- package/dist/cargo/actions/deposit.js.map +1 -1
- package/dist/cargo/actions/index.d.ts +1 -1
- package/dist/cargo/actions/index.d.ts.map +1 -1
- package/dist/cargo/actions/index.js +28 -84
- package/dist/cargo/actions/index.js.map +1 -1
- package/dist/cargo/actions/wallet-context.d.ts +52 -3
- package/dist/cargo/actions/wallet-context.d.ts.map +1 -1
- package/dist/cargo/actions/wallet-context.js +118 -7
- package/dist/cargo/actions/wallet-context.js.map +1 -1
- package/dist/cargo/actions/wallet-token.d.ts +1 -6
- package/dist/cargo/actions/wallet-token.d.ts.map +1 -1
- package/dist/cargo/actions/wallet-token.js +0 -53
- package/dist/cargo/actions/wallet-token.js.map +1 -1
- package/dist/cargo/actions/withdrawal.d.ts +1 -1
- package/dist/cargo/actions/withdrawal.d.ts.map +1 -1
- package/dist/cargo/actions/withdrawal.js +39 -164
- package/dist/cargo/actions/withdrawal.js.map +1 -1
- package/dist/cargo/index.d.ts.map +1 -1
- package/dist/cargo/index.js +2 -10
- package/dist/cargo/index.js.map +1 -1
- package/dist/claim-stakes/actions/index.d.ts +57 -8
- package/dist/claim-stakes/actions/index.d.ts.map +1 -1
- package/dist/claim-stakes/actions/index.js +541 -675
- package/dist/claim-stakes/actions/index.js.map +1 -1
- package/dist/claim-stakes/index.d.ts +21 -6
- package/dist/claim-stakes/index.d.ts.map +1 -1
- package/dist/claim-stakes/index.js +33 -19
- package/dist/claim-stakes/index.js.map +1 -1
- package/dist/client/context.d.ts.map +1 -1
- package/dist/client/context.js +1 -1
- package/dist/client/context.js.map +1 -1
- package/dist/client/contracts.d.ts +16 -6
- package/dist/client/contracts.d.ts.map +1 -1
- package/dist/client/errors.d.ts +2 -2
- package/dist/client/errors.d.ts.map +1 -1
- package/dist/client/errors.js.map +1 -1
- package/dist/client/index.d.ts +35 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +35 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/rpc-subscription-provider.d.ts +35 -0
- package/dist/client/rpc-subscription-provider.d.ts.map +1 -0
- package/dist/client/rpc-subscription-provider.js +190 -0
- package/dist/client/rpc-subscription-provider.js.map +1 -0
- package/dist/combat/actions/index.d.ts +15 -9
- package/dist/combat/actions/index.d.ts.map +1 -1
- package/dist/combat/actions/index.js +245 -274
- package/dist/combat/actions/index.js.map +1 -1
- package/dist/combat/index.d.ts +20 -5
- package/dist/combat/index.d.ts.map +1 -1
- package/dist/combat/index.js +12 -17
- package/dist/combat/index.js.map +1 -1
- package/dist/crafting/actions/index.d.ts +16 -5
- package/dist/crafting/actions/index.d.ts.map +1 -1
- package/dist/crafting/actions/index.js +204 -318
- package/dist/crafting/actions/index.js.map +1 -1
- package/dist/crafting/index.d.ts +33 -3
- package/dist/crafting/index.d.ts.map +1 -1
- package/dist/crafting/index.js +49 -28
- package/dist/crafting/index.js.map +1 -1
- package/dist/factions/actions/index.d.ts +2 -1
- package/dist/factions/actions/index.d.ts.map +1 -1
- package/dist/factions/actions/index.js +6 -4
- package/dist/factions/actions/index.js.map +1 -1
- package/dist/factions/index.d.ts +6 -1
- package/dist/factions/index.d.ts.map +1 -1
- package/dist/factions/index.js +16 -18
- package/dist/factions/index.js.map +1 -1
- package/dist/factions/profile-faction.d.ts +20 -8
- package/dist/factions/profile-faction.d.ts.map +1 -1
- package/dist/factions/profile-faction.js +20 -8
- package/dist/factions/profile-faction.js.map +1 -1
- package/dist/fleets/actions/add-ship.d.ts +35 -0
- package/dist/fleets/actions/add-ship.d.ts.map +1 -0
- package/dist/fleets/actions/add-ship.js +120 -0
- package/dist/fleets/actions/add-ship.js.map +1 -0
- package/dist/fleets/actions/create-fleet.d.ts +36 -0
- package/dist/fleets/actions/create-fleet.d.ts.map +1 -0
- package/dist/fleets/actions/create-fleet.js +108 -0
- package/dist/fleets/actions/create-fleet.js.map +1 -0
- package/dist/fleets/actions/crew-transfer.d.ts +41 -0
- package/dist/fleets/actions/crew-transfer.d.ts.map +1 -0
- package/dist/fleets/actions/crew-transfer.js +94 -0
- package/dist/fleets/actions/crew-transfer.js.map +1 -0
- package/dist/fleets/actions/dock-bounds.d.ts +38 -0
- package/dist/fleets/actions/dock-bounds.d.ts.map +1 -0
- package/dist/fleets/actions/dock-bounds.js +46 -0
- package/dist/fleets/actions/dock-bounds.js.map +1 -0
- package/dist/fleets/actions/index.d.ts +68 -26
- package/dist/fleets/actions/index.d.ts.map +1 -1
- package/dist/fleets/actions/index.js +395 -335
- package/dist/fleets/actions/index.js.map +1 -1
- package/dist/fleets/actions/respawn.d.ts +38 -0
- package/dist/fleets/actions/respawn.d.ts.map +1 -0
- package/dist/fleets/actions/respawn.js +93 -0
- package/dist/fleets/actions/respawn.js.map +1 -0
- package/dist/fleets/actions/ship-import.d.ts +1 -1
- package/dist/fleets/actions/ship-import.d.ts.map +1 -1
- package/dist/fleets/actions/ship-import.js +67 -91
- package/dist/fleets/actions/ship-import.js.map +1 -1
- package/dist/fleets/cooldown.d.ts +44 -0
- package/dist/fleets/cooldown.d.ts.map +1 -0
- package/dist/fleets/cooldown.js +43 -0
- package/dist/fleets/cooldown.js.map +1 -0
- package/dist/fleets/coordinate-warp-estimate.d.ts +70 -0
- package/dist/fleets/coordinate-warp-estimate.d.ts.map +1 -0
- package/dist/fleets/coordinate-warp-estimate.js +46 -0
- package/dist/fleets/coordinate-warp-estimate.js.map +1 -0
- package/dist/fleets/index.d.ts +35 -0
- package/dist/fleets/index.d.ts.map +1 -1
- package/dist/fleets/index.js +54 -12
- package/dist/fleets/index.js.map +1 -1
- package/dist/fleets/movement-arithmetic.d.ts +21 -0
- package/dist/fleets/movement-arithmetic.d.ts.map +1 -0
- package/dist/fleets/movement-arithmetic.js +41 -0
- package/dist/fleets/movement-arithmetic.js.map +1 -0
- package/dist/fleets/subwarp-estimate.d.ts +70 -0
- package/dist/fleets/subwarp-estimate.d.ts.map +1 -0
- package/dist/fleets/subwarp-estimate.js +38 -0
- package/dist/fleets/subwarp-estimate.js.map +1 -0
- package/dist/fleets/travel-profile.d.ts +102 -0
- package/dist/fleets/travel-profile.d.ts.map +1 -0
- package/dist/fleets/travel-profile.js +120 -0
- package/dist/fleets/travel-profile.js.map +1 -0
- package/dist/fleets/warp-lane-estimate.d.ts +59 -0
- package/dist/fleets/warp-lane-estimate.d.ts.map +1 -0
- package/dist/fleets/warp-lane-estimate.js +36 -0
- package/dist/fleets/warp-lane-estimate.js.map +1 -0
- package/dist/fleets/warp-lane-policy.d.ts +68 -0
- package/dist/fleets/warp-lane-policy.d.ts.map +1 -0
- package/dist/fleets/warp-lane-policy.js +91 -0
- package/dist/fleets/warp-lane-policy.js.map +1 -0
- package/dist/fleets/warp-lane-toll.d.ts +55 -0
- package/dist/fleets/warp-lane-toll.d.ts.map +1 -0
- package/dist/fleets/warp-lane-toll.js +79 -0
- package/dist/fleets/warp-lane-toll.js.map +1 -0
- package/dist/identity/actions/create-profile.d.ts +1 -1
- package/dist/identity/actions/create-profile.d.ts.map +1 -1
- package/dist/identity/actions/create-profile.js +2 -2
- package/dist/identity/actions/create-profile.js.map +1 -1
- package/dist/identity/actions/index.d.ts +5 -4
- package/dist/identity/actions/index.d.ts.map +1 -1
- package/dist/identity/actions/index.js +52 -29
- package/dist/identity/actions/index.js.map +1 -1
- package/dist/identity/actions/research-unlock.d.ts +52 -0
- package/dist/identity/actions/research-unlock.d.ts.map +1 -0
- package/dist/identity/actions/research-unlock.js +155 -0
- package/dist/identity/actions/research-unlock.js.map +1 -0
- package/dist/identity/index.d.ts +5 -2
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +6 -12
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/research-state.d.ts +60 -0
- package/dist/identity/research-state.d.ts.map +1 -0
- package/dist/identity/research-state.js +68 -0
- package/dist/identity/research-state.js.map +1 -0
- package/dist/index.d.ts +26 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/internal/c4/account-decoding.d.ts +49 -0
- package/dist/internal/c4/account-decoding.d.ts.map +1 -0
- package/dist/internal/c4/account-decoding.js +74 -0
- package/dist/internal/c4/account-decoding.js.map +1 -0
- package/dist/internal/c4/cargo-bytes-config.d.ts +7 -0
- package/dist/internal/c4/cargo-bytes-config.d.ts.map +1 -0
- package/dist/internal/c4/cargo-bytes-config.js +19 -0
- package/dist/internal/c4/cargo-bytes-config.js.map +1 -0
- package/dist/internal/c4/cargo-pod.d.ts +15 -0
- package/dist/internal/c4/cargo-pod.d.ts.map +1 -0
- package/dist/internal/c4/cargo-pod.js +13 -0
- package/dist/internal/c4/cargo-pod.js.map +1 -0
- package/dist/internal/c4/character-modifier.d.ts +1 -1
- package/dist/internal/c4/character-modifier.d.ts.map +1 -1
- package/dist/internal/c4/character-registration.d.ts +2 -0
- package/dist/internal/c4/character-registration.d.ts.map +1 -1
- package/dist/internal/c4/character-registration.js +2 -0
- package/dist/internal/c4/character-registration.js.map +1 -1
- package/dist/internal/c4/character.d.ts +157 -0
- package/dist/internal/c4/character.d.ts.map +1 -0
- package/dist/internal/c4/character.js +64 -0
- package/dist/internal/c4/character.js.map +1 -0
- package/dist/internal/c4/claim-stake-building-definitions.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake-building-definitions.js +2 -1
- package/dist/internal/c4/claim-stake-building-definitions.js.map +1 -1
- package/dist/internal/c4/claim-stake-configuration.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake-configuration.js +5 -36
- package/dist/internal/c4/claim-stake-configuration.js.map +1 -1
- package/dist/internal/c4/claim-stake-definitions.d.ts +4 -4
- package/dist/internal/c4/claim-stake-definitions.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake-definitions.js +2 -1
- package/dist/internal/c4/claim-stake-definitions.js.map +1 -1
- package/dist/internal/c4/claim-stake-plots.d.ts +17 -0
- package/dist/internal/c4/claim-stake-plots.d.ts.map +1 -0
- package/dist/internal/c4/claim-stake-plots.js +29 -0
- package/dist/internal/c4/claim-stake-plots.js.map +1 -0
- package/dist/internal/c4/claim-stake.d.ts +13 -33
- package/dist/internal/c4/claim-stake.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake.js +49 -94
- package/dist/internal/c4/claim-stake.js.map +1 -1
- package/dist/internal/c4/combat.d.ts +1 -82
- package/dist/internal/c4/combat.d.ts.map +1 -1
- package/dist/internal/c4/combat.js +16 -213
- package/dist/internal/c4/combat.js.map +1 -1
- package/dist/internal/c4/crafting-process-codec.d.ts +13 -0
- package/dist/internal/c4/crafting-process-codec.d.ts.map +1 -0
- package/dist/internal/c4/crafting-process-codec.js +34 -0
- package/dist/internal/c4/crafting-process-codec.js.map +1 -0
- package/dist/internal/c4/crafting.d.ts +27 -33
- package/dist/internal/c4/crafting.d.ts.map +1 -1
- package/dist/internal/c4/crafting.js +76 -127
- package/dist/internal/c4/crafting.js.map +1 -1
- package/dist/internal/c4/currency-cache.d.ts +6 -0
- package/dist/internal/c4/currency-cache.d.ts.map +1 -0
- package/dist/internal/c4/currency-cache.js +27 -0
- package/dist/internal/c4/currency-cache.js.map +1 -0
- package/dist/internal/c4/discriminators.d.ts +85 -0
- package/dist/internal/c4/discriminators.d.ts.map +1 -0
- package/dist/internal/c4/discriminators.js +174 -0
- package/dist/internal/c4/discriminators.js.map +1 -0
- package/dist/internal/c4/docking-funding.d.ts +4 -0
- package/dist/internal/c4/docking-funding.d.ts.map +1 -0
- package/dist/internal/c4/docking-funding.js +11 -0
- package/dist/internal/c4/docking-funding.js.map +1 -0
- package/dist/internal/c4/faction-epoch-meter.d.ts +10 -0
- package/dist/internal/c4/faction-epoch-meter.d.ts.map +1 -0
- package/dist/internal/c4/faction-epoch-meter.js +26 -0
- package/dist/internal/c4/faction-epoch-meter.js.map +1 -0
- package/dist/internal/c4/faction-treasury.d.ts +23 -0
- package/dist/internal/c4/faction-treasury.d.ts.map +1 -0
- package/dist/internal/c4/faction-treasury.js +41 -0
- package/dist/internal/c4/faction-treasury.js.map +1 -0
- package/dist/internal/c4/faction.d.ts +21 -0
- package/dist/internal/c4/faction.d.ts.map +1 -0
- package/dist/internal/c4/faction.js +23 -0
- package/dist/internal/c4/faction.js.map +1 -0
- package/dist/internal/c4/factions.d.ts +15 -57
- package/dist/internal/c4/factions.d.ts.map +1 -1
- package/dist/internal/c4/factions.js +80 -223
- package/dist/internal/c4/factions.js.map +1 -1
- package/dist/internal/c4/fleet-arrival.d.ts +28 -0
- package/dist/internal/c4/fleet-arrival.d.ts.map +1 -0
- package/dist/internal/c4/fleet-arrival.js +42 -0
- package/dist/internal/c4/fleet-arrival.js.map +1 -0
- package/dist/internal/c4/fleet-creation.d.ts +7 -0
- package/dist/internal/c4/fleet-creation.d.ts.map +1 -0
- package/dist/internal/c4/fleet-creation.js +171 -0
- package/dist/internal/c4/fleet-creation.js.map +1 -0
- package/dist/internal/c4/fleet-crew-binding.d.ts +9 -0
- package/dist/internal/c4/fleet-crew-binding.d.ts.map +1 -1
- package/dist/internal/c4/fleet-crew-binding.js +31 -44
- package/dist/internal/c4/fleet-crew-binding.js.map +1 -1
- package/dist/internal/c4/fleet-respawn.d.ts +17 -0
- package/dist/internal/c4/fleet-respawn.d.ts.map +1 -0
- package/dist/internal/c4/fleet-respawn.js +62 -0
- package/dist/internal/c4/fleet-respawn.js.map +1 -0
- package/dist/internal/c4/fleet-ship-assembly.d.ts +11 -0
- package/dist/internal/c4/fleet-ship-assembly.d.ts.map +1 -0
- package/dist/internal/c4/fleet-ship-assembly.js +44 -0
- package/dist/internal/c4/fleet-ship-assembly.js.map +1 -0
- package/dist/internal/c4/fleet.d.ts +48 -19
- package/dist/internal/c4/fleet.d.ts.map +1 -1
- package/dist/internal/c4/fleet.js +50 -87
- package/dist/internal/c4/fleet.js.map +1 -1
- package/dist/internal/c4/game-definition-layout.d.ts +2 -0
- package/dist/internal/c4/game-definition-layout.d.ts.map +1 -1
- package/dist/internal/c4/game-definition-layout.js +4 -0
- package/dist/internal/c4/game-definition-layout.js.map +1 -1
- package/dist/internal/c4/game.d.ts +101 -30
- package/dist/internal/c4/game.d.ts.map +1 -1
- package/dist/internal/c4/game.js +203 -124
- package/dist/internal/c4/game.js.map +1 -1
- package/dist/internal/c4/identity.d.ts +3 -152
- package/dist/internal/c4/identity.d.ts.map +1 -1
- package/dist/internal/c4/identity.js +19 -126
- package/dist/internal/c4/identity.js.map +1 -1
- package/dist/internal/c4/local-market-order.d.ts +29 -0
- package/dist/internal/c4/local-market-order.d.ts.map +1 -0
- package/dist/internal/c4/local-market-order.js +46 -0
- package/dist/internal/c4/local-market-order.js.map +1 -0
- package/dist/internal/c4/loot-layout.js +1 -1
- package/dist/internal/c4/loot-layout.js.map +1 -1
- package/dist/internal/c4/loot.d.ts +89 -0
- package/dist/internal/c4/loot.d.ts.map +1 -0
- package/dist/internal/c4/loot.js +109 -0
- package/dist/internal/c4/loot.js.map +1 -0
- package/dist/internal/c4/loyalty.d.ts +0 -27
- package/dist/internal/c4/loyalty.d.ts.map +1 -1
- package/dist/internal/c4/loyalty.js +32 -160
- package/dist/internal/c4/loyalty.js.map +1 -1
- package/dist/internal/c4/market.d.ts +2 -38
- package/dist/internal/c4/market.d.ts.map +1 -1
- package/dist/internal/c4/market.js +26 -120
- package/dist/internal/c4/market.js.map +1 -1
- package/dist/internal/c4/mining-instructions.d.ts +2 -0
- package/dist/internal/c4/mining-instructions.d.ts.map +1 -0
- package/dist/internal/c4/mining-instructions.js +3 -0
- package/dist/internal/c4/mining-instructions.js.map +1 -0
- package/dist/internal/c4/open-signal.d.ts +8 -0
- package/dist/internal/c4/open-signal.d.ts.map +1 -0
- package/dist/internal/c4/open-signal.js +37 -0
- package/dist/internal/c4/open-signal.js.map +1 -0
- package/dist/internal/c4/pda.d.ts +43 -0
- package/dist/internal/c4/pda.d.ts.map +1 -1
- package/dist/internal/c4/pda.js +83 -17
- package/dist/internal/c4/pda.js.map +1 -1
- package/dist/internal/c4/profile-faction.d.ts +2 -1
- package/dist/internal/c4/profile-faction.d.ts.map +1 -1
- package/dist/internal/c4/profile-faction.js +36 -72
- package/dist/internal/c4/profile-faction.js.map +1 -1
- package/dist/internal/c4/profile-permissions.d.ts +1 -1
- package/dist/internal/c4/profile-permissions.d.ts.map +1 -1
- package/dist/internal/c4/profile-permissions.js +4 -1
- package/dist/internal/c4/profile-permissions.js.map +1 -1
- package/dist/internal/c4/region-geometry.d.ts +8 -0
- package/dist/internal/c4/region-geometry.d.ts.map +1 -0
- package/dist/internal/c4/region-geometry.js +43 -0
- package/dist/internal/c4/region-geometry.js.map +1 -0
- package/dist/internal/c4/rewards.d.ts +1 -61
- package/dist/internal/c4/rewards.d.ts.map +1 -1
- package/dist/internal/c4/rewards.js +23 -203
- package/dist/internal/c4/rewards.js.map +1 -1
- package/dist/internal/c4/runtime-bindings.d.ts +4 -0
- package/dist/internal/c4/runtime-bindings.d.ts.map +1 -0
- package/dist/internal/c4/runtime-bindings.js +4 -0
- package/dist/internal/c4/runtime-bindings.js.map +1 -0
- package/dist/internal/c4/scan-detection-codecs.d.ts +3 -0
- package/dist/internal/c4/scan-detection-codecs.d.ts.map +1 -0
- package/dist/internal/c4/scan-detection-codecs.js +3 -0
- package/dist/internal/c4/scan-detection-codecs.js.map +1 -0
- package/dist/internal/c4/scan-lifecycle.d.ts +306 -0
- package/dist/internal/c4/scan-lifecycle.d.ts.map +1 -0
- package/dist/internal/c4/scan-lifecycle.js +235 -0
- package/dist/internal/c4/scan-lifecycle.js.map +1 -0
- package/dist/internal/c4/scanning.d.ts +4 -41
- package/dist/internal/c4/scanning.d.ts.map +1 -1
- package/dist/internal/c4/scanning.js +27 -108
- package/dist/internal/c4/scanning.js.map +1 -1
- package/dist/internal/c4/ship-import.d.ts +4 -0
- package/dist/internal/c4/ship-import.d.ts.map +1 -0
- package/dist/internal/c4/ship-import.js +13 -0
- package/dist/internal/c4/ship-import.js.map +1 -0
- package/dist/internal/c4/ship-stats.d.ts.map +1 -1
- package/dist/internal/c4/ship-stats.js +45 -43
- package/dist/internal/c4/ship-stats.js.map +1 -1
- package/dist/internal/c4/starbase.d.ts +0 -32
- package/dist/internal/c4/starbase.d.ts.map +1 -1
- package/dist/internal/c4/starbase.js +26 -136
- package/dist/internal/c4/starbase.js.map +1 -1
- package/dist/internal/c4/wallet-cargo-cache.js +2 -1
- package/dist/internal/c4/wallet-cargo-cache.js.map +1 -1
- package/dist/internal/c4/world.d.ts +37 -7
- package/dist/internal/c4/world.d.ts.map +1 -1
- package/dist/internal/c4/world.js +87 -129
- package/dist/internal/c4/world.js.map +1 -1
- package/dist/internal/cargo.d.ts +2 -0
- package/dist/internal/cargo.d.ts.map +1 -1
- package/dist/internal/cargo.js +8 -0
- package/dist/internal/cargo.js.map +1 -1
- package/dist/internal/fleet.d.ts +1 -0
- package/dist/internal/fleet.d.ts.map +1 -1
- package/dist/internal/fleet.js +3 -1
- package/dist/internal/fleet.js.map +1 -1
- package/dist/internal/loyalty-atlas-bank-state.d.ts +16 -0
- package/dist/internal/loyalty-atlas-bank-state.d.ts.map +1 -0
- package/dist/internal/loyalty-atlas-bank-state.js +10 -0
- package/dist/internal/loyalty-atlas-bank-state.js.map +1 -0
- package/dist/internal/planning/account-state.d.ts +6 -0
- package/dist/internal/planning/account-state.d.ts.map +1 -1
- package/dist/internal/planning/account-state.js +13 -0
- package/dist/internal/planning/account-state.js.map +1 -1
- package/dist/internal/planning/action-runtime.d.ts +38 -0
- package/dist/internal/planning/action-runtime.d.ts.map +1 -0
- package/dist/internal/planning/action-runtime.js +63 -0
- package/dist/internal/planning/action-runtime.js.map +1 -0
- package/dist/internal/planning/arrival-guards.d.ts +19 -0
- package/dist/internal/planning/arrival-guards.d.ts.map +1 -0
- package/dist/internal/planning/arrival-guards.js +172 -0
- package/dist/internal/planning/arrival-guards.js.map +1 -0
- package/dist/internal/planning/authorization-adapter.d.ts +55 -37
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +231 -81
- package/dist/internal/planning/authorization-adapter.js.map +1 -1
- package/dist/internal/planning/character-registration-guard.d.ts +4 -0
- package/dist/internal/planning/character-registration-guard.d.ts.map +1 -0
- package/dist/internal/planning/character-registration-guard.js +59 -0
- package/dist/internal/planning/character-registration-guard.js.map +1 -0
- package/dist/internal/planning/character-registration.d.ts +23 -0
- package/dist/internal/planning/character-registration.d.ts.map +1 -0
- package/dist/internal/planning/character-registration.js +87 -0
- package/dist/internal/planning/character-registration.js.map +1 -0
- package/dist/internal/planning/currency-cache-guard.d.ts +4 -0
- package/dist/internal/planning/currency-cache-guard.d.ts.map +1 -0
- package/dist/internal/planning/currency-cache-guard.js +34 -0
- package/dist/internal/planning/currency-cache-guard.js.map +1 -0
- package/dist/internal/planning/democracy-history.d.ts +50 -0
- package/dist/internal/planning/democracy-history.d.ts.map +1 -0
- package/dist/internal/planning/democracy-history.js +189 -0
- package/dist/internal/planning/democracy-history.js.map +1 -0
- package/dist/internal/planning/direct-options.d.ts +17 -0
- package/dist/internal/planning/direct-options.d.ts.map +1 -0
- package/dist/internal/planning/direct-options.js +43 -0
- package/dist/internal/planning/direct-options.js.map +1 -0
- package/dist/internal/planning/faction-enrollment.d.ts +0 -4
- package/dist/internal/planning/faction-enrollment.d.ts.map +1 -1
- package/dist/internal/planning/faction-enrollment.js +1 -31
- package/dist/internal/planning/faction-enrollment.js.map +1 -1
- package/dist/internal/planning/faction-trade-guards.d.ts +30 -0
- package/dist/internal/planning/faction-trade-guards.d.ts.map +1 -0
- package/dist/internal/planning/faction-trade-guards.js +15 -0
- package/dist/internal/planning/faction-trade-guards.js.map +1 -0
- package/dist/internal/planning/faction-trade-state.d.ts +16 -0
- package/dist/internal/planning/faction-trade-state.d.ts.map +1 -0
- package/dist/internal/planning/faction-trade-state.js +43 -0
- package/dist/internal/planning/faction-trade-state.js.map +1 -0
- package/dist/internal/planning/fleet-arrival.d.ts +40 -0
- package/dist/internal/planning/fleet-arrival.d.ts.map +1 -0
- package/dist/internal/planning/fleet-arrival.js +107 -0
- package/dist/internal/planning/fleet-arrival.js.map +1 -0
- package/dist/internal/planning/fleet-attack-xp.d.ts +20 -0
- package/dist/internal/planning/fleet-attack-xp.d.ts.map +1 -0
- package/dist/internal/planning/fleet-attack-xp.js +104 -0
- package/dist/internal/planning/fleet-attack-xp.js.map +1 -0
- package/dist/internal/planning/fleet-creation.d.ts +30 -0
- package/dist/internal/planning/fleet-creation.d.ts.map +1 -0
- package/dist/internal/planning/fleet-creation.js +89 -0
- package/dist/internal/planning/fleet-creation.js.map +1 -0
- package/dist/internal/planning/fleet-crew-guard.d.ts +28 -0
- package/dist/internal/planning/fleet-crew-guard.d.ts.map +1 -0
- package/dist/internal/planning/fleet-crew-guard.js +48 -0
- package/dist/internal/planning/fleet-crew-guard.js.map +1 -0
- package/dist/internal/planning/fleet-crew-transfer.d.ts +7 -0
- package/dist/internal/planning/fleet-crew-transfer.d.ts.map +1 -0
- package/dist/internal/planning/fleet-crew-transfer.js +123 -0
- package/dist/internal/planning/fleet-crew-transfer.js.map +1 -0
- package/dist/internal/planning/fleet-dock-funding-guard.d.ts +42 -0
- package/dist/internal/planning/fleet-dock-funding-guard.d.ts.map +1 -0
- package/dist/internal/planning/fleet-dock-funding-guard.js +209 -0
- package/dist/internal/planning/fleet-dock-funding-guard.js.map +1 -0
- package/dist/internal/planning/fleet-dock-funding.d.ts +9 -0
- package/dist/internal/planning/fleet-dock-funding.d.ts.map +1 -0
- package/dist/internal/planning/fleet-dock-funding.js +154 -0
- package/dist/internal/planning/fleet-dock-funding.js.map +1 -0
- package/dist/internal/planning/fleet-docking-guard.d.ts +4 -0
- package/dist/internal/planning/fleet-docking-guard.d.ts.map +1 -0
- package/dist/internal/planning/fleet-docking-guard.js +43 -0
- package/dist/internal/planning/fleet-docking-guard.js.map +1 -0
- package/dist/internal/planning/fleet-docking.d.ts +10 -0
- package/dist/internal/planning/fleet-docking.d.ts.map +1 -0
- package/dist/internal/planning/fleet-docking.js +71 -0
- package/dist/internal/planning/fleet-docking.js.map +1 -0
- package/dist/internal/planning/fleet-respawn.d.ts +28 -0
- package/dist/internal/planning/fleet-respawn.d.ts.map +1 -0
- package/dist/internal/planning/fleet-respawn.js +164 -0
- package/dist/internal/planning/fleet-respawn.js.map +1 -0
- package/dist/internal/planning/fleet-ship-assembly.d.ts +36 -0
- package/dist/internal/planning/fleet-ship-assembly.d.ts.map +1 -0
- package/dist/internal/planning/fleet-ship-assembly.js +118 -0
- package/dist/internal/planning/fleet-ship-assembly.js.map +1 -0
- package/dist/internal/planning/fleet-state.d.ts +25 -0
- package/dist/internal/planning/fleet-state.d.ts.map +1 -0
- package/dist/internal/planning/fleet-state.js +28 -0
- package/dist/internal/planning/fleet-state.js.map +1 -0
- package/dist/internal/planning/governance-fees.d.ts +64 -0
- package/dist/internal/planning/governance-fees.d.ts.map +1 -0
- package/dist/internal/planning/governance-fees.js +231 -0
- package/dist/internal/planning/governance-fees.js.map +1 -0
- package/dist/internal/planning/local-market-order-funding.d.ts +8 -0
- package/dist/internal/planning/local-market-order-funding.d.ts.map +1 -0
- package/dist/internal/planning/local-market-order-funding.js +128 -0
- package/dist/internal/planning/local-market-order-funding.js.map +1 -0
- package/dist/internal/planning/local-market-order.d.ts +40 -0
- package/dist/internal/planning/local-market-order.d.ts.map +1 -0
- package/dist/internal/planning/local-market-order.js +139 -0
- package/dist/internal/planning/local-market-order.js.map +1 -0
- package/dist/internal/planning/mining-stop.d.ts +14 -0
- package/dist/internal/planning/mining-stop.d.ts.map +1 -0
- package/dist/internal/planning/mining-stop.js +42 -0
- package/dist/internal/planning/mining-stop.js.map +1 -0
- package/dist/internal/planning/movement-character.d.ts +7 -0
- package/dist/internal/planning/movement-character.d.ts.map +1 -0
- package/dist/internal/planning/movement-character.js +41 -0
- package/dist/internal/planning/movement-character.js.map +1 -0
- package/dist/internal/planning/movement-xp-guard.d.ts +4 -0
- package/dist/internal/planning/movement-xp-guard.d.ts.map +1 -0
- package/dist/internal/planning/movement-xp-guard.js +104 -0
- package/dist/internal/planning/movement-xp-guard.js.map +1 -0
- package/dist/internal/planning/open-signal-guard.d.ts +3 -0
- package/dist/internal/planning/open-signal-guard.d.ts.map +1 -0
- package/dist/internal/planning/open-signal-guard.js +32 -0
- package/dist/internal/planning/open-signal-guard.js.map +1 -0
- package/dist/internal/planning/open-signal.d.ts +31 -0
- package/dist/internal/planning/open-signal.d.ts.map +1 -0
- package/dist/internal/planning/open-signal.js +85 -0
- package/dist/internal/planning/open-signal.js.map +1 -0
- package/dist/internal/planning/original-token.d.ts +40 -0
- package/dist/internal/planning/original-token.d.ts.map +1 -0
- package/dist/internal/planning/original-token.js +112 -0
- package/dist/internal/planning/original-token.js.map +1 -0
- package/dist/internal/planning/own-starbase-facts.d.ts +33 -0
- package/dist/internal/planning/own-starbase-facts.d.ts.map +1 -0
- package/dist/internal/planning/own-starbase-facts.js +49 -0
- package/dist/internal/planning/own-starbase-facts.js.map +1 -0
- package/dist/internal/planning/plan-fields.d.ts +60 -0
- package/dist/internal/planning/plan-fields.d.ts.map +1 -0
- package/dist/internal/planning/plan-fields.js +159 -0
- package/dist/internal/planning/plan-fields.js.map +1 -0
- package/dist/internal/planning/plan-guards.d.ts +4 -0
- package/dist/internal/planning/plan-guards.d.ts.map +1 -0
- package/dist/internal/planning/plan-guards.js +175 -0
- package/dist/internal/planning/plan-guards.js.map +1 -0
- package/dist/internal/planning/profile-key.d.ts +13 -0
- package/dist/internal/planning/profile-key.d.ts.map +1 -0
- package/dist/internal/planning/profile-key.js +20 -0
- package/dist/internal/planning/profile-key.js.map +1 -0
- package/dist/internal/planning/recipe-state.d.ts +9 -0
- package/dist/internal/planning/recipe-state.d.ts.map +1 -0
- package/dist/internal/planning/recipe-state.js +23 -0
- package/dist/internal/planning/recipe-state.js.map +1 -0
- package/dist/internal/planning/rent-catalog.d.ts +37 -0
- package/dist/internal/planning/rent-catalog.d.ts.map +1 -0
- package/dist/internal/planning/rent-catalog.js +165 -0
- package/dist/internal/planning/rent-catalog.js.map +1 -0
- package/dist/internal/planning/rent.d.ts +19 -0
- package/dist/internal/planning/rent.d.ts.map +1 -0
- package/dist/internal/planning/rent.js +35 -0
- package/dist/internal/planning/rent.js.map +1 -0
- package/dist/internal/planning/research-unlock.d.ts +60 -0
- package/dist/internal/planning/research-unlock.d.ts.map +1 -0
- package/dist/internal/planning/research-unlock.js +208 -0
- package/dist/internal/planning/research-unlock.js.map +1 -0
- package/dist/internal/planning/respawn-guards.d.ts +3 -0
- package/dist/internal/planning/respawn-guards.d.ts.map +1 -0
- package/dist/internal/planning/respawn-guards.js +42 -0
- package/dist/internal/planning/respawn-guards.js.map +1 -0
- package/dist/internal/planning/runtime-guards.d.ts +41 -0
- package/dist/internal/planning/runtime-guards.d.ts.map +1 -0
- package/dist/internal/planning/runtime-guards.js +658 -0
- package/dist/internal/planning/runtime-guards.js.map +1 -0
- package/dist/internal/planning/scan-completion-guard.d.ts +43 -0
- package/dist/internal/planning/scan-completion-guard.d.ts.map +1 -0
- package/dist/internal/planning/scan-completion-guard.js +95 -0
- package/dist/internal/planning/scan-completion-guard.js.map +1 -0
- package/dist/internal/planning/scan-completion.d.ts +20 -0
- package/dist/internal/planning/scan-completion.d.ts.map +1 -0
- package/dist/internal/planning/scan-completion.js +197 -0
- package/dist/internal/planning/scan-completion.js.map +1 -0
- package/dist/internal/planning/scan-detect-guard.d.ts +34 -0
- package/dist/internal/planning/scan-detect-guard.d.ts.map +1 -0
- package/dist/internal/planning/scan-detect-guard.js +77 -0
- package/dist/internal/planning/scan-detect-guard.js.map +1 -0
- package/dist/internal/planning/scan-detect.d.ts +24 -0
- package/dist/internal/planning/scan-detect.d.ts.map +1 -0
- package/dist/internal/planning/scan-detect.js +245 -0
- package/dist/internal/planning/scan-detect.js.map +1 -0
- package/dist/internal/planning/scan-input.d.ts +9 -0
- package/dist/internal/planning/scan-input.d.ts.map +1 -0
- package/dist/internal/planning/scan-input.js +58 -0
- package/dist/internal/planning/scan-input.js.map +1 -0
- package/dist/internal/planning/ship-import-funding.d.ts +22 -0
- package/dist/internal/planning/ship-import-funding.d.ts.map +1 -0
- package/dist/internal/planning/ship-import-funding.js +53 -0
- package/dist/internal/planning/ship-import-funding.js.map +1 -0
- package/dist/internal/planning/ship-token.d.ts +1 -6
- package/dist/internal/planning/ship-token.d.ts.map +1 -1
- package/dist/internal/planning/ship-token.js +2 -41
- package/dist/internal/planning/ship-token.js.map +1 -1
- package/dist/internal/planning/starbase-player-owner.d.ts +21 -0
- package/dist/internal/planning/starbase-player-owner.d.ts.map +1 -0
- package/dist/internal/planning/starbase-player-owner.js +17 -0
- package/dist/internal/planning/starbase-player-owner.js.map +1 -0
- package/dist/internal/planning/starbase-system-guard.d.ts +6 -0
- package/dist/internal/planning/starbase-system-guard.d.ts.map +1 -0
- package/dist/internal/planning/starbase-system-guard.js +94 -0
- package/dist/internal/planning/starbase-system-guard.js.map +1 -0
- package/dist/internal/planning/starbase-system.d.ts +15 -0
- package/dist/internal/planning/starbase-system.d.ts.map +1 -0
- package/dist/internal/planning/starbase-system.js +25 -0
- package/dist/internal/planning/starbase-system.js.map +1 -0
- package/dist/internal/planning/token-mint.d.ts +4 -0
- package/dist/internal/planning/token-mint.d.ts.map +1 -0
- package/dist/internal/planning/token-mint.js +16 -0
- package/dist/internal/planning/token-mint.js.map +1 -0
- package/dist/internal/planning/trade-faction-market.d.ts +20 -0
- package/dist/internal/planning/trade-faction-market.d.ts.map +1 -0
- package/dist/internal/planning/trade-faction-market.js +56 -0
- package/dist/internal/planning/trade-faction-market.js.map +1 -0
- package/dist/internal/planning/wallet-starbase.d.ts +34 -0
- package/dist/internal/planning/wallet-starbase.d.ts.map +1 -0
- package/dist/internal/planning/wallet-starbase.js +39 -0
- package/dist/internal/planning/wallet-starbase.js.map +1 -0
- package/dist/internal/planning/xp-runtime.d.ts +36 -0
- package/dist/internal/planning/xp-runtime.d.ts.map +1 -0
- package/dist/internal/planning/xp-runtime.js +117 -0
- package/dist/internal/planning/xp-runtime.js.map +1 -0
- package/dist/internal/read-meta.d.ts +12 -0
- package/dist/internal/read-meta.d.ts.map +1 -1
- package/dist/internal/read-meta.js +10 -0
- package/dist/internal/read-meta.js.map +1 -1
- package/dist/internal/system-program.d.ts +4 -0
- package/dist/internal/system-program.d.ts.map +1 -0
- package/dist/internal/system-program.js +3 -0
- package/dist/internal/system-program.js.map +1 -0
- package/dist/loyalty/actions/index.d.ts +1 -1
- package/dist/loyalty/actions/index.d.ts.map +1 -1
- package/dist/loyalty/actions/index.js +15 -45
- package/dist/loyalty/actions/index.js.map +1 -1
- package/dist/loyalty/index.d.ts.map +1 -1
- package/dist/loyalty/index.js +6 -18
- package/dist/loyalty/index.js.map +1 -1
- package/dist/markets/actions/index.d.ts +62 -4
- package/dist/markets/actions/index.d.ts.map +1 -1
- package/dist/markets/actions/index.js +230 -178
- package/dist/markets/actions/index.js.map +1 -1
- package/dist/markets/actions/trade-faction-market.d.ts +43 -0
- package/dist/markets/actions/trade-faction-market.d.ts.map +1 -0
- package/dist/markets/actions/trade-faction-market.js +277 -0
- package/dist/markets/actions/trade-faction-market.js.map +1 -0
- package/dist/markets/index.d.ts +38 -7
- package/dist/markets/index.d.ts.map +1 -1
- package/dist/markets/index.js +59 -20
- package/dist/markets/index.js.map +1 -1
- package/dist/mining/actions/index.d.ts +87 -0
- package/dist/mining/actions/index.d.ts.map +1 -0
- package/dist/mining/actions/index.js +319 -0
- package/dist/mining/actions/index.js.map +1 -0
- package/dist/mining/estimate.d.ts +114 -0
- package/dist/mining/estimate.d.ts.map +1 -0
- package/dist/mining/estimate.js +127 -0
- package/dist/mining/estimate.js.map +1 -0
- package/dist/mining/index.d.ts +9 -2
- package/dist/mining/index.d.ts.map +1 -1
- package/dist/mining/index.js +10 -13
- package/dist/mining/index.js.map +1 -1
- package/dist/mining/profile.d.ts +82 -0
- package/dist/mining/profile.d.ts.map +1 -0
- package/dist/mining/profile.js +109 -0
- package/dist/mining/profile.js.map +1 -0
- package/dist/planning/assembly.d.ts +6 -1
- package/dist/planning/assembly.d.ts.map +1 -1
- package/dist/planning/assembly.js +12 -8
- package/dist/planning/assembly.js.map +1 -1
- package/dist/planning/execution.d.ts +19 -3
- package/dist/planning/execution.d.ts.map +1 -1
- package/dist/planning/execution.js +540 -72
- package/dist/planning/execution.js.map +1 -1
- package/dist/planning/index.d.ts +217 -149
- package/dist/planning/index.d.ts.map +1 -1
- package/dist/planning/index.js +31 -355
- package/dist/planning/index.js.map +1 -1
- package/dist/planning/plan-construction.d.ts +25 -0
- package/dist/planning/plan-construction.d.ts.map +1 -0
- package/dist/planning/plan-construction.js +143 -0
- package/dist/planning/plan-construction.js.map +1 -0
- package/dist/planning/plan-sequence-checkpoint.d.ts +9 -0
- package/dist/planning/plan-sequence-checkpoint.d.ts.map +1 -1
- package/dist/planning/plan-sequence-checkpoint.js +16 -7
- package/dist/planning/plan-sequence-checkpoint.js.map +1 -1
- package/dist/planning/plan-sequence-execution.d.ts +5 -0
- package/dist/planning/plan-sequence-execution.d.ts.map +1 -1
- package/dist/planning/plan-sequence-execution.js +74 -40
- package/dist/planning/plan-sequence-execution.js.map +1 -1
- package/dist/planning/plan-sequence.d.ts +2 -1
- package/dist/planning/plan-sequence.d.ts.map +1 -1
- package/dist/planning/plan-sequence.js +8 -1
- package/dist/planning/plan-sequence.js.map +1 -1
- package/dist/planning/plan-validation.d.ts +17 -0
- package/dist/planning/plan-validation.d.ts.map +1 -0
- package/dist/planning/plan-validation.js +135 -0
- package/dist/planning/plan-validation.js.map +1 -0
- package/dist/planning/simulation.d.ts +25 -1
- package/dist/planning/simulation.d.ts.map +1 -1
- package/dist/planning/simulation.js +111 -11
- package/dist/planning/simulation.js.map +1 -1
- package/dist/registry/cargo.d.ts +7 -12
- package/dist/registry/cargo.d.ts.map +1 -1
- package/dist/registry/cargo.js +20 -20
- package/dist/registry/cargo.js.map +1 -1
- package/dist/registry/docking.d.ts +10 -0
- package/dist/registry/docking.d.ts.map +1 -0
- package/dist/registry/docking.js +12 -0
- package/dist/registry/docking.js.map +1 -0
- package/dist/registry/index.d.ts +4 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +190 -224
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/onboarding.d.ts +10 -2
- package/dist/registry/onboarding.d.ts.map +1 -1
- package/dist/registry/onboarding.js +20 -7
- package/dist/registry/onboarding.js.map +1 -1
- package/dist/registry/scanning.d.ts +7 -0
- package/dist/registry/scanning.d.ts.map +1 -0
- package/dist/registry/scanning.js +13 -0
- package/dist/registry/scanning.js.map +1 -0
- package/dist/registry/ship-stats-snapshot.js +19 -19
- package/dist/registry/ship-stats-snapshot.js.map +1 -1
- package/dist/registry/ships.d.ts +22 -2
- package/dist/registry/ships.d.ts.map +1 -1
- package/dist/registry/ships.js +31 -4
- package/dist/registry/ships.js.map +1 -1
- package/dist/registry/xp-runtime.d.ts +4 -0
- package/dist/registry/xp-runtime.d.ts.map +1 -0
- package/dist/registry/xp-runtime.js +14 -0
- package/dist/registry/xp-runtime.js.map +1 -0
- package/dist/rewards/index.d.ts +11 -5
- package/dist/rewards/index.d.ts.map +1 -1
- package/dist/rewards/index.js +10 -21
- package/dist/rewards/index.js.map +1 -1
- package/dist/scanning/actions/index.d.ts +116 -0
- package/dist/scanning/actions/index.d.ts.map +1 -0
- package/dist/scanning/actions/index.js +191 -0
- package/dist/scanning/actions/index.js.map +1 -0
- package/dist/scanning/index.d.ts +9 -12
- package/dist/scanning/index.d.ts.map +1 -1
- package/dist/scanning/index.js +18 -22
- package/dist/scanning/index.js.map +1 -1
- package/dist/scanning/lifecycle.d.ts +77 -0
- package/dist/scanning/lifecycle.d.ts.map +1 -0
- package/dist/scanning/lifecycle.js +93 -0
- package/dist/scanning/lifecycle.js.map +1 -0
- package/dist/scanning/odds.d.ts +111 -0
- package/dist/scanning/odds.d.ts.map +1 -0
- package/dist/scanning/odds.js +294 -0
- package/dist/scanning/odds.js.map +1 -0
- package/dist/scanning/signals.d.ts +121 -0
- package/dist/scanning/signals.d.ts.map +1 -0
- package/dist/scanning/signals.js +171 -0
- package/dist/scanning/signals.js.map +1 -0
- package/dist/starbases/actions/index.d.ts +6 -4
- package/dist/starbases/actions/index.d.ts.map +1 -1
- package/dist/starbases/actions/index.js +34 -67
- package/dist/starbases/actions/index.js.map +1 -1
- package/dist/starbases/index.d.ts.map +1 -1
- package/dist/starbases/index.js +3 -11
- package/dist/starbases/index.js.map +1 -1
- package/dist/world/index.d.ts +108 -5
- package/dist/world/index.d.ts.map +1 -1
- package/dist/world/index.js +110 -15
- package/dist/world/index.js.map +1 -1
- package/dist/world/planet-claim-stake-plots.d.ts +139 -0
- package/dist/world/planet-claim-stake-plots.d.ts.map +1 -0
- package/dist/world/planet-claim-stake-plots.js +117 -0
- package/dist/world/planet-claim-stake-plots.js.map +1 -0
- package/dist/world/starbase-status.d.ts +176 -0
- package/dist/world/starbase-status.d.ts.map +1 -0
- package/dist/world/starbase-status.js +153 -0
- package/dist/world/starbase-status.js.map +1 -0
- package/package.json +10 -2
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { deriveCurrencyCache, validateCurrencyCache, } from '../../internal/c4/currency-cache.js';
|
|
2
|
+
import { validateStarbaseSystem } from '../../internal/planning/starbase-system.js';
|
|
3
|
+
import { SYSTEM_PROGRAM } from '../../internal/system-program.js';
|
|
4
|
+
import { isAddress } from '@solana/kit';
|
|
5
|
+
import { resolveActionRuntime } from '../../internal/planning/action-runtime.js';
|
|
6
|
+
import { requireProfileStarbasePlayer } from '../../internal/planning/starbase-player-owner.js';
|
|
2
7
|
import { InvalidActionInputError, SageSdkError } from '../../client/errors.js';
|
|
3
8
|
import { readContextRawAccounts } from '../../client/reconciliation.js';
|
|
4
|
-
import {
|
|
9
|
+
import { SAGE_PROGRAM_ADDRESS } from '../../internal/c4/runtime-bindings.js';
|
|
5
10
|
import { craftingHabAccountDefinition, craftingProcessAccountDefinition, deriveRecipeAddress, recipeAccountDefinition, } from '../../internal/c4/crafting.js';
|
|
6
|
-
import { characterAccountDefinition, findCharacterPda, } from '../../internal/c4/
|
|
11
|
+
import { characterAccountDefinition, findCharacterPda, } from '../../internal/c4/character.js';
|
|
7
12
|
import { deriveStarbasePlayerAddress, starbasePlayerAccountDefinition, } from '../../internal/c4/starbase.js';
|
|
8
13
|
import { deriveInternalCraftingProcessState } from '../../internal/crafting-process-state.js';
|
|
9
14
|
import { requireGameAddress } from '../../internal/game-context.js';
|
|
10
|
-
import { adaptCancelCraftingProcessInstruction, adaptStartCraftingProcessInstruction, adaptCompleteCraftingProcessInstruction,
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
15
|
+
import { adaptCancelCraftingProcessInstruction, adaptStartCraftingProcessInstruction, adaptCompleteCraftingProcessInstruction, readPlanAuthorization, } from '../../internal/planning/authorization-adapter.js';
|
|
16
|
+
import { starSystemAccountDefinition } from '../../internal/c4/world.js';
|
|
17
|
+
import { buildPlannerPlan } from '../../planning/plan-construction.js';
|
|
18
|
+
import { hashRecipeConfiguration, validateRecipeUsage, } from '../../internal/planning/recipe-state.js';
|
|
19
|
+
import { accountStatePrecondition } from '../../internal/planning/account-state.js';
|
|
20
|
+
import { GAME_DISCRIMINATOR } from '../../internal/c4/discriminators.js';
|
|
13
21
|
const U64_MAX = (1n << 64n) - 1n;
|
|
14
22
|
const U32_MAX = 4_294_967_295;
|
|
15
23
|
function invalid(field, value, acceptedRange, remedy) {
|
|
@@ -38,15 +46,7 @@ function readAddress(value, field) {
|
|
|
38
46
|
function validateStartOptions(value) {
|
|
39
47
|
const options = readRecord(value, 'options');
|
|
40
48
|
assertKeys(options, 'options', ['authorization', 'craftingProcess', 'quantity', 'numCrew'], ['craftingHab']);
|
|
41
|
-
const
|
|
42
|
-
assertKeys(authorizationRecord, 'authorization', ['profile', 'authority', 'keyIndex'], ['certificate']);
|
|
43
|
-
const authorization = authorizationRecord;
|
|
44
|
-
readAddress(authorization.profile, 'authorization.profile');
|
|
45
|
-
readAddress(authorization.authority, 'authorization.authority');
|
|
46
|
-
if (authorization.certificate !== undefined) {
|
|
47
|
-
readAddress(authorization.certificate, 'authorization.certificate');
|
|
48
|
-
}
|
|
49
|
-
validatePlanAuthorization(authorization);
|
|
49
|
+
const authorization = readPlanAuthorization(options.authorization);
|
|
50
50
|
if (typeof options.quantity !== 'bigint' ||
|
|
51
51
|
options.quantity <= 0n ||
|
|
52
52
|
options.quantity > U64_MAX) {
|
|
@@ -54,9 +54,9 @@ function validateStartOptions(value) {
|
|
|
54
54
|
}
|
|
55
55
|
if (typeof options.numCrew !== 'number' ||
|
|
56
56
|
!Number.isInteger(options.numCrew) ||
|
|
57
|
-
options.numCrew <
|
|
57
|
+
options.numCrew < 1 ||
|
|
58
58
|
options.numCrew > U32_MAX) {
|
|
59
|
-
invalid('numCrew', options.numCrew, `an integer from
|
|
59
|
+
invalid('numCrew', options.numCrew, `an integer from 1 through ${String(U32_MAX)} (unsigned u32)`, 'Set numCrew to at least one crew member, within the instruction codec range; a Crafting Process cannot start without crew.');
|
|
60
60
|
}
|
|
61
61
|
return {
|
|
62
62
|
authorization,
|
|
@@ -68,35 +68,11 @@ function validateStartOptions(value) {
|
|
|
68
68
|
: { craftingHab: options.craftingHab }),
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
assertKeys(options, 'options', ['authorization', 'atUnixSeconds']);
|
|
74
|
-
const authorizationRecord = readRecord(options.authorization, 'authorization');
|
|
75
|
-
assertKeys(authorizationRecord, 'authorization', ['profile', 'authority', 'keyIndex'], ['certificate']);
|
|
76
|
-
const authorization = authorizationRecord;
|
|
77
|
-
readAddress(authorization.profile, 'authorization.profile');
|
|
78
|
-
readAddress(authorization.authority, 'authorization.authority');
|
|
79
|
-
if (authorization.certificate !== undefined) {
|
|
80
|
-
readAddress(authorization.certificate, 'authorization.certificate');
|
|
81
|
-
}
|
|
82
|
-
validatePlanAuthorization(authorization);
|
|
83
|
-
if (typeof options.atUnixSeconds !== 'bigint' || options.atUnixSeconds < 0n) {
|
|
84
|
-
invalid('atUnixSeconds', options.atUnixSeconds, 'a non-negative bigint Unix timestamp', 'Set atUnixSeconds to the explicit current Unix timestamp before retrying.');
|
|
85
|
-
}
|
|
86
|
-
return { atUnixSeconds: options.atUnixSeconds, authorization };
|
|
87
|
-
}
|
|
88
|
-
function validateCancelOptions(value) {
|
|
71
|
+
/** Validates completion or cancellation options, which share one shape. */
|
|
72
|
+
function validateProcessOptions(value) {
|
|
89
73
|
const options = readRecord(value, 'options');
|
|
90
74
|
assertKeys(options, 'options', ['authorization', 'atUnixSeconds']);
|
|
91
|
-
const
|
|
92
|
-
assertKeys(authorizationRecord, 'authorization', ['profile', 'authority', 'keyIndex'], ['certificate']);
|
|
93
|
-
const authorization = authorizationRecord;
|
|
94
|
-
readAddress(authorization.profile, 'authorization.profile');
|
|
95
|
-
readAddress(authorization.authority, 'authorization.authority');
|
|
96
|
-
if (authorization.certificate !== undefined) {
|
|
97
|
-
readAddress(authorization.certificate, 'authorization.certificate');
|
|
98
|
-
}
|
|
99
|
-
validatePlanAuthorization(authorization);
|
|
75
|
+
const authorization = readPlanAuthorization(options.authorization);
|
|
100
76
|
if (typeof options.atUnixSeconds !== 'bigint' || options.atUnixSeconds < 0n) {
|
|
101
77
|
invalid('atUnixSeconds', options.atUnixSeconds, 'a non-negative bigint Unix timestamp', 'Set atUnixSeconds to the explicit current Unix timestamp before retrying.');
|
|
102
78
|
}
|
|
@@ -134,48 +110,19 @@ function validateKnownInputs(recipe, items, quantity, source, sourceAddress) {
|
|
|
134
110
|
}
|
|
135
111
|
}
|
|
136
112
|
}
|
|
137
|
-
async function
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
seeds: [
|
|
141
|
-
getBytesEncoder().encode(new TextEncoder().encode('CurrencyConfig')),
|
|
142
|
-
getAddressEncoder().encode(game),
|
|
143
|
-
],
|
|
144
|
-
});
|
|
145
|
-
return address;
|
|
146
|
-
}
|
|
147
|
-
function validateCurrencyCache(account, game, canonicalAddress) {
|
|
148
|
-
const decoder = sage.getCurrencyConfigCacheDecoder();
|
|
149
|
-
const validDiscriminator = sage.CURRENCY_CONFIG_CACHE_DISCRIMINATOR.every((byte, index) => account.data[index] === byte);
|
|
150
|
-
if (account.address !== canonicalAddress ||
|
|
151
|
-
account.owner !== sage.SAGE_PROGRAM_ADDRESS ||
|
|
152
|
-
account.data.length !== decoder.fixedSize ||
|
|
153
|
-
!validDiscriminator ||
|
|
154
|
-
decoder.decode(account.data).gameId !== game) {
|
|
155
|
-
fail(`CurrencyCache ${account.address} does not match the configured Game, canonical PDA, owner, or pinned account layout. Refresh the Game currency configuration and retry.`, account.address);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
async function hashAccountState(account) {
|
|
159
|
-
const owner = getAddressEncoder().encode(account.owner);
|
|
160
|
-
const canonical = new Uint8Array(owner.length + account.data.length);
|
|
161
|
-
canonical.set(owner);
|
|
162
|
-
canonical.set(account.data, owner.length);
|
|
163
|
-
const digest = new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', canonical));
|
|
164
|
-
return [...digest].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
165
|
-
}
|
|
166
|
-
async function precondition(account, describes) {
|
|
167
|
-
return Object.freeze({
|
|
113
|
+
async function recipePrecondition(account, describes, requiredUses = 0n) {
|
|
114
|
+
return {
|
|
115
|
+
kind: 'recipe-state',
|
|
168
116
|
address: account.address,
|
|
169
|
-
|
|
117
|
+
configHash: await hashRecipeConfiguration(account),
|
|
118
|
+
requiredUses,
|
|
170
119
|
describes,
|
|
171
|
-
|
|
172
|
-
});
|
|
120
|
+
};
|
|
173
121
|
}
|
|
174
|
-
async function resolveAccounts(ctx, recipe, player, options, game) {
|
|
175
|
-
const character = await findCharacterPda(options.authorization.profile, game);
|
|
122
|
+
async function resolveAccounts(ctx, recipe, player, options, game, character) {
|
|
176
123
|
const currencyCache = options.craftingHab === undefined
|
|
177
124
|
? undefined
|
|
178
|
-
: await
|
|
125
|
+
: await deriveCurrencyCache(game).then(([address]) => address);
|
|
179
126
|
const addresses = [
|
|
180
127
|
character,
|
|
181
128
|
player.address,
|
|
@@ -218,11 +165,12 @@ async function resolveAccounts(ctx, recipe, player, options, game) {
|
|
|
218
165
|
recipeData.id !== recipe.id ||
|
|
219
166
|
recipeData.status !== recipe.status ||
|
|
220
167
|
recipeData.habRequired !== recipe.habRequired ||
|
|
221
|
-
recipeData.usageCountRaw !== recipe.usageCountRaw ||
|
|
222
168
|
recipeData.usageLimitRaw !== recipe.usageLimitRaw ||
|
|
223
169
|
!sameBalances(recipe.ingredients, recipeData.inputs)) {
|
|
224
170
|
fail(`Recipe ${recipe.address} changed or does not match the configured Game, canonical PDA, status, limits, or ingredients. Refresh the Recipe through this context and retry.`, recipe.address);
|
|
225
171
|
}
|
|
172
|
+
// One start consumes one Recipe use, independent of the crafted quantity.
|
|
173
|
+
validateRecipeUsage(recipeAccount, 1n);
|
|
226
174
|
if (options.craftingHab === undefined) {
|
|
227
175
|
return { character, characterAccount, playerAccount, recipeAccount };
|
|
228
176
|
}
|
|
@@ -234,13 +182,22 @@ async function resolveAccounts(ctx, recipe, player, options, game) {
|
|
|
234
182
|
habData.ownerProfile !== options.authorization.profile ||
|
|
235
183
|
habData.system !== player.system.address ||
|
|
236
184
|
habData.state.kind !== options.craftingHab.state.kind ||
|
|
185
|
+
// The crew reservation was computed from the snapshot's modifier.
|
|
186
|
+
habData.modifiers.crewCount.raw !==
|
|
187
|
+
options.craftingHab.modifiers.crewCount.raw ||
|
|
237
188
|
Math.max(0, habData.jobCapacity - habData.jobsRunning) !==
|
|
238
189
|
options.craftingHab.availableJobSlots ||
|
|
239
190
|
!habData.unlockedRecipeIds.includes(recipe.id) ||
|
|
240
191
|
!sameBalances(options.craftingHab.production.inventory.items, habData.production.inventory.amounts)) {
|
|
241
|
-
fail(`Crafting Hab ${options.craftingHab.address} changed or does not match its Game, Profile, System, active capacity, unlocked Recipe, or production inventory. Refresh the Crafting Hab through this context and retry.`, options.craftingHab.address);
|
|
192
|
+
fail(`Crafting Hab ${options.craftingHab.address} changed or does not match its Game, Profile, System, active capacity, crew-count modifier, unlocked Recipe, or production inventory. Refresh the Crafting Hab through this context and retry.`, options.craftingHab.address);
|
|
242
193
|
}
|
|
243
|
-
|
|
194
|
+
// The Character's research concurrency bonus raises the Hab's job limit.
|
|
195
|
+
const jobLimit = habData.jobCapacity +
|
|
196
|
+
characterData.modifiers.values.craftingJobConcurrencyBonus;
|
|
197
|
+
if (habData.jobsRunning >= jobLimit) {
|
|
198
|
+
fail(`Crafting Hab ${options.craftingHab.address} runs ${String(habData.jobsRunning)} jobs, its limit including the Character's concurrency bonus (${String(jobLimit)}). Complete or cancel another Hab job, refresh it, and retry.`, options.craftingHab.address);
|
|
199
|
+
}
|
|
200
|
+
await validateCurrencyCache(currencyCacheAccount, game, 'crafting');
|
|
244
201
|
return {
|
|
245
202
|
character,
|
|
246
203
|
characterAccount,
|
|
@@ -254,9 +211,16 @@ async function resolveAccounts(ctx, recipe, player, options, game) {
|
|
|
254
211
|
/** Plans one Crafting Process start without signing, simulation, or writes.
|
|
255
212
|
*
|
|
256
213
|
* The planner validates the loaded Recipe and Starbase Player, optional Hab,
|
|
257
|
-
* known ingredient balances,
|
|
258
|
-
*
|
|
259
|
-
*
|
|
214
|
+
* known ingredient balances, the crew the job reserves, the Hab job limit
|
|
215
|
+
* including the Character's research concurrency bonus, and exact
|
|
216
|
+
* whole-account state. The ATLAS fee and any crew-roster bonuses remain
|
|
217
|
+
* chain-authoritative. It returns one inert Plan whose two required signer
|
|
218
|
+
* roles are bound only during execution.
|
|
219
|
+
*
|
|
220
|
+
* Each start consumes exactly one Recipe use, whatever its quantity, and needs
|
|
221
|
+
* the Recipe's fresh `usageCountRaw` to be below `usageLimitRaw`. A stored
|
|
222
|
+
* limit of `0n` is therefore never usable. Cancelling or destroying a process
|
|
223
|
+
* returns its use. See `docs/evidence/crafting-zero-usage-limit.md`.
|
|
260
224
|
*
|
|
261
225
|
* @example
|
|
262
226
|
* ```ts
|
|
@@ -275,26 +239,19 @@ export async function planStartCraftingProcess(ctx, recipe, player, input) {
|
|
|
275
239
|
if (recipe.game.address !== game || canonicalRecipe !== recipe.address) {
|
|
276
240
|
fail(`Recipe ${recipe.address} does not match the configured Game ${game} or its canonical recipe-id PDA. Refresh the Recipe through this context and retry.`, recipe.address);
|
|
277
241
|
}
|
|
278
|
-
|
|
279
|
-
fail(`Starbase Player ${player.address} does not belong to authorization Profile ${options.authorization.profile}. Refresh the Starbase Player for that Profile and retry.`, player.address);
|
|
280
|
-
}
|
|
281
|
-
const canonicalPlayer = await deriveStarbasePlayerAddress(player.system.address, player.character.address);
|
|
282
|
-
if (canonicalPlayer !== player.address) {
|
|
283
|
-
fail(`Starbase Player ${player.address} is not canonical for its Character and System. Refresh the Starbase Player through this context and retry.`, player.address);
|
|
284
|
-
}
|
|
242
|
+
const character = await requireProfileStarbasePlayer(player, options.authorization.profile, game);
|
|
285
243
|
if (recipe.status !== 'active') {
|
|
286
244
|
fail(`Recipe ${recipe.name} is ${recipe.status}, so it cannot start a Crafting Process. Choose an active Recipe, refresh it, and retry.`, recipe.address);
|
|
287
245
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
fail(`Starbase Player ${player.address} has only ${String(player.availableCrew)} crew available, but numCrew requested ${String(options.numCrew)}. Reduce numCrew or free crew, refresh the Starbase Player, and retry.`, player.address);
|
|
246
|
+
// A Crafting Hab scales the reserved crew by its crew-count modifier
|
|
247
|
+
// (U26F6, 64 raw units per 1.0), rounded up.
|
|
248
|
+
const reservedCrew = options.craftingHab === undefined
|
|
249
|
+
? BigInt(options.numCrew)
|
|
250
|
+
: (BigInt(options.numCrew) * options.craftingHab.modifiers.crewCount.raw +
|
|
251
|
+
63n) /
|
|
252
|
+
64n;
|
|
253
|
+
if (reservedCrew > BigInt(player.availableCrew)) {
|
|
254
|
+
fail(`Starbase Player ${player.address} has only ${String(player.availableCrew)} crew available, but this job reserves ${String(reservedCrew)} (numCrew ${String(options.numCrew)}${options.craftingHab === undefined ? '' : ' scaled by the Crafting Hab crew-count modifier'}). Reduce numCrew or free crew, refresh the Starbase Player, and retry.`, player.address);
|
|
298
255
|
}
|
|
299
256
|
if (recipe.habRequired && options.craftingHab === undefined) {
|
|
300
257
|
fail(`Recipe ${recipe.name} requires a Crafting Hab. Provide craftingHab from the same Profile and Star System before retrying.`, recipe.address);
|
|
@@ -312,37 +269,47 @@ export async function planStartCraftingProcess(ctx, recipe, player, input) {
|
|
|
312
269
|
if (options.craftingHab.state.kind !== 'active') {
|
|
313
270
|
fail(`Crafting Hab ${options.craftingHab.address} is ${options.craftingHab.state.kind}; it must be active before starting a Crafting Process. Refresh or reactivate the Hab and retry.`, options.craftingHab.address);
|
|
314
271
|
}
|
|
315
|
-
if (options.craftingHab.availableJobSlots < 1) {
|
|
316
|
-
fail(`Crafting Hab ${options.craftingHab.address} has no available job slots. Complete or cancel another Hab job, refresh it, and retry.`, options.craftingHab.address);
|
|
317
|
-
}
|
|
318
272
|
if (!options.craftingHab.unlockedRecipes.some(({ address }) => address === recipe.address)) {
|
|
319
273
|
fail(`Crafting Hab ${options.craftingHab.address} has not unlocked Recipe ${recipe.name}. Choose an unlocked Recipe or update the Hab before retrying.`, options.craftingHab.address);
|
|
320
274
|
}
|
|
321
|
-
validateKnownInputs(recipe, options.craftingHab.production.inventory.items, options.quantity, 'Crafting Hab', options.craftingHab.address);
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
validateKnownInputs(recipe, player.cargo.items, options.quantity, 'Starbase Player', player.address);
|
|
325
275
|
}
|
|
326
|
-
|
|
276
|
+
// Inputs come from the Starbase Player's cargo whether or not a Hab is used.
|
|
277
|
+
validateKnownInputs(recipe, player.cargo.items, options.quantity, 'Starbase Player', player.address);
|
|
278
|
+
const resolved = await resolveAccounts(ctx, recipe, player, options, game, character);
|
|
279
|
+
const [runtimeSystem] = await readContextRawAccounts(ctx, [
|
|
280
|
+
player.system.address,
|
|
281
|
+
]);
|
|
282
|
+
if (!runtimeSystem)
|
|
283
|
+
fail('The crafting System is missing. Refresh the Starbase and recreate this Plan.', player.system.address);
|
|
284
|
+
const runtime = await resolveActionRuntime(ctx, {
|
|
285
|
+
mode: 'crafting-start',
|
|
286
|
+
game,
|
|
287
|
+
system: player.system.address,
|
|
288
|
+
starbaseSeqId: starSystemAccountDefinition.decode(runtimeSystem).sequenceId,
|
|
289
|
+
...(options.craftingHab === undefined
|
|
290
|
+
? {}
|
|
291
|
+
: { structure: options.craftingHab.address }),
|
|
292
|
+
});
|
|
327
293
|
const description = `Start crafting ${String(options.quantity)} units of ${recipe.name} with ${String(options.numCrew)} crew at Starbase Player ${player.address}.`;
|
|
328
294
|
const preconditions = [
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
295
|
+
accountStatePrecondition(resolved.characterAccount, `The canonical Character remains assigned to Profile ${options.authorization.profile} in the configured Game.`),
|
|
296
|
+
accountStatePrecondition(resolved.playerAccount, `Starbase Player ${player.address} retains its Character, Profile, System, crew, and input inventory.`),
|
|
297
|
+
recipePrecondition(resolved.recipeAccount, `Recipe ${recipe.name} retains its configuration and at least one remaining use for this job.`, 1n),
|
|
332
298
|
...(resolved.habAccount === undefined
|
|
333
299
|
? []
|
|
334
300
|
: [
|
|
335
|
-
|
|
336
|
-
precondition(resolved.currencyCacheAccount, 'The canonical CurrencyCache remains assigned to the configured Game for Hab crafting.'),
|
|
301
|
+
accountStatePrecondition(resolved.habAccount, `Crafting Hab ${resolved.habAccount.address} remains active with an available job slot and the Recipe unlocked; inputs come from the Starbase Player's cargo.`),
|
|
337
302
|
]),
|
|
338
303
|
];
|
|
339
|
-
return
|
|
304
|
+
return buildPlannerPlan({
|
|
340
305
|
kind: 'crafting.start-process',
|
|
341
|
-
preconditions: await Promise.all(preconditions),
|
|
306
|
+
preconditions: [...runtime.guards, ...(await Promise.all(preconditions))],
|
|
342
307
|
steps: [
|
|
343
308
|
{
|
|
344
|
-
describes: description
|
|
309
|
+
describes: `${description} ${runtime.description}`,
|
|
345
310
|
instruction: adaptStartCraftingProcessInstruction({
|
|
311
|
+
...runtime.accounts,
|
|
312
|
+
starbaseGovernance: runtime.accounts.starbaseGovernance,
|
|
346
313
|
authorization: options.authorization,
|
|
347
314
|
character: resolved.character,
|
|
348
315
|
craftingProcess: options.craftingProcess,
|
|
@@ -362,7 +329,7 @@ export async function planStartCraftingProcess(ctx, recipe, player, input) {
|
|
|
362
329
|
signers: [options.authorization.authority, options.craftingProcess],
|
|
363
330
|
},
|
|
364
331
|
],
|
|
365
|
-
summary: description
|
|
332
|
+
summary: `${description} ${runtime.description}`,
|
|
366
333
|
});
|
|
367
334
|
}
|
|
368
335
|
function sameProcessSnapshot(process, account) {
|
|
@@ -372,7 +339,7 @@ function sameProcessSnapshot(process, account) {
|
|
|
372
339
|
account.system === process.system.address &&
|
|
373
340
|
account.starbasePlayer === process.starbasePlayer.address &&
|
|
374
341
|
account.starbaseSequenceId === process.starbaseSequenceId &&
|
|
375
|
-
account.craftingHab === process.craftingHab
|
|
342
|
+
account.craftingHab === process.craftingHab?.address &&
|
|
376
343
|
account.quantityRaw === process.quantityRaw &&
|
|
377
344
|
account.numCrew === process.numCrew &&
|
|
378
345
|
account.startsAtUnixSeconds === process.startsAtUnixSeconds &&
|
|
@@ -382,47 +349,57 @@ function sameProcessSnapshot(process, account) {
|
|
|
382
349
|
account.inputs.storageCostRaw === process.inputs.usedStorageUnitsRaw &&
|
|
383
350
|
sameBalances(process.inputs.items, account.inputs.amounts));
|
|
384
351
|
}
|
|
352
|
+
/** SDK reads omit `craftingHab` for a Process without a Hab; a caller-built
|
|
353
|
+
* snapshot carrying the raw stored System address is rejected with that cause
|
|
354
|
+
* instead of being read as a Hab and reported as a changed Process. */
|
|
355
|
+
function processHabAddress(process) {
|
|
356
|
+
const habAddress = process.craftingHab?.address;
|
|
357
|
+
if (habAddress === SYSTEM_PROGRAM)
|
|
358
|
+
invalid('process.craftingHab', habAddress, 'a Crafting Hab address, or no craftingHab for a Process started without a Hab', 'The stored System address means this Process has no Hab. Use a snapshot from getCraftingProcess, which omits craftingHab, or omit craftingHab, then plan again.');
|
|
359
|
+
return habAddress;
|
|
360
|
+
}
|
|
385
361
|
function validateGameRead(account, game) {
|
|
386
362
|
if (account.address !== game ||
|
|
387
|
-
account.owner !==
|
|
388
|
-
account.data.length <
|
|
389
|
-
!
|
|
363
|
+
account.owner !== SAGE_PROGRAM_ADDRESS ||
|
|
364
|
+
account.data.length < GAME_DISCRIMINATOR.length ||
|
|
365
|
+
!GAME_DISCRIMINATOR.every((byte, index) => account.data[index] === byte)) {
|
|
390
366
|
fail(`Game ${account.address} does not match the configured address, owner, or pinned account layout. Refresh the configured Game and retry.`, account.address);
|
|
391
367
|
}
|
|
392
368
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
369
|
+
/** Reads and validates the Crafting Process graph shared by completion and
|
|
370
|
+
* cancellation, with `extra` in the same read: the unchanged Process, its
|
|
371
|
+
* canonical System and Starbase, the unchanged Recipe and its Hab policy, the
|
|
372
|
+
* Profile's canonical Starbase Player and Character, and the Process Hab,
|
|
373
|
+
* active and owned, when present. `action` completes the remedies, and
|
|
374
|
+
* `staleStarbaseGuidance` adds advice for a replaced Starbase. */
|
|
375
|
+
async function resolveProcessAccounts(ctx, process, profile, game, action, extra, staleStarbaseGuidance) {
|
|
376
|
+
const character = await findCharacterPda(profile, game);
|
|
377
|
+
const habAddress = processHabAddress(process);
|
|
378
|
+
const [processCandidate, recipeCandidate, playerCandidate, systemCandidate, characterCandidate, extraAccount, habCandidate,] = await readContextRawAccounts(ctx, [
|
|
400
379
|
process.address,
|
|
401
380
|
process.recipe.address,
|
|
402
381
|
process.starbasePlayer.address,
|
|
403
382
|
process.system.address,
|
|
404
|
-
...(habAddress === undefined ? [] : [habAddress]),
|
|
405
383
|
character,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
];
|
|
409
|
-
const
|
|
410
|
-
const byAddress = new Map(addresses.map((address, index) => [address, reads[index]]));
|
|
411
|
-
const processAccount = requireAccount(byAddress.get(process.address), process.address, `Crafting Process ${process.address} is missing, so it may already be cancelled or closed. Refresh the Crafting Process and retry only if it still exists.`);
|
|
412
|
-
const recipeAccount = requireAccount(byAddress.get(process.recipe.address), process.recipe.address, `Recipe ${process.recipe.address} is missing. Refresh the Crafting Process and its Recipe before retrying completion.`);
|
|
413
|
-
const playerAccount = requireAccount(byAddress.get(process.starbasePlayer.address), process.starbasePlayer.address, `Starbase Player ${process.starbasePlayer.address} is missing. Refresh the Crafting Process and Starbase Player before retrying completion.`);
|
|
414
|
-
const systemAccount = requireAccount(byAddress.get(process.system.address), process.system.address, `Star System ${process.system.address} is missing. Refresh the Crafting Process and Star System before retrying completion.`);
|
|
415
|
-
const characterAccount = requireAccount(byAddress.get(character), character, `Canonical Character ${character} is missing for Profile ${options.authorization.profile}. Create or repair the Character in the configured Game before retrying completion.`);
|
|
416
|
-
const gameAccount = requireAccount(byAddress.get(game), game, `Configured Game ${game} is missing. Refresh the configured Game before retrying completion.`);
|
|
417
|
-
const currencyCacheAccount = requireAccount(byAddress.get(currencyCache), currencyCache, `Canonical CurrencyCache ${currencyCache} is missing for the configured Game. Refresh the Game currency configuration before retrying completion.`);
|
|
418
|
-
const habAccount = habAddress === undefined
|
|
419
|
-
? undefined
|
|
420
|
-
: requireAccount(byAddress.get(habAddress), habAddress, `Crafting Hab ${habAddress} is missing. Refresh the Crafting Process and Hab before retrying completion.`);
|
|
421
|
-
const processData = craftingProcessAccountDefinition.decode(processAccount);
|
|
384
|
+
extra,
|
|
385
|
+
...(habAddress === undefined ? [] : [habAddress]),
|
|
386
|
+
]);
|
|
387
|
+
const processAccount = requireAccount(processCandidate, process.address, `Crafting Process ${process.address} is missing, so it may already be completed, cancelled, or closed. Refresh the Crafting Process and retry only if it still exists.`);
|
|
422
388
|
if (processAccount.address !== process.address ||
|
|
423
|
-
!sameProcessSnapshot(process,
|
|
389
|
+
!sameProcessSnapshot(process, craftingProcessAccountDefinition.decode(processAccount))) {
|
|
424
390
|
fail(`Crafting Process ${process.address} changed or no longer matches its relationships, timing, crew, quantity, fee, or inputs. Refresh the Crafting Process and retry.`, process.address);
|
|
425
391
|
}
|
|
392
|
+
await validateStarbaseSystem(requireAccount(systemCandidate, process.system.address, `Star System ${process.system.address} is missing. Refresh the Crafting Process and Star System before retrying ${action}.`), {
|
|
393
|
+
address: process.system.address,
|
|
394
|
+
game,
|
|
395
|
+
starbaseSequenceId: process.starbaseSequenceId,
|
|
396
|
+
}, staleStarbaseGuidance);
|
|
397
|
+
const recipeAccount = requireAccount(recipeCandidate, process.recipe.address, `Recipe ${process.recipe.address} is missing. Refresh the Crafting Process and its Recipe before retrying ${action}.`);
|
|
398
|
+
const playerAccount = requireAccount(playerCandidate, process.starbasePlayer.address, `Starbase Player ${process.starbasePlayer.address} is missing. Refresh the Crafting Process and Starbase Player before retrying ${action}.`);
|
|
399
|
+
const characterAccount = requireAccount(characterCandidate, character, `Canonical Character ${character} is missing for Profile ${profile}. Create or repair the Character in the configured Game before retrying ${action}.`);
|
|
400
|
+
const habAccount = habAddress === undefined
|
|
401
|
+
? undefined
|
|
402
|
+
: requireAccount(habCandidate, habAddress, `Crafting Hab ${habAddress} is missing. Refresh the Crafting Process and Hab before retrying ${action}.`);
|
|
426
403
|
const recipeData = recipeAccountDefinition.decode(recipeAccount);
|
|
427
404
|
const canonicalRecipe = await deriveRecipeAddress(game, recipeData.id);
|
|
428
405
|
if (recipeAccount.address !== process.recipe.address ||
|
|
@@ -432,65 +409,72 @@ async function resolveCompleteAccounts(ctx, process, options, game) {
|
|
|
432
409
|
recipeData.name !== process.recipe.name ||
|
|
433
410
|
recipeData.status !== process.recipe.status ||
|
|
434
411
|
recipeData.habRequired !== process.recipe.habRequired ||
|
|
435
|
-
recipeData.usageCountRaw !== process.recipe.usageCountRaw ||
|
|
436
412
|
recipeData.usageLimitRaw !== process.recipe.usageLimitRaw ||
|
|
437
413
|
!sameBalances(process.recipe.ingredients, recipeData.inputs) ||
|
|
438
414
|
!sameBalances(process.recipe.outputs, recipeData.outputs)) {
|
|
439
|
-
fail(`Recipe ${process.recipe.address} changed or does not match the configured Game, canonical recipe-id PDA, status, Hab policy, limits, ingredients, or outputs. Refresh the Crafting Process and Recipe before retrying
|
|
415
|
+
fail(`Recipe ${process.recipe.address} changed or does not match the configured Game, canonical recipe-id PDA, status, Hab policy, limits, ingredients, or outputs. Refresh the Crafting Process and Recipe before retrying ${action}.`, process.recipe.address);
|
|
440
416
|
}
|
|
441
417
|
if (recipeData.habRequired && habAddress === undefined) {
|
|
442
|
-
fail(`Recipe ${recipeData.name} requires a Crafting Hab, but Crafting Process ${process.address} omits one. Refresh or repair the Process relationship before retrying
|
|
418
|
+
fail(`Recipe ${recipeData.name} requires a Crafting Hab, but Crafting Process ${process.address} omits one. Refresh or repair the Process relationship before retrying ${action}.`, process.address);
|
|
443
419
|
}
|
|
444
420
|
const playerData = starbasePlayerAccountDefinition.decode(playerAccount);
|
|
445
421
|
const canonicalPlayer = await deriveStarbasePlayerAddress(process.system.address, character);
|
|
446
422
|
if (playerAccount.address !== process.starbasePlayer.address ||
|
|
447
423
|
canonicalPlayer !== process.starbasePlayer.address ||
|
|
448
|
-
playerData.playerProfile !==
|
|
424
|
+
playerData.playerProfile !== profile ||
|
|
449
425
|
playerData.character !== character ||
|
|
450
426
|
playerData.system !== process.system.address) {
|
|
451
|
-
fail(`Starbase Player ${process.starbasePlayer.address} does not match the authorization Profile, canonical Character, or Crafting Process System. Refresh the Crafting Process and Starbase Player before retrying
|
|
452
|
-
}
|
|
453
|
-
const systemData = starSystemAccountDefinition.decode(systemAccount);
|
|
454
|
-
const canonicalSystem = await deriveStarSystemAddress(game, systemData.systemId);
|
|
455
|
-
if (systemAccount.address !== process.system.address ||
|
|
456
|
-
canonicalSystem !== process.system.address ||
|
|
457
|
-
systemData.game !== game ||
|
|
458
|
-
systemData.sequenceId !== process.starbaseSequenceId ||
|
|
459
|
-
systemData.starbase === undefined) {
|
|
460
|
-
fail(`Star System ${process.system.address} does not match the configured Game, canonical system-id PDA, active Starbase, or Crafting Process Starbase sequence. Refresh the Crafting Process and Star System before retrying completion.`, process.system.address);
|
|
427
|
+
fail(`Starbase Player ${process.starbasePlayer.address} does not match the authorization Profile, canonical Character, or Crafting Process System. Refresh the Crafting Process and Starbase Player before retrying ${action}.`, process.starbasePlayer.address);
|
|
461
428
|
}
|
|
462
429
|
if (habAccount !== undefined) {
|
|
463
430
|
const habData = craftingHabAccountDefinition.decode(habAccount);
|
|
464
431
|
if (habAccount.address !== habAddress ||
|
|
465
432
|
habData.game !== game ||
|
|
466
|
-
habData.ownerProfile !==
|
|
433
|
+
habData.ownerProfile !== profile ||
|
|
467
434
|
habData.system !== process.system.address ||
|
|
468
435
|
habData.systemSequenceId !== process.starbaseSequenceId ||
|
|
469
436
|
habData.state.kind !== 'active') {
|
|
470
|
-
fail(`Crafting Hab ${habAddress} is not active or does not match the configured Game, authorization Profile, Crafting Process System, or Starbase sequence. Refresh the Crafting Process and Hab before retrying
|
|
437
|
+
fail(`Crafting Hab ${habAddress} is not active or does not match the configured Game, authorization Profile, Crafting Process System, or Starbase sequence. Refresh the Crafting Process and Hab before retrying ${action}.`, habAccount.address);
|
|
471
438
|
}
|
|
472
439
|
}
|
|
473
440
|
const characterData = characterAccountDefinition.decode(characterAccount);
|
|
474
441
|
if (characterAccount.address !== character ||
|
|
475
|
-
characterData.playerProfile !==
|
|
442
|
+
characterData.playerProfile !== profile ||
|
|
476
443
|
characterData.game !== game) {
|
|
477
|
-
fail(`The canonical Character does not match Profile ${
|
|
444
|
+
fail(`The canonical Character does not match Profile ${profile} and the configured Game ${game}. Refresh or repair the Character relationship before retrying ${action}.`, characterAccount.address);
|
|
478
445
|
}
|
|
479
|
-
validateGameRead(gameAccount, game);
|
|
480
|
-
validateCurrencyCache(currencyCacheAccount, game, currencyCache);
|
|
481
446
|
return {
|
|
482
447
|
character,
|
|
483
448
|
characterAccount,
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
gameAccount,
|
|
487
|
-
...(habAccount === undefined ? {} : { habAccount }),
|
|
449
|
+
extraAccount,
|
|
450
|
+
habAccount,
|
|
488
451
|
playerAccount,
|
|
489
452
|
processAccount,
|
|
490
453
|
recipeAccount,
|
|
491
|
-
systemAccount,
|
|
492
454
|
};
|
|
493
455
|
}
|
|
456
|
+
/** The validated Process graph preconditions, with `systemGuard` after the
|
|
457
|
+
* Starbase Player when the action guards the Starbase separately. */
|
|
458
|
+
function processPreconditions(process, resolved, profile, systemGuard = []) {
|
|
459
|
+
return [
|
|
460
|
+
accountStatePrecondition(resolved.processAccount, `Crafting Process ${process.address} retains its validated relationships, timing, crew, quantity, fee, and inputs.`),
|
|
461
|
+
recipePrecondition(resolved.recipeAccount, `Recipe ${process.recipe.name} retains its validated Game, Hab policy, ingredients, and outputs.`),
|
|
462
|
+
accountStatePrecondition(resolved.playerAccount, `Starbase Player ${process.starbasePlayer.address} retains its Profile, Character, and System relationships.`),
|
|
463
|
+
...systemGuard.map((guard) => Promise.resolve(guard)),
|
|
464
|
+
...(resolved.habAccount === undefined
|
|
465
|
+
? []
|
|
466
|
+
: [
|
|
467
|
+
accountStatePrecondition(resolved.habAccount, `Crafting Hab ${resolved.habAccount.address} remains active in the validated Game, Profile, System, and Starbase sequence.`),
|
|
468
|
+
]),
|
|
469
|
+
accountStatePrecondition(resolved.characterAccount, `The canonical Character remains assigned to Profile ${profile} in the configured Game.`),
|
|
470
|
+
];
|
|
471
|
+
}
|
|
472
|
+
/** Requires the authorization Profile to own the Process. */
|
|
473
|
+
function requireProcessOwner(process, profile) {
|
|
474
|
+
if (process.profile.address !== profile) {
|
|
475
|
+
fail(`Crafting Process ${process.address} does not belong to authorization Profile ${profile}. Use the owning Profile, refresh the Process, and retry.`, process.address);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
494
478
|
/** Plans completion of one Crafting Process without signing, simulation, or writes.
|
|
495
479
|
*
|
|
496
480
|
* The planner resolves and validates the Process account graph, requires Profile
|
|
@@ -508,11 +492,10 @@ async function resolveCompleteAccounts(ctx, process, options, game) {
|
|
|
508
492
|
* ```
|
|
509
493
|
*/
|
|
510
494
|
export async function planCompleteCraftingProcess(ctx, process, input) {
|
|
511
|
-
const options =
|
|
495
|
+
const options = validateProcessOptions(input);
|
|
512
496
|
const game = requireGameAddress(ctx);
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}
|
|
497
|
+
const { profile } = options.authorization;
|
|
498
|
+
requireProcessOwner(process, profile);
|
|
516
499
|
const state = deriveInternalCraftingProcessState(process, options.atUnixSeconds);
|
|
517
500
|
if (state.kind !== 'complete') {
|
|
518
501
|
const timing = state.kind === 'scheduled'
|
|
@@ -520,33 +503,36 @@ export async function planCompleteCraftingProcess(ctx, process, input) {
|
|
|
520
503
|
: `in-progress and not complete with ${String(state.remainingSeconds)} seconds remaining`;
|
|
521
504
|
fail(`Crafting Process ${process.address} is ${timing} at Unix timestamp ${String(options.atUnixSeconds)}. Wait until it is complete, provide a current timestamp, and retry.`, process.address);
|
|
522
505
|
}
|
|
523
|
-
const
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
506
|
+
const [currencyCache] = await deriveCurrencyCache(game);
|
|
507
|
+
const resolved = await resolveProcessAccounts(ctx, process, profile, game, 'completion', currencyCache);
|
|
508
|
+
await validateCurrencyCache(requireAccount(resolved.extraAccount, currencyCache, `Canonical CurrencyCache ${currencyCache} is missing for the configured Game. Refresh the Game currency configuration before retrying completion.`), game, 'crafting');
|
|
509
|
+
const runtime = await resolveActionRuntime(ctx, {
|
|
510
|
+
mode: 'crafting-complete',
|
|
511
|
+
game,
|
|
512
|
+
system: process.system.address,
|
|
513
|
+
starbaseSeqId: process.starbaseSequenceId,
|
|
514
|
+
character: resolved.character,
|
|
515
|
+
process: process.address,
|
|
530
516
|
...(resolved.habAccount === undefined
|
|
531
|
-
?
|
|
532
|
-
:
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
precondition(resolved.gameAccount, `Game ${game} retains its pinned owner and account layout.`),
|
|
537
|
-
precondition(resolved.currencyCacheAccount, 'The canonical CurrencyCache remains assigned to the configured Game.'),
|
|
538
|
-
];
|
|
539
|
-
return createPlan({
|
|
517
|
+
? {}
|
|
518
|
+
: { structure: resolved.habAccount.address }),
|
|
519
|
+
});
|
|
520
|
+
const description = `Complete crafting ${String(process.quantityRaw)} units of ${process.recipe.name} at Starbase Player ${process.starbasePlayer.address}, returning ${String(process.numCrew)} crew and producing the Recipe outputs.`;
|
|
521
|
+
return buildPlannerPlan({
|
|
540
522
|
kind: 'crafting.complete-process',
|
|
541
|
-
preconditions:
|
|
523
|
+
preconditions: [
|
|
524
|
+
...runtime.guards,
|
|
525
|
+
...(await Promise.all(processPreconditions(process, resolved, profile))),
|
|
526
|
+
],
|
|
542
527
|
steps: [
|
|
543
528
|
{
|
|
544
|
-
describes: description
|
|
529
|
+
describes: `${description} ${runtime.description}`,
|
|
545
530
|
instruction: adaptCompleteCraftingProcessInstruction({
|
|
531
|
+
...runtime.accounts,
|
|
546
532
|
authorization: options.authorization,
|
|
547
533
|
character: resolved.character,
|
|
548
534
|
craftingProcess: process.address,
|
|
549
|
-
currencyCache
|
|
535
|
+
currencyCache,
|
|
550
536
|
game,
|
|
551
537
|
recipe: process.recipe.address,
|
|
552
538
|
starbasePlayer: process.starbasePlayer.address,
|
|
@@ -558,108 +544,9 @@ export async function planCompleteCraftingProcess(ctx, process, input) {
|
|
|
558
544
|
signers: [options.authorization.authority],
|
|
559
545
|
},
|
|
560
546
|
],
|
|
561
|
-
summary: description
|
|
547
|
+
summary: `${description} ${runtime.description}`,
|
|
562
548
|
});
|
|
563
549
|
}
|
|
564
|
-
async function resolveCancelAccounts(ctx, process, options, game) {
|
|
565
|
-
const character = await findCharacterPda(options.authorization.profile, game);
|
|
566
|
-
const habAddress = process.craftingHab.address === sage.SAGE_PROGRAM_ADDRESS
|
|
567
|
-
? undefined
|
|
568
|
-
: process.craftingHab.address;
|
|
569
|
-
const addresses = [
|
|
570
|
-
process.address,
|
|
571
|
-
process.recipe.address,
|
|
572
|
-
process.starbasePlayer.address,
|
|
573
|
-
process.system.address,
|
|
574
|
-
...(habAddress === undefined ? [] : [habAddress]),
|
|
575
|
-
character,
|
|
576
|
-
game,
|
|
577
|
-
];
|
|
578
|
-
const reads = await readContextRawAccounts(ctx, addresses);
|
|
579
|
-
const byAddress = new Map(addresses.map((address, index) => [address, reads[index]]));
|
|
580
|
-
const processAccount = requireAccount(byAddress.get(process.address), process.address, `Crafting Process ${process.address} is missing, so it may already be completed, cancelled, or closed. Refresh the Crafting Process and retry only if it still exists.`);
|
|
581
|
-
const systemAccount = requireAccount(byAddress.get(process.system.address), process.system.address, `Star System ${process.system.address} is missing. Refresh the Crafting Process and Star System before retrying cancellation.`);
|
|
582
|
-
const processData = craftingProcessAccountDefinition.decode(processAccount);
|
|
583
|
-
if (processAccount.address !== process.address ||
|
|
584
|
-
!sameProcessSnapshot(process, processData)) {
|
|
585
|
-
fail(`Crafting Process ${process.address} changed or no longer matches its relationships, timing, crew, quantity, fee, or inputs. Refresh the Crafting Process and retry.`, process.address);
|
|
586
|
-
}
|
|
587
|
-
const systemData = starSystemAccountDefinition.decode(systemAccount);
|
|
588
|
-
const canonicalSystem = await deriveStarSystemAddress(game, systemData.systemId);
|
|
589
|
-
if (systemAccount.address !== process.system.address ||
|
|
590
|
-
canonicalSystem !== process.system.address ||
|
|
591
|
-
systemData.game !== game) {
|
|
592
|
-
fail(`Star System ${process.system.address} does not match the configured Game or canonical system-id PDA. Refresh the Crafting Process and Star System before retrying cancellation.`, process.system.address);
|
|
593
|
-
}
|
|
594
|
-
if (systemData.sequenceId !== process.starbaseSequenceId) {
|
|
595
|
-
fail(`The Starbase sequence for Crafting Process ${process.address} is stale at ${String(process.starbaseSequenceId)}, while Star System ${process.system.address} is at sequence ${String(systemData.sequenceId)}. The program requires destroyCraftingProcess for this destroyed-Starbase cleanup case; do not cancel the Process.`, process.address);
|
|
596
|
-
}
|
|
597
|
-
if (systemData.starbase === undefined) {
|
|
598
|
-
fail(`Star System ${process.system.address} does not have an active Starbase. Refresh the Crafting Process and Star System before retrying cancellation.`, process.system.address);
|
|
599
|
-
}
|
|
600
|
-
const recipeAccount = requireAccount(byAddress.get(process.recipe.address), process.recipe.address, `Recipe ${process.recipe.address} is missing. Refresh the Crafting Process and its Recipe before retrying cancellation.`);
|
|
601
|
-
const playerAccount = requireAccount(byAddress.get(process.starbasePlayer.address), process.starbasePlayer.address, `Starbase Player ${process.starbasePlayer.address} is missing. Refresh the Crafting Process and Starbase Player before retrying cancellation.`);
|
|
602
|
-
const characterAccount = requireAccount(byAddress.get(character), character, `Canonical Character ${character} is missing for Profile ${options.authorization.profile}. Create or repair the Character in the configured Game before retrying cancellation.`);
|
|
603
|
-
const gameAccount = requireAccount(byAddress.get(game), game, `Configured Game ${game} is missing. Refresh the configured Game before retrying cancellation.`);
|
|
604
|
-
const habAccount = habAddress === undefined
|
|
605
|
-
? undefined
|
|
606
|
-
: requireAccount(byAddress.get(habAddress), habAddress, `Crafting Hab ${habAddress} is missing. Refresh the Crafting Process and Hab before retrying cancellation.`);
|
|
607
|
-
const recipeData = recipeAccountDefinition.decode(recipeAccount);
|
|
608
|
-
const canonicalRecipe = await deriveRecipeAddress(game, recipeData.id);
|
|
609
|
-
if (recipeAccount.address !== process.recipe.address ||
|
|
610
|
-
canonicalRecipe !== process.recipe.address ||
|
|
611
|
-
recipeData.game !== game ||
|
|
612
|
-
recipeData.id !== process.recipe.id ||
|
|
613
|
-
recipeData.name !== process.recipe.name ||
|
|
614
|
-
recipeData.status !== process.recipe.status ||
|
|
615
|
-
recipeData.habRequired !== process.recipe.habRequired ||
|
|
616
|
-
recipeData.usageCountRaw !== process.recipe.usageCountRaw ||
|
|
617
|
-
recipeData.usageLimitRaw !== process.recipe.usageLimitRaw ||
|
|
618
|
-
!sameBalances(process.recipe.ingredients, recipeData.inputs) ||
|
|
619
|
-
!sameBalances(process.recipe.outputs, recipeData.outputs)) {
|
|
620
|
-
fail(`Recipe ${process.recipe.address} changed or does not match the configured Game, canonical recipe-id PDA, status, Hab policy, limits, ingredients, or outputs. Refresh the Crafting Process and Recipe before retrying cancellation.`, process.recipe.address);
|
|
621
|
-
}
|
|
622
|
-
if (recipeData.habRequired && habAddress === undefined) {
|
|
623
|
-
fail(`Recipe ${recipeData.name} requires a Crafting Hab, but Crafting Process ${process.address} omits one. Refresh or repair the Process relationship before retrying cancellation.`, process.address);
|
|
624
|
-
}
|
|
625
|
-
const playerData = starbasePlayerAccountDefinition.decode(playerAccount);
|
|
626
|
-
const canonicalPlayer = await deriveStarbasePlayerAddress(process.system.address, character);
|
|
627
|
-
if (playerAccount.address !== process.starbasePlayer.address ||
|
|
628
|
-
canonicalPlayer !== process.starbasePlayer.address ||
|
|
629
|
-
playerData.playerProfile !== options.authorization.profile ||
|
|
630
|
-
playerData.character !== character ||
|
|
631
|
-
playerData.system !== process.system.address) {
|
|
632
|
-
fail(`Starbase Player ${process.starbasePlayer.address} does not match the authorization Profile, canonical Character, or Crafting Process System. Refresh the Crafting Process and Starbase Player before retrying cancellation.`, process.starbasePlayer.address);
|
|
633
|
-
}
|
|
634
|
-
if (habAccount !== undefined) {
|
|
635
|
-
const habData = craftingHabAccountDefinition.decode(habAccount);
|
|
636
|
-
if (habAccount.address !== habAddress ||
|
|
637
|
-
habData.game !== game ||
|
|
638
|
-
habData.ownerProfile !== options.authorization.profile ||
|
|
639
|
-
habData.system !== process.system.address ||
|
|
640
|
-
habData.systemSequenceId !== process.starbaseSequenceId ||
|
|
641
|
-
habData.state.kind !== 'active') {
|
|
642
|
-
fail(`Crafting Hab ${habAddress} is not active or does not match the configured Game, authorization Profile, Crafting Process System, or Starbase sequence. Refresh the Crafting Process and Hab before retrying cancellation.`, habAccount.address);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
const characterData = characterAccountDefinition.decode(characterAccount);
|
|
646
|
-
if (characterAccount.address !== character ||
|
|
647
|
-
characterData.playerProfile !== options.authorization.profile ||
|
|
648
|
-
characterData.game !== game) {
|
|
649
|
-
fail(`The canonical Character does not match Profile ${options.authorization.profile} and the configured Game ${game}. Refresh or repair the Character relationship before retrying cancellation.`, characterAccount.address);
|
|
650
|
-
}
|
|
651
|
-
validateGameRead(gameAccount, game);
|
|
652
|
-
return {
|
|
653
|
-
character,
|
|
654
|
-
characterAccount,
|
|
655
|
-
gameAccount,
|
|
656
|
-
...(habAccount === undefined ? {} : { habAccount }),
|
|
657
|
-
playerAccount,
|
|
658
|
-
processAccount,
|
|
659
|
-
recipeAccount,
|
|
660
|
-
systemAccount,
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
550
|
/** Plans cancellation of one unfinished Crafting Process without signing or writes.
|
|
664
551
|
*
|
|
665
552
|
* The planner resolves and validates the Process account graph, requires Profile
|
|
@@ -677,33 +564,32 @@ async function resolveCancelAccounts(ctx, process, options, game) {
|
|
|
677
564
|
* ```
|
|
678
565
|
*/
|
|
679
566
|
export async function planCancelCraftingProcess(ctx, process, input) {
|
|
680
|
-
const options =
|
|
567
|
+
const options = validateProcessOptions(input);
|
|
681
568
|
const game = requireGameAddress(ctx);
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}
|
|
569
|
+
const { profile } = options.authorization;
|
|
570
|
+
requireProcessOwner(process, profile);
|
|
685
571
|
const state = deriveInternalCraftingProcessState(process, options.atUnixSeconds);
|
|
686
572
|
if (state.kind === 'complete') {
|
|
687
573
|
fail(`Crafting Process ${process.address} is complete at Unix timestamp ${String(options.atUnixSeconds)} and cannot be cancelled. Use planCompleteCraftingProcess with a refreshed snapshot instead.`, process.address);
|
|
688
574
|
}
|
|
689
|
-
const resolved = await
|
|
575
|
+
const resolved = await resolveProcessAccounts(ctx, process, profile, game, 'cancellation', game, 'For a Crafting Process belonging to the destroyed Starbase, use destroyCraftingProcess; do not cancel the Process.');
|
|
576
|
+
const gameAccount = requireAccount(resolved.extraAccount, game, `Configured Game ${game} is missing. Refresh the configured Game before retrying cancellation.`);
|
|
577
|
+
validateGameRead(gameAccount, game);
|
|
690
578
|
const description = `Cancel crafting ${String(process.quantityRaw)} units of ${process.recipe.name} at Starbase Player ${process.starbasePlayer.address}, returning all inputs and ${String(process.numCrew)} crew and closing the Crafting Process.`;
|
|
691
|
-
|
|
692
|
-
precondition(resolved.processAccount, `Crafting Process ${process.address} retains its validated relationships, timing, crew, quantity, fee, and inputs.`),
|
|
693
|
-
precondition(resolved.recipeAccount, `Recipe ${process.recipe.name} retains its validated Game, Hab policy, usage, ingredients, and outputs.`),
|
|
694
|
-
precondition(resolved.playerAccount, `Starbase Player ${process.starbasePlayer.address} retains its Profile, Character, and System relationships.`),
|
|
695
|
-
precondition(resolved.systemAccount, `Star System ${process.system.address} retains its active Starbase and validated sequence.`),
|
|
696
|
-
...(resolved.habAccount === undefined
|
|
697
|
-
? []
|
|
698
|
-
: [
|
|
699
|
-
precondition(resolved.habAccount, `Crafting Hab ${resolved.habAccount.address} remains active in the validated Game, Profile, System, and Starbase sequence.`),
|
|
700
|
-
]),
|
|
701
|
-
precondition(resolved.characterAccount, `The canonical Character remains assigned to Profile ${options.authorization.profile} in the configured Game.`),
|
|
702
|
-
precondition(resolved.gameAccount, `Game ${game} retains its pinned owner and account layout.`),
|
|
703
|
-
];
|
|
704
|
-
return createPlan({
|
|
579
|
+
return buildPlannerPlan({
|
|
705
580
|
kind: 'crafting.cancel-process',
|
|
706
|
-
preconditions: await Promise.all(
|
|
581
|
+
preconditions: await Promise.all([
|
|
582
|
+
...processPreconditions(process, resolved, profile, [
|
|
583
|
+
{
|
|
584
|
+
kind: 'starbase-system',
|
|
585
|
+
address: process.system.address,
|
|
586
|
+
game,
|
|
587
|
+
starbaseSequenceId: process.starbaseSequenceId,
|
|
588
|
+
describes: `Star System ${process.system.address} retains its canonical Game identity, active Starbase and sequence ${process.starbaseSequenceId}; unrelated shared activity may change.`,
|
|
589
|
+
},
|
|
590
|
+
]),
|
|
591
|
+
accountStatePrecondition(gameAccount, `Game ${game} retains its pinned owner and account layout.`),
|
|
592
|
+
]),
|
|
707
593
|
steps: [
|
|
708
594
|
{
|
|
709
595
|
describes: description,
|